summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-07-13 18:49:56 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-07-13 18:49:56 +0300
commita1760a56ff2a9be9506e96f4cd17459bf2916b30 (patch)
treed0f345ca2682f02008a3a1f07276e2ca888d3bd5 /tests
parentb82f34edde79e14d6b9260b3fddaf36b1354a558 (diff)
downloadmicropython-a1760a56ff2a9be9506e96f4cd17459bf2916b30.tar.gz
micropython-a1760a56ff2a9be9506e96f4cd17459bf2916b30.zip
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.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/run-tests-exp.sh57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/run-tests-exp.sh b/tests/run-tests-exp.sh
new file mode 100755
index 0000000000..032c42dd3b
--- /dev/null
+++ b/tests/run-tests-exp.sh
@@ -0,0 +1,57 @@
+#!/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