Guido van Rossum | e53309c | 2007-05-23 17:28:08 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # A script that runs each unit test independently, with output |
| 4 | # directed to a file in OUT/$T.out. If command line arguments are |
| 5 | # given, they are tests to run; otherwise every file named |
| 6 | # Lib/test/test_* is run (via regrtest). A summary of failing, |
| 7 | # passing and skipped tests is written to stdout and to the files |
| 8 | # GOOD, BAD and SKIPPED. |
| 9 | |
| 10 | # Reset PYTHONPATH to avoid alien influences on the tests. |
| 11 | unset PYTHONPATH |
| 12 | |
| 13 | # Choose the Python binary. |
| 14 | case `uname` in |
| 15 | Darwin) PYTHON=./python.exe;; |
| 16 | *) PYTHON=./python;; |
| 17 | esac |
| 18 | |
| 19 | # Create the output directory if necessary. |
| 20 | mkdir -p OUT |
| 21 | |
| 22 | # Empty the summary files. |
| 23 | >GOOD |
| 24 | >BAD |
| 25 | >SKIPPED |
| 26 | |
| 27 | # Compute the list of tests to run. |
| 28 | case $# in |
| 29 | 0) |
| 30 | TESTS=`(cd Lib/test; ls test_*.py | sed 's/\.py//' | grep -v test_socket)` |
| 31 | ;; |
| 32 | *) |
| 33 | TESTS="$@" |
| 34 | ;; |
| 35 | esac |
| 36 | |
| 37 | # Run the tests. |
| 38 | for T in $TESTS |
| 39 | do |
| 40 | echo -n $T |
| 41 | if $PYTHON Lib/test/regrtest.py -uall $T >OUT/$T.out 2>&1 |
| 42 | then |
| 43 | if grep -q "1 test skipped:" OUT/$T.out |
| 44 | then |
| 45 | echo " SKIPPED" |
| 46 | echo $T >>SKIPPED |
| 47 | else |
| 48 | echo |
| 49 | echo $T >>GOOD |
| 50 | fi |
| 51 | else |
| 52 | echo " BAD" |
| 53 | echo $T >>BAD |
| 54 | fi |
| 55 | done |