diff options
Diffstat (limited to 'cmake/basictest')
-rwxr-xr-x | cmake/basictest | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/cmake/basictest b/cmake/basictest index 575f1c87..5e9010a0 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -1,9 +1,18 @@ #!/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 ${1})/extension/ +export AWKLIBPATH=$(dirname ${GAWKEXE})/extension/ export LANG=C # Is this shell running in a native MinGW shell (MSYS) ? if test -n "$COMSPEC"; then @@ -13,11 +22,27 @@ else # This is a shell running in Unix environment. COMPARE="cmp" fi -if test -r ${TESTHOME}/${2}.in + +# 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 - $1 $3 -f ${2}.awk < ${TESTHOME}/${2}.in > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} + $GAWKEXE ${OPTION} -f ${TESTCASE}.awk < ${TESTHOME}/${TESTCASE}.in > ${TESTHOME}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${TESTCASE} else - $1 $3 -f ${2}.awk > ${TESTHOME}/_${2} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${2} + $GAWKEXE ${OPTION} -f ${TESTCASE}.awk > ${TESTHOME}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${TESTCASE} fi -${COMPARE} ${TESTHOME}/${2}.ok ${TESTHOME}/_${2} && rm -f ${TESTHOME}/_${2} +# Compare the actual output with the expected (correct) output. +${COMPARE} ${TESTHOME}/${TESTCASE}.ok ${TESTHOME}/_${TESTCASE} && rm -f ${TESTHOME}/_${TESTCASE} |