Commit 71321f49 authored by Niels Möller's avatar Niels Möller
Browse files

Copied new version rom lsh/src/testsuite.

This version handles test scripts located in $srcdir.

Rev: src/nettle/testsuite/run-tests:1.6
parent 16d5ddeb
...@@ -3,9 +3,23 @@ ...@@ -3,9 +3,23 @@
failed=0 failed=0
all=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 () { env_program () {
if [ -x ./"$1" ] ; then if [ -x "$1" ] ; then
if ./"$1"; then : ; else if "$1"; then : ; else
echo FAIL: $1 echo FAIL: $1
exit 1 exit 1
fi fi
...@@ -13,8 +27,8 @@ env_program () { ...@@ -13,8 +27,8 @@ env_program () {
} }
test_program () { test_program () {
testname=`echo "$1" | sed -e 's,-test$,,' -e 's,^\./,,'` testname=`basename "$1" -test`
"./$1" "$1"
case "$?" in case "$?" in
0) 0)
echo PASS: $testname echo PASS: $testname
...@@ -31,12 +45,12 @@ test_program () { ...@@ -31,12 +45,12 @@ test_program () {
esac esac
} }
env_program setup-env env_program `find_program setup-env`
if [ $# -eq 0 ] ; then if [ $# -eq 0 ] ; then
for f in *-test; do test_program "$f"; done for f in *-test; do test_program "./$f"; done
else else
for f in "$@" ; do test_program "$f"; done for f in "$@" ; do test_program `find_program "$f"`; done
fi fi
if [ $failed -eq 0 ] ; then if [ $failed -eq 0 ] ; then
...@@ -49,7 +63,7 @@ echo "$dashes" ...@@ -49,7 +63,7 @@ echo "$dashes"
echo "$banner" echo "$banner"
echo "$dashes" echo "$dashes"
env_program teardown-env env_program `find_program teardown-env`
[ "$failed" -eq 0 ] [ "$failed" -eq 0 ]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment