Benny Prijono | cc1ada5 | 2008-06-15 19:43:43 +0000 | [diff] [blame] | 1 | # $Id$ |
Benny Prijono | 8c331df | 2008-06-13 15:32:08 +0000 | [diff] [blame] | 2 | import os |
| 3 | import sys |
| 4 | |
Benny Prijono | f9bd1f2 | 2008-06-16 13:04:44 +0000 | [diff] [blame^] | 5 | # Usage: |
| 6 | # runall.py [test-to-resume] |
| 7 | |
| 8 | |
Benny Prijono | 8c331df | 2008-06-13 15:32:08 +0000 | [diff] [blame] | 9 | # Initialize test list |
| 10 | tests = [] |
| 11 | |
| 12 | # Excluded tests (because they fail?) |
| 13 | excluded_tests = [ "svn", |
| 14 | "pyc", |
| 15 | "scripts-call/150_srtp_1_2", |
| 16 | "scripts-call/150_srtp_2_1", |
| 17 | "scripts-call/300_ice_1_1"] |
| 18 | |
Benny Prijono | cc1ada5 | 2008-06-15 19:43:43 +0000 | [diff] [blame] | 19 | # Add basic tests |
Benny Prijono | 8c331df | 2008-06-13 15:32:08 +0000 | [diff] [blame] | 20 | for f in os.listdir("scripts-run"): |
| 21 | tests.append("mod_run.py scripts-run/" + f) |
| 22 | |
Benny Prijono | cc1ada5 | 2008-06-15 19:43:43 +0000 | [diff] [blame] | 23 | # Add basic call tests |
Benny Prijono | 8c331df | 2008-06-13 15:32:08 +0000 | [diff] [blame] | 24 | for f in os.listdir("scripts-call"): |
| 25 | tests.append("mod_call.py scripts-call/" + f) |
| 26 | |
Benny Prijono | cc1ada5 | 2008-06-15 19:43:43 +0000 | [diff] [blame] | 27 | # Add presence tests |
| 28 | for f in os.listdir("scripts-pres"): |
| 29 | tests.append("mod_pres.py scripts-pres/" + f) |
| 30 | |
Benny Prijono | 8c331df | 2008-06-13 15:32:08 +0000 | [diff] [blame] | 31 | # Filter-out excluded tests |
| 32 | for pat in excluded_tests: |
| 33 | tests = [t for t in tests if t.find(pat)==-1] |
| 34 | |
Benny Prijono | f9bd1f2 | 2008-06-16 13:04:44 +0000 | [diff] [blame^] | 35 | # Resume test? |
| 36 | resume_script="" |
| 37 | if len(sys.argv) > 1: |
| 38 | if sys.argv[1][0]=='-' or sys.argv[1][0]=='/': |
| 39 | print "Usage:" |
| 40 | print " runall.py [RESUME]" |
| 41 | print "where" |
| 42 | print " RESUME is string/substring to specify where to resume tests." |
| 43 | print " If this argument is omited, tests will start from the beginning." |
| 44 | sys.exit(0) |
| 45 | resume_script=sys.argv[1] |
| 46 | |
| 47 | |
Benny Prijono | 8c331df | 2008-06-13 15:32:08 +0000 | [diff] [blame] | 48 | # Now run the tests |
| 49 | for t in tests: |
Benny Prijono | f9bd1f2 | 2008-06-16 13:04:44 +0000 | [diff] [blame^] | 50 | if resume_script!="" and t.find(resume_script)==-1: |
| 51 | print "Skipping " + t +".." |
| 52 | continue |
| 53 | resume_script="" |
Benny Prijono | 8c331df | 2008-06-13 15:32:08 +0000 | [diff] [blame] | 54 | cmdline = "python run.py " + t |
| 55 | print "Running " + cmdline |
| 56 | ret = os.system(cmdline + " > output.log") |
| 57 | if ret != 0: |
| 58 | print "Test " + t + " failed." |
| 59 | print "Please see 'output.log' for the test log." |
| 60 | sys.exit(1) |
| 61 | |
| 62 | print "All tests completed successfully" |