diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ChangeLog | 119 | ||||
-rw-r--r-- | test/Makefile.am | 82 | ||||
-rw-r--r-- | test/Makefile.in | 102 | ||||
-rw-r--r-- | test/Maketests | 19 | ||||
-rw-r--r-- | test/dbugeval.in | 2 | ||||
-rw-r--r-- | test/dbugeval.ok | 1 | ||||
-rw-r--r-- | test/fts.awk | 31 | ||||
-rw-r--r-- | test/lintwarn.ok | 4 | ||||
-rw-r--r-- | test/mpfrnegzero.awk | 15 | ||||
-rw-r--r-- | test/mpfrnegzero.ok | 9 | ||||
-rw-r--r-- | test/readdir0.awk | 25 | ||||
-rw-r--r-- | test/readfile2.awk | 12 | ||||
-rw-r--r-- | test/readfile2.ok | 21 | ||||
-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/regrange.ok | 2 | ||||
-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 | ||||
-rw-r--r-- | test/rwarray.awk | 25 | ||||
-rw-r--r-- | test/split_after_fpat.awk | 11 | ||||
-rw-r--r-- | test/split_after_fpat.in | 1 | ||||
-rw-r--r-- | test/split_after_fpat.ok | 4 | ||||
-rw-r--r-- | test/strftime.awk | 42 |
27 files changed, 708 insertions, 80 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 33c5ca05..a337603b 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,122 @@ +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 + may fail without adequate locale support, per request from + Nelson H.F. Beebe. + +2014-04-08 Arnold D. Robbins <arnold@skeeve.com> + + * 4.1.1: Release tar ball made. + +2014-04-04 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am: Prettify list of tests a little bit. + +2014-04-03 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (EXTRA_DIST): Add readfile2.ok. Oops. + +2014-03-27 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (readfile2): New test. + * readfile2.awk, readfile2.ok: New files. + +2014-02-28 Arnold D. Robbins <arnold@skeeve.com> + + * regrange.ok: Update after code improvements. + +2014-02-03 Stepan Kasal <kasal@ucw.cz> + + * strftime.awk: the default format uses %e, not %d (Introduced on + 2014-01-16; the previous code mangled the output of command "date" + to match %d.) Remove the "mucking" for cygwin, it's obsolete and + incompatible with %e. + +2014-01-28 Eli Zaretskii <eliz@gnu.org> + + * strftime.awk: If DATECMD variable is non-empty, use it instead + of the literal "date" as the 'date'-like command. + +2014-01-19 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (mpfrnegzero): New test. + * mpfrnegzero.awk, mpfrnegzero.ok: New files. + +2014-01-17 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (readdir): Run ls commands outside the awk script. + * readdir0.awk: Read ls results from files. Helps with MinGW. + Thanks to Eli Zaretskii for the problem report. + +2014-01-17 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am: Quote instances of $(top_srcdir) also. + +2014-01-16 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * Makefile.am (strftime): Remove comment about the race condition, since + this should be fixed. And gawk now calls date inside the script. + * strftime.awk: Based on an idea from Pat Rankin, fix the race + condition by looping repeatedly over strftime/date/strftime until + the before and after strftime results match. That should fix + the race condition where the seconds field might increment between + invocations. + +2014-01-14 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (split_after_fpat): New test. + * split_after_fpat.awk, split_after_fpat.ok, + split_after_fpat.in: New files. + +2013-12-30 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (ignrcas2): Change to use en_US.UTF-8; it + seems that plain en_US doesn't exist anymore. Thanks to + Richard Palo. + +2013-12-29 John E. Malmberg <wb8tyw@qsl.net> + + * fts.awk: Adjust for VMS. + * rwarray.awk: Adjust for VMS. + 2013-12-10 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am: Remove instances of "" that were incorrect. diff --git a/test/Makefile.am b/test/Makefile.am index 13c9b977..13069084 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,7 +1,7 @@ # # test/Makefile.am --- automake input file for gawk # -# Copyright (C) 1988-2012 the Free Software Foundation, Inc. +# Copyright (C) 1988-2014 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -167,6 +167,8 @@ EXTRA_DIST = \ datanonl.awk \ datanonl.in \ datanonl.ok \ + dbugeval.in \ + dbugeval.ok \ defref.awk \ defref.ok \ delargv.awk \ @@ -522,6 +524,8 @@ EXTRA_DIST = \ mpfrexprange.ok \ mpfrieee.awk \ mpfrieee.ok \ + mpfrnegzero.awk \ + mpfrnegzero.ok \ mpfrnr.awk \ mpfrnr.in \ mpfrnr.ok \ @@ -708,6 +712,8 @@ EXTRA_DIST = \ range1.ok \ readdir.awk \ readdir0.awk \ + readfile2.awk \ + readfile2.ok \ rebt8b1.awk \ rebt8b1.ok \ rebt8b2.awk \ @@ -725,6 +731,10 @@ EXTRA_DIST = \ regexprange.ok \ reginttrad.awk \ reginttrad.ok \ + regnul1.awk \ + regnul1.ok \ + regnul2.awk \ + regnul2.ok \ regrange.awk \ regrange.ok \ regtest.sh \ @@ -755,6 +765,10 @@ EXTRA_DIST = \ rs.awk \ rs.in \ rs.ok \ + rsgetline.awk \ + rsgetline.in \ + rsgetline.ok \ + rsglstdin.ok \ rsnul1nl.awk \ rsnul1nl.in \ rsnul1nl.ok \ @@ -808,6 +822,9 @@ EXTRA_DIST = \ sortu.awk \ sortu.ok \ space.ok \ + split_after_fpat.awk \ + split_after_fpat.in \ + split_after_fpat.ok \ splitarg4.awk \ splitarg4.in \ splitarg4.ok \ @@ -942,8 +959,7 @@ BASIC_TESTS = \ arrayref arrymem1 arryref2 arryref3 arryref4 arryref5 arynasty \ arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \ aryprm8 arysubnm asgext awkpath \ - back89 backgsub \ - badassign1 \ + back89 backgsub badassign1 \ childin clobber closebad clsflnam compare compare2 concat1 concat2 \ concat3 concat4 convfmt \ datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \ @@ -982,7 +998,7 @@ 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 \ @@ -994,8 +1010,9 @@ GAWK_EXT_TESTS = \ nastyparm next nondec nondec2 \ patsplit posix printfbad1 printfbad2 printfbad3 procinfs \ profile1 profile2 profile3 profile4 profile5 pty1 \ - rebuf regx8bit reginttrad reint reint2 rsstart1 \ - rsstart2 rsstart3 rstest6 shadow sortfor sortu splitarg4 strftime \ + 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 \ symtab7 symtab8 symtab9 @@ -1005,7 +1022,8 @@ INET_TESTS = inetdayu inetdayt inetechu inetecht MACHINE_TESTS = double1 double2 fmtspcl intformat -MPFR_TESTS = mpfrnr mpfrrnd mpfrieee mpfrexprange mpfrsort mpfrbigint +MPFR_TESTS = mpfrnr mpfrnegzero mpfrrnd mpfrieee mpfrexprange \ + mpfrsort mpfrbigint LOCALE_CHARSET_TESTS = \ asort asorti backbigs1 backsmalls1 backsmalls2 \ @@ -1014,7 +1032,7 @@ LOCALE_CHARSET_TESTS = \ SHLIB_TESTS = \ fnmatch filefuncs fork fork2 fts functab4 inplace1 inplace2 inplace3 \ - ordchr ordchr2 readdir readfile revout revtwoway rwarray testext time + ordchr ordchr2 readdir readfile readfile2 revout revtwoway rwarray testext time # List of the tests which should be run with --lint option: NEED_LINT = \ @@ -1137,6 +1155,10 @@ machine-msg-end: charset-msg-start: @echo "======== Starting tests that can vary based on character set or locale support ========" + @echo "************************************************" + @echo "** Some or all of these tests may fail if you **" + @echo "** have inadequate or missing locale support **" + @echo "************************************************" charset-msg-end: @echo "======== Done with tests that can vary based on character set or locale support ========" @@ -1173,7 +1195,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 @@ -1250,12 +1272,10 @@ nonl:: @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ strftime:: - @echo This test could fail on slow machines or on a minute boundary, - @echo so if it does, double check the actual results: @echo $@ @GAWKLOCALE=C; export GAWKLOCALE; \ TZ=GMT0; export TZ; \ - (LC_ALL=C date) | $(AWK) -v OUTPUT=_$@ -f "$(srcdir)"/strftime.awk + $(AWK) -v OUTPUT=_$@ -f "$(srcdir)"/strftime.awk @-$(CMP) strftime.ok _$@ && rm -f _$@ strftime.ok || exit 0 litoct:: @@ -1319,6 +1339,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 >_$@ @@ -1454,7 +1484,7 @@ widesub4:: ignrcas2:: @echo $@ - @GAWKLOCALE=en_US ; export GAWKLOCALE ; \ + @GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE ; \ $(AWK) -f "$(srcdir)"/$@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >> _$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ @@ -1695,6 +1725,11 @@ mpfrrnd: @$(AWK) -M -vPREC=53 -f "$(srcdir)"/$@.awk > _$@ 2>&1 @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +mpfrnegzero: + @echo $@ + @$(AWK) -M -f "$(srcdir)"/$@.awk > _$@ 2>&1 + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + mpfrnr: @echo $@ @$(AWK) -M -vPREC=113 -f "$(srcdir)"/$@.awk "$(srcdir)"/$@.in > _$@ @@ -1726,6 +1761,11 @@ readfile:: @$(AWK) -l readfile 'BEGIN {printf "%s", readfile("Makefile")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) Makefile _$@ && rm -f _$@ || cp -p Makefile $@.ok +readfile2:: + @echo $@ + @$(AWK) -f "$(srcdir)"/$@.awk "$(srcdir)"/$@.awk "$(srcdir)"/readdir.awk > _$@ || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + include2:: @echo $@ @AWKPATH="$(srcdir)" $(AWK) --include inclib 'BEGIN {print sandwich("a", "b", "c")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1800,7 +1840,7 @@ inplace3:: testext:: @echo $@ - @$(AWK) '/^(@load|BEGIN)/,/^}/' $(top_srcdir)/extension/testext.c > testext.awk + @$(AWK) '/^(@load|BEGIN)/,/^}/' "$(top_srcdir)"/extension/testext.c > testext.awk @$(AWK) -f testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ testext.awk @@ -1810,9 +1850,12 @@ readdir: echo If it does, try rerunning on an ext'[234]' filesystem. ; \ fi @echo $@ - @$(AWK) -f "$(srcdir)"/readdir.awk $(top_srcdir) > _$@ - @ls -afli $(top_srcdir) | sed 1d | $(AWK) -f "$(srcdir)"/readdir0.awk -v extout=_$@ $(top_srcdir) > $@.ok - @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@ + @$(AWK) -f "$(srcdir)"/readdir.awk "$(top_srcdir)" > _$@ + @ls -afi "$(top_srcdir)" > _dirlist + @ls -lna "$(top_srcdir)" | sed 1d > _longlist + @$(AWK) -f "$(srcdir)"/readdir0.awk -v extout=_$@ \ + -v dirlist=_dirlist -v longlist=_longlist > $@.ok + @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@ _dirlist _longlist fts: @case `uname` in \ @@ -1899,6 +1942,11 @@ 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 _$@ + # Targets generated for other tests: include Maketests diff --git a/test/Makefile.in b/test/Makefile.in index 17249a14..2632334b 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -17,7 +17,7 @@ # # test/Makefile.am --- automake input file for gawk # -# Copyright (C) 1988-2012 the Free Software Foundation, Inc. +# Copyright (C) 1988-2014 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -413,6 +413,8 @@ EXTRA_DIST = \ datanonl.awk \ datanonl.in \ datanonl.ok \ + dbugeval.in \ + dbugeval.ok \ defref.awk \ defref.ok \ delargv.awk \ @@ -768,6 +770,8 @@ EXTRA_DIST = \ mpfrexprange.ok \ mpfrieee.awk \ mpfrieee.ok \ + mpfrnegzero.awk \ + mpfrnegzero.ok \ mpfrnr.awk \ mpfrnr.in \ mpfrnr.ok \ @@ -954,6 +958,8 @@ EXTRA_DIST = \ range1.ok \ readdir.awk \ readdir0.awk \ + readfile2.awk \ + readfile2.ok \ rebt8b1.awk \ rebt8b1.ok \ rebt8b2.awk \ @@ -971,6 +977,10 @@ EXTRA_DIST = \ regexprange.ok \ reginttrad.awk \ reginttrad.ok \ + regnul1.awk \ + regnul1.ok \ + regnul2.awk \ + regnul2.ok \ regrange.awk \ regrange.ok \ regtest.sh \ @@ -1001,6 +1011,10 @@ EXTRA_DIST = \ rs.awk \ rs.in \ rs.ok \ + rsgetline.awk \ + rsgetline.in \ + rsgetline.ok \ + rsglstdin.ok \ rsnul1nl.awk \ rsnul1nl.in \ rsnul1nl.ok \ @@ -1054,6 +1068,9 @@ EXTRA_DIST = \ sortu.awk \ sortu.ok \ space.ok \ + split_after_fpat.awk \ + split_after_fpat.in \ + split_after_fpat.ok \ splitarg4.awk \ splitarg4.in \ splitarg4.ok \ @@ -1187,8 +1204,7 @@ BASIC_TESTS = \ arrayref arrymem1 arryref2 arryref3 arryref4 arryref5 arynasty \ arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \ aryprm8 arysubnm asgext awkpath \ - back89 backgsub \ - badassign1 \ + back89 backgsub badassign1 \ childin clobber closebad clsflnam compare compare2 concat1 concat2 \ concat3 concat4 convfmt \ datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \ @@ -1227,7 +1243,7 @@ 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 \ @@ -1239,15 +1255,18 @@ GAWK_EXT_TESTS = \ nastyparm next nondec nondec2 \ patsplit posix printfbad1 printfbad2 printfbad3 procinfs \ profile1 profile2 profile3 profile4 profile5 pty1 \ - rebuf regx8bit reginttrad reint reint2 rsstart1 \ - rsstart2 rsstart3 rstest6 shadow sortfor sortu splitarg4 strftime \ + 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 \ symtab7 symtab8 symtab9 EXTRA_TESTS = inftest regtest INET_TESTS = inetdayu inetdayt inetechu inetecht MACHINE_TESTS = double1 double2 fmtspcl intformat -MPFR_TESTS = mpfrnr mpfrrnd mpfrieee mpfrexprange mpfrsort mpfrbigint +MPFR_TESTS = mpfrnr mpfrnegzero mpfrrnd mpfrieee mpfrexprange \ + mpfrsort mpfrbigint + LOCALE_CHARSET_TESTS = \ asort asorti backbigs1 backsmalls1 backsmalls2 \ fmttest fnarydel fnparydl jarebug lc_num1 mbfw1 \ @@ -1255,7 +1274,7 @@ LOCALE_CHARSET_TESTS = \ SHLIB_TESTS = \ fnmatch filefuncs fork fork2 fts functab4 inplace1 inplace2 inplace3 \ - ordchr ordchr2 readdir readfile revout revtwoway rwarray testext time + ordchr ordchr2 readdir readfile readfile2 revout revtwoway rwarray testext time # List of the tests which should be run with --lint option: @@ -1563,6 +1582,10 @@ machine-msg-end: charset-msg-start: @echo "======== Starting tests that can vary based on character set or locale support ========" + @echo "************************************************" + @echo "** Some or all of these tests may fail if you **" + @echo "** have inadequate or missing locale support **" + @echo "************************************************" charset-msg-end: @echo "======== Done with tests that can vary based on character set or locale support ========" @@ -1597,7 +1620,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 @@ -1674,12 +1697,10 @@ nonl:: @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ strftime:: - @echo This test could fail on slow machines or on a minute boundary, - @echo so if it does, double check the actual results: @echo $@ @GAWKLOCALE=C; export GAWKLOCALE; \ TZ=GMT0; export TZ; \ - (LC_ALL=C date) | $(AWK) -v OUTPUT=_$@ -f "$(srcdir)"/strftime.awk + $(AWK) -v OUTPUT=_$@ -f "$(srcdir)"/strftime.awk @-$(CMP) strftime.ok _$@ && rm -f _$@ strftime.ok || exit 0 litoct:: @@ -1743,6 +1764,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 >_$@ @@ -1878,7 +1909,7 @@ widesub4:: ignrcas2:: @echo $@ - @GAWKLOCALE=en_US ; export GAWKLOCALE ; \ + @GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE ; \ $(AWK) -f "$(srcdir)"/$@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >> _$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ @@ -2118,6 +2149,11 @@ mpfrrnd: @$(AWK) -M -vPREC=53 -f "$(srcdir)"/$@.awk > _$@ 2>&1 @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +mpfrnegzero: + @echo $@ + @$(AWK) -M -f "$(srcdir)"/$@.awk > _$@ 2>&1 + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + mpfrnr: @echo $@ @$(AWK) -M -vPREC=113 -f "$(srcdir)"/$@.awk "$(srcdir)"/$@.in > _$@ @@ -2149,6 +2185,11 @@ readfile:: @$(AWK) -l readfile 'BEGIN {printf "%s", readfile("Makefile")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) Makefile _$@ && rm -f _$@ || cp -p Makefile $@.ok +readfile2:: + @echo $@ + @$(AWK) -f "$(srcdir)"/$@.awk "$(srcdir)"/$@.awk "$(srcdir)"/readdir.awk > _$@ || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + include2:: @echo $@ @AWKPATH="$(srcdir)" $(AWK) --include inclib 'BEGIN {print sandwich("a", "b", "c")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -2223,7 +2264,7 @@ inplace3:: testext:: @echo $@ - @$(AWK) '/^(@load|BEGIN)/,/^}/' $(top_srcdir)/extension/testext.c > testext.awk + @$(AWK) '/^(@load|BEGIN)/,/^}/' "$(top_srcdir)"/extension/testext.c > testext.awk @$(AWK) -f testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ testext.awk @@ -2233,9 +2274,12 @@ readdir: echo If it does, try rerunning on an ext'[234]' filesystem. ; \ fi @echo $@ - @$(AWK) -f "$(srcdir)"/readdir.awk $(top_srcdir) > _$@ - @ls -afli $(top_srcdir) | sed 1d | $(AWK) -f "$(srcdir)"/readdir0.awk -v extout=_$@ $(top_srcdir) > $@.ok - @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@ + @$(AWK) -f "$(srcdir)"/readdir.awk "$(top_srcdir)" > _$@ + @ls -afi "$(top_srcdir)" > _dirlist + @ls -lna "$(top_srcdir)" | sed 1d > _longlist + @$(AWK) -f "$(srcdir)"/readdir0.awk -v extout=_$@ \ + -v dirlist=_dirlist -v longlist=_longlist > $@.ok + @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@ _dirlist _longlist fts: @case `uname` in \ @@ -2320,6 +2364,11 @@ 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 _$@ Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: @@ -3474,9 +3523,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: @@ -3484,6 +3538,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: $$? >>_$@ @@ -3504,6 +3563,11 @@ sortu: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +split_after_fpat: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + splitarg4: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index df272ce8..0841ae77 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1152,9 +1152,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 +1167,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: $$? >>_$@ @@ -1182,6 +1192,11 @@ sortu: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +split_after_fpat: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + splitarg4: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ 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/fts.awk b/test/fts.awk index a1b49cbd..70af560f 100644 --- a/test/fts.awk +++ b/test/fts.awk @@ -3,8 +3,19 @@ BEGIN { Level = 0 - system("rm -fr d1 d2") - system("mkdir d1 d2 ; touch d1/f1 d1/f2 d2/f1 d2/f2") + os = "" + if (ENVIRON["AWKLIBPATH"] == "sys$disk:[-]") { + os = "VMS" + system("create/dir/prot=o:rwed [.d1]") + system("create/dir/prot=o:rwed [.d2]") + system("copy fts.awk [.d1]f1") + system("copy fts.awk [.d1]f2") + system("copy fts.awk [.d2]f1") + system("copy fts.awk [.d2]f2") + } else { + system("rm -fr d1 d2") + system("mkdir d1 d2 ; touch d1/f1 d1/f2 d2/f1 d2/f2") + } pathlist[1] = "d1" pathlist[2] = "d2" flags = FTS_PHYSICAL @@ -19,7 +30,14 @@ BEGIN { traverse(data2) close(output) - system("rm -fr d1 d2") + if (os == "VMS") { + system("delete [.d1]*.*;*") + system("delete [.d2]*.*;*") + system("delete d1.dir;*") + system("delete d2.dir;*") + } else { + system("rm -fr d1 d2") + } } function indent( i) @@ -96,6 +114,13 @@ function process(pathname, data_array, for (i in stat_data) data_array[pathname]["."]["stat"][i] = stat_data[i] + os = "" + if (ENVIRON["AWKLIBPATH"] == "sys$disk:[-]") { + os = "VMS" + # Command in next section not valid on VMS. + return + } + command = ("ls -f " pathname) while ((command | getline direntry) > 0) { if (direntry == "." || direntry == "..") 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/mpfrnegzero.awk b/test/mpfrnegzero.awk new file mode 100644 index 00000000..cc6bf65b --- /dev/null +++ b/test/mpfrnegzero.awk @@ -0,0 +1,15 @@ +BEGIN { + printf("-0 -> %f, -0.0 -> %f\n", -0, -0.0) + + printf("atan2(+0, -0) = %f\n", atan2(+0, -0)) + printf("atan2(+0.0, -0.0) = %f\n", atan2(+0.0, -0.0)) + + printf("atan2(-0, -0) = %f\n", atan2(-0, -0)) + printf("atan2(-0.0, -0.0) = %f\n", atan2(-0.0, -0.0)) + + printf("atan2(+0, +0) = %f\n", atan2(+0, +0)) + printf("atan2(+0.0, +0.0) = %f\n", atan2(+0.0, +0.0)) + + printf("atan2(-0, +0) = %f\n", atan2(-0, +0)) + printf("atan2(-0.0, +0.0) = %f\n", atan2(-0.0, +0.0)) +} diff --git a/test/mpfrnegzero.ok b/test/mpfrnegzero.ok new file mode 100644 index 00000000..7af16292 --- /dev/null +++ b/test/mpfrnegzero.ok @@ -0,0 +1,9 @@ +-0 -> -0.000000, -0.0 -> -0.000000 +atan2(+0, -0) = 3.141593 +atan2(+0.0, -0.0) = 3.141593 +atan2(-0, -0) = -3.141593 +atan2(-0.0, -0.0) = -3.141593 +atan2(+0, +0) = 0.000000 +atan2(+0.0, +0.0) = 0.000000 +atan2(-0, +0) = -0.000000 +atan2(-0.0, +0.0) = -0.000000 diff --git a/test/readdir0.awk b/test/readdir0.awk index 296c03c7..2b7674a4 100644 --- a/test/readdir0.awk +++ b/test/readdir0.awk @@ -1,4 +1,9 @@ +# NOTE: This program is not a generalized parser for the output of 'ls'. +# It's job is to read the output of ls from the gawk source code directory, +# where we know there are no symbolic links, nor are there files with +# spaces in their file names, etc. BEGIN { + # analyze results from readdir extension while ((getline x < extout) > 0) { numrec++ if ((split(x, f, "/") == 3) && (f[3] == "u")) @@ -12,12 +17,7 @@ BEGIN { } BEGIN { - dir = ARGV[1] - delete ARGV[1] - ls_afi = "ls -afi " dir - ls_al = ("ls -lna " dir " | sed 1d") - - for (i = 1; (ls_afi | getline) > 0; i++) { + for (i = 1; (getline < dirlist) > 0; i++) { # inode number is $1, filename is read of record inode = $1 $1 = "" @@ -26,21 +26,18 @@ BEGIN { names[i] = $0 ino[names[i]] = inode } - close(ls_afi) + close(dirlist) - for (j = 1; (ls_al | getline) > 0; j++) { + for (j = 1; (getline < longlist) > 0; j++) { type_let = substr($0, 1, 1) if (type_let == "-") type_let = "f" - $1 = $2 = $3 = $4 = $5 = $6 = $7 = $8 = "" - $0 = $0 - sub(/^ */, "") - type[$0] = type_let + type[$NF] = type_let } - close(ls_al) + close(longlist) if (i != j) - printf("mismatch: %d from `ls -afi' and %d from `ls -l'\n", i, j) > "/dev/stderr" + printf("mismatch: %d from `ls -afi' and %d from `ls -lna'\n", i, j) > "/dev/stderr" for (i = 1; i in names; i++) printf("%s/%s/%s\n", ino[names[i]], names[i], (ftype_unknown ? "u" : type[names[i]])) diff --git a/test/readfile2.awk b/test/readfile2.awk new file mode 100644 index 00000000..c21483fc --- /dev/null +++ b/test/readfile2.awk @@ -0,0 +1,12 @@ +@load "readfile" +BEGIN { PROCINFO["readfile"] = 1 } +BEGINFILE { print "Start of", basename(FILENAME) } +{ printf ("%d: <%s>\n", FNR, $0 ) } +ENDFILE { print "End of", basename(FILENAME) } + +function basename(file, result) +{ + result = file + gsub(".*/", "", result) + return result +} diff --git a/test/readfile2.ok b/test/readfile2.ok new file mode 100644 index 00000000..be1ded6c --- /dev/null +++ b/test/readfile2.ok @@ -0,0 +1,21 @@ +Start of readfile2.awk +1: <@load "readfile" +BEGIN { PROCINFO["readfile"] = 1 } +BEGINFILE { print "Start of", basename(FILENAME) } +{ printf ("%d: <%s>\n", FNR, $0 ) } +ENDFILE { print "End of", basename(FILENAME) } + +function basename(file, result) +{ + result = file + gsub(".*/", "", result) + return result +} +> +End of readfile2.awk +Start of readdir.awk +1: <@load "readdir" + +{ print } +> +End of readdir.awk 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/regrange.ok b/test/regrange.ok index 1fa00c70..ae8c6499 100644 --- a/test/regrange.ok +++ b/test/regrange.ok @@ -3,4 +3,4 @@ "c" ~ /[[a-d]/ --> 1 "\" ~ /[\[-\]]/ --> 1 "[.c.]" ~ /[a-[.e.]]/ --> 1 -"[.d.]" ~ /[[.c.]-[.z.]]/ --> 0 +"[.d.]" ~ /[[.c.]-[.z.]]/ --> 1 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] [,] diff --git a/test/rwarray.awk b/test/rwarray.awk index 5d1b7e9d..0cb214ee 100644 --- a/test/rwarray.awk +++ b/test/rwarray.awk @@ -21,13 +21,20 @@ BEGIN { printf("dict[%s] = %s\n", dictindices[i], dict[dictindices[i]]) > "new.out" close("new.out"); - ret = system("cmp orig.out new.out") - - if (ret == 0) - print "old and new are equal - GOOD" - else - print "old and new are not equal - BAD" - - if (ret == 0 && !("KEEPIT" in ENVIRON)) - system("rm -f orig.bin orig.out new.out") + os = "" + if (ENVIRON["AWKLIBPATH"] == "sys$disk:[-]") { + os = "VMS" + # return status from system() on VMS can not be used here + } + if (os != "VMS") { + ret = system("cmp orig.out new.out") + + if (ret == 0) + print "old and new are equal - GOOD" + else + print "old and new are not equal - BAD" + + if (ret == 0 && !("KEEPIT" in ENVIRON)) + system("rm -f orig.bin orig.out new.out") + } } diff --git a/test/split_after_fpat.awk b/test/split_after_fpat.awk new file mode 100644 index 00000000..7e7cfd99 --- /dev/null +++ b/test/split_after_fpat.awk @@ -0,0 +1,11 @@ +BEGIN { FPAT = "\"[^\"]*\"" } + +{ print $1 } + +END { f("hi there") } + +function f (p, a, n, i) +{ + n = split(p,a) + print n ; for (i=1; i<=n; i++) print a[i] +} diff --git a/test/split_after_fpat.in b/test/split_after_fpat.in new file mode 100644 index 00000000..1aeefd59 --- /dev/null +++ b/test/split_after_fpat.in @@ -0,0 +1 @@ +a"stuff"b diff --git a/test/split_after_fpat.ok b/test/split_after_fpat.ok new file mode 100644 index 00000000..5c284490 --- /dev/null +++ b/test/split_after_fpat.ok @@ -0,0 +1,4 @@ +"stuff" +2 +hi +there diff --git a/test/strftime.awk b/test/strftime.awk index 775cd4e5..f1276c15 100644 --- a/test/strftime.awk +++ b/test/strftime.awk @@ -1,19 +1,35 @@ # strftime.awk ; test the strftime code # # input is the output of `date', see Makefile.in -# -# The mucking about with $0 and $N is to avoid problems -# on cygwin, where the timezone field is empty and there -# are two consecutive blanks. -# Additional mucking about to lop off the seconds field; -# helps decrease chance of difference due to a second boundary +BEGIN { + maxtries = 10 + # On DOS/Windows, DATECMD is set by the Makefile to point to + # Unix-like 'date' command. + datecmd = DATECMD + if (datecmd == "") + datecmd = "date" + fmt = "%a %b %e %H:%M:%S %Z %Y" -{ - $3 = sprintf("%02d", $3 + 0) - $4 = substr($4, 1, 5) - print > "strftime.ok" - $0 = strftime("%a %b %d %H:%M %Z %Y") - $NF = $NF - print > OUTPUT + # loop until before equals after, thereby protecting + # against a race condition where the seconds field might have + # incremented between running date and strftime + i = 0 + while (1) { + if (++i > maxtries) { + printf "Warning: this system is so slow that after %d attempts, we could never get two sequential invocations of strftime to give the same result!\n", maxtries > "/dev/stderr" + break + } + before = strftime(fmt) + datecmd | getline sd + after = strftime(fmt) + close(datecmd) + if (before == after) { + if (i > 1) + printf "Notice: it took %d loops to get the before and after strftime values to match\n", i > "/dev/stderr" + break + } + } + print sd > "strftime.ok" + print after > OUTPUT } |