run-tests 917 Bytes
Newer Older
1
#!/usr/bin/env bash
2
3

RM="/bin/rm -f"
4
CPYTHON3=python3.3
5
6
7
MP_PY=../../unix/py

numtests=0
8
numtestcases=0
9
10
11
12
13
14
numpassed=0
numfailed=0
namefailed=

for infile in tests/*.py
do
15
    basename=`basename $infile .py`
16
17
18
19
20
    outfile=${basename}.out
    expfile=${basename}.exp

    $CPYTHON3 -B $infile > $expfile
    $MP_PY $infile > $outfile
21
    ((numtestcases = numtestcases + $(cat $expfile | wc -l)))
22
23
24
25
26
27
28
29

    diff --brief $expfile $outfile > /dev/null

    if [ $? -eq 0 ]
    then
        echo "pass  $infile"
        $RM $outfile
        $RM $expfile
30
        ((numpassed=numpassed + 1))
31
32
    else
        echo "FAIL  $infile"
33
        ((numfailed=numfailed + 1))
34
35
36
        namefailed="$namefailed $basename"
    fi

37
    ((numtests=numtests + 1))
38
39
done

40
echo "$numtests tests performed ($numtestcases individual testcases)"
41
echo "$numpassed tests passed"
42
if [[ $numfailed != 0 ]]
43
44
45
then
    echo "$numfailed tests failed -$namefailed"
fi