Break out some common test code to a separate file.

Next step to refactor remaining tests.
This commit is contained in:
Daniel Aarno 2018-07-28 18:09:56 +01:00
parent 81e4e8bba5
commit 6db23c03b5
2 changed files with 20 additions and 9 deletions

19
tests/simple-test.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
if [ -z "$srcdir" ]; then
srcdir=`dirname $0`
fi
TEST_RESULT=$srcdir/$1
shift
../examples/"$@" 2>&1 | tee tmp.out
if cmp -s tmp.out $TEST_RESULT.out; then
echo "OK"
exit 0
else
echo "FAIL"
diff tmp.out $TEST_RESULT.out
exit 1
fi

View File

@ -1,11 +1,3 @@
#!/bin/sh
# success
../examples/test1 -r -n mike > tmp.out 2>&1
if cmp -s tmp.out $srcdir/test1.out; then
exit 0
else
exit 1
fi
./simple-test.sh test1 `basename $0 .sh` -r -n mike