aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Kahrs <Juergen.Kahrs@googlemail.com>2013-05-04 16:37:29 +0200
committerJuergen Kahrs <Juergen.Kahrs@googlemail.com>2013-05-04 16:37:29 +0200
commite081fb5a615104d2ac8ec6b193ce3106950a3bbb (patch)
treefea4759fb838f30836fcc0f4d42e93be01b64472
parent582c08d3795cec69eae28f9513c65d21ad0a13e8 (diff)
downloadegawk-e081fb5a615104d2ac8ec6b193ce3106950a3bbb.tar.gz
egawk-e081fb5a615104d2ac8ec6b193ce3106950a3bbb.tar.bz2
egawk-e081fb5a615104d2ac8ec6b193ce3106950a3bbb.zip
All SHLIB test cases are implemented now and pass on Linux. With MinGW only 6 of them pass.
-rwxr-xr-xcmake/basictest84
-rw-r--r--extension/CMakeLists.txt2
-rw-r--r--test/CMakeLists.txt12
3 files changed, 81 insertions, 17 deletions
diff --git a/cmake/basictest b/cmake/basictest
index 5e9010a0..211491f6 100755
--- a/cmake/basictest
+++ b/cmake/basictest
@@ -10,9 +10,10 @@ 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/
+TOPSRCDIR=$(dirname ${0})/..
+SRCDIR=${TOPSRCDIR}/test
+export AWKPATH=${SRCDIR}
+export AWKLIBPATH=$(dirname ${GAWKEXE})extension/
export LANG=C
# Is this shell running in a native MinGW shell (MSYS) ?
if test -n "$COMSPEC"; then
@@ -25,10 +26,73 @@ fi
# Each test case that cannot be handle in the "standard way" shall
# be implemented as a function here.
+
+function inplace1() {
+ cp ${SRCDIR}/inplace.1.in _${TESTCASE}.1
+ cp ${SRCDIR}/inplace.2.in _${TESTCASE}.2
+ AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.1.ok _${TESTCASE}.1 && rm -f _${TESTCASE}.1
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.2.ok _${TESTCASE}.2 && rm -f _${TESTCASE}.2
+}
+
+function inplace2() {
+ cp ${SRCDIR}/inplace.1.in _${TESTCASE}.1
+ cp ${SRCDIR}/inplace.2.in _${TESTCASE}.2
+ AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.1.ok _${TESTCASE}.1 && rm -f _${TESTCASE}.1
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.1.bak.ok _${TESTCASE}.1.bak && rm -f _${TESTCASE}.1.bak
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.2.ok _${TESTCASE}.2 && rm -f _${TESTCASE}.2
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.2.bak.ok _${TESTCASE}.2.bak && rm -f _${TESTCASE}.2.bak
+}
+
+function inplace3() {
+ cp ${SRCDIR}/inplace.1.in _${TESTCASE}.1
+ cp ${SRCDIR}/inplace.2.in _${TESTCASE}.2
+ AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE}
+ AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "Before"} {gsub(/bar/, "foo"); print} END {print "After"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >>_${TESTCASE} 2>&1 || echo EXIT CODE: $$? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.1.ok _${TESTCASE}.1 && rm -f _${TESTCASE}.1
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.1.bak.ok _${TESTCASE}.1.bak && rm -f _${TESTCASE}.1.bak
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.2.ok _${TESTCASE}.2 && rm -f _${TESTCASE}.2
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.2.bak.ok _${TESTCASE}.2.bak && rm -f _${TESTCASE}.2.bak
+}
+
function testext() {
- $GAWKEXE '/^(@load|BEGIN)/,/^}/' ${TESTHOME}/../extension/testext.c > testext.awk
- $GAWKEXE -f ${TESTCASE}.awk > ${TESTHOME}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${TESTCASE}
+ $GAWKEXE ' /^(@load|BEGIN)/,/^}/' ${SRCDIR}/../extension/testext.c > testext.awk
+ $GAWKEXE -f ${TESTCASE}.awk > ${SRCDIR}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${SRCDIR}/_${TESTCASE}
rm -f testext.awk
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE}
+}
+
+function readdir() {
+ if [ "`uname`" = Linux ] && [ "`stat -f . 2>/dev/null | awk 'NR == 2 { print $$NF }'`" = nfs ]; then
+ echo This test may fail on GNU/Linux systems when run on an NFS filesystem.;
+ echo If it does, try rerunning on an ext'[234]' filesystem. ;
+ 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}
+}
+
+function ordchr2() {
+ $GAWKEXE -l ordchr 'BEGIN {print chr(ord("z"))}' >_${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
+}
+
+function fts() {
+ if [ "`uname`" = IRIX ]; then \
+ echo This test may fail on IRIX systems when run on an NFS filesystem.; \
+ 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}
}
# Is this test case implemented as a function ?
@@ -36,13 +100,15 @@ 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
+elif test -r ${SRCDIR}/${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}
+ $GAWKEXE ${OPTION} -f ${TESTCASE}.awk < ${SRCDIR}/${TESTCASE}.in > ${SRCDIR}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${SRCDIR}/_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE}
else
- $GAWKEXE ${OPTION} -f ${TESTCASE}.awk > ${TESTHOME}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${TESTHOME}/_${TESTCASE}
+ $GAWKEXE ${OPTION} -f ${TESTCASE}.awk > ${SRCDIR}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${SRCDIR}/_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE}
fi
# Compare the actual output with the expected (correct) output.
-${COMPARE} ${TESTHOME}/${TESTCASE}.ok ${TESTHOME}/_${TESTCASE} && rm -f ${TESTHOME}/_${TESTCASE}
+#${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE}
diff --git a/extension/CMakeLists.txt b/extension/CMakeLists.txt
index bb4d4e5c..92e6b972 100644
--- a/extension/CMakeLists.txt
+++ b/extension/CMakeLists.txt
@@ -27,7 +27,7 @@
remove_definitions(-DGAWK)
MACRO(BuildExtension name sources)
- add_library (${name} MODULE ${sources})
+ add_library (${name} MODULE ${sources} ${ARGN})
target_link_libraries(${name})
set_target_properties(${name} PROPERTIES PREFIX "")
install(PROGRAMS ${CMAKE_BINARY_DIR}/extension/${name}${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION lib)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 6b085e08..0c99de79 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -60,8 +60,7 @@ foreach(testgroup ${ALL_GROUPS} )
${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 OR
- ${testcase} STREQUAL readdir
+ ${testcase} STREQUAL rsstart2 OR ${testcase} STREQUAL strftime
)
set(file_suffix "_HANGS")
# These are the test cases that fail.
@@ -77,7 +76,7 @@ foreach(testgroup ${ALL_GROUPS} )
${testcase} STREQUAL devfd2 OR ${testcase} STREQUAL dumpvars OR
${testcase} STREQUAL exit OR ${testcase} STREQUAL exitval1 OR
${testcase} STREQUAL fflush OR ${testcase} STREQUAL fmtspcl OR
- ${testcase} STREQUAL fsspcoln OR ${testcase} STREQUAL fts OR
+ ${testcase} STREQUAL fsspcoln OR
${testcase} STREQUAL gsubtst3 OR ${testcase} STREQUAL incdupe OR
${testcase} STREQUAL incdupe2 OR ${testcase} STREQUAL incdupe3 OR
${testcase} STREQUAL incdupe4 OR ${testcase} STREQUAL incdupe5 OR
@@ -85,8 +84,7 @@ foreach(testgroup ${ALL_GROUPS} )
${testcase} STREQUAL include2 OR ${testcase} STREQUAL inetdayt OR
${testcase} STREQUAL inetdayu OR ${testcase} STREQUAL inetecht OR
${testcase} STREQUAL inetechu OR ${testcase} STREQUAL inftest OR
- ${testcase} STREQUAL inplace1 OR ${testcase} STREQUAL inplace2 OR
- ${testcase} STREQUAL inplace3 OR ${testcase} STREQUAL jarebug OR
+ ${testcase} STREQUAL jarebug OR
${testcase} STREQUAL leaddig OR ${testcase} STREQUAL localenl OR
${testcase} STREQUAL mbfw1 OR ${testcase} STREQUAL mbprintf1 OR
${testcase} STREQUAL messages OR ${testcase} STREQUAL mmap8k OR
@@ -94,11 +92,11 @@ foreach(testgroup ${ALL_GROUPS} )
${testcase} STREQUAL mpfrnr OR ${testcase} STREQUAL mpfrrnd OR
${testcase} STREQUAL next OR ${testcase} STREQUAL nofile OR
${testcase} STREQUAL nondec2 OR ${testcase} STREQUAL nors OR
- ${testcase} STREQUAL ordchr2 OR ${testcase} STREQUAL pid OR
+ ${testcase} STREQUAL pid OR
${testcase} STREQUAL pipeio2 OR ${testcase} STREQUAL posix2008sub OR
${testcase} STREQUAL printf0 OR ${testcase} STREQUAL printfbad2 OR
${testcase} STREQUAL profile1 OR ${testcase} STREQUAL profile2 OR
- ${testcase} STREQUAL profile3 OR ${testcase} STREQUAL readfile OR
+ ${testcase} STREQUAL profile3 OR
${testcase} STREQUAL redfilnm OR ${testcase} STREQUAL regtest OR
${testcase} STREQUAL rsnulbig OR ${testcase} STREQUAL rsnulbig2 OR
${testcase} STREQUAL rsstart3 OR ${testcase} STREQUAL rtlen OR