Changeset 2082


Ignore:
Timestamp:
Jun 27, 2008 10:15:41 PM (16 years ago)
Author:
nanang
Message:

Updated runall.py to cleanup the 'logs' directory before test; fixed log ext name; added report num of tests performed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/test-pjsua/runall.py

    r2078 r2082  
    6161    if sys.argv[1]=='/h' or sys.argv[1]=='-h' or sys.argv[1]=='--help' or sys.argv[1]=='/help': 
    6262        print "Usage:" 
    63         print "  runall.py [OPTIONS] [run.py OPTIONS]" 
     63        print "  runall.py [OPTIONS] [run.py-OPTIONS]" 
    6464        print "Options:" 
    6565        print "  --resume,-r RESUME" 
    66         print "  where" 
    6766        print "      RESUME is string/substring to specify where to resume tests." 
    6867        print "      If this argument is omited, tests will start from the beginning." 
     68        print "  run.py-OPTIONS are applicable here" 
    6969        sys.exit(0) 
    7070 
     
    8484 
    8585# Init vars 
    86 failed_cnt = 0 
     86fails_cnt = 0 
     87tests_cnt = 0 
    8788 
    88 # Create "logs" directory 
     89# Re-create "logs" directory 
     90try: 
     91    shutil.rmtree("logs") 
     92except: 
     93    print "Warning: failed in removing directory 'logs'" 
     94 
    8995try: 
    9096    os.mkdir("logs") 
    9197except: 
    92     print 
     98    print "Warning: failed in creating directory 'logs'" 
    9399 
    94100# Now run the tests 
     
    108114                logname = re.search(".*\s+(.*)", t).group(1) 
    109115                logname = re.sub("[\\\/]", "_", logname) 
     116                logname = re.sub("\.py$", ".log", logname) 
    110117                logname = "logs/" + logname 
    111118                shutil.move("output.log", logname) 
    112119                print "Please see '" + logname + "' for the test log." 
     120                fails_cnt += 1 
    113121        else: 
    114122                dur = int(t1 - t0) 
    115123                print " ok [" + str(dur) + "s]" 
     124        tests_cnt += 1 
    116125 
    117126if failed_cnt == 0: 
    118         print "All tests completed successfully" 
     127        print "All " + str(tests_cnt) + " tests completed successfully" 
    119128else: 
    120         print "Tests completed, with " +  str(failed_cnt) + " test(s) failed" 
     129        print str(tests_cnt) + " tests completed, " +  str(fails_cnt) + " test(s) failed" 
    121130 
Note: See TracChangeset for help on using the changeset viewer.