]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Moved testsuite driver here, and
authorNiels Möller <nisse@lysator.liu.se>
Tue, 18 Feb 2003 20:07:40 +0000 (21:07 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Tue, 18 Feb 2003 20:07:40 +0000 (21:07 +0100)
symlink it from all directories that need it.

Rev: misc/run-tests:1.1

run-tests [new file with mode: 0755]

diff --git a/run-tests b/run-tests
new file mode 100755 (executable)
index 0000000..87a04a4
--- /dev/null
+++ b/run-tests
@@ -0,0 +1,69 @@
+#! /bin/sh
+
+failed=0
+all=0
+
+if [ -z "$srcdir" ] ; then
+  srcdir=`pwd`
+fi
+
+export srcdir
+
+find_program () {
+  if [ -x "$1" ] ; then
+    echo "./$1"
+  else
+    echo "$srcdir/$1"
+  fi
+}
+
+env_program () {
+  if [ -x "$1" ] ; then
+    if "$1"; then : ; else
+      echo FAIL: $1
+      exit 1
+    fi
+  fi
+}
+
+test_program () {
+  testname=`basename "$1" -test`
+  "$1"
+  case "$?" in
+      0)
+       echo PASS: $testname
+       all=`expr $all + 1`
+       ;;
+      77)
+       echo SKIP: $testname
+      ;;
+      *)
+       echo FAIL: $testname
+       failed=`expr $failed + 1`
+       all=`expr $all + 1`
+       ;;
+  esac
+}
+
+env_program `find_program setup-env`
+
+if [ $# -eq 0 ] ; then
+  for f in *-test; do test_program "./$f"; done
+else
+  for f in "$@" ; do test_program `find_program "$f"`; done
+fi
+
+if [ $failed -eq 0 ] ; then
+  banner="All $all tests passed"
+else
+  banner="$failed of $all tests failed"
+fi
+dashes=`echo "$banner" | sed s/./=/g`
+echo "$dashes"
+echo "$banner"
+echo "$dashes"
+
+env_program `find_program teardown-env`
+
+[ "$failed" -eq 0 ]
+