diff options
author | Benny Prijono <bennylp@teluu.com> | 2010-03-23 14:03:30 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2010-03-23 14:03:30 +0000 |
commit | 21922560c1fb20d2b851acce5d5d67e7d3b8899c (patch) | |
tree | fe7a4dd5eedbee5abb0eeef99c7189f5d5ee2dad /tests/pjsua | |
parent | 8e703ff217b32a9cc4d29393769ac85688900fbf (diff) |
Ticket #1041:
- initial work for GNU targets
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3120 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'tests/pjsua')
-rw-r--r-- | tests/pjsua/runall.py | 93 |
1 files changed, 63 insertions, 30 deletions
diff --git a/tests/pjsua/runall.py b/tests/pjsua/runall.py index 3eb1a6d4..fad6c540 100644 --- a/tests/pjsua/runall.py +++ b/tests/pjsua/runall.py @@ -57,40 +57,67 @@ for f in os.listdir("scripts-recvfrom"): for pat in excluded_tests: tests = [t for t in tests if t.find(pat)==-1] -# List the tests only? -if len(sys.argv)==2 and sys.argv[1]=="--list": - for t in tests: - print t - sys.exit(0) -# Resume test? resume_script="" -if len(sys.argv) > 1: - if sys.argv[1]=='-r' or sys.argv[1]=='--resume': - resume_script=sys.argv[2] - if sys.argv[1]=='/h' or sys.argv[1]=='-h' or sys.argv[1]=='--help' or sys.argv[1]=='/help': - print "Usage:" - print " runall.py [OPTIONS] [run.py-OPTIONS]" - print "Options:" - print " --resume,-r RESUME" - print " RESUME is string/substring to specify where to resume tests." - print " If this argument is omited, tests will start from the beginning." - print " run.py-OPTIONS are applicable here" - sys.exit(0) +shell_cmd="" + +# Parse arguments +sys.argv.pop(0) +while len(sys.argv): + if sys.argv[0]=='/h' or sys.argv[0]=='-h' or sys.argv[0]=='--help' or sys.argv[0]=='/help': + sys.argv.pop(0) + print "Usage:" + print " runall.py [OPTIONS] [run.py-OPTIONS]" + print "OPTIONS:" + print " --list" + print " List the tests" + print " --list-xml" + print " List the tests as XML format suitable for ccdash" + print " --resume,-r RESUME" + print " RESUME is string/substring to specify where to resume tests." + print " If this argument is omited, tests will start from the beginning." + print " --shell,-s SHELL" + print " Run the tests with the specified SHELL cmd. This can also be" + print " used to run the test with ccdash. Example:" + print " --shell '/bin/sh -c'" + print " run.py-OPTIONS are applicable here" + sys.exit(0) + elif sys.argv[0] == '-r' or sys.argv[0] == '--resume': + if len(sys.argv) > 1: + resume_script=sys.argv[1] + sys.argv.pop(0) + sys.argv.pop(1) + else: + sys.argv.pop(0) + sys.stderr.write("Error: argument value required") + sys.exit(1) + elif sys.argv[0] == '--list': + sys.argv.pop(0) + for t in tests: + print t + sys.exit(0) + elif sys.argv[0] == '--list-xml': + sys.argv.pop(0) + for t in tests: + (mod,param) = t.split(None,2) + tname = mod[4:mod.find(".py")] + "_" + \ + param[param.find("/")+1:param.find(".py")] + tcmd = 'python run.py ' + t + print '\t\t<Test name="%s" cmd="%s" wdir="tests/pjsua" />' % (tname, tcmd) + sys.exit(0) + elif sys.argv[0] == '-s' or sys.argv[0] == '--shell': + if len(sys.argv) > 1: + shell_cmd = sys.argv[1] + sys.argv.pop(0) + sys.argv.pop(1) + else: + sys.argv.pop(0) + sys.stderr.write("Error: argument value required") + sys.exit(1) # Generate arguments for run.py -argv = sys.argv -argv_to_skip = 1 -if resume_script != "": - argv_to_skip += 2 -argv_st = "" -for a in argv: - if argv_to_skip > 0: - argv_to_skip -= 1 - else: - argv_st += a + " " - +argv_st = " ".join(sys.argv) # Init vars fails_cnt = 0 @@ -108,14 +135,20 @@ except: print "Warning: failed in creating directory 'logs'" # Now run the tests +total_cnt = len(tests) for t in tests: if resume_script!="" and t.find(resume_script)==-1: print "Skipping " + t +".." + total_cnt = total_cnt - 1 continue resume_script="" cmdline = "python run.py " + argv_st + t + if shell_cmd: + cmdline = "%s '%s'" % (shell_cmd, cmdline) t0 = time.time() - print "Running " + cmdline + "...", + msg = "Running %d/%d: %s..." % (tests_cnt+1, total_cnt, cmdline) + sys.stdout.write(msg) + sys.stdout.flush() ret = os.system(cmdline + " > output.log") t1 = time.time() if ret != 0: |