Skip to content
Snippets Groups Projects
Commit a1760a56 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

test: Add run-tests-exp.sh, script to run testsuite with only sh dependency.

This script uses expected test results as generated by run-tests --write-exp,
and requires only standard unix shell funtionality (no bash). It is useful
to run testsuite on embedded systems, where there's no CPython and Bash.
parent b82f34ed
No related branches found
No related tags found
No related merge requests found
#!/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
# on embedded systems which doesn't have CPython3.
#
RM="rm -f"
MP_PY=micropython
numtests=0
numtestcases=0
numpassed=0
numfailed=0
namefailed=
if [ $# -eq 0 ]
then
tests="basics/*.py micropython/*.py float/*.py import/*.py io/*.py misc/*.py"
else
tests="$@"
fi
for infile in $tests
do
basename=`basename $infile .py`
outfile=${basename}.out
expfile=$infile.exp
$MP_PY $infile > $outfile
numtestcases=$(expr $numtestcases + $(cat $expfile | wc -l))
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
numtests=$(expr $numtests + 1)
done
echo "$numtests tests performed ($numtestcases individual testcases)"
echo "$numpassed tests passed"
if [ $numfailed != 0 ]
then
echo "$numfailed tests failed -$namefailed"
exit 1
else
exit 0
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment