blob: 5e9010a0c47a46f54ede6a87c5c91f8157bf3d0f (
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
|
#!/bin/sh
# Use this for debugging the test cases.
# The resulting textual output will not destroy the test cases.
set -x
# After test case execution, the output can be found in
# build/Testing/Temporary/LastTest.log
export PATH=$PATH:/c/MinGW/msys/1.0/bin
export GAWKEXE=$1
export TESTCASE=$2
export OPTION=$3
TESTHOME=$(dirname ${0})/../test
export AWKPATH=${TESTHOME}
export AWKLIBPATH=$(dirname ${GAWKEXE})/extension/
export LANG=C
# Is this shell running in a native MinGW shell (MSYS) ?
if test -n "$COMSPEC"; then
# Ignore all differences in white space.
COMPARE="diff -w"
else
# This is a shell running in Unix environment.
COMPARE="cmp"
fi
# Each test case that cannot be handle in the "standard way" shall
# be implemented as a function here.
function testext() {
$GAWKEXE '/^(@load|BEGIN)/,/^}/' ${TESTHOME}/../extension/testext.c > testext.awk
$GAWKEXE -f ${TESTCASE}.awk > ${TESTHOME}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${TESTCASE}
rm -f testext.awk
}
# Is this test case implemented as a function ?
if [ "$( type -t $TESTCASE )" = "function" ]
then
$TESTCASE
# If no function exists, then treat the test case in standard way.
elif test -r ${TESTHOME}/${TESTCASE}.in
# Any existing .in file will be redirected to standard input.
then
$GAWKEXE ${OPTION} -f ${TESTCASE}.awk < ${TESTHOME}/${TESTCASE}.in > ${TESTHOME}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${TESTCASE}
else
$GAWKEXE ${OPTION} -f ${TESTCASE}.awk > ${TESTHOME}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${TESTCASE}
fi
# Compare the actual output with the expected (correct) output.
${COMPARE} ${TESTHOME}/${TESTCASE}.ok ${TESTHOME}/_${TESTCASE} && rm -f ${TESTHOME}/_${TESTCASE}
|