diff options
author | Juergen Kahrs <Juergen.Kahrs@googlemail.com> | 2013-05-06 17:46:17 +0200 |
---|---|---|
committer | Juergen Kahrs <Juergen.Kahrs@googlemail.com> | 2013-05-06 17:46:17 +0200 |
commit | 263bd7ca867fdb26241a8681075f99d97c33c4d0 (patch) | |
tree | 79c75bd582df797dc23d4edb9b5b8062150b5a2f | |
parent | bfebb6547fb331a87820be10d9c91efd274ea399 (diff) | |
download | egawk-263bd7ca867fdb26241a8681075f99d97c33c4d0.tar.gz egawk-263bd7ca867fdb26241a8681075f99d97c33c4d0.tar.bz2 egawk-263bd7ca867fdb26241a8681075f99d97c33c4d0.zip |
All 377 test cases are in now. Only mbfw1 and mbprintf1 fail on Linux.
-rwxr-xr-x | cmake/basictest | 177 | ||||
-rw-r--r-- | test/CMakeLists.txt | 26 |
2 files changed, 167 insertions, 36 deletions
diff --git a/cmake/basictest b/cmake/basictest index 3b8dd39a..68dd8615 100755 --- a/cmake/basictest +++ b/cmake/basictest @@ -57,8 +57,13 @@ function awkpath() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } -function litoct() { - echo ab | $GAWKEXE --traditional -f ${SRCDIR}/litoct.awk >_${TESTCASE} +function argtest() { + $GAWKEXE -f ${SRCDIR}/argtest.awk -x -y abc >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function badargs() { + $GAWKEXE -f 2>&1 | grep -v patchlevel >_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } @@ -101,15 +106,20 @@ function localenl() { } function mbprintf1() { - GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE - $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE} - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} + GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE + $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } function mbfw1() { - GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE - $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE} - ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} + GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE + $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function printfbad2() { + $GAWKEXE --lint -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in 2>&1 | sed "s;$SRCDIR/;;g" >_${TESTCASE} || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } function beginfile1() { @@ -117,6 +127,20 @@ function beginfile1() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function beginfile2() { + # This differs from the original, the pwd part is new. + # The re-direction is now bound to the .sh file. + # This way the output of "set -x" is not written to the script's output file. + ( cd ${SRCDIR} && LC_ALL=C AWK="$GAWKEXE" ${SRCDIR}/${TESTCASE}.sh ${SRCDIR}/${TESTCASE}.in > `pwd`/_${TESTCASE} 2>&1 ) + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} +} + +function dumpvars() { + AWKPATH=${SRCDIR} $GAWKEXE --dump-variables 1 < ${SRCDIR}/${TESTCASE}.in >/dev/null 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + mv awkvars.out _${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function manyfiles() { rm -rf junk mkdir junk @@ -142,6 +166,11 @@ function rsstart2() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function rsstart3() { + head ${SRCDIR}/rsstart1.in | $GAWKEXE -f ${SRCDIR}/rsstart2.awk >_${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: @@ -205,6 +234,46 @@ function ordchr2() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function include2() { + AWKPATH=${SRCDIR} $GAWKEXE -i inclib 'BEGIN {print sandwich("a", "b", "c")}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function incdupe() { + AWKPATH=${SRCDIR} $GAWKEXE --lint -i inclib -i inclib.awk 'BEGIN {print sandwich("a", "b", "c")}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function incdupe2() { + AWKPATH=${SRCDIR} $GAWKEXE --lint -f inclib -f inclib.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function incdupe3() { + AWKPATH=${SRCDIR} $GAWKEXE --lint -f hello -f hello.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function incdupe4() { + AWKPATH=${SRCDIR} $GAWKEXE --lint -f hello -i hello.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function incdupe5() { + AWKPATH=${SRCDIR} $GAWKEXE --lint -i hello -f hello.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function incdupe6() { + AWKPATH=${SRCDIR} $GAWKEXE --lint -i inchello -f hello.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function incdupe7() { + AWKPATH=${SRCDIR} $GAWKEXE --lint -f hello -i inchello >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function readfile() { $GAWKEXE -l readfile 'BEGIN {printf "%s", readfile("Makefile")}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} ${COMPARE} Makefile _${TESTCASE} && rm -f _${TESTCASE} || cp -p Makefile ${TESTCASE}.ok @@ -219,6 +288,42 @@ function fts() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} ${SRCDIR}/${TESTCASE}.ok } +function charasbytes() { + [ -z "$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH=${SRCDIR} $GAWKEXE -b -f ${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in | \ + od -c -t x1 | sed -e 's/ */ /g' -e 's/ *$//' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function symtab6() { + $GAWKEXE -d__${TESTCASE} -f ${SRCDIR}/${TESTCASE}.awk + grep -v '^ENVIRON' __${TESTCASE} | grep -v '^PROCINFO' > _${TESTCASE} ; rm __${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function symtab8() { + $GAWKEXE -d__${TESTCASE} -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} + grep -v '^ENVIRON' __${TESTCASE} | grep -v '^PROCINFO' | grep -v '^FILENAME' >> _${TESTCASE} ; rm __${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function colonwarn() { + for i in 1 2 3 ; \ + do $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk $i < ${SRCDIR}/${TESTCASE}.in ; \ + done > _${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 devfd() { + $GAWKEXE 1 /dev/fd/4 /dev/fd/5 4<${SRCDIR}/devfd.in4 5<${SRCDIR}/devfd.in5 >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function fflush() { ${SRCDIR}/fflush.sh >_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} @@ -330,11 +435,40 @@ function printf0() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function profile1() { + $GAWKEXE --pretty-print=ap-${TESTCASE}.out -f ${SRCDIR}/xref.awk ${SRCDIR}/dtdgport.awk > _${TESTCASE}.out1 + $GAWKEXE -f ap-${TESTCASE}.out ${SRCDIR}/dtdgport.awk > _${TESTCASE}.out2 ; rm ap-${TESTCASE}.out + ${COMPARE} _${TESTCASE}.out1 _${TESTCASE}.out2 && rm _${TESTCASE}.out[12] || { echo EXIT CODE: $$? >>_${TESTCASE} ; \ + cp $(srcdir)/dtdgport.awk > ${TESTCASE}.ok ; } +} + +function profile2() { + $GAWKEXE --profile=ap-${TESTCASE}.out -v sortcmd=sort -f ${SRCDIR}/xref.awk ${SRCDIR}/dtdgport.awk > /dev/null + sed 1,2d < ap-${TESTCASE}.out > _${TESTCASE}; rm ap-${TESTCASE}.out + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function profile3() { + $GAWKEXE --profile=ap-${TESTCASE}.out -f ${SRCDIR}/${TESTCASE}.awk > /dev/null + sed 1,2d < ap-${TESTCASE}.out > _${TESTCASE}; rm ap-${TESTCASE}.out + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function posix2008sub() { $GAWKEXE --posix -f ${SRCDIR}/${TESTCASE}.awk > _${TESTCASE} 2>&1 ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function next() { + LC_ALL=${GAWKLOCALE:-C} LANG=${GAWKLOCALE:-C} AWK="$GAWKEXE" ${SRCDIR}/${TESTCASE}.sh > _${TESTCASE} 2>&1 + LC_ALL=C ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function exit() { + AWK="$GAWKEXE" ${SRCDIR}/${TESTCASE}.sh > _${TESTCASE} 2>&1 + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function mpfrexprange() { $GAWKEXE -M -vPREC=53 -f ${SRCDIR}/${TESTCASE}.awk > _${TESTCASE} 2>&1 ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} @@ -376,11 +510,33 @@ function rtlenmb() { ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function nondec2() { + $GAWKEXE --non-decimal-data -v a=0x1 -f ${SRCDIR}/${TESTCASE}.awk >_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + function nofile() { $GAWKEXE '{}' no/such/file >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} } +function binmode1() { + $GAWKEXE -v BINMODE=3 'BEGIN { print BINMODE }' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function devfd1() { + $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk 4< ${SRCDIR}/devfd.in1 5< ${SRCDIR}/devfd.in2 >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + +function devfd2() { + # The program text is the '1' which will print each record. How compact can you get? + $GAWKEXE 1 /dev/fd/4 /dev/fd/5 4< ${SRCDIR}/devfd.in1 5< ${SRCDIR}/devfd.in2 >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE} + ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE} +} + + # Is this test case implemented as a function ? if [ "$( type -t $TESTCASE )" = "function" ] then @@ -393,8 +549,9 @@ then ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} else $GAWKEXE ${OPTION} -f ${TESTCASE}.awk > ${SRCDIR}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${SRCDIR}/_${TESTCASE} + # Compare the expected (correct) output with the actual output. ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} + # If the comparison succeeds then remove the actual output. + # Else leave the actual output file untouched for later analysis. fi -# Compare the actual output with the expected (correct) output. -#${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index eb3ddcef..d92897d8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -54,32 +54,6 @@ foreach(testgroup ${ALL_GROUPS} ) ${testcase} STREQUAL uninit4 OR ${testcase} STREQUAL uninit5 OR ${testcase} STREQUAL uninitialized) set(options "--lint") - # 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. - elseif( - ${testcase} STREQUAL argtest OR - ${testcase} STREQUAL badargs OR ${testcase} STREQUAL beginfile2 OR - ${testcase} STREQUAL binmode1 OR ${testcase} STREQUAL charasbytes OR - ${testcase} STREQUAL colonwarn OR - ${testcase} STREQUAL devfd OR ${testcase} STREQUAL devfd1 OR - ${testcase} STREQUAL devfd2 OR ${testcase} STREQUAL dumpvars OR - ${testcase} STREQUAL exit OR - ${testcase} STREQUAL fmtspcl OR - ${testcase} STREQUAL incdupe OR - ${testcase} STREQUAL incdupe2 OR ${testcase} STREQUAL incdupe3 OR - ${testcase} STREQUAL incdupe4 OR ${testcase} STREQUAL incdupe5 OR - ${testcase} STREQUAL incdupe6 OR ${testcase} STREQUAL incdupe7 OR - ${testcase} STREQUAL include2 OR - ${testcase} STREQUAL next OR - ${testcase} STREQUAL nondec2 OR - ${testcase} STREQUAL printfbad2 OR - ${testcase} STREQUAL profile1 OR ${testcase} STREQUAL profile2 OR - ${testcase} STREQUAL profile3 OR - ${testcase} STREQUAL rsstart3 OR - ${testcase} STREQUAL symtab6 OR ${testcase} STREQUAL symtab8 - ) - set(file_suffix "_FAILS") endif() if ("${file_suffix}" STREQUAL "") |