blob: be10e106de9f2b989f8f2d15ead03130716efd5a (
plain) (
blame)
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
|
#!/bin/sh
IS_TEST_CASE=0
if ! . "$(cd -- "$(dirname -- "$0")" && pwd -P)/bootstrap.sh"
then
echo 'Unable to find bootstrap script'>&2
exit 1
fi
wantedFilter=''
if test $# -eq 1
then
wantedFilter="${1}"
else
wantedFilter=''
fi
someTestExecuted=0
for testFile in "${DIR_TESTCASES}"/*
do
fullTestName="$(basename "${testFile}")"
testName=${fullTestName%.success}
if test "${fullTestName}" != "${testName}"
then
should='succeed'
else
testName=${fullTestName%.fail}
if test "${fullTestName}" != "${testName}"
then
should='fail'
else
printf 'Unrecognized test case: %s\n', "${fullTestName}"
exit 1
fi
fi
if test -z "${wantedFilter}" -o "${testName}" = "${wantedFilter}"
then
printf '%s should %s... ' "${testName}" "${should}"
case "${should}" in
'succeed')
if testOutput="$(${testFile} 2>&1)"
then
printf 'ok.\n'
else
printf 'FAILED!\n'
printf '%s\n' "${testOutput}" >&2
exit 1
fi
;;
'fail')
if testOutput="$(${testFile} 2>&1)"
then
printf 'FAILED!\n'
printf '%s\n' "${testOutput}" >&2
exit 1
else
printf 'ok.\n'
fi
;;
esac
someTestExecuted=1
fi
done
if test ${someTestExecuted} -eq 0
then
echo 'No test found!'>&2
exit 1
fi
|