blob: 075d357a681c8a8d543796389bde71b3d905be7f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
#!/bin/sh
TZ=GMT0; export TZ
srcdir=${SRCDIR-..}
# make it absolute for later use.
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 ${srcdir}/tests/*.sh
do
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()
{
only=$1
cat ${srcdir}/tests/TESTLIST | while read name input output options
do
case $name in
\#*) continue;;
'') continue;;
esac
rm -f core
[ "$only" != "" -a "$name" != "$only" ] && continue
export SRCDIR=${srcdir}
# I hate shells with their stupid, useless subshells.
passed=`cat ${passedfile}`
failed=`cat ${failedfile}`
(cd tests # run TESTonce in tests directory
if ${srcdir}/tests/TESTonce $name ${srcdir}/tests/$input ${srcdir}/tests/$output "$options"
then
passed=`expr $passed + 1`
echo $passed >${passedfile}
else
failed=`expr $failed + 1`
echo $failed >${failedfile}
fi
if [ -d COREFILES ]; then
if [ -f core ]; then mv core COREFILES/$name.core; fi
fi)
[ "$only" != "" -a "$name" = "$only" ] && break
done
# I hate shells with their stupid, useless subshells.
passed=`cat ${passedfile}`
failed=`cat ${failedfile}`
}
passed=0
failed=0
echo $passed >${passedfile}
echo $failed >${failedfile}
if [ $# -eq 0 ]
then
runComplexTests
runSimpleTests
elif [ $# -eq 1 ]
then
runSimpleTests $1
else
echo "Usage: $0 [test_name]"
exit 30
fi
# exit with number of failing tests.
echo '------------------------------------------------'
printf "%4u tests failed\n" $failed
printf "%4u tests passed\n" $passed
echo
cat ${failureoutput}
echo
echo
exit $failed
|