Changeset 2078 for pjproject/trunk/pjsip-apps/src/test-pjsua/runall.py
- Timestamp:
- Jun 27, 2008 9:12:12 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/test-pjsua/runall.py
r2071 r2078 3 3 import sys 4 4 import time 5 import re 6 import shutil 7 5 8 6 9 # Usage: … … 54 57 resume_script="" 55 58 if len(sys.argv) > 1: 56 if sys.argv[1][0]=='-' or sys.argv[1][0]=='/': 59 if sys.argv[1]=='-r' or sys.argv[1]=='--resume': 60 resume_script=sys.argv[2] 61 if sys.argv[1]=='/h' or sys.argv[1]=='-h' or sys.argv[1]=='--help' or sys.argv[1]=='/help': 57 62 print "Usage:" 58 print " runall.py [RESUME]" 59 print "where" 60 print " RESUME is string/substring to specify where to resume tests." 61 print " If this argument is omited, tests will start from the beginning." 63 print " runall.py [OPTIONS] [run.py OPTIONS]" 64 print "Options:" 65 print " --resume,-r RESUME" 66 print " where" 67 print " RESUME is string/substring to specify where to resume tests." 68 print " If this argument is omited, tests will start from the beginning." 62 69 sys.exit(0) 63 resume_script=sys.argv[1]64 70 71 72 # Generate arguments for run.py 73 argv = sys.argv 74 argv_to_skip = 1 75 if resume_script != "": 76 argv_to_skip += 2 77 argv_st = "" 78 for a in argv: 79 if argv_to_skip > 0: 80 argv_to_skip -= 1 81 else: 82 argv_st += a + " " 83 84 85 # Init vars 86 failed_cnt = 0 87 88 # Create "logs" directory 89 try: 90 os.mkdir("logs") 91 except: 92 print 65 93 66 94 # Now run the tests … … 70 98 continue 71 99 resume_script="" 72 cmdline = "python run.py " + t100 cmdline = "python run.py " + argv_st + t 73 101 t0 = time.time() 74 102 print "Running " + cmdline + "...", … … 78 106 dur = int(t1 - t0) 79 107 print " failed!! [" + str(dur) + "s]" 80 print "Please see 'output.log' for the test log." 81 sys.exit(1) 108 logname = re.search(".*\s+(.*)", t).group(1) 109 logname = re.sub("[\\\/]", "_", logname) 110 logname = "logs/" + logname 111 shutil.move("output.log", logname) 112 print "Please see '" + logname + "' for the test log." 82 113 else: 83 114 dur = int(t1 - t0) 84 115 print " ok [" + str(dur) + "s]" 85 116 86 print "All tests completed successfully" 117 if failed_cnt == 0: 118 print "All tests completed successfully" 119 else: 120 print "Tests completed, with " + str(failed_cnt) + " test(s) failed" 121
Note: See TracChangeset
for help on using the changeset viewer.