blob: 837aab2ee1d93b80f3fb1f5896f9dba6c391b1e7 [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;;
Guido van Rossum5ed317d2007-07-18 16:59:11 +000016CYGWIN*) PYTHON=./python.exe;;
Guido van Rossume53309c2007-05-23 17:28:08 +000017*) PYTHON=./python;;
18esac
19
20# Create the output directory if necessary.
21mkdir -p OUT
22
23# Empty the summary files.
24>GOOD
25>BAD
26>SKIPPED
27
Guido van Rossumda5b8f22007-06-12 23:30:11 +000028# The -u flag (edit this file to change).
Guido van Rossum486364b2007-06-30 05:01:58 +000029UFLAG=""
Guido van Rossum53970392007-06-12 00:28:30 +000030
Guido van Rossume53309c2007-05-23 17:28:08 +000031# Compute the list of tests to run.
32case $# in
330)
Guido van Rossum2bf71382007-06-08 00:07:57 +000034 TESTS=`(cd Lib/test; ls test_*.py | sed 's/\.py//')`
Guido van Rossume53309c2007-05-23 17:28:08 +000035 ;;
36*)
37 TESTS="$@"
38 ;;
39esac
40
41# Run the tests.
42for T in $TESTS
43do
44 echo -n $T
Guido van Rossumda5b8f22007-06-12 23:30:11 +000045 if $PYTHON Lib/test/regrtest.py $UFLAG $T >OUT/$T.out 2>&1
Guido van Rossume53309c2007-05-23 17:28:08 +000046 then
47 if grep -q "1 test skipped:" OUT/$T.out
48 then
49 echo " SKIPPED"
50 echo $T >>SKIPPED
51 else
52 echo
53 echo $T >>GOOD
54 fi
55 else
56 echo " BAD"
57 echo $T >>BAD
Guido van Rossum8ddff702007-06-30 01:14:33 +000058 ##echo "--------- Re-running test in verbose mode ---------" >>OUT/$T.out
59 ##$PYTHON Lib/test/regrtest.py -v $UFLAG $T >>OUT/$T.out 2>&1
Guido van Rossume53309c2007-05-23 17:28:08 +000060 fi
61done