summaryrefslogtreecommitdiff
path: root/tests/TESTrun.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/TESTrun.sh')
-rwxr-xr-xtests/TESTrun.sh69
1 files changed, 49 insertions, 20 deletions
diff --git a/tests/TESTrun.sh b/tests/TESTrun.sh
index 6449082..a7529a5 100755
--- a/tests/TESTrun.sh
+++ b/tests/TESTrun.sh
@@ -1,26 +1,43 @@
#!/bin/sh
-mkdir -p NEW
-mkdir -p DIFF
-passed=0
-failed=0
-cat /dev/null > failure-outputs.txt
+TZ=GMT0; export TZ
+srcdir=${SRCDIR-..}
+
+# make it absolute for later use.
+pwd
+srcdir=`cd $srcdir && pwd`
+
+# this should be run from the compiled build directory,
+# with srcdir= set to wherever the source code is.
+# not from the tests directory.
+echo RUNNING from ${srcdir}
+
+passedfile=`pwd`/tests/.passed
+failedfile=`pwd`/tests/.failed
+failureoutput=`pwd`/tests/failure-outputs.txt
+mkdir -p tests/NEW
+mkdir -p tests/DIFF
+cat /dev/null > ${failureoutput}
runComplexTests()
{
- for i in *.sh
+ for i in ${srcdir}/tests/*.sh
do
- case $i in TEST*.sh) continue;; esac
- sh ./$i
+ case $i in
+ ${srcdir}/tests/TEST*.sh) continue;;
+ ${srcdir}/tests/\*.sh) continue;;
+ esac
+ : echo Running $i
+ (sh $i ${srcdir})
done
+ passed=`cat ${passedfile}`
+ failed=`cat ${failedfile}`
}
runSimpleTests()
{
- passed=`cat .passed`
- failed=`cat .failed`
only=$1
- cat TESTLIST | while read name input output options
+ cat ${srcdir}/tests/TESTLIST | while read name input output options
do
case $name in
\#*) continue;;
@@ -28,23 +45,34 @@ runSimpleTests()
esac
rm -f core
[ "$only" != "" -a "$name" != "$only" ] && continue
- if ./TESTonce $name $input $output "$options"
+ SRCDIR=${srcdir}
+ export SRCDIR
+ # I hate shells with their stupid, useless subshells.
+ passed=`cat ${passedfile}`
+ failed=`cat ${failedfile}`
+ (
+ if ${srcdir}/tests/TESTonce $name ${srcdir}/tests/$input ${srcdir}/tests/$output "$options"
then
passed=`expr $passed + 1`
- echo $passed >.passed
+ echo $passed >${passedfile}
else
failed=`expr $failed + 1`
- echo $failed >.failed
+ echo $failed >${failedfile}
fi
+ if [ -d tests/COREFILES ]; then
+ if [ -f core ]; then mv core tests/COREFILES/$name.core; fi
+ fi)
[ "$only" != "" -a "$name" = "$only" ] && break
done
# I hate shells with their stupid, useless subshells.
- passed=`cat .passed`
- failed=`cat .failed`
+ passed=`cat ${passedfile}`
+ failed=`cat ${failedfile}`
}
-echo $passed >.passed
-echo $failed >.failed
+passed=0
+failed=0
+echo $passed >${passedfile}
+echo $failed >${failedfile}
if [ $# -eq 0 ]
then
runComplexTests
@@ -62,8 +90,9 @@ echo '------------------------------------------------'
printf "%4u tests failed\n" $failed
printf "%4u tests passed\n" $passed
echo
-echo
-cat failure-outputs.txt
+if [ -z "$SKIPPASSED" ]; then
+ cat ${failureoutput}
+fi
echo
echo
exit $failed