diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ChangeLog | 47 | ||||
-rw-r--r-- | test/Makefile.am | 51 | ||||
-rw-r--r-- | test/Makefile.in | 95 | ||||
-rw-r--r-- | test/Maketests | 45 | ||||
-rw-r--r-- | test/eofsrc1.ok | 3 | ||||
-rw-r--r-- | test/eofsrc1a.awk | 2 | ||||
-rw-r--r-- | test/eofsrc1b.awk | 2 | ||||
-rw-r--r-- | test/inplace1.ok | 2 | ||||
-rw-r--r-- | test/inplace2.ok | 2 | ||||
-rw-r--r-- | test/inplace3.ok | 4 | ||||
-rw-r--r-- | test/nsbad.awk | 15 | ||||
-rw-r--r-- | test/nsbad.ok | 13 | ||||
-rw-r--r-- | test/nsbad_cmd.ok | 3 | ||||
-rw-r--r-- | test/nsindirect1.awk | 13 | ||||
-rw-r--r-- | test/nsindirect1.ok | 2 | ||||
-rw-r--r-- | test/nsindirect2.awk | 44 | ||||
-rw-r--r-- | test/nsindirect2.ok | 5 | ||||
-rw-r--r-- | test/nsprof1.awk | 16 | ||||
-rw-r--r-- | test/nsprof1.ok | 19 | ||||
-rw-r--r-- | test/nsprof2.awk | 74 | ||||
-rw-r--r-- | test/nsprof2.ok | 75 | ||||
-rw-r--r-- | test/sourcesplit.ok | 4 | ||||
-rw-r--r-- | test/testext.ok | 3 | ||||
-rw-r--r-- | test/unterm.ok | 4 |
24 files changed, 492 insertions, 51 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 7f17f725..812f3faf 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -17,6 +17,15 @@ * Makefile.am (EXTRA_DIST): New test: dfacheck1. * dfacheck1.awk, dfacheck1.in, dfacheck1.ok: New files. +2018-12-12 Arnold D. Robbins <arnold@skeeve.com> + + * nsprof2.awk: Add extra @namespace lines for testing. + * nsprof2.ok: Adjusted. + +2018-12-06 Arnold D. Robbins <arnold@skeeve.com> + + * nsprof2.awk, nsprof2.ok: Updated after code changes. + 2018-11-28 Arnold D. Robbins <arnold@skeeve.com> * profile11.ok: Updated after code change. @@ -488,6 +497,40 @@ * inplace1.ok, inplace2.ok, inplace3.ok: Update after adding license to inplace.awk. +2017-07-26 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (nsbad_cmd, nsindirect1, nsindirect2): New tests. + * nsbad_cmd.ok, nsindirect1.awk, nsindirect1.ok, nsindirect2.awk, + nsindirect2.ok: New files. + +2017-07-26 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (nsbad): New test. + * nsbad.awk, nsbad.ok: New files. + +2017-07-20 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (inplace1, inplace2, inplace3): Update to use + inplace::suffix instead of INPLACE_SUFFIX. + * inplace1.ok, inplace2.ok, inplace3.ok: Update after code + changes. + +2017-07-07 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (eofsrc1): New test. + * eofsrc1a.awk, eofsrc1b.awk, eofsrc1.ok: New files. + * unterm.ok: Updated after code change. + +2017-07-01 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (nsprof2): New test. + * nsprof2.awk, nsprof2.ok: New files. + +2017-06-30 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (nsprof1): New test. + * nsprof1.awk, nsprof1.ok: New files. + 2017-06-27 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (mbprintf5): Skip this test on Cygwin. @@ -502,6 +545,10 @@ * Makefile.am (mbprintf5): New test. * mbprintf5.awk, mbprintf5.in, mbprintf5.ok: New files. +2017-05-30 Arnold D. Robbins <arnold@skeeve.com> + + * sourceplit.ok: Revise to match changed code. + 2017-05-24 Andrew J. Schorr <aschorr@telemetry-investments.com> * fwtest8.ok: Fix field number in error message, thanks to a bug diff --git a/test/Makefile.am b/test/Makefile.am index b4f50cec..0ffad9ad 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -262,6 +262,9 @@ EXTRA_DIST = \ dynlj.ok \ eofsplit.awk \ eofsplit.ok \ + eofsrc1a.awk \ + eofsrc1b.awk \ + eofsrc1.ok \ errno.awk \ errno.in \ errno.ok \ @@ -767,6 +770,17 @@ EXTRA_DIST = \ noparms.ok \ nors.in \ nors.ok \ + nsbad.awk \ + nsbad.ok \ + nsbad_cmd.ok \ + nsindirect1.awk \ + nsindirect1.ok \ + nsindirect2.awk \ + nsindirect2.ok \ + nsprof1.awk \ + nsprof1.ok \ + nsprof2.awk \ + nsprof2.ok \ nulinsrc.awk \ nulinsrc.ok \ nulrsend.awk \ @@ -1258,10 +1272,10 @@ BASIC_TESTS = \ callparam childin clobber closebad clsflnam compare compare2 \ concat1 concat2 concat3 concat4 concat5 convfmt \ datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \ - eofsplit exit2 exitval1 exitval2 exitval3 fcall_exit fcall_exit2 \ - fldchg fldchgnf fldterm fnamedat fnarray fnarray2 fnaryscl fnasgnm fnmisc \ - fordel forref forsimp fsbs fsnul1 fsrs fsspcoln fstabplus funsemnl \ - funsmnam funstack \ + eofsplit eofsrc1 exit2 exitval1 exitval2 exitval3 \ + fcall_exit fcall_exit2 fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \ + fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fsnul1 fsrs fsspcoln \ + fstabplus funsemnl funsmnam funstack \ getline getline2 getline3 getline4 getline5 getlnbuf getnr2tb getnr2tm \ gsubasgn gsubtest gsubtst2 gsubtst3 gsubtst4 gsubtst5 gsubtst6 gsubtst7 \ gsubtst8 \ @@ -1311,19 +1325,20 @@ GAWK_EXT_TESTS = \ incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 include include2 \ indirectbuiltin indirectcall indirectcall2 intarray isarrayunset \ lint lintexp lintindex lintint lintlength lintold lintset lintwarn \ - mixed1 mktime manyfiles match1 match2 match3 mbstr1 mbstr2 muldimposix \ + manyfiles match1 match2 match3 mbstr1 mbstr2 mixed1 mktime muldimposix \ nastyparm negtime next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 \ + nsbad nsbad_cmd nsindirect1 nsindirect2 nsprof1 nsprof2 \ patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge \ procinfs profile0 profile1 profile2 profile3 profile4 profile5 profile6 \ profile7 profile8 profile9 profile10 profile11 pty1 pty2 \ rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin \ rsstart1 rsstart2 rsstart3 rstest6 \ shadow shadowbuiltin sortfor sortfor2 sortu sourcesplit split_after_fpat \ - splitarg4 strftime strftfld strtonum strtonum1 switch2 symtab1 symtab2 \ + splitarg4 strftfld strftime strtonum strtonum1 switch2 symtab1 symtab2 \ symtab3 symtab4 symtab5 symtab6 symtab7 symtab8 symtab9 symtab10 \ - typedregex1 typedregex2 typedregex3 typedregex4 \ + timeout typedregex1 typedregex2 typedregex3 typedregex4 \ typeof1 typeof2 typeof3 typeof4 typeof5 \ - timeout watchpoint1 + watchpoint1 ARRAYDEBUG_TESTS = arrdbg @@ -1372,7 +1387,8 @@ NEED_NONDEC = mpfrbigint2 nondec2 intarray forcenum NEED_POSIX = printf0 posix2008sub paramasfunc1 paramasfunc2 muldimposix # List of tests that need --pretty-print -NEED_PRETTY = profile4 profile5 profile8 profile9 profile10 profile11 +NEED_PRETTY = nsprof1 nsprof2 \ + profile4 profile5 profile8 profile9 profile10 profile11 # List of tests that need --re-interval NEED_RE_INTERVAL = gsubtst3 reint reint2 @@ -2031,7 +2047,7 @@ inplace2:: @echo $@ @cp "$(srcdir)"/inplace.1.in _$@.1 @cp "$(srcdir)"/inplace.2.in _$@.2 - @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v inplace::suffix=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ @-$(CMP) "$(srcdir)"/$@.1.ok _$@.1 && rm -f _$@.1 @-$(CMP) "$(srcdir)"/$@.1.bak.ok _$@.1.bak && rm -f _$@.1.bak @@ -2042,8 +2058,8 @@ inplace3:: @echo $@ @cp "$(srcdir)"/inplace.1.in _$@.1 @cp "$(srcdir)"/inplace.2.in _$@.2 - @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "Before"} {gsub(/bar/, "foo"); print} END {print "After"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v inplace::suffix=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v inplace::suffix=.bak 'BEGIN {print "Before"} {gsub(/bar/, "foo"); print} END {print "After"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ @-$(CMP) "$(srcdir)"/$@.1.ok _$@.1 && rm -f _$@.1 @-$(CMP) "$(srcdir)"/$@.1.bak.ok _$@.1.bak && rm -f _$@.1.bak @@ -2199,6 +2215,17 @@ sourcesplit: @AWKPATH="$(srcdir)" $(AWK) --source='BEGIN { a = 5;' --source='print a }' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +eofsrc1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f "$(srcdir)"/$@a.awk -f "$(srcdir)"/$@b.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +nsbad_cmd: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -v foo:bar=3 -v foo:::blat=4 1 /dev/null >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + + # Use [:] in the regexp to keep MSYS from converting the /'s to \'s. nonfatal1: @echo $@ diff --git a/test/Makefile.in b/test/Makefile.in index b6adabdd..c244c7af 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -520,6 +520,9 @@ EXTRA_DIST = \ dynlj.ok \ eofsplit.awk \ eofsplit.ok \ + eofsrc1a.awk \ + eofsrc1b.awk \ + eofsrc1.ok \ errno.awk \ errno.in \ errno.ok \ @@ -1025,6 +1028,17 @@ EXTRA_DIST = \ noparms.ok \ nors.in \ nors.ok \ + nsbad.awk \ + nsbad.ok \ + nsbad_cmd.ok \ + nsindirect1.awk \ + nsindirect1.ok \ + nsindirect2.awk \ + nsindirect2.ok \ + nsprof1.awk \ + nsprof1.ok \ + nsprof2.awk \ + nsprof2.ok \ nulinsrc.awk \ nulinsrc.ok \ nulrsend.awk \ @@ -1516,10 +1530,10 @@ BASIC_TESTS = \ callparam childin clobber closebad clsflnam compare compare2 \ concat1 concat2 concat3 concat4 concat5 convfmt \ datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \ - eofsplit exit2 exitval1 exitval2 exitval3 fcall_exit fcall_exit2 \ - fldchg fldchgnf fldterm fnamedat fnarray fnarray2 fnaryscl fnasgnm fnmisc \ - fordel forref forsimp fsbs fsnul1 fsrs fsspcoln fstabplus funsemnl \ - funsmnam funstack \ + eofsplit eofsrc1 exit2 exitval1 exitval2 exitval3 \ + fcall_exit fcall_exit2 fldchg fldchgnf fldterm fnamedat fnarray fnarray2 \ + fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fsnul1 fsrs fsspcoln \ + fstabplus funsemnl funsmnam funstack \ getline getline2 getline3 getline4 getline5 getlnbuf getnr2tb getnr2tm \ gsubasgn gsubtest gsubtst2 gsubtst3 gsubtst4 gsubtst5 gsubtst6 gsubtst7 \ gsubtst8 \ @@ -1569,19 +1583,20 @@ GAWK_EXT_TESTS = \ incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 include include2 \ indirectbuiltin indirectcall indirectcall2 intarray isarrayunset \ lint lintexp lintindex lintint lintlength lintold lintset lintwarn \ - mixed1 mktime manyfiles match1 match2 match3 mbstr1 mbstr2 muldimposix \ + manyfiles match1 match2 match3 mbstr1 mbstr2 mixed1 mktime muldimposix \ nastyparm negtime next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 \ + nsbad nsbad_cmd nsindirect1 nsindirect2 nsprof1 nsprof2 \ patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge \ procinfs profile0 profile1 profile2 profile3 profile4 profile5 profile6 \ profile7 profile8 profile9 profile10 profile11 pty1 pty2 \ rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin \ rsstart1 rsstart2 rsstart3 rstest6 \ shadow shadowbuiltin sortfor sortfor2 sortu sourcesplit split_after_fpat \ - splitarg4 strftime strftfld strtonum strtonum1 switch2 symtab1 symtab2 \ + splitarg4 strftfld strftime strtonum strtonum1 switch2 symtab1 symtab2 \ symtab3 symtab4 symtab5 symtab6 symtab7 symtab8 symtab9 symtab10 \ - typedregex1 typedregex2 typedregex3 typedregex4 \ + timeout typedregex1 typedregex2 typedregex3 typedregex4 \ typeof1 typeof2 typeof3 typeof4 typeof5 \ - timeout watchpoint1 + watchpoint1 ARRAYDEBUG_TESTS = arrdbg EXTRA_TESTS = inftest regtest ignrcas3 @@ -1629,7 +1644,8 @@ NEED_NONDEC = mpfrbigint2 nondec2 intarray forcenum NEED_POSIX = printf0 posix2008sub paramasfunc1 paramasfunc2 muldimposix # List of tests that need --pretty-print -NEED_PRETTY = profile4 profile5 profile8 profile9 profile10 profile11 +NEED_PRETTY = nsprof1 nsprof2 \ + profile4 profile5 profile8 profile9 profile10 profile11 # List of tests that need --re-interval NEED_RE_INTERVAL = gsubtst3 reint reint2 @@ -2479,7 +2495,7 @@ inplace2:: @echo $@ @cp "$(srcdir)"/inplace.1.in _$@.1 @cp "$(srcdir)"/inplace.2.in _$@.2 - @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v inplace::suffix=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ @-$(CMP) "$(srcdir)"/$@.1.ok _$@.1 && rm -f _$@.1 @-$(CMP) "$(srcdir)"/$@.1.bak.ok _$@.1.bak && rm -f _$@.1.bak @@ -2490,8 +2506,8 @@ inplace3:: @echo $@ @cp "$(srcdir)"/inplace.1.in _$@.1 @cp "$(srcdir)"/inplace.2.in _$@.2 - @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "Before"} {gsub(/bar/, "foo"); print} END {print "After"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v inplace::suffix=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH="$(srcdir)"/../awklib/eg/lib $(AWK) -i inplace -v inplace::suffix=.bak 'BEGIN {print "Before"} {gsub(/bar/, "foo"); print} END {print "After"}' _$@.1 - _$@.2 < "$(srcdir)"/inplace.in >>_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ @-$(CMP) "$(srcdir)"/$@.1.ok _$@.1 && rm -f _$@.1 @-$(CMP) "$(srcdir)"/$@.1.bak.ok _$@.1.bak && rm -f _$@.1.bak @@ -2645,6 +2661,16 @@ sourcesplit: @AWKPATH="$(srcdir)" $(AWK) --source='BEGIN { a = 5;' --source='print a }' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +eofsrc1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f "$(srcdir)"/$@a.awk -f "$(srcdir)"/$@b.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +nsbad_cmd: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -v foo:bar=3 -v foo:::blat=4 1 /dev/null >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + # Use [:] in the regexp to keep MSYS from converting the /'s to \'s. nonfatal1: @echo $@ @@ -4285,11 +4311,6 @@ lintwarn: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ -mktime: - @echo $@ - @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ - match1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -4317,6 +4338,11 @@ mbstr2: AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +mktime: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + muldimposix: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --posix >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -4352,6 +4378,31 @@ nonfatal3: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +nsbad: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +nsindirect1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +nsindirect2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +nsprof1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +nsprof2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + patsplit: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -4554,6 +4605,11 @@ symtab10: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --debug < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +timeout: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + typedregex1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -4594,11 +4650,6 @@ typeof5: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ -timeout: - @echo $@ - @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ - double1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index 9ad8ade9..7163b4ab 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1606,11 +1606,6 @@ lintwarn: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ -mktime: - @echo $@ - @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ - match1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1638,6 +1633,11 @@ mbstr2: AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +mktime: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + muldimposix: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --posix >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1673,6 +1673,31 @@ nonfatal3: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +nsbad: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +nsindirect1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +nsindirect2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +nsprof1: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + +nsprof2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + patsplit: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1875,6 +1900,11 @@ symtab10: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --debug < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +timeout: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + typedregex1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1915,11 +1945,6 @@ typeof5: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ -timeout: - @echo $@ - @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ - double1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/eofsrc1.ok b/test/eofsrc1.ok new file mode 100644 index 00000000..64d85b33 --- /dev/null +++ b/test/eofsrc1.ok @@ -0,0 +1,3 @@ +gawk: ./eofsrc1a.awk:2: (END OF FILE) +gawk: ./eofsrc1a.awk:2: ^ source files / command-line arguments must contain complete functions or rules +EXIT CODE: 1 diff --git a/test/eofsrc1a.awk b/test/eofsrc1a.awk new file mode 100644 index 00000000..55143c2b --- /dev/null +++ b/test/eofsrc1a.awk @@ -0,0 +1,2 @@ +BEGIN { + n = 5 diff --git a/test/eofsrc1b.awk b/test/eofsrc1b.awk new file mode 100644 index 00000000..0dad2163 --- /dev/null +++ b/test/eofsrc1b.awk @@ -0,0 +1,2 @@ + print n +} diff --git a/test/inplace1.ok b/test/inplace1.ok index 730d7754..753079b3 100644 --- a/test/inplace1.ok +++ b/test/inplace1.ok @@ -1,5 +1,5 @@ before -gawk: inplace:47: warning: inplace_begin: disabling in-place editing for invalid FILENAME `-' +gawk: inplace:53: warning: inplace::begin: disabling in-place editing for invalid FILENAME `-' stdin start is bar replaced? stdin end diff --git a/test/inplace2.ok b/test/inplace2.ok index 730d7754..753079b3 100644 --- a/test/inplace2.ok +++ b/test/inplace2.ok @@ -1,5 +1,5 @@ before -gawk: inplace:47: warning: inplace_begin: disabling in-place editing for invalid FILENAME `-' +gawk: inplace:53: warning: inplace::begin: disabling in-place editing for invalid FILENAME `-' stdin start is bar replaced? stdin end diff --git a/test/inplace3.ok b/test/inplace3.ok index 815cd1c7..7802a0c8 100644 --- a/test/inplace3.ok +++ b/test/inplace3.ok @@ -1,11 +1,11 @@ before -gawk: inplace:47: warning: inplace_begin: disabling in-place editing for invalid FILENAME `-' +gawk: inplace:53: warning: inplace::begin: disabling in-place editing for invalid FILENAME `-' stdin start is bar replaced? stdin end after Before -gawk: inplace:47: warning: inplace_begin: disabling in-place editing for invalid FILENAME `-' +gawk: inplace:53: warning: inplace::begin: disabling in-place editing for invalid FILENAME `-' stdin start is foo replaced? stdin end diff --git a/test/nsbad.awk b/test/nsbad.awk new file mode 100644 index 00000000..825bb35c --- /dev/null +++ b/test/nsbad.awk @@ -0,0 +1,15 @@ +@namespace "1foo" +@namespace "for" +@namespace "42f" +@namespace "ab#d" + +BEGIN { + foo75::bar = 57 + if::junk = 1 + foo::match = 3 +} + +@namespace "foo" +function gsub () { + print "foo::gsub" +} diff --git a/test/nsbad.ok b/test/nsbad.ok new file mode 100644 index 00000000..dfa228a7 --- /dev/null +++ b/test/nsbad.ok @@ -0,0 +1,13 @@ +gawk: nsbad.awk:1: error: namespace name `1foo' must meet identifier naming rules +gawk: nsbad.awk:2: error: using reserved identifier `for' as a namespace is not allowed +gawk: nsbad.awk:3: error: namespace name `42f' must meet identifier naming rules +gawk: nsbad.awk:4: error: namespace name `ab#d' must meet identifier naming rules +gawk: nsbad.awk:8: error: using reserved identifier `if' as a namespace is not allowed +gawk: nsbad.awk:8: if::junk = 1 +gawk: nsbad.awk:8: ^ syntax error +gawk: nsbad.awk:9: error: using reserved identifier `match' as second component of a qualified name is not allowed +gawk: nsbad.awk:9: foo::match = 3 +gawk: nsbad.awk:9: ^ syntax error +gawk: nsbad.awk:13: function gsub () { +gawk: nsbad.awk:13: ^ `gsub' is a built-in function, it cannot be redefined +EXIT CODE: 1 diff --git a/test/nsbad_cmd.ok b/test/nsbad_cmd.ok new file mode 100644 index 00000000..cbca6ea0 --- /dev/null +++ b/test/nsbad_cmd.ok @@ -0,0 +1,3 @@ +gawk: error: identifier foo:bar: namespace separator is two colons, not one +gawk: error: qualified identifier `foo:::blat' is badly formed +EXIT CODE: 1 diff --git a/test/nsindirect1.awk b/test/nsindirect1.awk new file mode 100644 index 00000000..d04863f5 --- /dev/null +++ b/test/nsindirect1.awk @@ -0,0 +1,13 @@ +@namespace "test" + +BEGIN { + bar = 3 +} + +@namespace "awk" + +BEGIN { + print "before change, direct =", test::bar, "indirect =", SYMTAB["test::bar"] + SYMTAB["test::bar"] = 4 + print "after change, direct =", test::bar, "indirect =", SYMTAB["test::bar"] +} diff --git a/test/nsindirect1.ok b/test/nsindirect1.ok new file mode 100644 index 00000000..ab2e31ba --- /dev/null +++ b/test/nsindirect1.ok @@ -0,0 +1,2 @@ +before change, direct = 3 indirect = 3 +after change, direct = 4 indirect = 4 diff --git a/test/nsindirect2.awk b/test/nsindirect2.awk new file mode 100644 index 00000000..8017e8f7 --- /dev/null +++ b/test/nsindirect2.awk @@ -0,0 +1,44 @@ +BEGIN { + stftime::gensub = 3 # should be OK, not related to indirect calls +} + + +BEGIN { base_time = systime() } # in awk namespace + +@namespace "testing" + +function strftime(mesg) +{ + printf("strftime(%s) - this is not the function you are looking for\n", + mesg) + return 0 +} + +BEGIN { + strftime("from 'testing'") + gensub = "gensub" + print "gensub =", gensub +} + +function systime() +{ + return awk::base_time +} + +BEGIN { + st = "systime" + now[1] = @st() + + st = "awk::systime" + now[2] = @st() + + st = "testing::systime" + now[3] = @st() + + for (i = 1; i <= 3; i++) { + if (now[i] == awk::base_time || now[i] == awk::base_time + 1) + printf "iteration %d, got good result from systime\n", i + else + printf "iteration %d, got bad result from systime, now %d, base_time %d\n", i, now, awk::base_time + } +} diff --git a/test/nsindirect2.ok b/test/nsindirect2.ok new file mode 100644 index 00000000..9b71cd92 --- /dev/null +++ b/test/nsindirect2.ok @@ -0,0 +1,5 @@ +strftime() - this is not the function you are looking for +gensub = gensub +iteration 1, got good result from systime +iteration 2, got good result from systime +iteration 3, got good result from systime diff --git a/test/nsprof1.awk b/test/nsprof1.awk new file mode 100644 index 00000000..46be5bc9 --- /dev/null +++ b/test/nsprof1.awk @@ -0,0 +1,16 @@ +@namespace "foo" + +BEGIN { + a = 5 + a++ + print a +} + +/foo/ { print "bar" } + +@namespace "stuff" + +function stuff() +{ + print "stuff" +} diff --git a/test/nsprof1.ok b/test/nsprof1.ok new file mode 100644 index 00000000..eacc2707 --- /dev/null +++ b/test/nsprof1.ok @@ -0,0 +1,19 @@ +@namespace "foo" + +BEGIN { + a = 5 + a++ + print a +} + +/foo/ { + print "bar" +} + +@namespace "stuff" + + +function stuff() +{ + print "stuff" +} diff --git a/test/nsprof2.awk b/test/nsprof2.awk new file mode 100644 index 00000000..9c7da57e --- /dev/null +++ b/test/nsprof2.awk @@ -0,0 +1,74 @@ +# passwd.awk --- access password file information +# +# Arnold Robbins, arnold@skeeve.com, Public Domain +# May 1993 +# Revised October 2000 +# Revised December 2010 +# Revised July 2017 + +@namespace "foo" # this is foo + +@namespace "bar" # this is bar + +@namespace "passwd" # move to passwd namespace + +BEGIN { + # tailor this to suit your system + Awklib = "/usr/local/libexec/awk/" +} + +function Init( oldfs, oldrs, olddol0, pwcat, using_fw, using_fpat) +{ + if (Inited) + return + + oldfs = FS + oldrs = RS + olddol0 = $0 + using_fw = (PROCINFO["FS"] == "FIELDWIDTHS") + using_fpat = (PROCINFO["FS"] == "FPAT") + FS = ":" + RS = "\n" + + pwcat = Awklib "pwcat" + while ((pwcat | getline) > 0) { + Byname[$1] = $0 + Byuid[$3] = $0 + Bycount[++Total] = $0 + } + close(pwcat) + Count = 0 + Inited = 1 + FS = oldfs + if (using_fw) + FIELDWIDTHS = FIELDWIDTHS + else if (using_fpat) + FPAT = FPAT + RS = oldrs + $0 = olddol0 +} + +function awk::getpwnam(name) +{ + Init() + return Byname[name] +} + +function awk::getpwuid(uid) +{ + Init() + return Byuid[uid] +} + +function awk::getpwent() +{ + Init() + if (Count < Total) + return Bycount[++Count] + return "" +} + +function awk::endpwent() +{ + Count = 0 +} diff --git a/test/nsprof2.ok b/test/nsprof2.ok new file mode 100644 index 00000000..1bb78822 --- /dev/null +++ b/test/nsprof2.ok @@ -0,0 +1,75 @@ +# passwd.awk --- access password file information +# +# Arnold Robbins, arnold@skeeve.com, Public Domain +# May 1993 +# Revised October 2000 +# Revised December 2010 +# Revised July 2017 +@namespace "foo" # this is foo + +@namespace "bar" # this is bar + +@namespace "passwd" # move to passwd namespace + +BEGIN { + # tailor this to suit your system + Awklib = "/usr/local/libexec/awk/" +} + + +function awk::endpwent() +{ + Count = 0 +} + +function awk::getpwent() +{ + Init() + if (Count < Total) { + return Bycount[++Count] + } + return "" +} + +function awk::getpwnam(name) +{ + Init() + return Byname[name] +} + +function awk::getpwuid(uid) +{ + Init() + return Byuid[uid] +} + +function Init(oldfs, oldrs, olddol0, pwcat, using_fw, using_fpat) +{ + if (Inited) { + return + } + oldfs = awk::FS + oldrs = awk::RS + olddol0 = $0 + using_fw = (awk::PROCINFO["FS"] == "FIELDWIDTHS") + using_fpat = (awk::PROCINFO["FS"] == "FPAT") + awk::FS = ":" + awk::RS = "\n" + pwcat = Awklib "pwcat" + while ((pwcat | getline) > 0) { + Byname[$1] = $0 + Byuid[$3] = $0 + Bycount[++Total] = $0 + } + close(pwcat) + Count = 0 + Inited = 1 + awk::FS = oldfs + if (using_fw) { + awk::FIELDWIDTHS = awk::FIELDWIDTHS + } else if (using_fpat) { + awk::FPAT = awk::FPAT + } + awk::RS = oldrs + $0 = olddol0 +} diff --git a/test/sourcesplit.ok b/test/sourcesplit.ok index 7ed6ff82..c883f51c 100644 --- a/test/sourcesplit.ok +++ b/test/sourcesplit.ok @@ -1 +1,3 @@ -5 +gawk: cmd. line:1: BEGIN { a = 5; +gawk: cmd. line:1: ^ unexpected newline or end of string +EXIT CODE: 1 diff --git a/test/testext.ok b/test/testext.ok index 897a7336..fbc3c263 100644 --- a/test/testext.ok +++ b/test/testext.ok @@ -86,6 +86,9 @@ message_string = hello, world new_array["hello"] = "world" new_array["answer"] = "42" +test::testval = in namespace test +test::test_function() called. + at_exit2 called (should be first): data = NULL, exit_status = 0 at_exit1 called (should be second): (data is & data_for_1), data value = 0xdeadbeef, exit_status = 0 at_exit0 called (should be third): data = NULL, exit_status = 0 diff --git a/test/unterm.ok b/test/unterm.ok index 760d3703..399f626a 100644 --- a/test/unterm.ok +++ b/test/unterm.ok @@ -1,5 +1,5 @@ gawk: unterm.awk:1: BEGIN{x=".........................................................................................................................................................................................................................................................} gawk: unterm.awk:1: ^ unterminated string -gawk: unterm.awk:1: BEGIN{x=".........................................................................................................................................................................................................................................................} -gawk: unterm.awk:1: ^ syntax error +gawk: unterm.awk:1: (END OF FILE) +gawk: unterm.awk:1: ^ source files / command-line arguments must contain complete functions or rules EXIT CODE: 1 |