blob: adaa2fc6515883f415e98022a93ee83787301f4e [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 Rossum36987462007-07-23 02:57:24 +000028# The -u flag.
Guido van Rossum486364b2007-06-30 05:01:58 +000029UFLAG=""
Guido van Rossum36987462007-07-23 02:57:24 +000030case $1 in
31-u)
32 UFLAG="$1 $2"; shift; shift;;
33-u*)
34 UFLAG="$1"; shift;;
35esac
Guido van Rossum53970392007-06-12 00:28:30 +000036
Guido van Rossume53309c2007-05-23 17:28:08 +000037# Compute the list of tests to run.
38case $# in
390)
Guido van Rossum2bf71382007-06-08 00:07:57 +000040 TESTS=`(cd Lib/test; ls test_*.py | sed 's/\.py//')`
Guido van Rossume53309c2007-05-23 17:28:08 +000041 ;;
42*)
43 TESTS="$@"
44 ;;
45esac
46
47# Run the tests.
48for T in $TESTS
49do
50 echo -n $T
Guido van Rossum97a7f1e2007-07-26 18:43:46 +000051 if case $T in
52 *curses*) echo; $PYTHON Lib/test/regrtest.py $UFLAG $T 2>OUT/$T.out;;
53 *) $PYTHON Lib/test/regrtest.py $UFLAG $T >OUT/$T.out 2>&1;;
54 esac
Guido van Rossume53309c2007-05-23 17:28:08 +000055 then
56 if grep -q "1 test skipped:" OUT/$T.out
57 then
58 echo " SKIPPED"
59 echo $T >>SKIPPED
60 else
61 echo
62 echo $T >>GOOD
63 fi
64 else
65 echo " BAD"
66 echo $T >>BAD
Guido van Rossume53309c2007-05-23 17:28:08 +000067 fi
68done