aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcmake/basictest59
-rw-r--r--test/CMakeLists.txt9
2 files changed, 56 insertions, 12 deletions
diff --git a/cmake/basictest b/cmake/basictest
index 211491f6..13f9f81c 100755
--- a/cmake/basictest
+++ b/cmake/basictest
@@ -13,7 +13,7 @@ export OPTION=$3
TOPSRCDIR=$(dirname ${0})/..
SRCDIR=${TOPSRCDIR}/test
export AWKPATH=${SRCDIR}
-export AWKLIBPATH=$(dirname ${GAWKEXE})extension/
+export AWKLIBPATH=$(dirname ${GAWKEXE})/extension/
export LANG=C
# Is this shell running in a native MinGW shell (MSYS) ?
if test -n "$COMSPEC"; then
@@ -27,6 +27,59 @@ fi
# Each test case that cannot be handle in the "standard way" shall
# be implemented as a function here.
+function getline2() {
+ $GAWKEXE -f ${SRCDIR}/getline2.awk ${SRCDIR}/getline2.awk ${SRCDIR}/getline2.awk >_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function litoct() {
+ echo ab | $GAWKEXE --traditional -f ${SRCDIR}/litoct.awk >_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function nonl() {
+ AWKPATH=${SRCDIR} $GAWKEXE --lint -f nonl.awk /dev/null >_${TESTCASE} 2>&1
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function poundbang() {
+# The original poundbang test case looks a bit non-deterministic.
+# This is a shortened version.
+ sed "s;/tmp/gawk;$GAWKEXE;" < ${SRCDIR}/poundbang.awk > ./_pbd.awk
+ chmod +x ./_pbd.awk
+ ./_pbd.awk ${SRCDIR}/poundbang.awk > _`basename ${TESTCASE}` ;
+ ${COMPARE} ${SRCDIR}/poundbang.awk _`basename ${TESTCASE}` && rm -f _`basename ${TESTCASE}` _pbd.awk
+}
+
+function beginfile1() {
+ AWKPATH=${SRCDIR} $GAWKEXE -f ${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.awk . ./no/such/file Makefile >_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function manyfiles() {
+ rm -rf junk
+ mkdir junk
+ $GAWKEXE 'BEGIN { for (i = 1; i <= 1030; i++) print i, i}' >_${TESTCASE}
+ $GAWKEXE -f ${SRCDIR}/manyfiles.awk _${TESTCASE} _${TESTCASE}
+ wc -l junk/* | $GAWKEXE '$1 != 2' | wc -l | sed "s/ *//g" > _${TESTCASE}
+ rm -rf junk
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function rsstart2() {
+ $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/rsstart1.in >_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function strftime() {
+ echo This test could fail on slow machines or on a minute boundary,
+ echo so if it does, double check the actual results:
+ GAWKLOCALE=C; export GAWKLOCALE
+ TZ=GMT0; export TZ
+ (LC_ALL=C date) | $GAWKEXE -v OUTPUT=_${TESTCASE} -f ${SRCDIR}/strftime.awk
+ ${COMPARE} strftime.ok _${TESTCASE} && rm -f _${TESTCASE} strftime.ok || exit 0
+}
+
function inplace1() {
cp ${SRCDIR}/inplace.1.in _${TESTCASE}.1
cp ${SRCDIR}/inplace.2.in _${TESTCASE}.2
@@ -73,7 +126,7 @@ function readdir() {
fi
$GAWKEXE -f ${TESTCASE}.awk ${SRCDIR}/.. > ${SRCDIR}/_${TESTCASE} 2>&1
ls -afli ${TOPSRCDIR} | sed 1d | $GAWKEXE -f ${SRCDIR}/readdir0.awk -v extout=${SRCDIR}/_${TESTCASE} > ${SRCDIR}/${TESTCASE}.ok
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} ${SRCDIR}/${TESTCASE}.ok
}
function ordchr2() {
@@ -92,7 +145,7 @@ function fts() {
echo If it does, try rerunning on an xfs filesystem. ; \
fi
( cd ${SRCDIR} ; $GAWKEXE -f ${TESTCASE}.awk )
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} ${SRCDIR}/${TESTCASE}.ok
}
# Is this test case implemented as a function ?
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 0c99de79..9f1c751b 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -54,15 +54,6 @@ foreach(testgroup ${ALL_GROUPS} )
${testcase} STREQUAL uninit4 OR ${testcase} STREQUAL uninit5 OR
${testcase} STREQUAL uninitialized)
set(options "--lint")
- # Check for test cases that cause a "hang" in test case execution.
- # Each of them has to be analysed until all of them disappear from this list.
- elseif(
- ${testcase} STREQUAL getline2 OR ${testcase} STREQUAL litoct OR
- ${testcase} STREQUAL nonl OR ${testcase} STREQUAL poundbang OR
- ${testcase} STREQUAL beginfile1 OR ${testcase} STREQUAL manyfiles OR
- ${testcase} STREQUAL rsstart2 OR ${testcase} STREQUAL strftime
- )
- set(file_suffix "_HANGS")
# These are the test cases that fail.
# Some of them may reveal genuine bugs.
# Most of them fail because they need to be invoked with a special parameter.