run-tests 800 Bytes
Newer Older
1
#!/usr/bin/env bash
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

RM="/bin/rm -f"
CPYTHON3=python3
MP_PY=../../unix/py

numtests=0
numpassed=0
numfailed=0
namefailed=

for infile in tests/*.py
do
    basename=`basename $infile .c`
    outfile=${basename}.out
    expfile=${basename}.exp

    $CPYTHON3 -B $infile > $expfile
    $MP_PY $infile > $outfile

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

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

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

echo "$numtests tests performed"
echo "$numpassed tests passed"
40
if [[ $numfailed != 0 ]]
41
42
43
then
    echo "$numfailed tests failed -$namefailed"
fi