aboutsummaryrefslogtreecommitdiffstats
path: root/test/regression/Runtest
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2016-10-24 14:21:51 +0200
committerXavier Leroy <xavier.leroy@inria.fr>2016-10-24 14:34:59 +0200
commit03ab00aec5d10f4a2d048fab7f16489cf33fcc1d (patch)
tree16d5313fb0d61585f6d82c6232228d716e9f7553 /test/regression/Runtest
parent2fc1f0ce18c45d1148493d58e0c848fc70c44a4d (diff)
downloadcompcert-03ab00aec5d10f4a2d048fab7f16489cf33fcc1d.tar.gz
compcert-03ab00aec5d10f4a2d048fab7f16489cf33fcc1d.zip
Update the tests and test infrastructure in test/regression
Tests updated to work with x86 64 bits. Infrastructure added: script "Runtest", with ability to have different reference outputs depending on platform or bit size.
Diffstat (limited to 'test/regression/Runtest')
-rwxr-xr-xtest/regression/Runtest55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/regression/Runtest b/test/regression/Runtest
new file mode 100755
index 00000000..7cc6330b
--- /dev/null
+++ b/test/regression/Runtest
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# The name of the test
+name="$1"
+shift
+
+# The temp file for output
+out="test$$.log"
+rm -f $out
+trap "rm -f $out" 0 INT QUIT
+
+# The architecture and the model
+arch=`sed -n -e 's/^ARCH=//p' ../../Makefile.config`
+model=`sed -n -e 's/^MODEL=//p' ../../Makefile.config`
+
+# Its bit size
+case "$arch,$model" in
+ ia32,64) bits=64;;
+ *) bits=32;;
+esac
+
+# The reference output
+if test -f "Results/$name-$arch-$model"; then
+ ref="Results/$name-$arch-$model"
+elif test -f "Results/$name-$arch"; then
+ ref="Results/$name-$arch"
+elif test -f "Results/$name-$bits"; then
+ ref="Results/$name-$bits"
+elif test -f "Results/$name"; then
+ ref="Results/$name"
+else
+ ref=""
+fi
+
+# Administer the test
+if $* > $out
+then
+ if test -n "$ref"; then
+ if cmp -s "$out" "$ref"; then
+ echo "$name: passed"
+ exit 0
+ else
+ echo "$name: WRONG OUTPUT (diff follows)"
+ diff -u "$ref" "$out"
+ exit 2
+ fi
+ else
+ echo "$name: passed"
+ exit 0
+ fi
+else
+ echo "$name: EXECUTION FAILED (status $?)"
+ exit 2
+fi
+