summaryrefslogtreecommitdiff
path: root/tools/run-test.sh
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2018-07-02 12:38:33 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2018-07-02 12:38:33 +0000
commit3cb4106b13aa883f3b704aa4026b78fd36db3756 (patch)
tree7909fa214055aa344a71b515c8781c03db32ab79 /tools/run-test.sh
parent42c3adc8841167026bb8409cb5e4390a32bff49a (diff)
downloadnsss-3cb4106b13aa883f3b704aa4026b78fd36db3756.tar.xz
Add test framework, fix some bugs
Diffstat (limited to 'tools/run-test.sh')
-rwxr-xr-xtools/run-test.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/run-test.sh b/tools/run-test.sh
new file mode 100755
index 0000000..d651b09
--- /dev/null
+++ b/tools/run-test.sh
@@ -0,0 +1,22 @@
+#!/bin/sh -e
+
+prog="$1"
+
+if test -x "./src/tests/${prog}.wrapper" ; then
+ cmd="./src/tests/${prog}.wrapper $prog"
+else
+ cmd="./$prog"
+fi
+
+if test -r "./src/tests/${prog}.expected" ; then
+ cp -f "./src/tests/${prog}.expected" "./${prog}.expected"
+elif test -x "./src/tests/${prog}.baseline" ; then
+ "./src/tests/${prog}.baseline" > "./${prog}.expected"
+else
+ echo "run-test.sh: fatal: missing baseline for $prog" 1>&2 ; exit 100
+fi
+
+$cmd | diff "./${prog}.expected" -
+
+rm -f "./${prog}.expected"
+echo "run-test.sh: info: $prog: pass" 1>&2