diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 90 | ||||
-rw-r--r-- | test/ChangeLog | 94 | ||||
-rw-r--r-- | test/Makefile.am | 78 | ||||
-rw-r--r-- | test/Makefile.in | 101 | ||||
-rw-r--r-- | test/Maketests | 24 | ||||
-rw-r--r-- | test/badargs.ok | 4 | ||||
-rw-r--r-- | test/dbugeval.in | 2 | ||||
-rw-r--r-- | test/dbugeval.ok | 1 | ||||
-rw-r--r-- | test/filefuncs.awk | 2 | ||||
-rw-r--r-- | test/functab4.awk | 26 | ||||
-rw-r--r-- | test/functab4.ok | 7 | ||||
-rw-r--r-- | test/id.ok | 81 | ||||
-rw-r--r-- | test/indirectcall2.awk | 11 | ||||
-rw-r--r-- | test/indirectcall2.ok | 4 | ||||
-rw-r--r-- | test/lintwarn.ok | 4 | ||||
-rw-r--r-- | test/mpfrrem.awk | 6 | ||||
-rw-r--r-- | test/mpfrrem.ok | 4 | ||||
-rw-r--r-- | test/mpfrsqrt.awk | 82 | ||||
-rw-r--r-- | test/mpfrsqrt.ok | 2 | ||||
-rw-r--r-- | test/ofs1.ok | 6 | ||||
-rw-r--r-- | test/printhuge.awk | 3 | ||||
-rw-r--r-- | test/printhuge.ok | 1 | ||||
-rw-r--r-- | test/profile2.ok | 4 | ||||
-rw-r--r-- | test/regnul1.awk | 84 | ||||
-rw-r--r-- | test/regnul1.ok | 8 | ||||
-rw-r--r-- | test/regnul2.awk | 112 | ||||
-rw-r--r-- | test/regnul2.ok | 27 | ||||
-rw-r--r-- | test/rsgetline.awk | 23 | ||||
-rw-r--r-- | test/rsgetline.in | 1 | ||||
-rw-r--r-- | test/rsgetline.ok | 3 | ||||
-rw-r--r-- | test/rsglstdin.ok | 3 |
31 files changed, 824 insertions, 74 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000..fee5eeca --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,90 @@ +# +# test/CMakeLists.txt --- CMake input file for gawk +# +# Copyright (C) 2013 +# the Free Software Foundation, Inc. +# +# This file is part of GAWK, the GNU implementation of the +# AWK Programming Language. +# +# GAWK is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# GAWK is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +# + +## process this file with CMake to produce Makefile + +if(WIN32) + set(SHELL_PREFIX "C:\\MinGW\\msys\\1.0\\bin\\sh") +endif() + +# Find the names of the groups of tests in Makefile.am. +file(READ ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.am ALL_GROUPS) +string(REGEX MATCHALL "[A-Z_]*_TESTS " ALL_GROUPS "${ALL_GROUPS}") +string(REGEX REPLACE "_TESTS " ";" ALL_GROUPS "${ALL_GROUPS}") +# For each group of test cases, search through Makefile.am and find the test cases. +foreach(testgroup ${ALL_GROUPS} ) + file(READ ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.am ONE_GROUP) + string(REGEX MATCH "${testgroup}_TESTS = [a-z0-9_ \\\n\t]*" ONE_GROUP "${ONE_GROUP}") + string(REGEX REPLACE "${testgroup}_TESTS = " "" ONE_GROUP "${ONE_GROUP}") + string(REGEX REPLACE "[\\\n\t]" "" ONE_GROUP "${ONE_GROUP}") + string(REGEX REPLACE " " ";" ONE_GROUP "${ONE_GROUP}") + # Use each name of a test case to start a script that executes the test case. + foreach(testcase ${ONE_GROUP} ) + add_test("${testgroup}.${testcase}" ${SHELL_PREFIX} ${CMAKE_SOURCE_DIR}/cmake/basictest ${CMAKE_BINARY_DIR}/gawk${CMAKE_EXECUTABLE_SUFFIX} ${testcase}) + endforeach(testcase) +endforeach(testgroup) + +# Create an empty configuration file for customizing test execution. +set(CTestCustom ${CMAKE_BINARY_DIR}/CTestCustom.cmake) +file(WRITE ${CTestCustom} "# DO NOT EDIT, THIS FILE WILL BE OVERWRITTEN\n" ) +# Test case SHLIB.filefuncs needs a file named gawkapi.o in source directory. +file(APPEND ${CTestCustom} "file(COPY ${CMAKE_SOURCE_DIR}/README DESTINATION ${CMAKE_SOURCE_DIR}/gawkapi.o)\n") +# Exclude test cases from execution that make no sense on a certain platform. +file(APPEND ${CTestCustom} "set(CTEST_CUSTOM_TESTS_IGNORE\n") +if(WIN32) + file(APPEND ${CTestCustom} " BASIC.exitval2\n") + file(APPEND ${CTestCustom} " BASIC.hsprint\n") + file(APPEND ${CTestCustom} " BASIC.rstest4\n") + file(APPEND ${CTestCustom} " BASIC.rstest5\n") + file(APPEND ${CTestCustom} " UNIX.getlnhd\n") + file(APPEND ${CTestCustom} " UNIX.pid\n") + file(APPEND ${CTestCustom} " GAWK_EXT.beginfile1\n") + file(APPEND ${CTestCustom} " GAWK_EXT.beginfile2\n") + file(APPEND ${CTestCustom} " GAWK_EXT.clos1way\n") + file(APPEND ${CTestCustom} " GAWK_EXT.devfd\n") + file(APPEND ${CTestCustom} " GAWK_EXT.devfd1\n") + file(APPEND ${CTestCustom} " GAWK_EXT.devfd2\n") + file(APPEND ${CTestCustom} " GAWK_EXT.getlndir\n") + file(APPEND ${CTestCustom} " GAWK_EXT.posix\n") + file(APPEND ${CTestCustom} " GAWK_EXT.pty1\n") + file(APPEND ${CTestCustom} " INET.inetdayu\n") + file(APPEND ${CTestCustom} " INET.inetdayt\n") + file(APPEND ${CTestCustom} " INET.inetechu\n") + file(APPEND ${CTestCustom} " INET.inetecht\n") + file(APPEND ${CTestCustom} " MACHINE.double2\n") + file(APPEND ${CTestCustom} " LOCALE_CHARSET.fmttest\n") + file(APPEND ${CTestCustom} " LOCALE_CHARSET.lc_num1\n") + file(APPEND ${CTestCustom} " LOCALE_CHARSET.mbfw1\n") + file(APPEND ${CTestCustom} " SHLIB.filefuncs\n") + file(APPEND ${CTestCustom} " SHLIB.fnmatch\n") + file(APPEND ${CTestCustom} " SHLIB.fork\n") + file(APPEND ${CTestCustom} " SHLIB.fork2\n") + file(APPEND ${CTestCustom} " SHLIB.fts\n") + file(APPEND ${CTestCustom} " SHLIB.functab4\n") + file(APPEND ${CTestCustom} " SHLIB.readdir\n") + file(APPEND ${CTestCustom} " SHLIB.revtwoway\n") + file(APPEND ${CTestCustom} " SHLIB.rwarray\n") +endif() +file(APPEND ${CTestCustom} ")\n") + diff --git a/test/ChangeLog b/test/ChangeLog index 6d4cd1c2..8e89f0d2 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,97 @@ +2014-09-18 Arnold D. Robbins <arnold@skeeve.com> + + * filefuncs.awk: Change to build directory instead of "..". + * Makefile.am (filefuncs): Pass in $(abs_top_builddir). + +2014-09-05 Arnold D. Robbins <arnold@skeeve.com> + + * functab4.awk: Changed to use stat instead of chdir since + /tmp isn't /tmp on all systems (e.g. Mac OS X). Thanks to + Hermann Peifer for the report. + + Sort of related: + + * indirectcall2.awk, indirectcall2.ok: New files. + * id.ok: Updated. + +2014-09-04 Arnold D. Robbins <arnold@skeeve.com> + + * profile2.ok: Update after code improvement in profiler. + * functab4.ok: Update after making indirect calls of + extension functions work. :-) + +2014-08-15 Arnold D. Robbins <arnold@skeeve.com> + + * badargs.ok: Adjust after revising text for -L option. + +2014-08-12 Arnold D. Robbins <arnold@skeeve.com> + + * ofs1.ok: Updated to match corrected behavior in gawk. + +2014-08-05 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (mpfrsqrt): New test. + * mpfrsqrt.awk, mpfrsqrt.ok: New files. + Test from Katie Wasserman <katie@wass.net>. + +2014-07-25 Arnold D. Robbins <arnold@skeeve.com> + + * printhuge.awk: Add a newline to output. + * printhuge.ok: Adjust. + +2014-07-24 Arnold D. Robbins <arnold@skeeve.com> + + * badargs.ok: Adjust after correctly alphabetizing options. + +2014-07-10 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (printhuge): New test. + * printhuge.awk, printhuge.ok: New files. + Test from mail.green.fox@gmail.com. + +2014-06-24 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (profile1, profile4, profile5): Adjust for change to + --pretty-print option. + +2014-06-19 Michael Forney <forney@google.com> + + * Makefile.am (poundbang): Fix relative path of AWKPROG. + +2014-06-08 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (dbugeval): Add leading @ to recipe. Ooops. + +2014-05-30 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (regnul1, regnul2): New tests. + * regnul1.awk, regnul1.ok, regnul1.awk, regnul2.ok: New files. + +2014-05-22 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * lintwarn.ok: Updated. + +2014-05-13 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (EXTRA_DIST): Forgot dbugeval.ok. Ooops. + +2014-05-11 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (dbugeval): New test. + * dbugeval.in, dbugeval.ok: New files. + +2014-05-10 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * Makefile.am (rsglstdin): New test. + * rsglstdin.ok: New file. + +2014-05-09 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * Makefile.am (rebuf): Force buffer size to 4096 via AWKBUFSIZE + environment variable. + (rsgetline): New test. + * rsgetline.awk, rsgetline.in, rsgetline.ok: New files. + 2014-04-11 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (charset-msg-start): Add a warning message that tests diff --git a/test/Makefile.am b/test/Makefile.am index 238f2ed7..1c14ea81 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -167,6 +167,8 @@ EXTRA_DIST = \ datanonl.awk \ datanonl.in \ datanonl.ok \ + dbugeval.in \ + dbugeval.ok \ defref.awk \ defref.ok \ delargv.awk \ @@ -419,6 +421,8 @@ EXTRA_DIST = \ indirectcall.awk \ indirectcall.in \ indirectcall.ok \ + indirectcall2.awk \ + indirectcall2.ok \ inftest.awk \ inftest.ok \ inplace.in \ @@ -527,10 +531,14 @@ EXTRA_DIST = \ mpfrnr.awk \ mpfrnr.in \ mpfrnr.ok \ + mpfrrem.awk \ + mpfrrem.ok \ mpfrrnd.awk \ mpfrrnd.ok \ mpfrsort.awk \ mpfrsort.ok \ + mpfrsqrt.awk \ + mpfrsqrt.ok \ mtchi18n.awk \ mtchi18n.in \ mtchi18n.ok \ @@ -680,6 +688,8 @@ EXTRA_DIST = \ printfbad3.awk \ printfbad3.ok \ printfloat.awk \ + printhuge.awk \ + printhuge.ok \ printlang.awk \ prmarscl.awk \ prmarscl.ok \ @@ -729,6 +739,10 @@ EXTRA_DIST = \ regexprange.ok \ reginttrad.awk \ reginttrad.ok \ + regnul1.awk \ + regnul1.ok \ + regnul2.awk \ + regnul2.ok \ regrange.awk \ regrange.ok \ regtest.sh \ @@ -759,6 +773,10 @@ EXTRA_DIST = \ rs.awk \ rs.in \ rs.ok \ + rsgetline.awk \ + rsgetline.in \ + rsgetline.ok \ + rsglstdin.ok \ rsnul1nl.awk \ rsnul1nl.in \ rsnul1nl.ok \ @@ -988,19 +1006,19 @@ UNIX_TESTS = \ GAWK_EXT_TESTS = \ aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \ backw badargs beginfile1 beginfile2 binmode1 charasbytes \ - colonwarn clos1way delsub devfd devfd1 devfd2 dumpvars exit \ + colonwarn clos1way dbugeval delsub devfd devfd1 devfd2 dumpvars exit \ fieldwdth fpat1 fpat2 fpat3 fpatnull fsfwfs funlen \ functab1 functab2 functab3 fwtest fwtest2 fwtest3 \ gensub gensub2 getlndir gnuops2 gnuops3 gnureops \ icasefs icasers id igncdym igncfs ignrcas2 ignrcase \ incdupe incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 \ - include include2 indirectcall \ + include include2 indirectcall indirectcall2 \ lint lintold lintwarn \ manyfiles match1 match2 match3 mbstr1 \ nastyparm next nondec nondec2 \ - patsplit posix printfbad1 printfbad2 printfbad3 procinfs \ + patsplit posix printfbad1 printfbad2 printfbad3 printhuge procinfs \ profile1 profile2 profile3 profile4 profile5 pty1 \ - rebuf regx8bit reginttrad reint reint2 rsstart1 \ + rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin rsstart1 \ rsstart2 rsstart3 rstest6 shadow sortfor sortu split_after_fpat \ splitarg4 strftime \ strtonum switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 \ @@ -1012,8 +1030,8 @@ INET_TESTS = inetdayu inetdayt inetechu inetecht MACHINE_TESTS = double1 double2 fmtspcl intformat -MPFR_TESTS = mpfrnr mpfrnegzero mpfrrnd mpfrieee mpfrexprange \ - mpfrsort mpfrbigint +MPFR_TESTS = mpfrnr mpfrnegzero mpfrrem mpfrrnd mpfrieee mpfrexprange \ + mpfrsort mpfrsqrt mpfrbigint LOCALE_CHARSET_TESTS = \ asort asorti backbigs1 backsmalls1 backsmalls2 \ @@ -1185,7 +1203,7 @@ poundbang:: @if ./_pbd.awk "$(srcdir)"/poundbang.awk > _`basename $@` ; \ then : ; \ else \ - sed "s;/tmp/gawk;../$(AWKPROG);" < "$(srcdir)"/poundbang.awk > ./_pbd.awk ; \ + sed "s;/tmp/gawk;$(AWKPROG);" < "$(srcdir)"/poundbang.awk > ./_pbd.awk ; \ chmod +x ./_pbd.awk ; \ LC_ALL=$${GAWKLOCALE:-C} LANG=$${GAWKLOCALE:-C} ./_pbd.awk "$(srcdir)"/poundbang.awk > _`basename $@`; \ fi @@ -1329,6 +1347,16 @@ fmtspcl: fmtspcl.ok $(CMP) "$(srcdir)"/$@-mpfr.ok _$@ && rm -f _$@ ; \ fi +rebuf:: + @echo $@ + @AWKBUFSIZE=4096 AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +rsglstdin:: + @echo $@ + @cat "$(srcdir)"/rsgetline.in | AWKPATH="$(srcdir)" $(AWK) -f rsgetline.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + reint:: @echo $@ @$(AWK) --re-interval -f "$(srcdir)"/reint.awk "$(srcdir)"/reint.in >_$@ @@ -1639,10 +1667,11 @@ dumpvars:: profile1: @echo $@ - @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/xref.awk "$(srcdir)"/dtdgport.awk > _$@.out1 + @$(AWK) -f "$(srcdir)"/xref.awk "$(srcdir)"/dtdgport.awk > _$@.out1 + @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/xref.awk @$(AWK) -f ap-$@.out "$(srcdir)"/dtdgport.awk > _$@.out2 ; rm ap-$@.out @$(CMP) _$@.out1 _$@.out2 && rm _$@.out[12] || { echo EXIT CODE: $$? >>_$@ ; \ - cp "$(srcdir)"/dtdgport.awk > $@.ok ; } + cp "$(srcdir)"/dtdgport.awk $@.ok ; } profile2: @@ -1659,13 +1688,13 @@ profile3: profile4: @echo $@ - @GAWK_NO_PP_RUN=1 $(AWK) --profile=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null + @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null @sed 1,2d < ap-$@.out > _$@; rm ap-$@.out @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ profile5: @echo $@ - @GAWK_NO_PP_RUN=1 $(AWK) --profile=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null + @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null @sed 1,2d < ap-$@.out > _$@; rm ap-$@.out @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ @@ -1725,6 +1754,16 @@ mpfrbigint: @$(AWK) -M -f "$(srcdir)"/$@.awk > _$@ 2>&1 @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +mpfrsqrt: + @echo $@ + @$(AWK) -M -f "$(srcdir)"/$@.awk > _$@ 2>&1 + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +mpfrrem: + @echo $@ + @$(AWK) -M -f "$(srcdir)"/$@.awk > _$@ 2>&1 + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + jarebug:: @echo $@ @"$(srcdir)"/$@.sh "$(AWKPROG)" "$(srcdir)"/$@.awk "$(srcdir)"/$@.in "_$@" @@ -1922,6 +1961,23 @@ backsmalls2: AWKPATH="$(srcdir)" $(AWK) -f $@.awk "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +dbugeval:: + @echo $@ + @$(AWK) --debug -f /dev/null < "$(srcdir)"/$@.in > _$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +printhuge:: + @echo $@ + @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +filefuncs: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk -v builddir="$(abs_top_builddir)" >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + + # Targets generated for other tests: include Maketests diff --git a/test/Makefile.in b/test/Makefile.in index 0831c597..b7e25511 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -413,6 +413,8 @@ EXTRA_DIST = \ datanonl.awk \ datanonl.in \ datanonl.ok \ + dbugeval.in \ + dbugeval.ok \ defref.awk \ defref.ok \ delargv.awk \ @@ -665,6 +667,8 @@ EXTRA_DIST = \ indirectcall.awk \ indirectcall.in \ indirectcall.ok \ + indirectcall2.awk \ + indirectcall2.ok \ inftest.awk \ inftest.ok \ inplace.in \ @@ -773,10 +777,14 @@ EXTRA_DIST = \ mpfrnr.awk \ mpfrnr.in \ mpfrnr.ok \ + mpfrrem.awk \ + mpfrrem.ok \ mpfrrnd.awk \ mpfrrnd.ok \ mpfrsort.awk \ mpfrsort.ok \ + mpfrsqrt.awk \ + mpfrsqrt.ok \ mtchi18n.awk \ mtchi18n.in \ mtchi18n.ok \ @@ -926,6 +934,8 @@ EXTRA_DIST = \ printfbad3.awk \ printfbad3.ok \ printfloat.awk \ + printhuge.awk \ + printhuge.ok \ printlang.awk \ prmarscl.awk \ prmarscl.ok \ @@ -975,6 +985,10 @@ EXTRA_DIST = \ regexprange.ok \ reginttrad.awk \ reginttrad.ok \ + regnul1.awk \ + regnul1.ok \ + regnul2.awk \ + regnul2.ok \ regrange.awk \ regrange.ok \ regtest.sh \ @@ -1005,6 +1019,10 @@ EXTRA_DIST = \ rs.awk \ rs.in \ rs.ok \ + rsgetline.awk \ + rsgetline.in \ + rsgetline.ok \ + rsglstdin.ok \ rsnul1nl.awk \ rsnul1nl.in \ rsnul1nl.ok \ @@ -1233,19 +1251,19 @@ UNIX_TESTS = \ GAWK_EXT_TESTS = \ aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \ backw badargs beginfile1 beginfile2 binmode1 charasbytes \ - colonwarn clos1way delsub devfd devfd1 devfd2 dumpvars exit \ + colonwarn clos1way dbugeval delsub devfd devfd1 devfd2 dumpvars exit \ fieldwdth fpat1 fpat2 fpat3 fpatnull fsfwfs funlen \ functab1 functab2 functab3 fwtest fwtest2 fwtest3 \ gensub gensub2 getlndir gnuops2 gnuops3 gnureops \ icasefs icasers id igncdym igncfs ignrcas2 ignrcase \ incdupe incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 \ - include include2 indirectcall \ + include include2 indirectcall indirectcall2 \ lint lintold lintwarn \ manyfiles match1 match2 match3 mbstr1 \ nastyparm next nondec nondec2 \ - patsplit posix printfbad1 printfbad2 printfbad3 procinfs \ + patsplit posix printfbad1 printfbad2 printfbad3 printhuge procinfs \ profile1 profile2 profile3 profile4 profile5 pty1 \ - rebuf regx8bit reginttrad reint reint2 rsstart1 \ + rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin rsstart1 \ rsstart2 rsstart3 rstest6 shadow sortfor sortu split_after_fpat \ splitarg4 strftime \ strtonum switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 \ @@ -1254,8 +1272,8 @@ GAWK_EXT_TESTS = \ EXTRA_TESTS = inftest regtest INET_TESTS = inetdayu inetdayt inetechu inetecht MACHINE_TESTS = double1 double2 fmtspcl intformat -MPFR_TESTS = mpfrnr mpfrnegzero mpfrrnd mpfrieee mpfrexprange \ - mpfrsort mpfrbigint +MPFR_TESTS = mpfrnr mpfrnegzero mpfrrem mpfrrnd mpfrieee mpfrexprange \ + mpfrsort mpfrsqrt mpfrbigint LOCALE_CHARSET_TESTS = \ asort asorti backbigs1 backsmalls1 backsmalls2 \ @@ -1610,7 +1628,7 @@ poundbang:: @if ./_pbd.awk "$(srcdir)"/poundbang.awk > _`basename $@` ; \ then : ; \ else \ - sed "s;/tmp/gawk;../$(AWKPROG);" < "$(srcdir)"/poundbang.awk > ./_pbd.awk ; \ + sed "s;/tmp/gawk;$(AWKPROG);" < "$(srcdir)"/poundbang.awk > ./_pbd.awk ; \ chmod +x ./_pbd.awk ; \ LC_ALL=$${GAWKLOCALE:-C} LANG=$${GAWKLOCALE:-C} ./_pbd.awk "$(srcdir)"/poundbang.awk > _`basename $@`; \ fi @@ -1754,6 +1772,16 @@ fmtspcl: fmtspcl.ok $(CMP) "$(srcdir)"/$@-mpfr.ok _$@ && rm -f _$@ ; \ fi +rebuf:: + @echo $@ + @AWKBUFSIZE=4096 AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +rsglstdin:: + @echo $@ + @cat "$(srcdir)"/rsgetline.in | AWKPATH="$(srcdir)" $(AWK) -f rsgetline.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + reint:: @echo $@ @$(AWK) --re-interval -f "$(srcdir)"/reint.awk "$(srcdir)"/reint.in >_$@ @@ -2064,10 +2092,11 @@ dumpvars:: profile1: @echo $@ - @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/xref.awk "$(srcdir)"/dtdgport.awk > _$@.out1 + @$(AWK) -f "$(srcdir)"/xref.awk "$(srcdir)"/dtdgport.awk > _$@.out1 + @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/xref.awk @$(AWK) -f ap-$@.out "$(srcdir)"/dtdgport.awk > _$@.out2 ; rm ap-$@.out @$(CMP) _$@.out1 _$@.out2 && rm _$@.out[12] || { echo EXIT CODE: $$? >>_$@ ; \ - cp "$(srcdir)"/dtdgport.awk > $@.ok ; } + cp "$(srcdir)"/dtdgport.awk $@.ok ; } profile2: @echo $@ @@ -2083,13 +2112,13 @@ profile3: profile4: @echo $@ - @GAWK_NO_PP_RUN=1 $(AWK) --profile=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null + @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null @sed 1,2d < ap-$@.out > _$@; rm ap-$@.out @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ profile5: @echo $@ - @GAWK_NO_PP_RUN=1 $(AWK) --profile=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null + @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null @sed 1,2d < ap-$@.out > _$@; rm ap-$@.out @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ @@ -2149,6 +2178,16 @@ mpfrbigint: @$(AWK) -M -f "$(srcdir)"/$@.awk > _$@ 2>&1 @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +mpfrsqrt: + @echo $@ + @$(AWK) -M -f "$(srcdir)"/$@.awk > _$@ 2>&1 + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +mpfrrem: + @echo $@ + @$(AWK) -M -f "$(srcdir)"/$@.awk > _$@ 2>&1 + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + jarebug:: @echo $@ @"$(srcdir)"/$@.sh "$(AWKPROG)" "$(srcdir)"/$@.awk "$(srcdir)"/$@.in "_$@" @@ -2344,6 +2383,22 @@ backsmalls2: @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ AWKPATH="$(srcdir)" $(AWK) -f $@.awk "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +dbugeval:: + @echo $@ + @$(AWK) --debug -f /dev/null < "$(srcdir)"/$@.in > _$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +printhuge:: + @echo $@ + @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +filefuncs: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk -v builddir="$(abs_top_builddir)" >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: @@ -3428,6 +3483,11 @@ indirectcall: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +indirectcall2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + lint: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -3498,9 +3558,14 @@ pty1: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ -rebuf: +regnul1: @echo $@ - @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +regnul2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ regx8bit: @@ -3508,6 +3573,11 @@ regx8bit: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +rsgetline: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + rstest6: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -3642,11 +3712,6 @@ fnmatch: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ -filefuncs: - @echo $@ - @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ - fork: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index b9b713c4..f8d5e8a9 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1082,6 +1082,11 @@ indirectcall: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +indirectcall2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + lint: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1152,9 +1157,14 @@ pty1: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ -rebuf: +regnul1: @echo $@ - @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +regnul2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ regx8bit: @@ -1162,6 +1172,11 @@ regx8bit: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +rsgetline: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + rstest6: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1296,11 +1311,6 @@ fnmatch: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ -filefuncs: - @echo $@ - @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ - fork: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/badargs.ok b/test/badargs.ok index 1be81ec3..1664ec1c 100644 --- a/test/badargs.ok +++ b/test/badargs.ok @@ -17,10 +17,10 @@ Short options: GNU long options: (extensions) -h --help -i includefile --include=includefile -l library --load=library - -L [fatal] --lint[=fatal] - -n --non-decimal-data + -L[fatal|invalid] --lint[=fatal|invalid] -M --bignum -N --use-lc-numeric + -n --non-decimal-data -o[file] --pretty-print[=file] -O --optimize -p[file] --profile[=file] diff --git a/test/dbugeval.in b/test/dbugeval.in new file mode 100644 index 00000000..6a3c2459 --- /dev/null +++ b/test/dbugeval.in @@ -0,0 +1,2 @@ +eval "" +eval "" diff --git a/test/dbugeval.ok b/test/dbugeval.ok new file mode 100644 index 00000000..284f2abb --- /dev/null +++ b/test/dbugeval.ok @@ -0,0 +1 @@ +EXIT CODE: 2 diff --git a/test/filefuncs.awk b/test/filefuncs.awk index 4bbfcb55..7aa5ae6a 100644 --- a/test/filefuncs.awk +++ b/test/filefuncs.awk @@ -1,7 +1,7 @@ @load "filefuncs" BEGIN { - if (chdir("..") < 0) { + if (chdir(builddir) < 0) { printf "Error: chdir failed with ERRNO %s\n", ERRNO exit 1 } diff --git a/test/functab4.awk b/test/functab4.awk index 0d9d4267..196fcc6d 100644 --- a/test/functab4.awk +++ b/test/functab4.awk @@ -6,9 +6,25 @@ function foo() } BEGIN { - x = FUNCTAB["chdir"] - print "x =", x - @x("/tmp") - printf "we are now in --> " - system("/bin/pwd || /usr/bin/pwd") + f = FUNCTAB["foo"] + @f() + + ret1 = stat(".", data1) + print "ret1 =", ret1 + + f = "stat" + ret2 = @f(".", data2) + print "ret2 =", ret2 + + problem = 0 + for (i in data1) { + if (! isarray(data1[i])) { +# print i, data1[i] + if (! (i in data2) || data1[i] != data2[i]) { + printf("mismatch element \"%s\"\n", i) + problems++ + } + } + } + print(problems ? (problems+0) "encountered" : "no problems encountered") } diff --git a/test/functab4.ok b/test/functab4.ok index 70a520b7..2b76cd88 100644 --- a/test/functab4.ok +++ b/test/functab4.ok @@ -1,3 +1,4 @@ -x = chdir -gawk: functab4.awk:11: fatal: cannot (yet) call extension functions indirectly -EXIT CODE: 2 +foo! +ret1 = 0 +ret2 = 0 +no problems encountered @@ -1,32 +1,73 @@ -FUNCTAB -> array -ARGV -> array -SYMTAB -> array -ORS -> scalar -ROUNDMODE -> scalar -i -> untyped OFS -> scalar +rand -> builtin +ARGC -> scalar +dcgettext -> builtin +gsub -> builtin +PREC -> scalar +match -> builtin +ARGIND -> scalar +int -> builtin ERRNO -> scalar +ARGV -> array +log -> builtin +sprintf -> builtin +ROUNDMODE -> scalar +strftime -> builtin +systime -> builtin +and -> builtin +srand -> builtin FNR -> scalar +asort -> builtin +atan2 -> builtin +cos -> builtin +TEXTDOMAIN -> scalar +ORS -> scalar +split -> builtin +div -> builtin +RSTART -> scalar +compl -> builtin +bindtextdomain -> builtin +exp -> builtin +or -> builtin +fflush -> builtin +gensub -> builtin LINT -> scalar +dcngettext -> builtin +index -> builtin IGNORECASE -> scalar -NR -> scalar -function1 -> user -ARGIND -> scalar -NF -> scalar -TEXTDOMAIN -> scalar +system -> builtin CONVFMT -> scalar +sqrt -> builtin +rshift -> builtin +tolower -> builtin +FS -> scalar +BINMODE -> scalar +sin -> builtin +asorti -> builtin FIELDWIDTHS -> scalar -ARGC -> scalar +function1 -> user +FILENAME -> scalar +close -> builtin +mktime -> builtin +FUNCTAB -> array +NF -> scalar +isarray -> builtin an_array -> untyped -PROCINFO -> array -PREC -> scalar +patsplit -> builtin +NR -> scalar SUBSEP -> scalar -FPAT -> scalar -RS -> scalar -FS -> scalar +extension -> builtin +i -> untyped +sub -> builtin OFMT -> scalar RLENGTH -> scalar +substr -> builtin +FPAT -> scalar +RS -> scalar +xor -> builtin RT -> scalar -BINMODE -> scalar -FILENAME -> scalar -RSTART -> scalar +PROCINFO -> array +lshift -> builtin +SYMTAB -> array +strtonum -> builtin +toupper -> builtin diff --git a/test/indirectcall2.awk b/test/indirectcall2.awk new file mode 100644 index 00000000..8f3c9483 --- /dev/null +++ b/test/indirectcall2.awk @@ -0,0 +1,11 @@ +BEGIN { + Quarter_pi = 3.1415927 / 4 + print sin(Quarter_pi) + + f = "sin" + print @f(Quarter_pi) + + print substr("abcdefgh", 2, 3) + f = "substr" + print @f("abcdefgh", 2, 3) +} diff --git a/test/indirectcall2.ok b/test/indirectcall2.ok new file mode 100644 index 00000000..05bee4b1 --- /dev/null +++ b/test/indirectcall2.ok @@ -0,0 +1,4 @@ +0.707107 +0.707107 +bcd +bcd diff --git a/test/lintwarn.ok b/test/lintwarn.ok index ec87612f..bc5226e6 100644 --- a/test/lintwarn.ok +++ b/test/lintwarn.ok @@ -1,6 +1,6 @@ gawk: lintwarn.awk:2: warning: `BEGINFILE' is a gawk extension -gawk: lintwarn.awk:3: error: `getline var' invalid inside `BEGINFILE' rule -gawk: lintwarn.awk:4: error: `getline' invalid inside `BEGINFILE' rule +gawk: lintwarn.awk:3: error: non-redirected `getline' invalid inside `BEGINFILE' rule +gawk: lintwarn.awk:4: error: non-redirected `getline' invalid inside `BEGINFILE' rule gawk: lintwarn.awk:8: warning: statement may have no effect gawk: lintwarn.awk:9: warning: plain `print' in BEGIN or END rule should probably be `print ""' gawk: lintwarn.awk:10: error: `nextfile' used in BEGIN action diff --git a/test/mpfrrem.awk b/test/mpfrrem.awk new file mode 100644 index 00000000..fd8bc4d5 --- /dev/null +++ b/test/mpfrrem.awk @@ -0,0 +1,6 @@ +BEGIN { + print "15 % 7 =", 15 % 7 + print "15 % -7 =", 15 % -7 + print "-15 % 7 =", -15 % 7 + print "-15 % -7 =", -15 % -7 +} diff --git a/test/mpfrrem.ok b/test/mpfrrem.ok new file mode 100644 index 00000000..91010457 --- /dev/null +++ b/test/mpfrrem.ok @@ -0,0 +1,4 @@ +15 % 7 = 1 +15 % -7 = 1 +-15 % 7 = -1 +-15 % -7 = -1 diff --git a/test/mpfrsqrt.awk b/test/mpfrsqrt.awk new file mode 100644 index 00000000..23a15c92 --- /dev/null +++ b/test/mpfrsqrt.awk @@ -0,0 +1,82 @@ +# Date: Sat, 02 Aug 2014 12:27:00 -0400 +# To: bug-gawk@gnu.org +# From: Katherine Wasserman <katie@wass.net> +# Message-ID: <E1XDc9F-0007BX-O1@eggs.gnu.org> +# Subject: [bug-gawk] GAWK 4.1 SQRT() bug +# +# In version 4.1.60 of GAWK the sqrt() function does not work correctly on bignums. +# Here's a demo of the problem along with, a function that does work correctly. +# +# Running this program (sqrt-bug.awk): +# -------------------------------------------------------------------- +BEGIN { +a=11111111111111111111111111111111111111111111111111111111111 +print sqrt(a^2) +#print sq_root(a^2) + +# ADR: Added for gawk-4.1-stable which doesn't have built-in div() function +if (PROCINFO["version"] < "4.1.60") + print sq_root2(a^2) +else + print sq_root(a^2) +} + + +function sq_root(x, temp,r,z) +{ temp=substr(x,1,length(x)/2) + 0 # a good first guess + z=0 + while (abs(z-temp)>1) + { z=temp + div(x,temp,r) + temp=r["quotient"] + temp + div(temp,2,r) + temp=r["quotient"] + } + return temp +} + +function sq_root2(x, temp,r,z) +{ temp=substr(x,1,length(x)/2) + 0 # a good first guess + z=0 + while (abs(z-temp)>1) + { z=temp + awk_div(x,temp,r) + temp=r["quotient"] + temp + awk_div(temp,2,r) + temp=r["quotient"] + } + return temp +} + +function abs(x) +{ return (x<0 ? -x : x) +} +# +# -------------------------------------------------------------------- +# gawk -M -f sqrt-bug.awk +# +# results in: +# 11111111111111111261130863809439559987542611609749437808640 +# 11111111111111111111111111111111111111111111111111111111111 +# +# Thanks, +# Katie +# + +# div --- do integer division + +function awk_div(numerator, denominator, result, i, save_PREC) +{ + save_PREC = PREC + PREC = 400 # good enough for this test + + split("", result) + + numerator = int(numerator) + denominator = int(denominator) + result["quotient"] = int(numerator / denominator) + result["remainder"] = int(numerator % denominator) + + PREC = save_PREC + return 0.0 +} diff --git a/test/mpfrsqrt.ok b/test/mpfrsqrt.ok new file mode 100644 index 00000000..16217c78 --- /dev/null +++ b/test/mpfrsqrt.ok @@ -0,0 +1,2 @@ +11111111111111111111111111111111111111111111111111111111111 +11111111111111111111111111111111111111111111111111111111111 diff --git a/test/ofs1.ok b/test/ofs1.ok index a3a8ca7b..d01fa161 100644 --- a/test/ofs1.ok +++ b/test/ofs1.ok @@ -1,7 +1,7 @@ -a:x:c +a x c a x c a x c a -a:x:c a x c -a:x:c +a x c +a x c diff --git a/test/printhuge.awk b/test/printhuge.awk new file mode 100644 index 00000000..1de27ecc --- /dev/null +++ b/test/printhuge.awk @@ -0,0 +1,3 @@ +BEGIN { + printf("%c\n", sprintf("%c", (0xffffff00+255))) +} diff --git a/test/printhuge.ok b/test/printhuge.ok new file mode 100644 index 00000000..29e181eb --- /dev/null +++ b/test/printhuge.ok @@ -0,0 +1 @@ +ÿ diff --git a/test/profile2.ok b/test/profile2.ok index fe76a2c9..50c7e190 100644 --- a/test/profile2.ok +++ b/test/profile2.ok @@ -7,7 +7,7 @@ 1 asplit("BEGIN:END:atan2:break:close:continue:cos:delete:" "do:else:exit:exp:for:getline:gsub:if:in:index:int:" "length:log:match:next:print:printf:rand:return:sin:" "split:sprintf:sqrt:srand:sub:substr:system:while", keywords, ":") 1 split("00:00:00:00:00:00:00:00:00:00:" "20:10:10:12:12:11:07:00:00:00:" "08:08:08:08:08:33:08:00:00:00:" "08:44:08:36:08:08:08:00:00:00:" "08:44:45:42:42:41:08", machine, ":") 1 state = 1 - 571 for (; ; ) { + 571 for (;;) { 571 symb = lex() 571 nextstate = substr(machine[state symb], 1, 1) 571 act = substr(machine[state symb], 2, 1) @@ -109,7 +109,7 @@ 571 function lex() { - 1702 for (; ; ) { + 1702 for (;;) { 1702 if (tok == "(eof)") { return 7 } diff --git a/test/regnul1.awk b/test/regnul1.awk new file mode 100644 index 00000000..2a35d176 --- /dev/null +++ b/test/regnul1.awk @@ -0,0 +1,84 @@ +# From denis@gissoft.eu Thu May 29 09:07:56 IDT 2014 +# Article: 8400 of comp.lang.awk +# X-Received: by 10.236.81.99 with SMTP id l63mr3912466yhe.3.1401224812642; +# Tue, 27 May 2014 14:06:52 -0700 (PDT) +# X-Received: by 10.140.37.148 with SMTP id r20mr578874qgr.0.1401224812310; Tue, +# 27 May 2014 14:06:52 -0700 (PDT) +# Path: eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!hl10no6493021igb.0!news-out.google.com!gi6ni15574igc.0!nntp.google.com!hl10no6493018igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail +# Newsgroups: comp.lang.awk +# Date: Tue, 27 May 2014 14:06:52 -0700 (PDT) +# Complaints-To: groups-abuse@google.com +# Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=85.253.50.165; +# posting-account=zNhVLgoAAACsg-WfVe_or2VV7loUhx8H +# NNTP-Posting-Host: 85.253.50.165 +# User-Agent: G2/1.0 +# MIME-Version: 1.0 +# Message-ID: <3112e356-d2e1-45cd-ba55-2f939ee50105@googlegroups.com> +# Subject: \0 character can't be implement inside regexp in some cases? +# From: denis@gissoft.eu +# Injection-Date: Tue, 27 May 2014 21:06:52 +0000 +# Content-Type: text/plain; charset=ISO-8859-1 +# Xref: news.eternal-september.org comp.lang.awk:8400 +# +# Hello, +# +# while doing some experiments with the gawk(4.1.1) i was found problem in implementing character \x00 inside regexp for two cases: +# +# str~/\0/ +# +# and +# +# switch ( str ) { case /\0/: ... } +# +# the following code try to match given string(=="\x00") with the regexp /^\0$/ using different ways provided by gawk: +# +func _chm(t) { + _ch("match()",match(t,/^\0$/)) + _ch("split()",split(t,A,/^\0$/)>1) + _ch("patsplit()",patsplit(t,A,/^\0$/)) + _ch("gsub()",gsub(/^\0$/,"&",t)) + _ch("sub()",sub(/^\0$/,"&",t)) + _ch("gensub()",!gensub(/^\0$/,"","G",t)) + _ch("str~/rexp/",t~/^\0$/) + a=0; switch ( t ) { case /^\0$/: a=1 }; _ch("switch-case //",a) } + +func _ch(fn,bool) { + print substr(fn ": ",1,16) (bool ? "+" : "-") } + +BEGIN{ _chm("\000") } +# +# output: +# +# > gawk -f _null.gwk +# match(): + +# split(): + +# patsplit(): + +# gsub(): + +# sub(): + +# gensub(): + +# str~/rexp/: - +# switch-case //: - +# +# can someone explain me: +# +# why in case using match(), split(), patsplit(), gsub(), sub() and gensub() the given string "\x00" matches with the /^\0$/ +# +# but in cases: +# +# "\x00"~/^\0$/ +# +# and +# +# switch ( "\x00" ) { case /^\0$/: doesn't match? } +# +# +# thank You +# +# +# GNU Awk 4.1.1, API: 1.1 (GNU MPFR 3.1.0-p8, GNU MP 5.0.2) +# Copyright (C) 1989, 1991-2014 Free Software Foundation. +# downloaded from ezwinports +# +# windows 7x64; cmd +# +# diff --git a/test/regnul1.ok b/test/regnul1.ok new file mode 100644 index 00000000..2ba0e1da --- /dev/null +++ b/test/regnul1.ok @@ -0,0 +1,8 @@ +match(): + +split(): + +patsplit(): + +gsub(): + +sub(): + +gensub(): + +str~/rexp/: + +switch-case //: + diff --git a/test/regnul2.awk b/test/regnul2.awk new file mode 100644 index 00000000..3d93df41 --- /dev/null +++ b/test/regnul2.awk @@ -0,0 +1,112 @@ +# From denis@gissoft.eu Thu May 29 09:10:18 IDT 2014 +# Article: 8408 of comp.lang.awk +# X-Received: by 10.182.128.166 with SMTP id np6mr93689obb.16.1401289466734; +# Wed, 28 May 2014 08:04:26 -0700 (PDT) +# X-Received: by 10.140.36.6 with SMTP id o6mr4939qgo.26.1401289466607; Wed, 28 +# May 2014 08:04:26 -0700 (PDT) +# Path: eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!c1no19185457igq.0!news-out.google.com!qf4ni13600igc.0!nntp.google.com!c1no19185454igq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail +# Newsgroups: comp.lang.awk +# Date: Wed, 28 May 2014 08:04:26 -0700 (PDT) +# In-Reply-To: <lm4rra$4u9$1@dont-email.me> +# Complaints-To: groups-abuse@google.com +# Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=82.131.35.51; posting-account=zNhVLgoAAACsg-WfVe_or2VV7loUhx8H +# NNTP-Posting-Host: 82.131.35.51 +# References: <3112e356-d2e1-45cd-ba55-2f939ee50105@googlegroups.com> +# <lm34d7$tb4$1@news.m-online.net> <f666871f-a94c-4505-9677-8711d656433c@googlegroups.com> +# <lm4rra$4u9$1@dont-email.me> +# User-Agent: G2/1.0 +# MIME-Version: 1.0 +# Message-ID: <79828a24-d265-4e88-8de1-e61ecbaa6701@googlegroups.com> +# Subject: Re: \0 character can't be implement inside regexp in some cases? +# From: Denis Shirokov <denis@gissoft.eu> +# Injection-Date: Wed, 28 May 2014 15:04:26 +0000 +# Content-Type: text/plain; charset=ISO-8859-1 +# Xref: news.eternal-september.org comp.lang.awk:8408 +# +# +# All of the other use-cases just cluttered up your posting. +# +# oh, really? +# +# 1. where in the Janis code the case with the `switch-case'? +# 2. how do you know about that there is only two cases? may be you know it because my code contains the other test cases? +# 3. fine. do you know what situation with the dynamic regexps? no? +# 4. do you know what situation with RS,FS and /.../ in the middle-area? how you can say that there is only two cases if you absolutely do not know it? +# +# i'm asking: WHO will perform testing other cases? You? gawk-team? the God? +# what is that point of view: that it will be enough to say: +# Oh! my match(t,/^\0$/) is matching "\x00" but t~/^\0$/ is not. why oh why? +# +# where is the test cover? or you think that other peoples will doing its instead of You? instead of Me? +# +# and the second point: guys you are screaming about two levels of stack. really, you kidding? =) +# +# however, i'm attaching some additional information about dynrexp: +# +func _chmd(t,r) { + _ch("match()",match(t,r)) + _ch("split()",split(t,A,r)>1) + _ch("patsplit()",patsplit(t,A,r)) + _ch("gsub()",gsub(r,"&",t)) + t2=t; _ch("sub()",sub(r,"&",t2)) + _ch("gensub()",!gensub(r,"","G",t)) + _ch("str~/rexp/",t~r) + # switch-case is not applicable with dynrxp + _conline() } + +func _ch(fn,bool) { + print substr(fn ": ",1,16) (bool ? "+" : "-") } + +func _conline() { + print "__________________________"; print } + +BEGIN{ _chmd("\x01","^\1$") #testing that all doings right; all match + _chmd("\x00","^\1$") #testing that all doings right; all not match + _chmd("\x00","^\0$") #tesing dynrexp +} +# +# output: +# +# match(): + +# split(): + +# patsplit(): + +# gsub(): + +# sub(): + +# gensub(): + +# str~/rexp/: + +# __________________________ +# +# match(): - +# split(): - +# patsplit(): - +# gsub(): - +# sub(): - +# gensub(): - +# str~/rexp/: - +# __________________________ +# +# match(): + +# split(): + +# patsplit(): + +# gsub(): + +# sub(): + +# gensub(): + +# str~/rexp/: - +# +# it's looks like with the dynamic regexp the same story. +# +# i found another one moment that is possible near with the reason of this issue: +# +# i was testing what characters can be present in doublestring and regexp "directly" (just as the character) and what characters must be present as escape sequence (\qqq) +# +# so, i found the following: +# +# t="abc" +# if ( match(t,/^abc[NUL]def/) ) ... - where [NUL] is the character \x00 +# +# it's seems that in that case the regular expression is processed until [NUL]character and the other part is ignored because the example above gives TRUE +# +# friendship +# Denis Shirokov +# +# diff --git a/test/regnul2.ok b/test/regnul2.ok new file mode 100644 index 00000000..6b3cecab --- /dev/null +++ b/test/regnul2.ok @@ -0,0 +1,27 @@ +match(): + +split(): + +patsplit(): + +gsub(): + +sub(): + +gensub(): + +str~/rexp/: + +__________________________ + +match(): - +split(): - +patsplit(): - +gsub(): - +sub(): - +gensub(): - +str~/rexp/: - +__________________________ + +match(): + +split(): + +patsplit(): + +gsub(): + +sub(): + +gensub(): + +str~/rexp/: + +__________________________ + diff --git a/test/rsgetline.awk b/test/rsgetline.awk new file mode 100644 index 00000000..fa327fcf --- /dev/null +++ b/test/rsgetline.awk @@ -0,0 +1,23 @@ +# Date: Sun, 4 May 2014 18:09:01 +0200 +# From: Davide Brini <dave_br@gmx.com> +# To: bug-gawk@gnu.org +# Subject: Re: [bug-gawk] Computed regex and getline bug / issue +# +# I have been able to reduce the behavior to these simple test cases, which +# (unless I'm missing something obvious) should behave identically but don't: +# +# $ printf '1,2,' | gawk 'BEGIN{RS="[,]+"}{print; a = getline; print "-"a"-"; print}' +# 1 +# -0- +# 1 + +BEGIN { + RS = "[,]+" +} + +{ + printf "[%s] [%s]\n", $0, RT + a = getline + print "-"a"-" + printf "[%s] [%s]\n", $0, RT +} diff --git a/test/rsgetline.in b/test/rsgetline.in new file mode 100644 index 00000000..f1782346 --- /dev/null +++ b/test/rsgetline.in @@ -0,0 +1 @@ +1,2,
\ No newline at end of file diff --git a/test/rsgetline.ok b/test/rsgetline.ok new file mode 100644 index 00000000..1388369a --- /dev/null +++ b/test/rsgetline.ok @@ -0,0 +1,3 @@ +[1] [,] +-1- +[2] [,] diff --git a/test/rsglstdin.ok b/test/rsglstdin.ok new file mode 100644 index 00000000..1388369a --- /dev/null +++ b/test/rsglstdin.ok @@ -0,0 +1,3 @@ +[1] [,] +-1- +[2] [,] |