2014-07-13 16:49:56 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# This is plain shell variant of run-tests script, which uses .exp files
|
|
|
|
# as generated by run-tests --write-exp. It is useful to run testsuite
|
2015-02-20 01:21:38 +00:00
|
|
|
# on embedded systems which don't have CPython3.
|
2014-07-13 16:49:56 +01:00
|
|
|
#
|
|
|
|
|
|
|
|
RM="rm -f"
|
|
|
|
MP_PY=micropython
|
|
|
|
|
|
|
|
numtests=0
|
|
|
|
numtestcases=0
|
|
|
|
numpassed=0
|
2014-10-06 18:06:49 +01:00
|
|
|
numskipped=0
|
2014-07-13 16:49:56 +01:00
|
|
|
numfailed=0
|
2014-10-06 18:06:49 +01:00
|
|
|
nameskipped=
|
2014-07-13 16:49:56 +01:00
|
|
|
namefailed=
|
|
|
|
|
|
|
|
if [ $# -eq 0 ]
|
|
|
|
then
|
2014-10-06 18:06:49 +01:00
|
|
|
tests="basics/*.py micropython/*.py float/*.py import/*.py io/*.py misc/*.py unicode/*.py extmod/*.py unix/*.py"
|
2014-07-13 16:49:56 +01:00
|
|
|
else
|
|
|
|
tests="$@"
|
|
|
|
fi
|
|
|
|
|
|
|
|
for infile in $tests
|
|
|
|
do
|
|
|
|
basename=`basename $infile .py`
|
2014-10-06 18:06:49 +01:00
|
|
|
outfile=${basename}.py.out
|
2014-07-13 16:49:56 +01:00
|
|
|
expfile=$infile.exp
|
|
|
|
|
|
|
|
$MP_PY $infile > $outfile
|
|
|
|
numtestcases=$(expr $numtestcases + $(cat $expfile | wc -l))
|
|
|
|
|
2014-10-06 18:35:46 +01:00
|
|
|
if grep -q "SKIP\|SyntaxError: invalid micropython decorator" $outfile
|
2014-07-13 16:49:56 +01:00
|
|
|
then
|
2014-10-06 18:35:46 +01:00
|
|
|
# we don't count tests that explicitly ask to be skipped
|
2014-10-06 18:06:49 +01:00
|
|
|
# we don't count tests that fail due to unsupported decorator
|
|
|
|
echo "skip $infile"
|
2014-07-13 16:49:56 +01:00
|
|
|
$RM $outfile
|
2014-10-06 18:06:49 +01:00
|
|
|
numskipped=$(expr $numskipped + 1)
|
|
|
|
nameskipped="$nameskipped $basename"
|
2014-07-13 16:49:56 +01:00
|
|
|
else
|
2014-10-06 18:06:49 +01:00
|
|
|
diff --brief $expfile $outfile > /dev/null
|
|
|
|
|
|
|
|
if [ $? -eq 0 ]
|
|
|
|
then
|
|
|
|
echo "pass $infile"
|
|
|
|
$RM $outfile
|
|
|
|
numpassed=$(expr $numpassed + 1)
|
|
|
|
else
|
|
|
|
echo "FAIL $infile"
|
|
|
|
numfailed=$(expr $numfailed + 1)
|
|
|
|
namefailed="$namefailed $basename"
|
|
|
|
fi
|
2014-07-13 16:49:56 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
numtests=$(expr $numtests + 1)
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "$numtests tests performed ($numtestcases individual testcases)"
|
|
|
|
echo "$numpassed tests passed"
|
2014-10-06 18:06:49 +01:00
|
|
|
if [ $numskipped != 0 ]
|
|
|
|
then
|
|
|
|
echo "$numskipped tests skipped -$nameskipped"
|
|
|
|
fi
|
2014-07-13 16:49:56 +01:00
|
|
|
if [ $numfailed != 0 ]
|
|
|
|
then
|
|
|
|
echo "$numfailed tests failed -$namefailed"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
exit 0
|
|
|
|
fi
|