blob: 7372d8ee20c620227c436d4a67773d0ef916c7ff [file] [log] [blame]
Guido van Rossume53309c2007-05-23 17:28:08 +00001#!/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.
11unset PYTHONPATH
12
13# Choose the Python binary.
14case `uname` in
15Darwin) PYTHON=./python.exe;;
16*) PYTHON=./python;;
17esac
18
19# Create the output directory if necessary.
20mkdir -p OUT
21
22# Empty the summary files.
23>GOOD
24>BAD
25>SKIPPED
26
Guido van Rossum53970392007-06-12 00:28:30 +000027# The -uall flag (edit this file to change).
28UALL="-uall"
29
Guido van Rossume53309c2007-05-23 17:28:08 +000030# Compute the list of tests to run.
31case $# in
320)
Guido van Rossum2bf71382007-06-08 00:07:57 +000033 TESTS=`(cd Lib/test; ls test_*.py | sed 's/\.py//')`
Guido van Rossume53309c2007-05-23 17:28:08 +000034 ;;
35*)
36 TESTS="$@"
37 ;;
38esac
39
40# Run the tests.
41for T in $TESTS
42do
43 echo -n $T
Guido van Rossum53970392007-06-12 00:28:30 +000044 if $PYTHON Lib/test/regrtest.py $UALL $T >OUT/$T.out 2>&1
Guido van Rossume53309c2007-05-23 17:28:08 +000045 then
46 if grep -q "1 test skipped:" OUT/$T.out
47 then
48 echo " SKIPPED"
49 echo $T >>SKIPPED
50 else
51 echo
52 echo $T >>GOOD
53 fi
54 else
55 echo " BAD"
56 echo $T >>BAD
Guido van Rossum53970392007-06-12 00:28:30 +000057 echo "---------- Re-running test in verbose mode ----------" >>OUT/$T
58 $PYTHON Lib/test/regrtest.py -v $UALL $T >>OUT/$T.out 2>&1
Guido van Rossume53309c2007-05-23 17:28:08 +000059 fi
60done