diff options
Diffstat (limited to 'test')
89 files changed, 1991 insertions, 181 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 2ce66aee..0284ac23 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,211 @@ +Mon Oct 22 08:49:05 2007 Arnold D. Robbins <arnold@skeeve.com> + + * Release 3.1.6: Release tar file made. + +Wed Sep 26 14:32:28 2007 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (localenl): New test. + (regtest): Fixed invocation of shell script. + * localenl.sh, localenl.ok: New files. + * reg/func2.good: Revised to match current gawk output. + +Wed Sep 26 14:49:04 2007 Eli Zaretskii <eliz@gnu.org> + + * exitval2.w32: New file, a Windows version for exitval2.awk. + +Tue May 29 13:22:33 2007 Arnold D. Robbins <arnold@skeeve.com> + + * badargs.ok: Updated. + +Thu May 17 21:10:51 2007 Pat Rankin <rankin@pactechdata.com> + + * icasers.awk: Modify pattern to work on VMS too, doesn't + break Unix/Linux. + +Tue May 15 22:05:24 2007 Pat Rankin <rankin@pactechdata.com> + + Steps towards generating VMS .mms file to run test suite. + + * Makefile.am (FAIL_CODE1): New macro, list of programs + that exit 1. + * Gentests: Add VMS code. + * Gentests.vms: New file. + +Wed May 2 19:30:54 2007 Stepan Kasal <kasal@ucw.cz> + + Revert precedence of concatenation and | getline. + From mail dated 2005-10-31. + + * parsefld.awk, parsefld.in, parsefld.ok: New files. + * Makefile.am (parsefld): New basic test, check for $/regex/ and + for /re1/+/re2/. + * getline.awk, getline.ok: Add precedence check "echo " "date"|getline + +Sun Apr 29 22:43:28 2007 Arnold D. Robbins <arnold@skeeve.com> + + * hsprint.awk: Add extra "%" to format string. Thanks to Nelson Beebe. + * hsprint.ok: Revised. + +Tue Apr 24 23:15:01 2007 Andrew J. Schorr <ajschorr@users.sourceforge.net> + + * fmtspcl.tok: Provide correct version. + +Tue Apr 17 22:23:41 2007 Arnold D. Robbins <arnold@skeeve.com> + + * double2.awk, double2.ok: Limit to 2^63 for portability across + different platforms. Sigh. + +Thu Apr 12 20:00:27 2007 Andrew J. Schorr <ajschorr@users.sourceforge.net> + + * Makefile.am, Makefile.in (fmtspcl): Use fmtspcl.tok to build + a fmtspcl.ok file suitable for the given platform. + (diffout): Handle case where the .ok file is in the build directory. + +Mon Mar 26 08:24:04 2007 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (fmtspcl.ok): Don't remove for cleaning, add + to EXTRA_DIST. + +Fri Mar 9 11:38:34 2007 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (fmtspcl.tok): Removed use of and reference + to this file. + +Tue Feb 6 08:21:02 2007 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (double1, double2, zero2): New tests. + * double1.awk, double1.ok, double2.awk, double2.ok, + zero2.awk, zero2.ok: New files. + +Sun Feb 4 16:32:45 2007 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (parse1): New test. + * parse1.awk, parse1.in, parse1.ok: New files. + +Thu Feb 1 17:41:48 2007 Andrew J. Schorr <ajschorr@users.sourceforge.net> + + * Makefile.am (fmtspcl): New test. + (CLEANFILES): Add fmtpspcl.ok to list. + * fmtspcl.awk, fmtspcl.tok: New files. + +Mon Jan 29 15:31:35 2007 Andrew J. Schorr <ajschorr@users.sourceforge.net> + + * Makefile.am (diffout): Make it work if no problems. + (valgrind-scan): New target to show problems. + +Mon Jan 29 12:51:16 2007 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (reint2): New test. + * reint2.awk, reint2.in, reint2.ok: New files. + +Fri Jan 26 20:01:38 2007 Andrew J. Schorr <ajschorr@users.sourceforge.net> + + * Makefile.am (intformat): New test. + * intformat.awk, intformat.ok: New files. + +Tue Jan 23 08:10:48 2007 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (fwtest2): New test. + * fwtest2.awk, fwtest2.in, fwtest2.ok: New files. + +Sun Jan 21 13:09:33 2007 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (synerr2, wideidx2): New test. + * synerr2.awk, synerr2.ok, wideidx2.awk, wideidx2.ok: New files. + +Fri Jan 19 15:11:12 2007 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (strnum1, widesub4): New test. + * strnum1.awk, strnum1.ok, widesub4.awk, widesub4.ok: New files. + +Thu Jan 18 13:37:00 2007 Andrew J. Schorr <ajschorr@users.sourceforge.net> + + * Makeilfe.am (devfd, wideidx, widesub, widesub2, widesub3): New + tests. + * devfd.in4, devfd.in5, devfd.ok, wideidx.awk, wideidx.in, wideidx.ok, + widesub.awk, widesub.ok, widesub2.awk, widesub2.ok, widesub3.awk, + widesub3.in, widesub3.ok: New files. + +Tue Jan 16 12:16:39 2007 Andrew J. Schorr <ajschorr@users.sourceforge.net> + + * Makefile.am: In pid test, no further need to remove _pid.in, + since the test no longer creates that file. + * pid.awk: Do not read correct values from stdin (they are now passed + as command-line variables with -v). Make sure to produce output + if the comparisons are successful. + * pid.ok: No longer empty, should contain 3 lines if all goes well. + * pid.sh: Do not create _pid.in; instead, pass values in with -v. + +Sun Jan 14 18:03:12 2007 Arnold D. Robbins <arnold@skeeve.com> + + * fnarray.ok: Updated. + +2007-01-13 Eli Zaretskii <eliz@gnu.org> + + * pipeio2.awk: Don't use empty lines, because Windows ECHO does + something different when invoked without arguments. + + * pipeio2.ok: Update. + + * Makefile.am (EXTRA_DIST): Add exitval2.w32. + + * exitval2.w32: New file. + +Sat Jan 13 21:25:11 2007 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + + * lintold.awk, lintold.in, lintold.ok: New `--lint-old' test. + * Gentests, Makefile.am: Adjust. + +Sat Jan 13 21:17:51 2007 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + + * Makefile.am (Maketests): Allow rebuilding from a VPATH build. + +Fri Jan 12 14:04:24 2007 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (mtchi18n): new test. + * mtchi18n.awk, mtchi18n.in, mtchi18n.ok: new files. + +Wed Sep 6 02:09:26 2006 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (mixed1): new test. + * mixed1.ok: new file. + +Tue Jun 20 05:37:53 2006 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (devfd1, devfd2): new tests. + * devfd.in1, devfd.in2, devfd1.awk, devfd1.ok, devfd2.ok: new files. + +Sun Mar 12 23:48:31 2006 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (concat4): new test. + * concat4.awk, concat4.in, concat4.ok: new files. + +Sun Mar 12 23:33:26 2006 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (subi18n): new test (from + KIMURA Koichi <kimura.koichi@canon.co.jp>). + * subi18n.awk, subi18n.ok: New files. + +Mon Dec 19 05:41:56 2005 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (ovrflow1): new test. + * ovrflow1.awk, ovrflow1.ok: new files. + +Wed Dec 14 19:01:08 2005 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (binmode1): new test. + * binmode1.ok: new file. + +Fri Oct 7 12:28:41 2005 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (fwtest): new test. + * fwtest.awk, fwtest.in, fwtest.ok: new files. + +Fri Aug 12 14:40:47 2005 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (nofile): New test. + * nofile.ok: New file. + Tue Jul 26 21:46:16 2005 Arnold D. Robbins <arnold@skeeve.com> * Release 3.1.5: Release tar file made. diff --git a/test/Gentests b/test/Gentests index 10401ddf..58416e42 100755 --- a/test/Gentests +++ b/test/Gentests @@ -3,6 +3,8 @@ # This program should generate Maketests BEGIN { + if (VMSTESTS) vmsargvfixup() + # read the list of files for (i = 2; i < ARGC; i++) files[ARGV[i]] @@ -29,6 +31,13 @@ BEGIN { next } +/^NEED_LINT_OLD *=/,/[^\\]$/ { + gsub(/(^NEED_LINT_OLD *=|\\$)/,"") + for (i = 1; i <= NF; i++) + lint_old[$i] + next +} + /^GENTESTS_UNUSED *=/,/[^\\]$/ { gsub(/(^GENTESTS_UNUSED *=|\\$)/,"") for (i = 1; i <= NF; i++) @@ -63,7 +72,9 @@ function generate(x, s) printf "WARNING: file `%s.awk' not found.\n", x > "/dev/stderr" else delete files[x".awk"] - + + if (VMSTESTS) return vmsgenerate(x) + print x ":" s = "" @@ -71,6 +82,10 @@ function generate(x, s) s = s " --lint" delete lint[x] } + if (x in lint_old) { + s = s " --lint-old" + delete lint_old[x] + } if (x".in" in files) { s = s " < $(srcdir)/$@.in" delete files[x".in"] @@ -85,8 +100,14 @@ END { for (x in lint) if (!(x in targets)) printf "WARNING: --lint target `%s' is missing.\n", x > "/dev/stderr" + for (x in lint_old) + if (!(x in targets)) + printf "WARNING: --lint-old target `%s' is missing.\n", x > "/dev/stderr" for (x in files) if (!(x in unused) && \ !(gensub(/\.(awk|in)$/,"","",x) in targets)) printf "WARNING: unused file `%s'.\n", x > "/dev/stderr" } + +# VMSTESTS: generate test template in vms format +# gawk -v "VMSTESTS=1" -f Gentests -f Gentests.vms Makefile.am *.awk *.in >Maketests.vms diff --git a/test/Makefile.am b/test/Makefile.am index ada5d393..9b4137de 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,14 +1,14 @@ # # test/Makefile.am --- automake input file for gawk # -# Copyright (C) 1988-2005 the Free Software Foundation, Inc. +# Copyright (C) 1988-2006 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 2 of the License, or +# 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, @@ -99,6 +99,7 @@ EXTRA_DIST = \ backw.in \ backw.ok \ badargs.ok \ + binmode1.ok \ childin.awk \ childin.in \ childin.ok \ @@ -121,6 +122,9 @@ EXTRA_DIST = \ concat2.ok \ concat3.awk \ concat3.ok \ + concat4.awk \ + concat4.in \ + concat4.ok \ convfmt.awk \ convfmt.ok \ datanonl.awk \ @@ -134,6 +138,18 @@ EXTRA_DIST = \ delarpm2.ok \ delfunc.awk \ delfunc.ok \ + devfd.in1 \ + devfd.in2 \ + devfd.in4 \ + devfd.in5 \ + devfd.ok \ + devfd1.awk \ + devfd1.ok \ + devfd2.ok \ + double1.awk \ + double1.ok \ + double2.awk \ + double2.ok \ dynlj.awk \ dynlj.ok \ eofsplit.awk \ @@ -142,6 +158,7 @@ EXTRA_DIST = \ exitval1.ok \ exitval2.awk \ exitval2.ok \ + exitval2.w32 \ fflush.ok \ fflush.sh \ fieldwdth.awk \ @@ -153,6 +170,8 @@ EXTRA_DIST = \ fldchgnf.awk \ fldchgnf.in \ fldchgnf.ok \ + fmtspcl.awk \ + fmtspcl.tok \ fmttest.awk \ fmttest.ok \ fnamedat.awk \ @@ -199,6 +218,12 @@ EXTRA_DIST = \ funstack.awk \ funstack.in \ funstack.ok \ + fwtest.awk \ + fwtest.in \ + fwtest.ok \ + fwtest2.awk \ + fwtest2.in \ + fwtest2.ok \ gensub.awk \ gensub.in \ gensub.ok \ @@ -269,6 +294,8 @@ EXTRA_DIST = \ inputred.ok \ intest.awk \ intest.ok \ + intformat.awk \ + intformat.ok \ intprec.awk \ intprec.ok \ iobug1.awk \ @@ -280,8 +307,13 @@ EXTRA_DIST = \ leadnl.ok \ lint.awk \ lint.ok \ + lintold.awk \ + lintold.in \ + lintold.ok \ litoct.awk \ litoct.ok \ + localenl.ok \ + localenl.sh \ longdbl.awk \ longdbl.in \ longdbl.ok \ @@ -308,7 +340,11 @@ EXTRA_DIST = \ messages.awk \ minusstr.awk \ minusstr.ok \ + mixed1.ok \ mmap8k.in \ + mtchi18n.awk \ + mtchi18n.in \ + mtchi18n.ok \ nasty.awk \ nasty.ok \ nasty2.awk \ @@ -336,6 +372,7 @@ EXTRA_DIST = \ nlstrina.ok \ noeffect.awk \ noeffect.ok \ + nofile.ok \ nofmtch.awk \ nofmtch.ok \ noloop1.awk \ @@ -387,10 +424,18 @@ EXTRA_DIST = \ out1.ok \ out2.ok \ out3.ok \ + ovrflow1.awk \ + ovrflow1.ok \ paramdup.awk \ paramdup.ok \ paramtyp.awk \ paramtyp.ok \ + parse1.awk \ + parse1.in \ + parse1.ok \ + parsefld.awk \ + parsefld.in \ + parsefld.ok \ parseme.awk \ parseme.ok \ pcntplus.awk \ @@ -456,6 +501,9 @@ EXTRA_DIST = \ reint.awk \ reint.in \ reint.ok \ + reint2.awk \ + reint2.in \ + reint2.ok \ reparse.awk \ reparse.in \ reparse.ok \ @@ -525,6 +573,8 @@ EXTRA_DIST = \ strtod.awk \ strtod.in \ strtod.ok \ + strnum1.awk \ + strnum1.ok \ strtonum.awk \ strtonum.ok \ strftime.awk \ @@ -533,6 +583,8 @@ EXTRA_DIST = \ subamp.awk \ subamp.in \ subamp.ok \ + subi18n.awk \ + subi18n.ok \ subsepnm.awk \ subsepnm.ok \ subslash.awk \ @@ -545,6 +597,8 @@ EXTRA_DIST = \ switch2.awk \ synerr1.awk \ synerr1.ok \ + synerr2.awk \ + synerr2.ok \ tradanch.awk \ tradanch.in \ tradanch.ok \ @@ -564,9 +618,25 @@ EXTRA_DIST = \ whiny.awk \ whiny.in \ whiny.ok \ + wideidx.awk \ + wideidx.in \ + wideidx.ok \ + wideidx2.awk \ + wideidx2.ok \ + widesub.awk \ + widesub.ok \ + widesub2.awk \ + widesub2.ok \ + widesub3.awk \ + widesub3.in \ + widesub3.ok \ + widesub4.awk \ + widesub4.ok \ wjposer1.awk \ wjposer1.in \ wjposer1.ok \ + zero2.awk \ + zero2.ok \ zeroe0.awk \ zeroe0.ok \ zeroflag.awk \ @@ -574,48 +644,55 @@ EXTRA_DIST = \ TESTS_WE_ARE_NOT_DOING_YET_FIXME_ONE_DAY = longdbl -# Get rid of core files when cleaning -CLEANFILES = core core.* +# Get rid of core files when cleaning and generated .ok file +CLEANFILES = core core.* fmtspcl.ok # try to keep these sorted BASIC_TESTS = addcomma anchgsub argarray arrayparm arrayref arrymem1 \ arrayprm2 arrayprm3 arryref2 arryref3 arryref4 arryref5 arynasty \ arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \ aryprm8 arysubnm asgext awkpath back89 backgsub childin clobber \ - clsflnam compare compare2 concat1 concat2 concat3 convfmt datanonl defref \ - delarprm delarpm2 delfunc dynlj eofsplit exitval1 exitval2 fldchg fldchgnf fmttest fnamedat \ + clsflnam compare compare2 concat1 concat2 concat3 concat4 convfmt datanonl defref \ + delarprm delarpm2 delfunc dynlj eofsplit exitval1 exitval2 fldchg fldchgnf fmtspcl fmttest fnamedat \ fnarray fnarray2 fnarydel fnaryscl fnasgnm fnmisc fnparydl \ fordel forsimp fsbs fsspcoln fsrs fstabplus funsemnl funsmnam funstack getline \ getline2 getline3 getlnbuf getnr2tb getnr2tm gsubasgn gsubtest \ - gsubtst2 gsubtst3 gsubtst4 gsubtst5 hex hsprint inputred intest \ + gsubtst2 gsubtst3 gsubtst4 gsubtst5 hex hsprint inputred intest intformat \ intprec iobug1 leaddig leadnl litoct longsub longwrds manglprm math membug1 \ - messages minusstr mmap8k nasty nasty2 negexp nested nfldstr \ - nfneg nfset nlfldsep nlinstr nlstrina noeffect nofmtch noloop1 \ + messages minusstr mmap8k mtchi18n nasty nasty2 negexp nested nfldstr \ + nfneg nfset nlfldsep nlinstr nlstrina noeffect nofile nofmtch noloop1 \ noloop2 nonl noparms nors nulrsend numindex numsubstr octsub ofmt \ - ofmtbig ofmtfidl ofmts onlynl opasnidx opasnslf paramdup paramtyp \ - parseme pcntplus prdupval prec printf0 printf1 prmarscl prmreuse \ + ofmtbig ofmtfidl ofmts onlynl opasnidx opasnslf ovrflow1 paramdup paramtyp \ + parse1 parsefld parseme pcntplus prdupval prec printf0 printf1 prmarscl prmreuse \ prt1eval prtoeval psx96sub rand rebt8b1 rebt8b2 redfilnm regeq \ reindops reparse resplit rs rsnul1nl rsnulbig rsnulbig2 rstest1 \ rstest2 rstest3 rstest4 rstest5 rswhite scalar sclforin sclifin \ sortempty splitargv splitarr splitdef splitvar splitwht sprintfc \ - strcat1 strtod subamp subsepnm subslash substr swaplns synerr1 tradanch \ - tweakfld uninit2 uninit3 uninit4 uninitialized unterm wjposer1 \ - zeroe0 zeroflag + strcat1 strtod strnum1 subamp subi18n subsepnm subslash substr swaplns \ + synerr1 synerr2 tradanch \ + tweakfld uninit2 uninit3 uninit4 uninitialized unterm wideidx wideidx2 \ + widesub widesub2 widesub3 widesub4 wjposer1 zeroe0 zeroflag zero2 -UNIX_TESTS = fflush getlnhd pid pipeio1 pipeio2 poundbang space strftlng +UNIX_TESTS = fflush getlnhd localenl pid pipeio1 pipeio2 poundbang space strftlng -GAWK_EXT_TESTS = argtest asort asorti backw badargs clos1way fieldwdth fsfwfs \ - gensub gensub2 gnuops2 gnuops3 gnureops icasefs icasers igncdym igncfs ignrcase \ - ignrcas2 lint match1 match2 manyfiles nondec nondec2 posix procinfs \ - printfbad1 regx8bit rebuf reint rsstart1 rsstart2 rsstart3 \ - rstest6 shadow sort1 strtonum strftime whiny +GAWK_EXT_TESTS = argtest asort asorti backw badargs binmode1 clos1way devfd devfd1 devfd2 double1 double2 \ + fieldwdth fsfwfs fwtest fwtest2 gensub gensub2 gnuops2 gnuops3 gnureops icasefs \ + icasers igncdym igncfs ignrcase ignrcas2 lint lintold match1 match2 manyfiles \ + nondec nondec2 posix procinfs printfbad1 regx8bit rebuf reint reint2 rsstart1 \ + rsstart2 rsstart3 rstest6 shadow sort1 strtonum strftime whiny EXTRA_TESTS = regtest inftest INET_TESTS = inetechu inetecht inetdayu inetdayt # List of the tests which should be run with --lint option: -NEED_LINT = defref noeffect nofmtch shadow uninit2 uninit3 uninit4 uninitialized +NEED_LINT = defref fmtspcl noeffect nofmtch shadow uninit2 uninit3 uninit4 uninitialized + +# List of the tests which should be run with --lint-old option: +NEED_LINT_OLD = lintold + +# List of the tests which fail with EXIT CODE 1 +FAIL_CODE1 = fnarray2 fnmisc gsubasgn mixed1 noparms paramdup synerr1 synerr2 unterm # List of the files that appear in manual tests or are for reserve testing: GENTESTS_UNUSED = Makefile.in gtlnbufv.awk printfloat.awk switch2.awk @@ -719,7 +796,7 @@ regtest:: @echo 'Some of the output from regtest is very system specific, do not' @echo 'be distressed if your output differs from that distributed.' @echo 'Manual inspection is called for.' - AWK=`pwd`/$(AWK) $(srcdir)/regtest.sh + AWK=$(AWKPROG) $(srcdir)/regtest.sh manyfiles:: @echo manyfiles @@ -780,6 +857,11 @@ litoct:: @echo ab | $(AWK) --traditional -f $(srcdir)/litoct.awk >_$@ @-$(CMP) $(srcdir)/litoct.ok _$@ && rm -f _$@ +devfd:: + @echo $@ + @$(AWK) 1 /dev/fd/4 /dev/fd/5 4<$(srcdir)/devfd.in4 5<$(srcdir)/devfd.in5 >_$@ 2>&1 || echo EXIT CODE: $$? >> _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + fflush:: @echo $@ @$(srcdir)/fflush.sh >_$@ @@ -806,7 +888,7 @@ tradanch:: pid:: @echo pid @AWKPATH=$(srcdir) AWK=$(AWKPROG) $(SHELL) $(srcdir)/pid.sh $$$$ > _`basename $@` ; : - @-$(CMP) $(srcdir)/pid.ok _`basename $@` && rm -f _`basename $@` _`basename $@`.in + @-$(CMP) $(srcdir)/pid.ok _`basename $@` && rm -f _`basename $@` strftlng:: @echo $@ @@ -821,6 +903,14 @@ nors:: @echo A B C D E | tr -d '\12\15' | $(AWK) '{ print $$NF }' - $(srcdir)/nors.in > _$@ @-$(CMP) $(srcdir)/nors.ok _$@ && rm -f _$@ +fmtspcl.ok: fmtspcl.tok Makefile + @$(AWK) -v "sd=$(srcdir)" 'BEGIN {pnan = sprintf("%g",sqrt(-1)); nnan = sprintf("%g",-sqrt(-1)); pinf = sprintf("%g",-log(0)); ninf = sprintf("%g",log(0))} {sub(/positive_nan/,pnan); sub(/negative_nan/,nnan); sub(/positive_infinity/,pinf); sub(/negative_infinity/,ninf); sub(/fmtspcl/,(sd"/fmtspcl")); print}' < $(srcdir)/fmtspcl.tok > $@ 2>/dev/null + +fmtspcl: fmtspcl.ok + @echo fmtspcl + @$(AWK) -f $(srcdir)/fmtspcl.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $@.ok _$@ && rm -f _$@ + reint:: @echo $@ @$(AWK) --re-interval -f $(srcdir)/reint.awk $(srcdir)/reint.in >_$@ @@ -923,6 +1013,42 @@ whiny:: @WHINY_USERS=1 $(AWK) -f $(srcdir)/$@.awk $(srcdir)/$@.in >_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +wideidx:: + @echo $@ + @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +wideidx2:: + @echo $@ + @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +widesub:: + @echo $@ + @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +widesub2:: + @echo $@ + @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +widesub3:: + @echo $@ + @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +widesub4:: + @echo $@ + @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + ignrcas2:: @echo $@ @GAWKLOCALE=en_US ; export GAWKLOCALE ; \ @@ -967,14 +1093,70 @@ nondec2:: @$(AWK) --non-decimal-data -v a=0x1 -f $(srcdir)/$@.awk >_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +nofile:: + @echo $@ + @$(AWK) '{}' no/such/file >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +binmode1:: + @echo $@ + @$(AWK) -v BINMODE=3 'BEGIN { print BINMODE }' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +subi18n:: + @echo $@ + @GAWKLOCALE=en_US.UTF-8 ; $(AWK) -f $(srcdir)/$@.awk > _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +concat4:: + @echo $@ + @GAWKLOCALE=en_US.UTF-8 ; $(AWK) -f $(srcdir)/$@.awk $(srcdir)/$@.in > _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +devfd1:: + @echo $@ + @$(AWK) -f $(srcdir)/$@.awk 4< $(srcdir)/devfd.in1 5< $(srcdir)/devfd.in2 >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +# The program text is the '1' which will print each record. How compact can you get? +devfd2:: + @echo $@ + @$(AWK) 1 /dev/fd/4 /dev/fd/5 4< $(srcdir)/devfd.in1 5< $(srcdir)/devfd.in2 >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +mixed1:: + @echo $@ + @$(AWK) -f /dev/null --source 'BEGIN {return junk}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +mtchi18n:: + @echo $@ + @GAWKLOCALE=ru_RU.UTF-8 ; export GAWKLOCALE ; \ + $(AWK) -f $(srcdir)/$@.awk $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >> _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +reint2:: + @echo $@ + @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH=$(srcdir) $(AWK) --re-interval -f $@.awk $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +localenl:: + @echo $@ + @$(srcdir)/$@.sh >_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + + + # Targets generated for other tests: include Maketests $(srcdir)/Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests - $(AWK) -f $(srcdir)/Gentests "$(srcdir)/Makefile.am" *.awk *.in > $(srcdir)/Maketests + files=`cd "$(srcdir)" && echo *.awk *.in`; \ + $(AWK) -f $(srcdir)/Gentests "$(srcdir)/Makefile.am" $$files > $(srcdir)/Maketests clean: - rm -fr _* core core.* junk out1 out2 out3 strftime.ok test1 test2 seq *~ + rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ # An attempt to print something that can be grepped for in build logs pass-fail: @@ -988,10 +1170,31 @@ pass-fail: diffout: for i in _* ; \ do \ + if [ "$$i" != "_*" ]; then \ echo ============== $$i ============= ; \ + if [ -r $${i#_}.ok ]; then \ + diff -c $${i#_}.ok $$i ; \ + else \ diff -c $(srcdir)/$${i#_}.ok $$i ; \ + fi ; \ + fi ; \ done | more +# convenient way to scan valgrind results for errors +valgrind-scan: + @echo "Scanning valgrind log files for problems:" + @$(AWK) '\ + function show() {if (cmd) {printf "%s: %s\n",FILENAME,cmd; cmd = ""}; \ + printf "\t%s\n",$$0}; \ + {$$1 = ""}; \ + /Prog and args are:/ {incmd = 1; cmd = ""; next}; \ + incmd {if (NF == 1) incmd = 0; else {cmd = (cmd $$0); next}}; \ + /ERROR SUMMARY:/ && !/: 0 errors from 0 contexts/ {show()}; \ + /definitely lost:/ && !/: 0 bytes in 0 blocks/ {show()}; \ + /possibly lost:/ && !/: 0 bytes in 0 blocks/ {show()}; \ + / suppressed:/ && !/: 0 bytes in 0 blocks/ {show()}; \ + ' log.[0-9]* + # This target is for testing with electric fence. efence: for i in $$(ls _* | sed 's;_\(.*\);\1;') ; \ diff --git a/test/Makefile.in b/test/Makefile.in index 0ce9b099..0f273e65 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -17,14 +17,14 @@ # # test/Makefile.am --- automake input file for gawk # -# Copyright (C) 1988-2005 the Free Software Foundation, Inc. +# Copyright (C) 1988-2006 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 2 of the License, or +# 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, @@ -36,15 +36,11 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -63,13 +59,14 @@ DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ subdir = test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/intmax_t.m4 $(top_srcdir)/m4/inttypes_h.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/longlong.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/socket.m4 \ - $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/strtod.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intmax_t.m4 \ + $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/isc-posix.m4 \ + $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/socket.m4 $(top_srcdir)/m4/stdint_h.m4 \ $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -81,8 +78,6 @@ SOURCES = DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -108,6 +103,9 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ @@ -124,8 +122,9 @@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ +MKDIR_P = @MKDIR_P@ MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ @@ -145,12 +144,14 @@ U = @U@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -162,28 +163,39 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ EXTRA_DIST = \ reg \ lib \ @@ -260,6 +272,7 @@ EXTRA_DIST = \ backw.in \ backw.ok \ badargs.ok \ + binmode1.ok \ childin.awk \ childin.in \ childin.ok \ @@ -282,6 +295,9 @@ EXTRA_DIST = \ concat2.ok \ concat3.awk \ concat3.ok \ + concat4.awk \ + concat4.in \ + concat4.ok \ convfmt.awk \ convfmt.ok \ datanonl.awk \ @@ -295,6 +311,18 @@ EXTRA_DIST = \ delarpm2.ok \ delfunc.awk \ delfunc.ok \ + devfd.in1 \ + devfd.in2 \ + devfd.in4 \ + devfd.in5 \ + devfd.ok \ + devfd1.awk \ + devfd1.ok \ + devfd2.ok \ + double1.awk \ + double1.ok \ + double2.awk \ + double2.ok \ dynlj.awk \ dynlj.ok \ eofsplit.awk \ @@ -303,6 +331,7 @@ EXTRA_DIST = \ exitval1.ok \ exitval2.awk \ exitval2.ok \ + exitval2.w32 \ fflush.ok \ fflush.sh \ fieldwdth.awk \ @@ -314,6 +343,8 @@ EXTRA_DIST = \ fldchgnf.awk \ fldchgnf.in \ fldchgnf.ok \ + fmtspcl.awk \ + fmtspcl.tok \ fmttest.awk \ fmttest.ok \ fnamedat.awk \ @@ -360,6 +391,12 @@ EXTRA_DIST = \ funstack.awk \ funstack.in \ funstack.ok \ + fwtest.awk \ + fwtest.in \ + fwtest.ok \ + fwtest2.awk \ + fwtest2.in \ + fwtest2.ok \ gensub.awk \ gensub.in \ gensub.ok \ @@ -430,6 +467,8 @@ EXTRA_DIST = \ inputred.ok \ intest.awk \ intest.ok \ + intformat.awk \ + intformat.ok \ intprec.awk \ intprec.ok \ iobug1.awk \ @@ -441,8 +480,13 @@ EXTRA_DIST = \ leadnl.ok \ lint.awk \ lint.ok \ + lintold.awk \ + lintold.in \ + lintold.ok \ litoct.awk \ litoct.ok \ + localenl.ok \ + localenl.sh \ longdbl.awk \ longdbl.in \ longdbl.ok \ @@ -469,7 +513,11 @@ EXTRA_DIST = \ messages.awk \ minusstr.awk \ minusstr.ok \ + mixed1.ok \ mmap8k.in \ + mtchi18n.awk \ + mtchi18n.in \ + mtchi18n.ok \ nasty.awk \ nasty.ok \ nasty2.awk \ @@ -497,6 +545,7 @@ EXTRA_DIST = \ nlstrina.ok \ noeffect.awk \ noeffect.ok \ + nofile.ok \ nofmtch.awk \ nofmtch.ok \ noloop1.awk \ @@ -548,10 +597,18 @@ EXTRA_DIST = \ out1.ok \ out2.ok \ out3.ok \ + ovrflow1.awk \ + ovrflow1.ok \ paramdup.awk \ paramdup.ok \ paramtyp.awk \ paramtyp.ok \ + parse1.awk \ + parse1.in \ + parse1.ok \ + parsefld.awk \ + parsefld.in \ + parsefld.ok \ parseme.awk \ parseme.ok \ pcntplus.awk \ @@ -617,6 +674,9 @@ EXTRA_DIST = \ reint.awk \ reint.in \ reint.ok \ + reint2.awk \ + reint2.in \ + reint2.ok \ reparse.awk \ reparse.in \ reparse.ok \ @@ -686,6 +746,8 @@ EXTRA_DIST = \ strtod.awk \ strtod.in \ strtod.ok \ + strnum1.awk \ + strnum1.ok \ strtonum.awk \ strtonum.ok \ strftime.awk \ @@ -694,6 +756,8 @@ EXTRA_DIST = \ subamp.awk \ subamp.in \ subamp.ok \ + subi18n.awk \ + subi18n.ok \ subsepnm.awk \ subsepnm.ok \ subslash.awk \ @@ -706,6 +770,8 @@ EXTRA_DIST = \ switch2.awk \ synerr1.awk \ synerr1.ok \ + synerr2.awk \ + synerr2.ok \ tradanch.awk \ tradanch.in \ tradanch.ok \ @@ -725,9 +791,25 @@ EXTRA_DIST = \ whiny.awk \ whiny.in \ whiny.ok \ + wideidx.awk \ + wideidx.in \ + wideidx.ok \ + wideidx2.awk \ + wideidx2.ok \ + widesub.awk \ + widesub.ok \ + widesub2.awk \ + widesub2.ok \ + widesub3.awk \ + widesub3.in \ + widesub3.ok \ + widesub4.awk \ + widesub4.ok \ wjposer1.awk \ wjposer1.in \ wjposer1.ok \ + zero2.awk \ + zero2.ok \ zeroe0.awk \ zeroe0.ok \ zeroflag.awk \ @@ -735,46 +817,53 @@ EXTRA_DIST = \ TESTS_WE_ARE_NOT_DOING_YET_FIXME_ONE_DAY = longdbl -# Get rid of core files when cleaning -CLEANFILES = core core.* +# Get rid of core files when cleaning and generated .ok file +CLEANFILES = core core.* fmtspcl.ok # try to keep these sorted BASIC_TESTS = addcomma anchgsub argarray arrayparm arrayref arrymem1 \ arrayprm2 arrayprm3 arryref2 arryref3 arryref4 arryref5 arynasty \ arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5 aryprm6 aryprm7 \ aryprm8 arysubnm asgext awkpath back89 backgsub childin clobber \ - clsflnam compare compare2 concat1 concat2 concat3 convfmt datanonl defref \ - delarprm delarpm2 delfunc dynlj eofsplit exitval1 exitval2 fldchg fldchgnf fmttest fnamedat \ + clsflnam compare compare2 concat1 concat2 concat3 concat4 convfmt datanonl defref \ + delarprm delarpm2 delfunc dynlj eofsplit exitval1 exitval2 fldchg fldchgnf fmtspcl fmttest fnamedat \ fnarray fnarray2 fnarydel fnaryscl fnasgnm fnmisc fnparydl \ fordel forsimp fsbs fsspcoln fsrs fstabplus funsemnl funsmnam funstack getline \ getline2 getline3 getlnbuf getnr2tb getnr2tm gsubasgn gsubtest \ - gsubtst2 gsubtst3 gsubtst4 gsubtst5 hex hsprint inputred intest \ + gsubtst2 gsubtst3 gsubtst4 gsubtst5 hex hsprint inputred intest intformat \ intprec iobug1 leaddig leadnl litoct longsub longwrds manglprm math membug1 \ - messages minusstr mmap8k nasty nasty2 negexp nested nfldstr \ - nfneg nfset nlfldsep nlinstr nlstrina noeffect nofmtch noloop1 \ + messages minusstr mmap8k mtchi18n nasty nasty2 negexp nested nfldstr \ + nfneg nfset nlfldsep nlinstr nlstrina noeffect nofile nofmtch noloop1 \ noloop2 nonl noparms nors nulrsend numindex numsubstr octsub ofmt \ - ofmtbig ofmtfidl ofmts onlynl opasnidx opasnslf paramdup paramtyp \ - parseme pcntplus prdupval prec printf0 printf1 prmarscl prmreuse \ + ofmtbig ofmtfidl ofmts onlynl opasnidx opasnslf ovrflow1 paramdup paramtyp \ + parse1 parsefld parseme pcntplus prdupval prec printf0 printf1 prmarscl prmreuse \ prt1eval prtoeval psx96sub rand rebt8b1 rebt8b2 redfilnm regeq \ reindops reparse resplit rs rsnul1nl rsnulbig rsnulbig2 rstest1 \ rstest2 rstest3 rstest4 rstest5 rswhite scalar sclforin sclifin \ sortempty splitargv splitarr splitdef splitvar splitwht sprintfc \ - strcat1 strtod subamp subsepnm subslash substr swaplns synerr1 tradanch \ - tweakfld uninit2 uninit3 uninit4 uninitialized unterm wjposer1 \ - zeroe0 zeroflag - -UNIX_TESTS = fflush getlnhd pid pipeio1 pipeio2 poundbang space strftlng -GAWK_EXT_TESTS = argtest asort asorti backw badargs clos1way fieldwdth fsfwfs \ - gensub gensub2 gnuops2 gnuops3 gnureops icasefs icasers igncdym igncfs ignrcase \ - ignrcas2 lint match1 match2 manyfiles nondec nondec2 posix procinfs \ - printfbad1 regx8bit rebuf reint rsstart1 rsstart2 rsstart3 \ - rstest6 shadow sort1 strtonum strftime whiny + strcat1 strtod strnum1 subamp subi18n subsepnm subslash substr swaplns \ + synerr1 synerr2 tradanch \ + tweakfld uninit2 uninit3 uninit4 uninitialized unterm wideidx wideidx2 \ + widesub widesub2 widesub3 widesub4 wjposer1 zeroe0 zeroflag zero2 + +UNIX_TESTS = fflush getlnhd localenl pid pipeio1 pipeio2 poundbang space strftlng +GAWK_EXT_TESTS = argtest asort asorti backw badargs binmode1 clos1way devfd devfd1 devfd2 double1 double2 \ + fieldwdth fsfwfs fwtest fwtest2 gensub gensub2 gnuops2 gnuops3 gnureops icasefs \ + icasers igncdym igncfs ignrcase ignrcas2 lint lintold match1 match2 manyfiles \ + nondec nondec2 posix procinfs printfbad1 regx8bit rebuf reint reint2 rsstart1 \ + rsstart2 rsstart3 rstest6 shadow sort1 strtonum strftime whiny EXTRA_TESTS = regtest inftest INET_TESTS = inetechu inetecht inetdayu inetdayt # List of the tests which should be run with --lint option: -NEED_LINT = defref noeffect nofmtch shadow uninit2 uninit3 uninit4 uninitialized +NEED_LINT = defref fmtspcl noeffect nofmtch shadow uninit2 uninit3 uninit4 uninitialized + +# List of the tests which should be run with --lint-old option: +NEED_LINT_OLD = lintold + +# List of the tests which fail with EXIT CODE 1 +FAIL_CODE1 = fnarray2 fnmisc gsubasgn mixed1 noparms paramdup synerr1 synerr2 unterm # List of the files that appear in manual tests or are for reserve testing: GENTESTS_UNUSED = Makefile.in gtlnbufv.awk printfloat.awk switch2.awk @@ -812,7 +901,6 @@ $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -uninstall-info-am: tags: TAGS TAGS: @@ -821,22 +909,21 @@ CTAGS: distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ @@ -894,12 +981,20 @@ info-am: install-data-am: +install-dvi: install-dvi-am + install-exec-am: +install-html: install-html-am + install-info: install-info-am install-man: +install-pdf: install-pdf-am + +install-ps: install-ps-am + installcheck-am: maintainer-clean: maintainer-clean-am @@ -918,16 +1013,19 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am +uninstall-am: + +.MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-am + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am # Message stuff is to make it a little easier to follow. @@ -1018,7 +1116,7 @@ regtest:: @echo 'Some of the output from regtest is very system specific, do not' @echo 'be distressed if your output differs from that distributed.' @echo 'Manual inspection is called for.' - AWK=`pwd`/$(AWK) $(srcdir)/regtest.sh + AWK=$(AWKPROG) $(srcdir)/regtest.sh manyfiles:: @echo manyfiles @@ -1079,6 +1177,11 @@ litoct:: @echo ab | $(AWK) --traditional -f $(srcdir)/litoct.awk >_$@ @-$(CMP) $(srcdir)/litoct.ok _$@ && rm -f _$@ +devfd:: + @echo $@ + @$(AWK) 1 /dev/fd/4 /dev/fd/5 4<$(srcdir)/devfd.in4 5<$(srcdir)/devfd.in5 >_$@ 2>&1 || echo EXIT CODE: $$? >> _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + fflush:: @echo $@ @$(srcdir)/fflush.sh >_$@ @@ -1105,7 +1208,7 @@ tradanch:: pid:: @echo pid @AWKPATH=$(srcdir) AWK=$(AWKPROG) $(SHELL) $(srcdir)/pid.sh $$$$ > _`basename $@` ; : - @-$(CMP) $(srcdir)/pid.ok _`basename $@` && rm -f _`basename $@` _`basename $@`.in + @-$(CMP) $(srcdir)/pid.ok _`basename $@` && rm -f _`basename $@` strftlng:: @echo $@ @@ -1120,6 +1223,14 @@ nors:: @echo A B C D E | tr -d '\12\15' | $(AWK) '{ print $$NF }' - $(srcdir)/nors.in > _$@ @-$(CMP) $(srcdir)/nors.ok _$@ && rm -f _$@ +fmtspcl.ok: fmtspcl.tok Makefile + @$(AWK) -v "sd=$(srcdir)" 'BEGIN {pnan = sprintf("%g",sqrt(-1)); nnan = sprintf("%g",-sqrt(-1)); pinf = sprintf("%g",-log(0)); ninf = sprintf("%g",log(0))} {sub(/positive_nan/,pnan); sub(/negative_nan/,nnan); sub(/positive_infinity/,pinf); sub(/negative_infinity/,ninf); sub(/fmtspcl/,(sd"/fmtspcl")); print}' < $(srcdir)/fmtspcl.tok > $@ 2>/dev/null + +fmtspcl: fmtspcl.ok + @echo fmtspcl + @$(AWK) -f $(srcdir)/fmtspcl.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $@.ok _$@ && rm -f _$@ + reint:: @echo $@ @$(AWK) --re-interval -f $(srcdir)/reint.awk $(srcdir)/reint.in >_$@ @@ -1222,6 +1333,42 @@ whiny:: @WHINY_USERS=1 $(AWK) -f $(srcdir)/$@.awk $(srcdir)/$@.in >_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +wideidx:: + @echo $@ + @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +wideidx2:: + @echo $@ + @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +widesub:: + @echo $@ + @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +widesub2:: + @echo $@ + @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +widesub3:: + @echo $@ + @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +widesub4:: + @echo $@ + @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + ignrcas2:: @echo $@ @GAWKLOCALE=en_US ; export GAWKLOCALE ; \ @@ -1265,6 +1412,59 @@ nondec2:: @echo $@ @$(AWK) --non-decimal-data -v a=0x1 -f $(srcdir)/$@.awk >_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +nofile:: + @echo $@ + @$(AWK) '{}' no/such/file >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +binmode1:: + @echo $@ + @$(AWK) -v BINMODE=3 'BEGIN { print BINMODE }' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +subi18n:: + @echo $@ + @GAWKLOCALE=en_US.UTF-8 ; $(AWK) -f $(srcdir)/$@.awk > _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +concat4:: + @echo $@ + @GAWKLOCALE=en_US.UTF-8 ; $(AWK) -f $(srcdir)/$@.awk $(srcdir)/$@.in > _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +devfd1:: + @echo $@ + @$(AWK) -f $(srcdir)/$@.awk 4< $(srcdir)/devfd.in1 5< $(srcdir)/devfd.in2 >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +# The program text is the '1' which will print each record. How compact can you get? +devfd2:: + @echo $@ + @$(AWK) 1 /dev/fd/4 /dev/fd/5 4< $(srcdir)/devfd.in1 5< $(srcdir)/devfd.in2 >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +mixed1:: + @echo $@ + @$(AWK) -f /dev/null --source 'BEGIN {return junk}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +mtchi18n:: + @echo $@ + @GAWKLOCALE=ru_RU.UTF-8 ; export GAWKLOCALE ; \ + $(AWK) -f $(srcdir)/$@.awk $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >> _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +reint2:: + @echo $@ + @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ + AWKPATH=$(srcdir) $(AWK) --re-interval -f $@.awk $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +localenl:: + @echo $@ + @$(srcdir)/$@.sh >_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: @@ -1622,6 +1822,11 @@ intest: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +intformat: + @echo intformat + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + intprec: @echo intprec @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1797,6 +2002,11 @@ opasnslf: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +ovrflow1: + @echo ovrflow1 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + paramdup: @echo paramdup @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1807,6 +2017,16 @@ paramtyp: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +parse1: + @echo parse1 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +parsefld: + @echo parsefld + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + parseme: @echo parseme @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1992,6 +2212,11 @@ strtod: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +strnum1: + @echo strnum1 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + subsepnm: @echo subsepnm @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -2017,6 +2242,11 @@ synerr1: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +synerr2: + @echo synerr2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + uninit2: @echo uninit2 @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -2057,6 +2287,11 @@ zeroflag: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +zero2: + @echo zero2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + getlnhd: @echo getlnhd @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -2082,6 +2317,16 @@ clos1way: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +double1: + @echo double1 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +double2: + @echo double2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + fieldwdth: @echo fieldwdth @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -2092,6 +2337,16 @@ fsfwfs: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +fwtest: + @echo fwtest + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +fwtest2: + @echo fwtest2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + gensub: @echo gensub @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -2147,6 +2402,11 @@ lint: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +lintold: + @echo lintold + @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint-old < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + match1: @echo match1 @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -2212,10 +2472,11 @@ strtonum: # Targets generated for other tests: $(srcdir)/Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests - $(AWK) -f $(srcdir)/Gentests "$(srcdir)/Makefile.am" *.awk *.in > $(srcdir)/Maketests + files=`cd "$(srcdir)" && echo *.awk *.in`; \ + $(AWK) -f $(srcdir)/Gentests "$(srcdir)/Makefile.am" $$files > $(srcdir)/Maketests clean: - rm -fr _* core core.* junk out1 out2 out3 strftime.ok test1 test2 seq *~ + rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ # An attempt to print something that can be grepped for in build logs pass-fail: @@ -2229,10 +2490,31 @@ pass-fail: diffout: for i in _* ; \ do \ + if [ "$$i" != "_*" ]; then \ echo ============== $$i ============= ; \ + if [ -r $${i#_}.ok ]; then \ + diff -c $${i#_}.ok $$i ; \ + else \ diff -c $(srcdir)/$${i#_}.ok $$i ; \ + fi ; \ + fi ; \ done | more +# convenient way to scan valgrind results for errors +valgrind-scan: + @echo "Scanning valgrind log files for problems:" + @$(AWK) '\ + function show() {if (cmd) {printf "%s: %s\n",FILENAME,cmd; cmd = ""}; \ + printf "\t%s\n",$$0}; \ + {$$1 = ""}; \ + /Prog and args are:/ {incmd = 1; cmd = ""; next}; \ + incmd {if (NF == 1) incmd = 0; else {cmd = (cmd $$0); next}}; \ + /ERROR SUMMARY:/ && !/: 0 errors from 0 contexts/ {show()}; \ + /definitely lost:/ && !/: 0 bytes in 0 blocks/ {show()}; \ + /possibly lost:/ && !/: 0 bytes in 0 blocks/ {show()}; \ + / suppressed:/ && !/: 0 bytes in 0 blocks/ {show()}; \ + ' log.[0-9]* + # This target is for testing with electric fence. efence: for i in $$(ls _* | sed 's;_\(.*\);\1;') ; \ diff --git a/test/Maketests b/test/Maketests index cb117521..8edf10c5 100644 --- a/test/Maketests +++ b/test/Maketests @@ -355,6 +355,11 @@ intest: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +intformat: + @echo intformat + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + intprec: @echo intprec @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -530,6 +535,11 @@ opasnslf: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +ovrflow1: + @echo ovrflow1 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + paramdup: @echo paramdup @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -540,6 +550,16 @@ paramtyp: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +parse1: + @echo parse1 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +parsefld: + @echo parsefld + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + parseme: @echo parseme @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -725,6 +745,11 @@ strtod: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +strnum1: + @echo strnum1 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + subsepnm: @echo subsepnm @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -750,6 +775,11 @@ synerr1: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +synerr2: + @echo synerr2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + uninit2: @echo uninit2 @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -790,6 +820,11 @@ zeroflag: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +zero2: + @echo zero2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + getlnhd: @echo getlnhd @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -815,6 +850,16 @@ clos1way: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +double1: + @echo double1 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +double2: + @echo double2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + fieldwdth: @echo fieldwdth @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -825,6 +870,16 @@ fsfwfs: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +fwtest: + @echo fwtest + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +fwtest2: + @echo fwtest2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + gensub: @echo gensub @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -880,6 +935,11 @@ lint: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +lintold: + @echo lintold + @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint-old < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + match1: @echo match1 @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/badargs.ok b/test/badargs.ok index 5c3bba71..28e42360 100644 --- a/test/badargs.ok +++ b/test/badargs.ok @@ -22,6 +22,7 @@ POSIX options: GNU long options: -W source=program-text --source=program-text -W traditional --traditional -W usage --usage + -W use-lc-numeric --use-lc-numeric -W version --version To report bugs, see node `Bugs' in `gawk.info', which is diff --git a/test/binmode1.ok b/test/binmode1.ok new file mode 100644 index 00000000..00750edc --- /dev/null +++ b/test/binmode1.ok @@ -0,0 +1 @@ +3 diff --git a/test/concat4.awk b/test/concat4.awk new file mode 100644 index 00000000..e6cf24fb --- /dev/null +++ b/test/concat4.awk @@ -0,0 +1,7 @@ +{ + a = $0 + print index(a,"b") + getline + a = a $0 + print index(a,"b") +} diff --git a/test/concat4.in b/test/concat4.in new file mode 100644 index 00000000..3bd1f0e2 --- /dev/null +++ b/test/concat4.in @@ -0,0 +1,2 @@ +foo +bar diff --git a/test/concat4.ok b/test/concat4.ok new file mode 100644 index 00000000..4f1d7cd3 --- /dev/null +++ b/test/concat4.ok @@ -0,0 +1,2 @@ +0 +4 diff --git a/test/devfd.in1 b/test/devfd.in1 new file mode 100644 index 00000000..0e50e690 --- /dev/null +++ b/test/devfd.in1 @@ -0,0 +1,20 @@ +this is file f1, line 1 +this is file f1, line 2 +this is file f1, line 3 +this is file f1, line 4 +this is file f1, line 5 +this is file f1, line 6 +this is file f1, line 7 +this is file f1, line 8 +this is file f1, line 9 +this is file f1, line 10 +this is file f1, line 11 +this is file f1, line 12 +this is file f1, line 13 +this is file f1, line 14 +this is file f1, line 15 +this is file f1, line 16 +this is file f1, line 17 +this is file f1, line 18 +this is file f1, line 19 +this is file f1, line 20 diff --git a/test/devfd.in2 b/test/devfd.in2 new file mode 100644 index 00000000..d3299a9d --- /dev/null +++ b/test/devfd.in2 @@ -0,0 +1,20 @@ +this is file f2, line 1 +this is file f2, line 2 +this is file f2, line 3 +this is file f2, line 4 +this is file f2, line 5 +this is file f2, line 6 +this is file f2, line 7 +this is file f2, line 8 +this is file f2, line 9 +this is file f2, line 10 +this is file f2, line 11 +this is file f2, line 12 +this is file f2, line 13 +this is file f2, line 14 +this is file f2, line 15 +this is file f2, line 16 +this is file f2, line 17 +this is file f2, line 18 +this is file f2, line 19 +this is file f2, line 20 diff --git a/test/devfd.in4 b/test/devfd.in4 new file mode 100644 index 00000000..57da1f80 --- /dev/null +++ b/test/devfd.in4 @@ -0,0 +1 @@ +file on fd 4 diff --git a/test/devfd.in5 b/test/devfd.in5 new file mode 100644 index 00000000..4469cb4d --- /dev/null +++ b/test/devfd.in5 @@ -0,0 +1 @@ +file on fd 5 diff --git a/test/devfd.ok b/test/devfd.ok new file mode 100644 index 00000000..14f8f2e5 --- /dev/null +++ b/test/devfd.ok @@ -0,0 +1,2 @@ +file on fd 4 +file on fd 5 diff --git a/test/devfd1.awk b/test/devfd1.awk new file mode 100644 index 00000000..6795704d --- /dev/null +++ b/test/devfd1.awk @@ -0,0 +1,11 @@ +BEGIN { + while (1) { + if ((getline l1 < "/dev/fd/4") <= 0) + break + print l1 + + if ((getline l2 < "/dev/fd/5") <= 0) + break + print l2 + } +} diff --git a/test/devfd1.ok b/test/devfd1.ok new file mode 100644 index 00000000..359d7d34 --- /dev/null +++ b/test/devfd1.ok @@ -0,0 +1,40 @@ +this is file f1, line 1 +this is file f2, line 1 +this is file f1, line 2 +this is file f2, line 2 +this is file f1, line 3 +this is file f2, line 3 +this is file f1, line 4 +this is file f2, line 4 +this is file f1, line 5 +this is file f2, line 5 +this is file f1, line 6 +this is file f2, line 6 +this is file f1, line 7 +this is file f2, line 7 +this is file f1, line 8 +this is file f2, line 8 +this is file f1, line 9 +this is file f2, line 9 +this is file f1, line 10 +this is file f2, line 10 +this is file f1, line 11 +this is file f2, line 11 +this is file f1, line 12 +this is file f2, line 12 +this is file f1, line 13 +this is file f2, line 13 +this is file f1, line 14 +this is file f2, line 14 +this is file f1, line 15 +this is file f2, line 15 +this is file f1, line 16 +this is file f2, line 16 +this is file f1, line 17 +this is file f2, line 17 +this is file f1, line 18 +this is file f2, line 18 +this is file f1, line 19 +this is file f2, line 19 +this is file f1, line 20 +this is file f2, line 20 diff --git a/test/devfd2.ok b/test/devfd2.ok new file mode 100644 index 00000000..be928c1b --- /dev/null +++ b/test/devfd2.ok @@ -0,0 +1,40 @@ +this is file f1, line 1 +this is file f1, line 2 +this is file f1, line 3 +this is file f1, line 4 +this is file f1, line 5 +this is file f1, line 6 +this is file f1, line 7 +this is file f1, line 8 +this is file f1, line 9 +this is file f1, line 10 +this is file f1, line 11 +this is file f1, line 12 +this is file f1, line 13 +this is file f1, line 14 +this is file f1, line 15 +this is file f1, line 16 +this is file f1, line 17 +this is file f1, line 18 +this is file f1, line 19 +this is file f1, line 20 +this is file f2, line 1 +this is file f2, line 2 +this is file f2, line 3 +this is file f2, line 4 +this is file f2, line 5 +this is file f2, line 6 +this is file f2, line 7 +this is file f2, line 8 +this is file f2, line 9 +this is file f2, line 10 +this is file f2, line 11 +this is file f2, line 12 +this is file f2, line 13 +this is file f2, line 14 +this is file f2, line 15 +this is file f2, line 16 +this is file f2, line 17 +this is file f2, line 18 +this is file f2, line 19 +this is file f2, line 20 diff --git a/test/double1.awk b/test/double1.awk new file mode 100644 index 00000000..70a6fb65 --- /dev/null +++ b/test/double1.awk @@ -0,0 +1,4 @@ +BEGIN { + print 9223372036854775808 + printf("%d\n", 9223372036854775808) +} diff --git a/test/double1.ok b/test/double1.ok new file mode 100644 index 00000000..e07477e1 --- /dev/null +++ b/test/double1.ok @@ -0,0 +1,2 @@ +9223372036854775808 +9223372036854775808 diff --git a/test/double2.awk b/test/double2.awk new file mode 100644 index 00000000..e826eeca --- /dev/null +++ b/test/double2.awk @@ -0,0 +1,46 @@ +# Date: Mon, 19 Dec 2005 18:14:13 -0800 +# From: David Ellsworth <ellswort@nas.nasa.gov> +# Subject: Re: gawk number to string bug +# To: eggert@CS.UCLA.EDU, eliz@gnu.org +# Cc: arnold@skeeve.com, aschorr@telemetry-investments.com, +# bug-gnu-utils@gnu.org, ellswort@nas.nasa.gov +# Message-id: <200512200214.jBK2EDuu020216@ece03.nas.nasa.gov> +# +# Since you are taking my bug report seriously (which is really great), +# let me add some more fuel to the fire. Consider this program: +# +# BEGIN { x=2**60; for(i=60;i<=65;i++) { printf "2^%d= %s %d %g\n",i,x,x,x; x*=2}} +# +# which prints out powers of two around 2^63. On an Opteron (as well as +# an Itanium), you get +# +# 2^60= 1152921504606846976 1152921504606846976 1.15292e+18 +# 2^61= 2305843009213693952 2305843009213693952 2.30584e+18 +# 2^62= 4611686018427387904 4611686018427387904 4.61169e+18 +# 2^63= -9223372036854775808 9223372036854775808 9.22337e+18 +# 2^64= 1.84467e+19 0 1.84467e+19 +# 2^65= 3.68935e+19 3.68935e+19 3.68935e+19 +# +# On a Xeon, you get +# +# 2^60= 1.15292e+18 1152921504606846976 1.15292e+18 +# 2^61= 2.30584e+18 2305843009213693952 2.30584e+18 +# 2^62= 4.61169e+18 4611686018427387904 4.61169e+18 +# 2^63= 9.22337e+18 9223372036854775808 9.22337e+18 +# 2^64= 1.84467e+19 0 1.84467e+19 +# 2^65= 3.68935e+19 3.68935e+19 3.68935e+19 +# +# The 2^64 value for %d is probably also a bug since the outputs +# for 2^63 and 2^65 are reasonable. +# +# - David +# + +BEGIN { + x = 2 ^ 60 +# for (i = 60; i <= 65; i++) { + for (i = 60; i <= 63; i++) { + printf "2^%d= %s %d %g %o\n", i, x, x, x, x + x *= 2 + } +} diff --git a/test/double2.ok b/test/double2.ok new file mode 100644 index 00000000..f7224e2a --- /dev/null +++ b/test/double2.ok @@ -0,0 +1,4 @@ +2^60= 1152921504606846976 1152921504606846976 1.15292e+18 100000000000000000000 +2^61= 2305843009213693952 2305843009213693952 2.30584e+18 200000000000000000000 +2^62= 4611686018427387904 4611686018427387904 4.61169e+18 400000000000000000000 +2^63= 9223372036854775808 9223372036854775808 9.22337e+18 1000000000000000000000 diff --git a/test/exitval2.w32 b/test/exitval2.w32 new file mode 100644 index 00000000..7f003663 --- /dev/null +++ b/test/exitval2.w32 @@ -0,0 +1,3 @@ +BEGIN { print "foo" | "sh -c \"read x ; echo $x ; exit 12\"" } +# this should still exit 0, as pointed out by kenny mccormack in +# comp.lang.awk on 2 feb 2005 diff --git a/test/fmtspcl.awk b/test/fmtspcl.awk new file mode 100644 index 00000000..6f037a3a --- /dev/null +++ b/test/fmtspcl.awk @@ -0,0 +1,26 @@ +function display(x,str, i,res) { + for (i = 0; i < n; i++) { + if ((res = sprintf(formats[i],x)) != str) + printf "sprintf(%s,%s) = %s (!= %s)\n", + formats[i],x,res,str + } +} + +BEGIN { + nan = sqrt(-1) + nan_str = sprintf("%f",nan) + nnan_str = sprintf("%f",-nan) + inf = -log(0) + inf_str = sprintf("%f",inf) + + n = 0 + formats[n++] = "%f" + formats[n++] = "%s" + formats[n++] = "%g" + formats[n++] = "%x" + formats[n++] = "%d" + display(nan,nan_str) + display(-nan,nnan_str) + display(inf,inf) + display(-inf,"-"inf_str) +} diff --git a/test/fmtspcl.tok b/test/fmtspcl.tok new file mode 100644 index 00000000..6bfb077d --- /dev/null +++ b/test/fmtspcl.tok @@ -0,0 +1,9 @@ +gawk: fmtspcl.awk:10: warning: sqrt: called with negative argument -1 +gawk: fmtspcl.awk:6: warning: [s]printf: value positive_nan is out of range for `%x' format +gawk: fmtspcl.awk:6: warning: [s]printf: value positive_nan is out of range for `%d' format +gawk: fmtspcl.awk:6: warning: [s]printf: value negative_nan is out of range for `%x' format +gawk: fmtspcl.awk:6: warning: [s]printf: value negative_nan is out of range for `%d' format +gawk: fmtspcl.awk:6: warning: [s]printf: value positive_infinity is out of range for `%x' format +gawk: fmtspcl.awk:6: warning: [s]printf: value positive_infinity is out of range for `%d' format +gawk: fmtspcl.awk:6: warning: [s]printf: value negative_infinity is out of range for `%x' format +gawk: fmtspcl.awk:6: warning: [s]printf: value negative_infinity is out of range for `%d' format diff --git a/test/fnarray.ok b/test/fnarray.ok index 3ee41814..c680c349 100644 --- a/test/fnarray.ok +++ b/test/fnarray.ok @@ -1,3 +1,5 @@ gawk: fnarray.awk:5: Num = foo[c] gawk: fnarray.awk:5: ^ use of non-array as array -EXIT CODE: 1 +gawk: fnarray.awk:5: fatal: function `foo' called with space between name and `(', +or used as a variable or an array +EXIT CODE: 2 diff --git a/test/fwtest.awk b/test/fwtest.awk new file mode 100644 index 00000000..730aeda8 --- /dev/null +++ b/test/fwtest.awk @@ -0,0 +1,2 @@ +BEGIN { FIELDWIDTHS = "1 1 1" } +{ print NF, $1, $2, $3 } diff --git a/test/fwtest.in b/test/fwtest.in new file mode 100644 index 00000000..8baef1b4 --- /dev/null +++ b/test/fwtest.in @@ -0,0 +1 @@ +abc diff --git a/test/fwtest.ok b/test/fwtest.ok new file mode 100644 index 00000000..f2e4bc6b --- /dev/null +++ b/test/fwtest.ok @@ -0,0 +1 @@ +3 a b c diff --git a/test/fwtest2.awk b/test/fwtest2.awk new file mode 100644 index 00000000..f9df5833 --- /dev/null +++ b/test/fwtest2.awk @@ -0,0 +1,59 @@ +# Date: Fri, 24 Mar 2006 15:17:24 +0100 +# From: =?UTF-8?Q?Ram=C3=B3n_Garc=C3=ADa?= <ramon.garcia.f@gmail.com> +# Subject: Re: Bug when parsing FIELDWIDTHS +# In-reply-to: <200603241144.k2OBiFOX030158@skeeve.com> +# To: Aharon Robbins <arnold@skeeve.com> +# Message-id: <daa40b5d0603240617j1b7e8861g3963035eafdeba1e@mail.gmail.com> +# MIME-version: 1.0 +# Content-type: multipart/mixed; boundary="----=_Part_9022_17179442.1143209844259" +# DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; +# h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; +# b=QVst9uUwAllKuDwXhuHbNjpRJStt3nEGc7p+BMG+HNk/qyHmnG/TYXSvIVKgZFja1thLhYbPYncw2MyEHtKyZuiTJCYqvpjWeST9qQNfxVMeu8FahqAky7n8ldsjOK6ncbCoE3hZe/g/Z9ZsVFC9LORXvM5uo7y1MGkUhgxO4qU= +# +# ------=_Part_9022_17179442.1143209844259 +# Content-Type: text/plain; charset=UTF-8 +# Content-Transfer-Encoding: base64 +# Content-Disposition: inline +# +# DQpTdXJlLiBIZXJlIGl0IGlzLg0KDQojIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj +# IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjDQpUaGlz +# IE1haWwgV2FzIFNjYW5uZWQgYnkgMDEyLm5ldCBBbnRpVmlydXMgU2VydmljZTItIFBvd2VyZWQg +# YnkgVHJlbmRNaWNybyBJbnRlcnNjYW4NCg== +# ------=_Part_9022_17179442.1143209844259 +# Content-Type: application/octet-stream; name=bug_data +# Content-Transfer-Encoding: 7bit +# X-Attachment-Id: f_el6ll617 +# Content-Disposition: attachment; filename="bug_data" +# +# 0.4867373206 1.3206333033 -0.2333178127 +# 0.5668176165 1.3711756314 -0.2193558040 +# 0.4325251781 1.3399488722 -0.1568307497 +# 0.4900487563 1.3295759570 -0.2217392402 +# -0.6790064191 1.2536623801 -0.2955415433 +# -0.6311440220 1.2966579993 -0.2246692210 +# -0.7209390351 1.1783407099 -0.2539408209 +# -0.6782473356 1.2495242556 -0.2811436366 +# -0.7062054082 1.1223820964 -1.1619805834 +# -0.6491590119 1.1248946162 -1.0851579675 +# -0.7948856821 1.1208852325 -1.1259821556 +# -0.7102549262 1.1225121126 -1.1475381286 +# +# ------=_Part_9022_17179442.1143209844259 +# Content-Type: application/octet-stream; name=bug.awk +# Content-Transfer-Encoding: 7bit +# X-Attachment-Id: f_el6llnjj +# Content-Disposition: attachment; filename="bug.awk" +# +#!/usr/bin/awk -f +BEGIN { + FIELDWIDTHS = "15 15 15"; +} +{ + x = $1; + y = $2; + z = $3; + print "x y z", x, y, z +} +# +# ------=_Part_9022_17179442.1143209844259-- +# diff --git a/test/fwtest2.in b/test/fwtest2.in new file mode 100644 index 00000000..93f4f007 --- /dev/null +++ b/test/fwtest2.in @@ -0,0 +1,12 @@ + 0.4867373206 1.3206333033 -0.2333178127 + 0.5668176165 1.3711756314 -0.2193558040 + 0.4325251781 1.3399488722 -0.1568307497 + 0.4900487563 1.3295759570 -0.2217392402 + -0.6790064191 1.2536623801 -0.2955415433 + -0.6311440220 1.2966579993 -0.2246692210 + -0.7209390351 1.1783407099 -0.2539408209 + -0.6782473356 1.2495242556 -0.2811436366 + -0.7062054082 1.1223820964 -1.1619805834 + -0.6491590119 1.1248946162 -1.0851579675 + -0.7948856821 1.1208852325 -1.1259821556 + -0.7102549262 1.1225121126 -1.1475381286 diff --git a/test/fwtest2.ok b/test/fwtest2.ok new file mode 100644 index 00000000..a53d2dfb --- /dev/null +++ b/test/fwtest2.ok @@ -0,0 +1,12 @@ +x y z 0.4867373206 1.3206333033 -0.2333178127 +x y z 0.5668176165 1.3711756314 -0.2193558040 +x y z 0.4325251781 1.3399488722 -0.1568307497 +x y z 0.4900487563 1.3295759570 -0.2217392402 +x y z -0.6790064191 1.2536623801 -0.2955415433 +x y z -0.6311440220 1.2966579993 -0.2246692210 +x y z -0.7209390351 1.1783407099 -0.2539408209 +x y z -0.6782473356 1.2495242556 -0.2811436366 +x y z -0.7062054082 1.1223820964 -1.1619805834 +x y z -0.6491590119 1.1248946162 -1.0851579675 +x y z -0.7948856821 1.1208852325 -1.1259821556 +x y z -0.7102549262 1.1225121126 -1.1475381286 diff --git a/test/getline.awk b/test/getline.awk index fc09f789..4601ca11 100644 --- a/test/getline.awk +++ b/test/getline.awk @@ -26,4 +26,8 @@ BEGIN { a = cmd | getline x close(cmd) print a, x + + # Concatenation has higher precedence than IO. + "echo " "date" | getline + print } diff --git a/test/getline.ok b/test/getline.ok index dd5bdb64..a033cb65 100644 --- a/test/getline.ok +++ b/test/getline.ok @@ -5,3 +5,4 @@ 2 B -1 C 1 D +date diff --git a/test/hsprint.awk b/test/hsprint.awk index d17cedeb..facc109d 100644 --- a/test/hsprint.awk +++ b/test/hsprint.awk @@ -51,7 +51,7 @@ BEGIN { substr(spc,s,1) substr(alt,a,1) substr(zero,z,1); fstr = sprintf(\ "%6s|%s%s|%s%s|%s%s|%s%s|%s%s|%s%s|\n", - fmt, + "%" fmt, fmt, oper[r], fmt, oper[r+1], fmt, oper[r+2], @@ -69,6 +69,3 @@ BEGIN { print ""; } } - - - diff --git a/test/hsprint.ok b/test/hsprint.ok index 55fd16f3..88fa832a 100644 --- a/test/hsprint.ok +++ b/test/hsprint.ok @@ -1,66 +1,66 @@ - %| 45| 55| 2d| 12.68| 1.27e+01| 12.68| - %0|00045|00055|0002d|0012.68|001.27e+01|0000012.68| - %#| 45| 055| 0x2d| 12.68| 1.27e+01| 12.68| - %#0|00045|00055|0x02d|0012.68|001.27e+01|0000012.68| - % | 45| 55| 2d| 12.68| 1.27e+01| 12.68| - % 0| 0045|00055|0002d| 012.68| 01.27e+01| 000012.68| - % #| 45| 055| 0x2d| 12.68| 1.27e+01| 12.68| - % #0| 0045|00055|0x02d| 012.68| 01.27e+01| 000012.68| - %+| +45| 55| 2d| +12.68| +1.27e+01| +12.68| - %+0|+0045|00055|0002d|+012.68|+01.27e+01|+000012.68| - %+#| +45| 055| 0x2d| +12.68| +1.27e+01| +12.68| - %+#0|+0045|00055|0x02d|+012.68|+01.27e+01|+000012.68| - %+ | +45| 55| 2d| +12.68| +1.27e+01| +12.68| - %+ 0|+0045|00055|0002d|+012.68|+01.27e+01|+000012.68| - %+ #| +45| 055| 0x2d| +12.68| +1.27e+01| +12.68| - %+ #0|+0045|00055|0x02d|+012.68|+01.27e+01|+000012.68| - %-|45 |55 |2d |12.68 |1.27e+01 |12.68 | - %-0|45 |55 |2d |12.68 |1.27e+01 |12.68 | - %-#|45 |055 |0x2d |12.68 |1.27e+01 |12.68 | - %-#0|45 |055 |0x2d |12.68 |1.27e+01 |12.68 | - %- | 45 |55 |2d | 12.68 | 1.27e+01 | 12.68 | - %- 0| 45 |55 |2d | 12.68 | 1.27e+01 | 12.68 | - %- #| 45 |055 |0x2d | 12.68 | 1.27e+01 | 12.68 | - %- #0| 45 |055 |0x2d | 12.68 | 1.27e+01 | 12.68 | - %-+|+45 |55 |2d |+12.68 |+1.27e+01 |+12.68 | - %-+0|+45 |55 |2d |+12.68 |+1.27e+01 |+12.68 | - %-+#|+45 |055 |0x2d |+12.68 |+1.27e+01 |+12.68 | - %-+#0|+45 |055 |0x2d |+12.68 |+1.27e+01 |+12.68 | - %-+ |+45 |55 |2d |+12.68 |+1.27e+01 |+12.68 | - %-+ 0|+45 |55 |2d |+12.68 |+1.27e+01 |+12.68 | - %-+ #|+45 |055 |0x2d |+12.68 |+1.27e+01 |+12.68 | + %| 45| 55| 2d| 12.68| 1.27e+01| 12.68| + %0|00045|00055|0002d|0012.68|001.27e+01|0000012.68| + %#| 45| 055| 0x2d| 12.68| 1.27e+01| 12.68| + %#0|00045|00055|0x02d|0012.68|001.27e+01|0000012.68| + % | 45| 55| 2d| 12.68| 1.27e+01| 12.68| + % 0| 0045|00055|0002d| 012.68| 01.27e+01| 000012.68| + % #| 45| 055| 0x2d| 12.68| 1.27e+01| 12.68| + % #0| 0045|00055|0x02d| 012.68| 01.27e+01| 000012.68| + %+| +45| 55| 2d| +12.68| +1.27e+01| +12.68| + %+0|+0045|00055|0002d|+012.68|+01.27e+01|+000012.68| + %+#| +45| 055| 0x2d| +12.68| +1.27e+01| +12.68| + %+#0|+0045|00055|0x02d|+012.68|+01.27e+01|+000012.68| + %+ | +45| 55| 2d| +12.68| +1.27e+01| +12.68| + %+ 0|+0045|00055|0002d|+012.68|+01.27e+01|+000012.68| + %+ #| +45| 055| 0x2d| +12.68| +1.27e+01| +12.68| +%+ #0|+0045|00055|0x02d|+012.68|+01.27e+01|+000012.68| + %-|45 |55 |2d |12.68 |1.27e+01 |12.68 | + %-0|45 |55 |2d |12.68 |1.27e+01 |12.68 | + %-#|45 |055 |0x2d |12.68 |1.27e+01 |12.68 | + %-#0|45 |055 |0x2d |12.68 |1.27e+01 |12.68 | + %- | 45 |55 |2d | 12.68 | 1.27e+01 | 12.68 | + %- 0| 45 |55 |2d | 12.68 | 1.27e+01 | 12.68 | + %- #| 45 |055 |0x2d | 12.68 | 1.27e+01 | 12.68 | +%- #0| 45 |055 |0x2d | 12.68 | 1.27e+01 | 12.68 | + %-+|+45 |55 |2d |+12.68 |+1.27e+01 |+12.68 | + %-+0|+45 |55 |2d |+12.68 |+1.27e+01 |+12.68 | + %-+#|+45 |055 |0x2d |+12.68 |+1.27e+01 |+12.68 | +%-+#0|+45 |055 |0x2d |+12.68 |+1.27e+01 |+12.68 | + %-+ |+45 |55 |2d |+12.68 |+1.27e+01 |+12.68 | +%-+ 0|+45 |55 |2d |+12.68 |+1.27e+01 |+12.68 | +%-+ #|+45 |055 |0x2d |+12.68 |+1.27e+01 |+12.68 | %-+ #0|+45 |055 |0x2d |+12.68 |+1.27e+01 |+12.68 | - %| zap| *| -3| -3.46| -3.46e+00| -3.457| - %0|00zap|0000*|-000003|-003.46|-03.46e+00|-00003.457| - %#| zap| *| -3.| -3.46| -3.46e+00| -3.457| - %#0|00zap|0000*|-00003.|-003.46|-03.46e+00|-00003.457| - % | zap| *| -3| -3.46| -3.46e+00| -3.457| - % 0|00zap|0000*|-000003|-003.46|-03.46e+00|-00003.457| - % #| zap| *| -3.| -3.46| -3.46e+00| -3.457| - % #0|00zap|0000*|-00003.|-003.46|-03.46e+00|-00003.457| - %+| zap| *| -3| -3.46| -3.46e+00| -3.457| - %+0|00zap|0000*|-000003|-003.46|-03.46e+00|-00003.457| - %+#| zap| *| -3.| -3.46| -3.46e+00| -3.457| - %+#0|00zap|0000*|-00003.|-003.46|-03.46e+00|-00003.457| - %+ | zap| *| -3| -3.46| -3.46e+00| -3.457| - %+ 0|00zap|0000*|-000003|-003.46|-03.46e+00|-00003.457| - %+ #| zap| *| -3.| -3.46| -3.46e+00| -3.457| - %+ #0|00zap|0000*|-00003.|-003.46|-03.46e+00|-00003.457| - %-|zap |* |-3 |-3.46 |-3.46e+00 |-3.457 | - %-0|zap |* |-3 |-3.46 |-3.46e+00 |-3.457 | - %-#|zap |* |-3. |-3.46 |-3.46e+00 |-3.457 | - %-#0|zap |* |-3. |-3.46 |-3.46e+00 |-3.457 | - %- |zap |* |-3 |-3.46 |-3.46e+00 |-3.457 | - %- 0|zap |* |-3 |-3.46 |-3.46e+00 |-3.457 | - %- #|zap |* |-3. |-3.46 |-3.46e+00 |-3.457 | - %- #0|zap |* |-3. |-3.46 |-3.46e+00 |-3.457 | - %-+|zap |* |-3 |-3.46 |-3.46e+00 |-3.457 | - %-+0|zap |* |-3 |-3.46 |-3.46e+00 |-3.457 | - %-+#|zap |* |-3. |-3.46 |-3.46e+00 |-3.457 | - %-+#0|zap |* |-3. |-3.46 |-3.46e+00 |-3.457 | - %-+ |zap |* |-3 |-3.46 |-3.46e+00 |-3.457 | - %-+ 0|zap |* |-3 |-3.46 |-3.46e+00 |-3.457 | - %-+ #|zap |* |-3. |-3.46 |-3.46e+00 |-3.457 | + %| zap| *| -3| -3.46| -3.46e+00| -3.457| + %0|00zap|0000*|-000003|-003.46|-03.46e+00|-00003.457| + %#| zap| *| -3.| -3.46| -3.46e+00| -3.457| + %#0|00zap|0000*|-00003.|-003.46|-03.46e+00|-00003.457| + % | zap| *| -3| -3.46| -3.46e+00| -3.457| + % 0|00zap|0000*|-000003|-003.46|-03.46e+00|-00003.457| + % #| zap| *| -3.| -3.46| -3.46e+00| -3.457| + % #0|00zap|0000*|-00003.|-003.46|-03.46e+00|-00003.457| + %+| zap| *| -3| -3.46| -3.46e+00| -3.457| + %+0|00zap|0000*|-000003|-003.46|-03.46e+00|-00003.457| + %+#| zap| *| -3.| -3.46| -3.46e+00| -3.457| + %+#0|00zap|0000*|-00003.|-003.46|-03.46e+00|-00003.457| + %+ | zap| *| -3| -3.46| -3.46e+00| -3.457| + %+ 0|00zap|0000*|-000003|-003.46|-03.46e+00|-00003.457| + %+ #| zap| *| -3.| -3.46| -3.46e+00| -3.457| +%+ #0|00zap|0000*|-00003.|-003.46|-03.46e+00|-00003.457| + %-|zap |* |-3 |-3.46 |-3.46e+00 |-3.457 | + %-0|zap |* |-3 |-3.46 |-3.46e+00 |-3.457 | + %-#|zap |* |-3. |-3.46 |-3.46e+00 |-3.457 | + %-#0|zap |* |-3. |-3.46 |-3.46e+00 |-3.457 | + %- |zap |* |-3 |-3.46 |-3.46e+00 |-3.457 | + %- 0|zap |* |-3 |-3.46 |-3.46e+00 |-3.457 | + %- #|zap |* |-3. |-3.46 |-3.46e+00 |-3.457 | +%- #0|zap |* |-3. |-3.46 |-3.46e+00 |-3.457 | + %-+|zap |* |-3 |-3.46 |-3.46e+00 |-3.457 | + %-+0|zap |* |-3 |-3.46 |-3.46e+00 |-3.457 | + %-+#|zap |* |-3. |-3.46 |-3.46e+00 |-3.457 | +%-+#0|zap |* |-3. |-3.46 |-3.46e+00 |-3.457 | + %-+ |zap |* |-3 |-3.46 |-3.46e+00 |-3.457 | +%-+ 0|zap |* |-3 |-3.46 |-3.46e+00 |-3.457 | +%-+ #|zap |* |-3. |-3.46 |-3.46e+00 |-3.457 | %-+ #0|zap |* |-3. |-3.46 |-3.46e+00 |-3.457 | diff --git a/test/icasers.awk b/test/icasers.awk index 933e3bf7..8fdc826b 100644 --- a/test/icasers.awk +++ b/test/icasers.awk @@ -1,2 +1,2 @@ -BEGIN { RS = "[[:upper:]]+" } +BEGIN { RS = "[[:upper:]\\n]+" } { print ; IGNORECASE = ! IGNORECASE } diff --git a/test/intformat.awk b/test/intformat.awk new file mode 100644 index 00000000..56ce606b --- /dev/null +++ b/test/intformat.awk @@ -0,0 +1,74 @@ +function abs(x) { + return (x+0 >= 0) ? x : -x +} + +function check(x,what, f,res) { + for (f in formats) { + res = sprintf(f,x) + if (formats[f] == "non-decimal") { + if ((x >= 0) && (res !~ /e+/)) { + if (abs(strtonum(res)-x) > 1e-5*abs(x)) + printf "(sprintf(%s,%s) = %s)-%g = %g\n", + f,what,res,x,strtonum(res)-x + } + } + else if (abs(res-x) > 1e-5*abs(x)) + printf "(sprintf(%s,%s) = %s)-%g = %g\n", + f,what,res,x,res-x + } +} + +function check_cons(fmt,base,rot,mexp, i,j,dig,res,s) { + # first off, check that zero formats properly + if ((s = sprintf(fmt,0)) != "0") + printf "(sprintf(%s,0) = %s) != 0\n",fmt,s + + res = "1" + dig = 1 + j = 0 + for (i = 0; i <= mexp; i++) { + s = sprintf(fmt,base^i) + if (s ~ /e+/) + return + if (s != res) + printf "(sprintf(%s,%d^%d) = %s) != %s\n", + fmt,base,i,s,res + if (++j == rot) { + dig = 1 + res = ("10"substr(res,2)) + j = 0 + } + else { + dig *= 2 + res = (dig substr(res,2)) + } + } +} + +BEGIN { + formats["%s"] = "" + formats["%d"] = "" + formats["%.0f"] = "" + formats["0%o"] = "non-decimal" + formats["0x%x"] = "non-decimal" + + check(0,"0") + for (i = 0; i <= 308; i++) { + check(10^i,"10^"i) + check(-10^i,"-10^"i) + } + for (i = 0; i <= 1023; i++) { + check(2^i,"2^"i) + check(-2^i,"-2^"i) + } + + check_cons("%d",10,1,9) + check_cons("%x",2,4,31) + check_cons("%o",2,3,31) + + # make sure basic %d and %x are working properly + printf "%d %d %x\n",3.7,-3.7,23.7 + + # check another problem in gawk 3.1.5: precision over 30 crashes + printf "%.55d\n",1 +} diff --git a/test/intformat.ok b/test/intformat.ok new file mode 100644 index 00000000..868f9f11 --- /dev/null +++ b/test/intformat.ok @@ -0,0 +1,2 @@ +3 -3 17 +0000000000000000000000000000000000000000000000000000001 diff --git a/test/lintold.awk b/test/lintold.awk new file mode 100644 index 00000000..61d12f2f --- /dev/null +++ b/test/lintold.awk @@ -0,0 +1,21 @@ +# lintold.awk --- test --lint-old + +BEGIN { + a[1] = 1 + for (i in a) + print a[i] + delete a[1] + if (2 in a) + a[2] **= 2; + if ((2,3) in a) + a[2,3] ^= 2 ** 3 ^ 15; +} +BEGIN { + FS = "ab" + foo = "\b\f\r" +} +END { +} +END { + print "done" +} diff --git a/test/lintold.in b/test/lintold.in new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/test/lintold.in @@ -0,0 +1 @@ + diff --git a/test/lintold.ok b/test/lintold.ok new file mode 100644 index 00000000..e3867e4e --- /dev/null +++ b/test/lintold.ok @@ -0,0 +1,16 @@ +gawk: lintold.awk:7: warning: `delete' is not supported in old awk +gawk: lintold.awk:8: warning: old awk does not support the keyword `in' except after `for' +gawk: lintold.awk:9: warning: old awk does not support operator `**=' +gawk: lintold.awk:10: warning: old awk does not support the keyword `in' except after `for' +gawk: lintold.awk:10: warning: old awk does not support multidimensional arrays +gawk: lintold.awk:11: warning: operator `^=' is not supported in old awk +gawk: lintold.awk:11: warning: old awk does not support operator `**' +gawk: lintold.awk:11: warning: operator `^' is not supported in old awk +gawk: lintold.awk:13: warning: old awk does not support multiple `BEGIN' or `END' rules +gawk: lintold.awk:15: warning: old awk does not support the `\b' escape sequence +gawk: lintold.awk:15: warning: old awk does not support the `\f' escape sequence +gawk: lintold.awk:15: warning: old awk does not support the `\r' escape sequence +gawk: lintold.awk:19: warning: old awk does not support multiple `BEGIN' or `END' rules +1 +gawk: lintold.awk:14: warning: old awk does not support regexps as value of `FS' +done diff --git a/test/localenl.ok b/test/localenl.ok new file mode 100644 index 00000000..a6a1cffa --- /dev/null +++ b/test/localenl.ok @@ -0,0 +1,5 @@ +LC_ALL=C passed +LC_ALL=UNKNOWN passed +LC_ALL=POSIX passed +LC_ALL=en_US.ISO-8859-1 passed +LC_ALL=en_US.UTF-8 passed diff --git a/test/localenl.sh b/test/localenl.sh new file mode 100755 index 00000000..2c7e78ce --- /dev/null +++ b/test/localenl.sh @@ -0,0 +1,74 @@ +#! /bin/sh +# From arnold@f7.net Sun Apr 22 20:15:25 2007 +# Date: Thu, 19 Apr 2007 17:09:02 +0300 +# From: Pekka Pessi <Pekka.Pessi@nokia.com> +# X-Face: #V(jdpv[lI!TNUU=2*oh:="#suS*ponXW"yr6G;~L}<xZn_2^0)V{jqdc4y}@2b]ffd}SY# +# :9||1pew85O,WjiYA"6C7bW^zt^+.{b#B{lEE+4$9lrXL(55g}dU>uZ\JfD\"IG#G{j`hZI;=DmT\H +# pfDMyJ`i=:M;BM3R.`[>P^ER8+]i +# Subject: UTF-8 locale and \n in regexps +# To: bug-gawk@gnu.org +# Cc: Pekka.Pessi@nokia.com +# Message-id: <pvlkgoh2wx.fsf@nokia.com> +# MIME-version: 1.0 +# Content-type: multipart/mixed; boundary="=-=-=" +# +# --=-=-= +# +# Hello, +# +# It looks like regexp with \n in [^] behaves badly if locale has +# an UTF-8 ctype. +# +# It looks like if there is \n and an range without \n, like /\n[^x\n]foo/, +# and first \n ends an even-numbered line within the string, regexp +# does not match. +# +# Please see the attached script for an demonstration. +# +# --Pekka Pessi +# +# +# --=-=-= +# Content-Disposition: inline; filename=gawk-test +# +#! /bin/sh + +AWK=${AWK:-../gawk} + +for LC_ALL in C UNKNOWN POSIX en_US.ISO-8859-1 en_US.UTF-8 +do +export LC_ALL +cat <<EOF | +line1 +line2 +line3 +line4 +line5 +line6 +line7 +line8 +line9 +EOF +$AWK ' +BEGIN { RS="\0"; } +{ + if (match($0, /\n[^2\n]*2/)) { got2=1; } else { print "no match 2"; } + if (match($0, /\n[^3\n]*3/)) { got3=1; } else { print "no match 3"; } + if (match($0, /\n[^4\n]*4/)) { got4=1; } else { print "no match 4"; } + if (match($0, /\n[^5\t]*5/)) { got5=1; } else { print "no match 5"; } + if (match($0, /\n[^6\n]*6/)) { got6=1; } else { print "no match 6"; } + if (match($0, /\n[a-z]*7\n/)){ got7=1; } else { print "no match 7"; } + if (match($0, /\n[^8\n]*8/)) { got8=1; } else { print "no match 8"; } + if (match($0, /8.[^9\n]+9/)) { got9=1; } else { print "no match 9"; } +} + +END { exit(!(got2 && got3 && got4 && got5 && got6 && got7 && got8 && got9)); } +' || { + echo LC_ALL=$LC_ALL FAILED + exit 1 +} +echo LC_ALL=$LC_ALL passed +done +# +# --=-=-=-- +# diff --git a/test/mixed1.ok b/test/mixed1.ok new file mode 100644 index 00000000..91608fa3 --- /dev/null +++ b/test/mixed1.ok @@ -0,0 +1,3 @@ +gawk: BEGIN {return junk} +gawk: ^ `return' used outside function context +EXIT CODE: 1 diff --git a/test/mtchi18n.awk b/test/mtchi18n.awk new file mode 100644 index 00000000..aac65451 --- /dev/null +++ b/test/mtchi18n.awk @@ -0,0 +1 @@ +{print match(""," *")} diff --git a/test/mtchi18n.in b/test/mtchi18n.in new file mode 100644 index 00000000..139597f9 --- /dev/null +++ b/test/mtchi18n.in @@ -0,0 +1,2 @@ + + diff --git a/test/mtchi18n.ok b/test/mtchi18n.ok new file mode 100644 index 00000000..6ed281c7 --- /dev/null +++ b/test/mtchi18n.ok @@ -0,0 +1,2 @@ +1 +1 diff --git a/test/nofile.ok b/test/nofile.ok new file mode 100644 index 00000000..2dee4572 --- /dev/null +++ b/test/nofile.ok @@ -0,0 +1,2 @@ +gawk: cmd. line:1: fatal: cannot open file `no/such/file' for reading (No such file or directory) +EXIT CODE: 2 diff --git a/test/ovrflow1.awk b/test/ovrflow1.awk new file mode 100644 index 00000000..0506a06e --- /dev/null +++ b/test/ovrflow1.awk @@ -0,0 +1,82 @@ +# From arnold@f7.net Thu Dec 15 08:57:08 2005 +# Return-Path: <arnold@f7.net> +# Received: from localhost (skeeve [127.0.0.1]) +# by skeeve.com (8.12.11/8.12.11) with ESMTP id jBF6ubXX003003 +# for <arnold@localhost>; Thu, 15 Dec 2005 08:57:08 +0200 +# Received: from pop.012.net.il [84.95.5.221] +# by localhost with POP3 (fetchmail-6.2.5) +# for arnold@localhost (single-drop); Thu, 15 Dec 2005 08:57:08 +0200 (IST) +# Received: from mtain3.012.net.il ([10.220.5.7]) +# by i_mss3.012.net.il (HyperSendmail v2004.12) +# with ESMTP id <0IRI007F9SHYRDF0@i_mss3.012.net.il> for arobbins@012.net.il; +# Thu, 15 Dec 2005 05:32:22 +0200 (IST) +# Received: from i_mtain1.012.net.il ([10.220.20.4]) +# by i_mtain3.012.net.il (HyperSendmail v2004.12) +# with ESMTP id <0IRI00CUNSHXU5D0@i_mtain3.012.net.il> for arobbins@012.net.il +# (ORCPT arobbins@012.net.il); Thu, 15 Dec 2005 05:32:22 +0200 (IST) +# Received: from f7.net ([64.34.169.74]) +# by i_mtain1.012.net.il (HyperSendmail v2004.12) +# with ESMTP id <0IRI005JEPNHIG00@i_mtain1.012.net.il> for arobbins@012.net.il; +# Thu, 15 Dec 2005 04:30:54 +0200 (IST) +# Received: (from arnold@localhost) by f7.net (8.11.7-20030920/8.11.7) +# id jBF2TkQ18162 for arobbins@012.net.il; Wed, 14 Dec 2005 20:29:46 -0600 +# Received: from fencepost.gnu.org (fencepost.gnu.org [199.232.76.164]) +# by f7.net (8.11.7-20030920/8.11.7) with ESMTP id jBF2Tis18148 for +# <arnold@skeeve.com>; Wed, 14 Dec 2005 20:29:44 -0600 +# Received: from monty-python.gnu.org ([199.232.76.173]) +# by fencepost.gnu.org with esmtp (Exim 4.34) +# id 1Emir1-0007i6-1e for bug-gawk@gnu.org; Wed, 14 Dec 2005 21:28:23 -0500 +# Received: from Debian-exim by monty-python.gnu.org with spam-scanned +# (Exim 4.34) id 1Emiv6-0006FV-9G for bug-gawk@gnu.org; Wed, +# 14 Dec 2005 21:32:37 -0500 +# Received: from [129.99.139.165] (helo=ece03.nas.nasa.gov) +# by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) +# (Exim 4.34) id 1Emiv5-0006F0-UO for bug-gawk@gnu.org; Wed, +# 14 Dec 2005 21:32:36 -0500 +# Received: from ece03.nas.nasa.gov (localhost.localdomain [127.0.0.1]) +# by ece03.nas.nasa.gov (8.12.11/8.12.11) with ESMTP id jBF2TcNa022308; Wed, +# 14 Dec 2005 18:29:38 -0800 +# Received: (from ellswort@localhost) +# by ece03.nas.nasa.gov (8.12.11/8.12.11/Submit) id jBF2TcQC022307; Wed, +# 14 Dec 2005 18:29:38 -0800 +# Date: Wed, 14 Dec 2005 18:29:38 -0800 +# From: David Ellsworth <ellswort@nas.nasa.gov> +# Subject: gawk number to string bug +# To: bug-gawk@gnu.org +# Cc: ellswort@nas.nasa.gov +# Message-id: <200512150229.jBF2TcQC022307@ece03.nas.nasa.gov> +# Original-recipient: rfc822;arobbins@012.net.il +# X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on skeeve.com +# X-Spam-Level: +# X-Spam-Status: No, hits=-4.9 required=5.0 tests=BAYES_00 autolearn=ham +# version=2.63 +# +# +# I ran into a bug in how gawk converts numbers into strings. +# +# Running the program + BEGIN { print 9223372036854775808 } +# prints +# -9223372036854775808 +# on a 64-bit machine. On a 32-bit machine, the same program prints out +# 9.22337e+18 +# which is correct. +# +# Note that 9223372036854775808 == 2^63. Printing out other powers of 2 +# is OK. +# +# Version details: +# gawk version 3.1.5, freshly downloaded from gnu.org +# gcc (GCC) 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8) +# uname -a output: +# Linux pixie 2.6.12-gentoo-r10 #2 SMP Tue Nov 1 03:42:22 PST 2005 +# x86_64 Dual Core AMD Opteron(tm) Processor 275 AuthenticAMD GNU/Linux +# +# (the 32-bit example used gawk version 3.1.3) +# +# - David +# +# +# ##################################################################################### +# This Mail Was Scanned by 012.net AntiVirus Service4- Powered by TrendMicro Interscan +# diff --git a/test/ovrflow1.ok b/test/ovrflow1.ok new file mode 100644 index 00000000..b0898f38 --- /dev/null +++ b/test/ovrflow1.ok @@ -0,0 +1 @@ +9223372036854775808 diff --git a/test/parse1.awk b/test/parse1.awk new file mode 100644 index 00000000..84906c49 --- /dev/null +++ b/test/parse1.awk @@ -0,0 +1,35 @@ +# Date: Fri, 06 Jan 2006 14:02:17 -0800 +# From: Paul Eggert <eggert@CS.UCLA.EDU> +# Subject: gawk misparses $expr++ if expr ends in ++ +# To: bug-gawk@gnu.org +# Message-id: <87irsxypzq.fsf@penguin.cs.ucla.edu> +# +# Here's an example of the problem: +# +# $ gawk 'BEGIN{a=3}{print $$a++++}' +# gawk: {print $$a++++} +# gawk: ^ syntax error +# +# But it's not a syntax error, as the expression conforms to the POSIX +# spec: it should be treated like '$($a++)++'. +# +# Mawk, Solaris awk (old awk), and Solaris nawk all accept the +# expression. For example: +# +# $ echo '3 4 5 6 7 8 9' | nawk 'BEGIN{a=3}{print $$a++++}' +# 7 +# +# This is with gawk 3.1.5 on Solaris 8 (sparc). +# +# +# ##################################################################################### +# This Mail Was Scanned by 012.net AntiVirus Service1- Powered by TrendMicro Interscan +# +BEGIN { a = 3 } + +{ + print "in:", $0 + print "a =", a + print $$a++++ + print "out:", $0 +} diff --git a/test/parse1.in b/test/parse1.in new file mode 100644 index 00000000..4a001d7b --- /dev/null +++ b/test/parse1.in @@ -0,0 +1 @@ +3 4 5 6 7 8 9 diff --git a/test/parse1.ok b/test/parse1.ok new file mode 100644 index 00000000..a452e60c --- /dev/null +++ b/test/parse1.ok @@ -0,0 +1,4 @@ +in: 3 4 5 6 7 8 9 +a = 3 +7 +out: 3 4 6 6 8 8 9 diff --git a/test/parsefld.awk b/test/parsefld.awk new file mode 100644 index 00000000..0dd2f914 --- /dev/null +++ b/test/parsefld.awk @@ -0,0 +1,2 @@ +{ print $/= b/ c /= d/ } +{ print /a/ + /b/ + !/c/} diff --git a/test/parsefld.in b/test/parsefld.in new file mode 100644 index 00000000..959d6825 --- /dev/null +++ b/test/parsefld.in @@ -0,0 +1 @@ +a = b diff --git a/test/parsefld.ok b/test/parsefld.ok new file mode 100644 index 00000000..8d0316f1 --- /dev/null +++ b/test/parsefld.ok @@ -0,0 +1,2 @@ +a0 +3 diff --git a/test/pid.awk b/test/pid.awk index 9b47d908..de83dabe 100644 --- a/test/pid.awk +++ b/test/pid.awk @@ -27,18 +27,20 @@ BEGIN { getline pid <"/dev/pid" getline ppid <"/dev/ppid" -} -NR == 1 { - if (pid != $0) { - printf "Bad pid %d, wanted %d\n", $0, pid - } -} -NR == 2 { - if (ppid != $0) { - printf "Bad ppid %d, wanted %d\n", $0, ppid - } -} -END { # ADR --- added + + if (pid != ok_pid) + printf "Bad pid %d, wanted %d\n", pid, ok_pid + else + print "PID ok" + + if (ppid != ok_ppid) + printf "Bad ppid %d, wanted %d\n", ppid, ok_ppid + else + print "PPID ok" + + # ADR --- added close("/dev/pid") close("/dev/ppid") + + print "All Done." } diff --git a/test/pid.ok b/test/pid.ok index e69de29b..a700d101 100644 --- a/test/pid.ok +++ b/test/pid.ok @@ -0,0 +1,3 @@ +PID ok +PPID ok +All Done. diff --git a/test/pid.sh b/test/pid.sh index 901637ad..da49afdf 100755 --- a/test/pid.sh +++ b/test/pid.sh @@ -1,5 +1,3 @@ #! /bin/sh AWK=${AWK-../gawk} -echo $$ > _pid.in -echo $1 >> _pid.in -exec $AWK -f pid.awk _pid.in 2>/dev/null +exec $AWK -v "ok_pid=$$" -v "ok_ppid=$1" -f pid.awk 2>/dev/null diff --git a/test/pipeio2.awk b/test/pipeio2.awk index dbf354bf..a4cd3bfa 100644 --- a/test/pipeio2.awk +++ b/test/pipeio2.awk @@ -25,7 +25,9 @@ BEGIN { #com = "cal 01 1997" com = ("cat " SRCDIR "/pipeio2.in") - while ((com | getline fnam) > 0) { + # Don't use empty lines, because Windows ECHO does + # something different when invoked without arguments + while ((com | getline fnam) > 0 && fnam != "") { # com_tr = "echo " fnam " | tr [0-9]. ..........." # com_tr = "echo " fnam " | sed 's/[0-9]/./g'" diff --git a/test/pipeio2.ok b/test/pipeio2.ok index 13b0b9b0..4514fbb3 100644 --- a/test/pipeio2.ok +++ b/test/pipeio2.ok @@ -12,5 +12,3 @@ S M Tu W Th F S .. .. .. .. .. .. .. 'echo 26 27 28 29 30 31 | sed "s/[0-9]/./g"' .. .. .. .. .. .. -'echo | sed "s/[0-9]/./g"' - diff --git a/test/reg/func2.good b/test/reg/func2.good index 3d7b5bae..a6515c97 100644 --- a/test/reg/func2.good +++ b/test/reg/func2.good @@ -1,2 +1,2 @@ gawk: reg/func2.awk:2: fatal: function `dummy' called with space between name and `(', -or used in other expression context +or used as a variable or an array diff --git a/test/reg/func2.out b/test/reg/func2.out deleted file mode 100644 index a6515c97..00000000 --- a/test/reg/func2.out +++ /dev/null @@ -1,2 +0,0 @@ -gawk: reg/func2.awk:2: fatal: function `dummy' called with space between name and `(', -or used as a variable or an array diff --git a/test/reint2.awk b/test/reint2.awk new file mode 100644 index 00000000..f9269dd8 --- /dev/null +++ b/test/reint2.awk @@ -0,0 +1 @@ +/^([[:digit:]]+[[:space:]]+){2}/ diff --git a/test/reint2.in b/test/reint2.in new file mode 100644 index 00000000..b85905ec --- /dev/null +++ b/test/reint2.in @@ -0,0 +1 @@ +1 2 3 diff --git a/test/reint2.ok b/test/reint2.ok new file mode 100644 index 00000000..b85905ec --- /dev/null +++ b/test/reint2.ok @@ -0,0 +1 @@ +1 2 3 diff --git a/test/strnum1.awk b/test/strnum1.awk new file mode 100644 index 00000000..e9cbdaf6 --- /dev/null +++ b/test/strnum1.awk @@ -0,0 +1,35 @@ +# Date: Tue, 04 Jul 2006 21:06:14 +0200 (MEST) +# From: Heiner Marxen <Heiner.Marxen@DrB.Insel.DE> +# Subject: conversion error +# To: bug-gawk@gnu.org +# Message-id: <200607041906.k64J6Eqa019360@drb9.drb.insel.de> +# +# Hello, +# +# The following awk script fails for gawk 3.1.4 and 3.1.5. +# Older versions did not do this, but I cannot say, how old they were. +# +BEGIN { + if( 0 ) { #ok + t = "8" + }else { #fails + t = "" + t = t "8" + } + printf("8 = %d\n", 0+t) # ok without this line + t = t "8" # does not invalidate numeric interpretation + printf("88 = %s\n", 0+t) + ## The above prints "88 = 8" with gawk 3.1.4 and 3.1.5 +} +# +# +# The following one-liner already exhibits the bug: +# +# gawk 'BEGIN{t=""; t=t "8";printf("8=%d\n", 0+t);t=t "8";printf("88=%s\n", 0+t)}' +# +# +# Preliminary observation: under somewhat strange conditions a variable +# does retain its numeric interpretation although something is appended to it. +# -- +# Heiner Marxen http://www.drb.insel.de/~heiner/ +# diff --git a/test/strnum1.ok b/test/strnum1.ok new file mode 100644 index 00000000..804bcfde --- /dev/null +++ b/test/strnum1.ok @@ -0,0 +1,2 @@ +8 = 8 +88 = 88 diff --git a/test/subi18n.awk b/test/subi18n.awk new file mode 100644 index 00000000..69bfca2b --- /dev/null +++ b/test/subi18n.awk @@ -0,0 +1,68 @@ +# Date: Mon, 27 Feb 2006 12:35:30 +0900 +# From: KIMURA Koichi <kimura.koichi@canon.co.jp> +# Subject: gawk: sub_common has multi-byte aware bug +# To: bug-gawk@gnu.org +# Message-id: <20060227121045.2198.KIMURA.KOICHI@canon.co.jp> +# +# Hi, +# +# A certain user faced bug of sub builtin function and report to me. +# Then I investigated the bug. +# +# reproduce script is here. + +BEGIN { + str = "type=\"directory\" version=\"1.0\"" + #print "BEGIN:", str + + while (str) { + sub(/^[^=]*/, "", str); + s = substr(str, 2) + print s + sub(/^="[^"]*"/, "", str) + sub(/^[ \t]*/, "", str) + } +} + +# and sample result is here (on GNU/Linux Fedora core 3) +# +# [kbk@skuld gawk-3.1.5]$ LC_ALL=C ./gawk -f subbug.awk +# "directory" version="1.0" +# "1.0" +# [kbk@skuld gawk-3.1.5]$ LC_ALL=en_US.UTF-8 ./gawk -f subbug.awk +# "directory" version="1.0" +# "dire +# [kbk@skuld gawk-3.1.5]$ +# +# In my investigation, this bug is cause by don't release wide-string when +# sub is executed. +# +# patch is here. +# +# --- builtin.c.orig 2005-07-27 03:07:43.000000000 +0900 +# +++ builtin.c 2006-02-26 02:07:52.000000000 +0900 +# @@ -2463,6 +2468,15 @@ sub_common(NODE *tree, long how_many, in +# t->stptr = buf; +# t->stlen = textlen; +# +# +#ifdef MBS_SUPPORT +# + if (t->flags & WSTRCUR) { +# + if (t->wstptr != NULL) +# + free(t->wstptr); +# + t->wstptr = NULL; +# + t->wstlen = 0; +# + t->flags &= ~WSTRCUR; +# + } +# +#endif +# free_temp(s); +# if (matches > 0 && lhs) { +# if (priv) { +# +# +# -- +# KIMURA Koichi +# +# +# ##################################################################################### +# This Mail Was Scanned by 012.net AntiVirus Service1- Powered by TrendMicro Interscan +# diff --git a/test/subi18n.ok b/test/subi18n.ok new file mode 100644 index 00000000..54842cda --- /dev/null +++ b/test/subi18n.ok @@ -0,0 +1,2 @@ +"directory" version="1.0" +"1.0" diff --git a/test/synerr2.awk b/test/synerr2.awk new file mode 100644 index 00000000..9860f248 --- /dev/null +++ b/test/synerr2.awk @@ -0,0 +1,47 @@ +# From: =?ISO-8859-1?Q?J=FCrgen_Kahrs?= <Juergen.KahrsDELETETHIS@vr-web.de> +# Newsgroups: gnu.utils.bug +# Subject: Re: gawk-3.1.5: syntax error, core dump +# Date: Fri, 23 Jun 2006 18:12:07 +0200 +# Lines: 12 +# Approved: bug-gnu-utils@gnu.org +# Message-ID: <mailman.3258.1151079135.9609.bug-gnu-utils@gnu.org> +# References: <mailman.3236.1151045898.9609.bug-gnu-utils@gnu.org> +# Reply-To: Juergen.KahrsDELETETHIS@vr-web.de +# NNTP-Posting-Host: lists.gnu.org +# Mime-Version: 1.0 +# Content-Type: text/plain; charset=ISO-8859-1 +# Content-Transfer-Encoding: 7bit +# X-Trace: news.Stanford.EDU 1151079136 27033 199.232.76.165 (23 Jun 2006 16:12:16 GMT) +# X-Complaints-To: news@news.stanford.edu +# To: gnu-utils-bug@moderators.isc.org +# Envelope-to: bug-gnu-utils@gnu.org +# X-Orig-X-Trace: individual.net +# vYX9N7nUUtqHxPyspweN0gZ4Blkl17z/xU01EwbykxB178O8M= +# User-Agent: Thunderbird 1.5 (X11/20060317) +# In-Reply-To: <mailman.3236.1151045898.9609.bug-gnu-utils@gnu.org> +# X-BeenThere: bug-gnu-utils@gnu.org +# X-Mailman-Version: 2.1.5 +# Precedence: list +# List-Id: Bug reports for the GNU utilities <bug-gnu-utils.gnu.org> +# List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-gnu-utils>, +# <mailto:bug-gnu-utils-request@gnu.org?subject=unsubscribe> +# List-Archive: <http://lists.gnu.org/pipermail/bug-gnu-utils> +# List-Post: <mailto:bug-gnu-utils@gnu.org> +# List-Help: <mailto:bug-gnu-utils-request@gnu.org?subject=help> +# List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-gnu-utils>, +# <mailto:bug-gnu-utils-request@gnu.org?subject=subscribe> +# Path: news.012.net.il!seanews2.seabone.net!newsfeed.albacom.net!news.mailgate.org!newsfeed.stueberl.de!newsfeed.news2me.com!headwall.stanford.edu!newsfeed.stanford.edu!shelby.stanford.edu!individual.net!not-for-mail +# Xref: news.012.net.il gnu.utils.bug:813 +# +# Karel Zak wrote: +# +# > it seems that gawk has problem with "syntax error" reporting: +# > +# > ./gawk '/^include / { system(sprintf("cd /etc; cat %s", [$]2)); skip +# > = 1; } { if (!skip) print $0; skipQuit; }' < /etc/ld.so.conf +# +# This test case can be boiled down to +# +# gawk 'BEGIN {sprintf("%s", $)}' +# +BEGIN { sprintf("%s", $) } diff --git a/test/synerr2.ok b/test/synerr2.ok new file mode 100644 index 00000000..cd30a843 --- /dev/null +++ b/test/synerr2.ok @@ -0,0 +1,3 @@ +gawk: synerr2.awk:47: BEGIN { sprintf("%s", $) } +gawk: synerr2.awk:47: ^ syntax error +EXIT CODE: 1 diff --git a/test/wideidx.awk b/test/wideidx.awk new file mode 100644 index 00000000..9c8a64ce --- /dev/null +++ b/test/wideidx.awk @@ -0,0 +1,7 @@ +{ + a=$0 + print index(a,"b") + getline + a = a $0 + print index(a,"b") +} diff --git a/test/wideidx.in b/test/wideidx.in new file mode 100644 index 00000000..3bd1f0e2 --- /dev/null +++ b/test/wideidx.in @@ -0,0 +1,2 @@ +foo +bar diff --git a/test/wideidx.ok b/test/wideidx.ok new file mode 100644 index 00000000..4f1d7cd3 --- /dev/null +++ b/test/wideidx.ok @@ -0,0 +1,2 @@ +0 +4 diff --git a/test/wideidx2.awk b/test/wideidx2.awk new file mode 100644 index 00000000..335c29de --- /dev/null +++ b/test/wideidx2.awk @@ -0,0 +1,89 @@ +# Date: Thu, 27 Apr 2006 20:59:03 +0100 +# From: Lee Haywood <ljhaywood2@googlemail.com> +# Subject: gawk multi-byte support bugs, assertion bug and fix. +# To: bug-gawk@gnu.org +# Message-id: <60962be00604271259na0d8fdayb9d0c69a853216e8@mail.gmail.com> +# MIME-version: 1.0 +# Content-type: multipart/alternative; +# boundary="----=_Part_10136_920879.1146167943492" +# Status: RO +# +# ------=_Part_10136_920879.1146167943492 +# Content-Type: text/plain; charset=ISO-8859-1 +# Content-Transfer-Encoding: quoted-printable +# Content-Disposition: inline +# +# +# Firstly, I have been getting the following error from version 3.1.5. +# +# awk: node.c:515: unref: Assertion `(tmp->flags & 4096) !=3D 0' failed. +# +# In mk_number() in node.c the MBS_SUPPORT code is inside the GAWKDEBUG +# section - moving it outside explicitly clears the string values, which +# prevents the assertion error from occurring. The corrected version is +# shown at the end of this message. +# +# As an aside, I also noticed that n->wstptr is not cleared by +# set_field() and set_record() in field.c when the flags are set to +# exclude WSTRCUR. However, I do not have a test case to show if +# changing them makes any difference. +# +# A second problem also occurs when gawk 3.1.5 is compiled with +# multi-byte character support (MBS_SUPPORT). The following code should +# change the index of the substring "bc" from 2 to 3, but it gets +# reported as 2 in both cases - which is obviously disastrous. +# +# awk 'BEGIN { +# Value =3D "abc" +# +# print "Before <" Value "> ", +# index( Value, "bc" ) +# +# sub( /bc/, "bbc", Value ) +# +# print "After <" Value ">", +# index( Value, "bc" ) +# }' +# +# Compiling with MBS_SUPPORT undefined makes these problems go away. +# +# /* mk_number --- allocate a node with defined number */ +# +# NODE * +# mk_number(AWKNUM x, unsigned int flags) +# { +# register NODE *r; +# +# getnode(r); +# r->type =3D Node_val; +# r->numbr =3D x; +# r->flags =3D flags; +# #if defined MBS_SUPPORT +# r->wstptr =3D NULL; +# r->wstlen =3D 0; +# #endif /* MBS_SUPPORT */ +# #ifdef GAWKDEBUG +# r->stref =3D 1; +# r->stptr =3D NULL; +# r->stlen =3D 0; +# #if defined MBS_SUPPORT +# r->flags &=3D ~WSTRCUR; +# #endif /* MBS_SUPPORT */ +# #endif /* GAWKDEBUG */ +# return r; +# } +# +# Thanks. +# +# -- +# Lee Haywood. + +BEGIN { + Value = "abc" + + print "Before <" Value "> ", index( Value, "bc" ) + + sub( /bc/, "bbc", Value ) + + print "After <" Value ">", index( Value, "bc" ) +} diff --git a/test/wideidx2.ok b/test/wideidx2.ok new file mode 100644 index 00000000..c0206ec6 --- /dev/null +++ b/test/wideidx2.ok @@ -0,0 +1,2 @@ +Before <abc> 2 +After <abbc> 3 diff --git a/test/widesub.awk b/test/widesub.awk new file mode 100644 index 00000000..768e715c --- /dev/null +++ b/test/widesub.awk @@ -0,0 +1,12 @@ +BEGIN { + str = "type=\"directory\" version=\"1.0\"" + #print "BEGIN:", str + + while (str) { + sub(/^[^=]*/, "", str); + s = substr(str, 2) + print s + sub(/^="[^"]*"/, "", str) + sub(/^[ \t]*/, "", str) + } +} diff --git a/test/widesub.ok b/test/widesub.ok new file mode 100644 index 00000000..54842cda --- /dev/null +++ b/test/widesub.ok @@ -0,0 +1,2 @@ +"directory" version="1.0" +"1.0" diff --git a/test/widesub2.awk b/test/widesub2.awk new file mode 100644 index 00000000..69383d34 --- /dev/null +++ b/test/widesub2.awk @@ -0,0 +1,9 @@ +BEGIN { + Value = "abc" + + print "Before <" Value "> ", index( Value, "bc" ) + + sub( /bc/, "bbc", Value ) + + print "After <" Value ">", index( Value, "bc" ) +} diff --git a/test/widesub2.ok b/test/widesub2.ok new file mode 100644 index 00000000..c0206ec6 --- /dev/null +++ b/test/widesub2.ok @@ -0,0 +1,2 @@ +Before <abc> 2 +After <abbc> 3 diff --git a/test/widesub3.awk b/test/widesub3.awk new file mode 100644 index 00000000..48c414a9 --- /dev/null +++ b/test/widesub3.awk @@ -0,0 +1,6 @@ +{ + if (substr($1,1,1) == substr($0,1,1)) + print "substr matches" + sub(/foo/,"bar") + print nr++ +} diff --git a/test/widesub3.in b/test/widesub3.in new file mode 100644 index 00000000..6357df99 --- /dev/null +++ b/test/widesub3.in @@ -0,0 +1,2 @@ +test +foo diff --git a/test/widesub3.ok b/test/widesub3.ok new file mode 100644 index 00000000..7507261c --- /dev/null +++ b/test/widesub3.ok @@ -0,0 +1,4 @@ +substr matches +0 +substr matches +1 diff --git a/test/widesub4.awk b/test/widesub4.awk new file mode 100644 index 00000000..c917aacb --- /dev/null +++ b/test/widesub4.awk @@ -0,0 +1,54 @@ +# Date: Sun, 28 May 2006 11:20:58 +0200 +# From: Frantisek Hanzlik <franta@hanzlici.cz> +# Subject: sub() function do'nt alter string length in awk 3.1.5 +# To: bug-gawk@gnu.org +# Message-id: <44796B7A.3050908@hanzlici.cz> +# +# Hello, +# I not know when it is my mistake or gawk bug - in simple example below +# I delete some chars from string variable, and after this string is +# modified, but its length is unchanged. +# +# awk 'BEGIN{A="1234567890abcdef"; +# for (i=1;i<6;i++){print length(A),"A=" A ".";sub("....","",A)} +# }' +# 16 A=1234567890abcdef. +# 16 A=567890abcdef. +# 16 A=90abcdef. +# 16 A=cdef. +# 16 A=. +# +# When I use gensub() instead of sub(), result is as I expected: +# +# awk 'BEGIN{A="1234567890abcdef"; +# for (i=1;i<6;i++){print length(A),"A=" A ".";A=gensub("....","",1,A)} +# }' +# 16 A=1234567890abcdef. +# 12 A=567890abcdef. +# 8 A=90abcdef. +# 4 A=cdef. +# 0 A=. +# +# OS/GAWK versions: +# - GNU/Linux kernel 2.6.16-1.2122_FC5 #1 i686, Fedora Core 5 distro +# - glibc-2.4-8 +# - GNU Awk 3.1.5 +# +# Yours sincerely +# Frantisek Hanzlík +# +# == Lucní 502 Linux/Unix, Novell, Internet Tel: +420-373729699 == +# == 33209 Stenovice e-mail:franta@hanzlici.cz Fax: +420-373729699 == +# == Czech Republic http://hanzlici.cz/ GSM: +420-604117319 == +# +# +# +# ##################################################################################### +# This Mail Was Scanned by 012.net AntiVirus Service3- Powered by TrendMicro Interscan +# +BEGIN{A="1234567890abcdef"; + for (i=1;i<6;i++){print length(A),"A=" A ".";sub("....","",A)} +} +BEGIN{A="1234567890abcdef"; + for (i=1;i<6;i++){print length(A),"A=" A ".";A=gensub("....","",1,A)} +} diff --git a/test/widesub4.ok b/test/widesub4.ok new file mode 100644 index 00000000..d582543b --- /dev/null +++ b/test/widesub4.ok @@ -0,0 +1,10 @@ +16 A=1234567890abcdef. +12 A=567890abcdef. +8 A=90abcdef. +4 A=cdef. +0 A=. +16 A=1234567890abcdef. +12 A=567890abcdef. +8 A=90abcdef. +4 A=cdef. +0 A=. diff --git a/test/zero2.awk b/test/zero2.awk new file mode 100644 index 00000000..8ecfb2f9 --- /dev/null +++ b/test/zero2.awk @@ -0,0 +1,5 @@ +BEGIN { + printf "%d\n", -.4 + printf "%d\n", -0.0 + printf "%d\n", -.9 +} diff --git a/test/zero2.ok b/test/zero2.ok new file mode 100644 index 00000000..bb0b1cf6 --- /dev/null +++ b/test/zero2.ok @@ -0,0 +1,3 @@ +0 +0 +0 |