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", |
Nanang Izzuddin | b40e287 | 2008-06-25 15:05:21 +0000 | [diff] [blame] | 15 | "scripts-call/150_srtp_2_1", # SRTP optional 'cannot' call SRTP mandatory |
Benny Prijono | 62a969c | 2008-06-26 13:29:29 +0000 | [diff] [blame] | 16 | "scripts-call/301_ice_public_b.py", # Doesn't work because OpenSER modifies SDP |
Nanang Izzuddin | b40e287 | 2008-06-25 15:05:21 +0000 | [diff] [blame] | 17 | "scripts-media-playrec/100_resample_lf_8_11.py", # related to clock-rate 11 kHz problem |
| 18 | "scripts-media-playrec/100_resample_lf_8_22.py", # related to clock-rate 22 kHz problem |
| 19 | "scripts-media-playrec/100_resample_lf_11" # related to clock-rate 11 kHz problem |
Benny Prijono | 7d578a7 | 2008-06-20 00:25:55 +0000 | [diff] [blame] | 20 | ] |
Benny Prijono | 8c331df | 2008-06-13 15:32:08 +0000 | [diff] [blame] | 21 | |
Benny Prijono | cc1ada5 | 2008-06-15 19:43:43 +0000 | [diff] [blame] | 22 | # Add basic tests |
Benny Prijono | 8c331df | 2008-06-13 15:32:08 +0000 | [diff] [blame] | 23 | for f in os.listdir("scripts-run"): |
| 24 | tests.append("mod_run.py scripts-run/" + f) |
| 25 | |
Benny Prijono | cc1ada5 | 2008-06-15 19:43:43 +0000 | [diff] [blame] | 26 | # Add basic call tests |
Benny Prijono | 8c331df | 2008-06-13 15:32:08 +0000 | [diff] [blame] | 27 | for f in os.listdir("scripts-call"): |
| 28 | tests.append("mod_call.py scripts-call/" + f) |
| 29 | |
Benny Prijono | cc1ada5 | 2008-06-15 19:43:43 +0000 | [diff] [blame] | 30 | # Add presence tests |
| 31 | for f in os.listdir("scripts-pres"): |
| 32 | tests.append("mod_pres.py scripts-pres/" + f) |
| 33 | |
Benny Prijono | 7d578a7 | 2008-06-20 00:25:55 +0000 | [diff] [blame] | 34 | # Add mod_sendto tests |
| 35 | for f in os.listdir("scripts-sendto"): |
| 36 | tests.append("mod_sendto.py scripts-sendto/" + f) |
| 37 | |
Nanang Izzuddin | b40e287 | 2008-06-25 15:05:21 +0000 | [diff] [blame] | 38 | # Add mod_media_playrec tests |
| 39 | for f in os.listdir("scripts-media-playrec"): |
| 40 | tests.append("mod_media_playrec.py scripts-media-playrec/" + f) |
| 41 | |
| 42 | # Add mod_pesq tests |
| 43 | for f in os.listdir("scripts-pesq"): |
| 44 | tests.append("mod_pesq.py scripts-pesq/" + f) |
| 45 | |
Benny Prijono | 8c331df | 2008-06-13 15:32:08 +0000 | [diff] [blame] | 46 | # Filter-out excluded tests |
| 47 | for pat in excluded_tests: |
| 48 | tests = [t for t in tests if t.find(pat)==-1] |
| 49 | |
Benny Prijono | f9bd1f2 | 2008-06-16 13:04:44 +0000 | [diff] [blame] | 50 | # Resume test? |
| 51 | resume_script="" |
| 52 | if len(sys.argv) > 1: |
| 53 | if sys.argv[1][0]=='-' or sys.argv[1][0]=='/': |
| 54 | print "Usage:" |
| 55 | print " runall.py [RESUME]" |
| 56 | print "where" |
| 57 | print " RESUME is string/substring to specify where to resume tests." |
| 58 | print " If this argument is omited, tests will start from the beginning." |
| 59 | sys.exit(0) |
| 60 | resume_script=sys.argv[1] |
| 61 | |
| 62 | |
Benny Prijono | 8c331df | 2008-06-13 15:32:08 +0000 | [diff] [blame] | 63 | # Now run the tests |
| 64 | for t in tests: |
Benny Prijono | f9bd1f2 | 2008-06-16 13:04:44 +0000 | [diff] [blame] | 65 | if resume_script!="" and t.find(resume_script)==-1: |
| 66 | print "Skipping " + t +".." |
| 67 | continue |
| 68 | resume_script="" |
Benny Prijono | 8c331df | 2008-06-13 15:32:08 +0000 | [diff] [blame] | 69 | cmdline = "python run.py " + t |
| 70 | print "Running " + cmdline |
| 71 | ret = os.system(cmdline + " > output.log") |
| 72 | if ret != 0: |
| 73 | print "Test " + t + " failed." |
| 74 | print "Please see 'output.log' for the test log." |
| 75 | sys.exit(1) |
| 76 | |
| 77 | print "All tests completed successfully" |