diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-16 14:55:10 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-16 14:55:10 +0300 |
commit | 00ef0423acd97cb964a2bae54c93a03a8ab50e5e (patch) | |
tree | 2864426773f537f912db1bd716c27b713c5f7dcf /test | |
parent | 3ba50a15ebd976f7a88393e2e45dc14b6478b9a9 (diff) | |
download | gawk-00ef0423acd97cb964a2bae54c93a03a8ab50e5e.tar.gz |
Move to 3.1.8.gawk-3.1.8
Diffstat (limited to 'test')
-rw-r--r-- | test/ChangeLog | 37 | ||||
-rw-r--r-- | test/Gentests.vms | 102 | ||||
-rw-r--r-- | test/Makefile.am | 21 | ||||
-rw-r--r-- | test/Makefile.in | 99 | ||||
-rw-r--r-- | test/Maketests | 20 | ||||
-rw-r--r-- | test/fcall_exit.awk | 24 | ||||
-rw-r--r-- | test/fcall_exit.ok | 2 | ||||
-rw-r--r-- | test/fcall_exit2.awk | 25 | ||||
-rw-r--r-- | test/fcall_exit2.in | 1 | ||||
-rw-r--r-- | test/fcall_exit2.ok | 2 | ||||
-rw-r--r-- | test/forref.awk | 11 | ||||
-rw-r--r-- | test/forref.ok | 3 | ||||
-rw-r--r-- | test/hsprint.ok | 16 | ||||
-rw-r--r-- | test/lc_num1.awk | 17 | ||||
-rw-r--r-- | test/lc_num1.ok | 2 | ||||
-rw-r--r-- | test/localenl.ok | 1 | ||||
-rwxr-xr-x | test/localenl.sh | 3 | ||||
-rw-r--r-- | test/uninit5.awk | 111 | ||||
-rw-r--r-- | test/uninit5.ok | 10 |
19 files changed, 444 insertions, 63 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 2b818b63..1deb4058 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,40 @@ +Thu May 6 20:55:14 2010 Arnold D. Robbins <arnold@skeeve.com> + + * Release 3.1.8: Release tar file made. + +Wed Apr 21 22:23:30 2010 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (EXTRA_DIST): Add Gentests.vms so it'll be + in the dist. + * localenl.sh, localenl.ok: Remove UNKNOWN locale per + request from Nelson Beebe. + * lc_num1.awk, lc_num1.ok: Revised to not fail on systems + where the quote flag isn't supported. Also per Nelson Beebe. + +Thu Feb 18 22:50:54 2010 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (fcall_exit2): New test. + * fcall_exit2.awk, fcall_exit2.in, fcall_exit2.ok: New files. + +Wed Feb 17 23:25:27 2010 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (fcall_exit): New test. + * fcall_exit.awk, fcall_exit.ok: New files. + +Fri Feb 5 13:02:10 2010 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (forref): New test. + * forref.awk, forref.ok: New files. + +Tue Oct 6 19:49:22 2009 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (uninit5): New test. + * uninit5.awk, uninit5.ok: New files. + +Tue Aug 4 06:04:04 2009 Arnold D. Robbins <arnold@skeeve.com> + + * hsprint.ok: Updated. + Tue Jul 21 22:28:56 2009 Arnold D. Robbins <arnold@skeeve.com> * Release 3.1.7: Release tar file made. diff --git a/test/Gentests.vms b/test/Gentests.vms new file mode 100644 index 00000000..cac7abd3 --- /dev/null +++ b/test/Gentests.vms @@ -0,0 +1,102 @@ +# Gentests.vms - supplements Gentests to generate tests in vms format +# gawk -v "VMSTESTS=1" -f Gentests -f Gentests.vms Makefile.am *.awk *.in >Maketests.vms + +/^FAIL_CODE1 *=/,/[^\\]$/ { + gsub(/(^FAIL_CODE1 *=|\\$)/,"") + for (i = 1; i <= NF; i++) + fail_code1[$i] + next +} + +END { + if (VMSTESTS) vmsepilog() +} + +# wildcard expansion done by gawk's vms_arg_fixup() to simulate shell +# globbing produces full filenames: device:[directory]name.type;# +# and by default also forces the value into upper case +function vmsargvfixup( i, f) +{ + # we're forcing lowercase below; need to override for some files + vmscasefixup["makefile.in"] = "Makefile.in" + + for (i = 2; i < ARGC; i++) { + f = ARGV[i] + sub(/^.+[]>]/, "", f) # strip dev+dir prefix + sub(/\;[0-9]+$/, "", f) # strip version suffix + f = tolower(f) + if (f in vmscasefixup) f = vmscasefixup[f] + ARGV[i] = f + } + + vmsprolog() # insert some stuff into the output file +} + +# output sufficient for the simplest tests in vms/vmstest.com +function vmsgenerate(x, s, o) +{ + # generate a gosub-style subroutine; start with its label + printf "$" x ":" + + s = "" + if (x in lint) { + 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 " <" x ".in" + delete files[x".in"] + } + + o = "_" x ".tmp" + print "\techo \"" x "\"" + print "$\tAWKPATH_srcdir" + print "$\tgawk -f " x ".awk" s " >" o " 2>&1" + print "$\tif .not.$status then call exit_code \"" o "\" " \ + ((x in fail_code1) ? "1" : "2") + print "$\tcmp " x ".ok " o + print "$\tif $status" + print "$\tthen\trm " o ";" + print "$\telse\techo \"test \"\"" x "\"\" failed\"" + print "$\tendif" + print "$\treturn" + + return +} + +# prolog for Maketests.vms +function vmsprolog() +{ + print "$" + print "$\techo\t= \"write sys$output\"" + print "$\tcmp\t= \"diff/Output=_NL:/Maximum=1\"" + print "$\trm\t= \"delete/noConfirm/noLog\"" + print "$\tgawk\t= \"$sys$disk:[-]gawk.exe\"" + print "$\tAWKPATH_srcdir = \"define/User AWKPATH sys$disk:[]\"" + print "$" + + print "$\tset noOn" + print "$ gosub 'p1'" + print "$\tset On" + print "$ exit" + print "$" +} + +# epilog for Maketests.vms +function vmsepilog() +{ + print "$" + print "$! add a fake \"EXIT CODE\" record to the end of temporary output file" + print "$! to simulate the ``|| echo EXIT CODE $$? >>_$@'' shell script usage" + print "$exit_code: subroutine" + print "$\tif f$trnlnm(\"FTMP\").nes.\"\" then close/noLog ftmp" + print "$\topen/Append ftmp 'p1'" + print "$\twrite ftmp \"EXIT CODE: \",p2" + print "$\tclose ftmp" + print "$ endsubroutine !exit_code" + print "$" +} diff --git a/test/Makefile.am b/test/Makefile.am index cea095fb..7b5e529b 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,7 +1,7 @@ # # test/Makefile.am --- automake input file for gawk # -# Copyright (C) 1988-2008 the Free Software Foundation, Inc. +# Copyright (C) 1988-2010 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -27,6 +27,7 @@ EXTRA_DIST = \ reg \ lib \ Gentests \ + Gentests.vms \ Maketests \ README \ addcomma.awk \ @@ -161,6 +162,11 @@ EXTRA_DIST = \ exitval2.awk \ exitval2.ok \ exitval2.w32 \ + fcall_exit.awk \ + fcall_exit.ok \ + fcall_exit2.awk \ + fcall_exit2.ok \ + fcall_exit2.in \ fflush.ok \ fflush.sh \ fieldwdth.awk \ @@ -196,6 +202,8 @@ EXTRA_DIST = \ fnparydl.ok \ fordel.awk \ fordel.ok \ + forref.awk \ + forref.ok \ forsimp.awk \ forsimp.ok \ fsbs.awk \ @@ -641,6 +649,8 @@ EXTRA_DIST = \ uninit3.ok \ uninit4.awk \ uninit4.ok \ + uninit5.awk \ + uninit5.ok \ uninitialized.awk \ uninitialized.ok \ unterm.awk \ @@ -688,8 +698,9 @@ BASIC_TESTS = \ arysubnm asgext awkpath back89 backgsub childin clobber closebad \ clsflnam compare compare2 concat1 concat2 concat3 concat4 convfmt \ datanonl defref delarpm2 delarprm delfunc dynlj eofsplit exitval1 \ - exitval2 fldchg fldchgnf fnamedat fnarray fnarray2 fnaryscl fnasgnm \ - fnmisc fordel forsimp fsbs fsrs fsspcoln fstabplus funsemnl funsmnam \ + exitval2 fcall_exit fcall_exit2 fldchg fldchgnf fnamedat fnarray \ + fnarray2 fnaryscl fnasgnm \ + fnmisc fordel forref forsimp fsbs fsrs fsspcoln fstabplus funsemnl funsmnam \ funstack getline getline2 getline3 getlnbuf getnr2tb getnr2tm \ gsubasgn gsubtest gsubtst2 gsubtst3 gsubtst4 gsubtst5 gsubtst6 \ hex hsprint inputred intest intprec iobug1 leaddig leadnl litoct \ @@ -704,7 +715,7 @@ BASIC_TESTS = \ rstest3 rstest4 rstest5 rswhite scalar sclforin sclifin sortempty \ splitargv splitarr splitdef splitvar splitwht strcat1 strnum1 \ strtod subamp subi18n subsepnm subslash substr swaplns synerr1 \ - synerr2 tradanch tweakfld uninit2 uninit3 uninit4 uninitialized \ + synerr2 tradanch tweakfld uninit2 uninit3 uninit4 uninit5 uninitialized \ unterm uparrfs wideidx wideidx2 widesub widesub2 widesub3 \ widesub4 wjposer1 zero2 zeroe0 zeroflag @@ -728,7 +739,7 @@ LOCALE_CHARSET_TESTS = asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \ mbprintf1 mbprintf2 rebt8b2 sort1 sprintfc whiny # List of the tests which should be run with --lint option: -NEED_LINT = defref fmtspcl noeffect nofmtch shadow uninit2 uninit3 uninit4 uninitialized +NEED_LINT = defref fmtspcl noeffect nofmtch shadow uninit2 uninit3 uninit4 uninit5 uninitialized # List of the tests which should be run with --lint-old option: NEED_LINT_OLD = lintold diff --git a/test/Makefile.in b/test/Makefile.in index 75061808..5efa6cc0 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -18,7 +18,7 @@ # # test/Makefile.am --- automake input file for gawk # -# Copyright (C) 1988-2008 the Free Software Foundation, Inc. +# Copyright (C) 1988-2010 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -66,9 +66,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/arch.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/libtool.m4 $(top_srcdir)/m4/longlong.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/libsigsegv.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 \ @@ -84,7 +82,6 @@ DIST_SOURCES = DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -103,18 +100,16 @@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ -FGREP = @FGREP@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HAVE_LIBSIGSEGV = @HAVE_LIBSIGSEGV@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -122,42 +117,33 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ -LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBSIGSEGV = @LIBSIGSEGV@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ +LIBSIGSEGV_PREFIX = @LIBSIGSEGV_PREFIX@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ +LTLIBSIGSEGV = @LTLIBSIGSEGV@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POSUB = @POSUB@ -RANLIB = @RANLIB@ -SED = @SED@ -SEGVINCLUDE = @SEGVINCLUDE@ -SEGVSUBDIR = @SEGVSUBDIR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOCKET_LIBS = @SOCKET_LIBS@ @@ -175,7 +161,6 @@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -206,7 +191,6 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -217,7 +201,6 @@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ -subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ @@ -227,6 +210,7 @@ EXTRA_DIST = \ reg \ lib \ Gentests \ + Gentests.vms \ Maketests \ README \ addcomma.awk \ @@ -361,6 +345,11 @@ EXTRA_DIST = \ exitval2.awk \ exitval2.ok \ exitval2.w32 \ + fcall_exit.awk \ + fcall_exit.ok \ + fcall_exit2.awk \ + fcall_exit2.ok \ + fcall_exit2.in \ fflush.ok \ fflush.sh \ fieldwdth.awk \ @@ -396,6 +385,8 @@ EXTRA_DIST = \ fnparydl.ok \ fordel.awk \ fordel.ok \ + forref.awk \ + forref.ok \ forsimp.awk \ forsimp.ok \ fsbs.awk \ @@ -841,6 +832,8 @@ EXTRA_DIST = \ uninit3.ok \ uninit4.awk \ uninit4.ok \ + uninit5.awk \ + uninit5.ok \ uninitialized.awk \ uninitialized.ok \ unterm.awk \ @@ -888,8 +881,9 @@ BASIC_TESTS = \ arysubnm asgext awkpath back89 backgsub childin clobber closebad \ clsflnam compare compare2 concat1 concat2 concat3 concat4 convfmt \ datanonl defref delarpm2 delarprm delfunc dynlj eofsplit exitval1 \ - exitval2 fldchg fldchgnf fnamedat fnarray fnarray2 fnaryscl fnasgnm \ - fnmisc fordel forsimp fsbs fsrs fsspcoln fstabplus funsemnl funsmnam \ + exitval2 fcall_exit fcall_exit2 fldchg fldchgnf fnamedat fnarray \ + fnarray2 fnaryscl fnasgnm \ + fnmisc fordel forref forsimp fsbs fsrs fsspcoln fstabplus funsemnl funsmnam \ funstack getline getline2 getline3 getlnbuf getnr2tb getnr2tm \ gsubasgn gsubtest gsubtst2 gsubtst3 gsubtst4 gsubtst5 gsubtst6 \ hex hsprint inputred intest intprec iobug1 leaddig leadnl litoct \ @@ -904,7 +898,7 @@ BASIC_TESTS = \ rstest3 rstest4 rstest5 rswhite scalar sclforin sclifin sortempty \ splitargv splitarr splitdef splitvar splitwht strcat1 strnum1 \ strtod subamp subi18n subsepnm subslash substr swaplns synerr1 \ - synerr2 tradanch tweakfld uninit2 uninit3 uninit4 uninitialized \ + synerr2 tradanch tweakfld uninit2 uninit3 uninit4 uninit5 uninitialized \ unterm uparrfs wideidx wideidx2 widesub widesub2 widesub3 \ widesub4 wjposer1 zero2 zeroe0 zeroflag @@ -925,7 +919,7 @@ LOCALE_CHARSET_TESTS = asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \ # List of the tests which should be run with --lint option: -NEED_LINT = defref fmtspcl noeffect nofmtch shadow uninit2 uninit3 uninit4 uninitialized +NEED_LINT = defref fmtspcl noeffect nofmtch shadow uninit2 uninit3 uninit4 uninit5 uninitialized # List of the tests which should be run with --lint-old option: NEED_LINT_OLD = lintold @@ -970,12 +964,6 @@ $(top_srcdir)/configure: $(am__configure_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs tags: TAGS TAGS: @@ -1043,7 +1031,7 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -clean-am: clean-generic clean-libtool mostlyclean-am +clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile @@ -1095,7 +1083,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am -mostlyclean-am: mostlyclean-generic mostlyclean-libtool +mostlyclean-am: mostlyclean-generic pdf: pdf-am @@ -1109,16 +1097,15 @@ uninstall-am: .MAKE: install-am install-strip -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am html html-am info info-am 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 \ - mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am +.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-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 # Message stuff is to make it a little easier to follow. @@ -1824,6 +1811,16 @@ exitval2: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +fcall_exit: + @echo fcall_exit + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +fcall_exit2: + @echo fcall_exit2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + fldchg: @echo fldchg @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -1869,6 +1866,11 @@ fordel: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +forref: + @echo forref + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + forsimp: @echo forsimp @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -2394,6 +2396,11 @@ uninit4: @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +uninit5: + @echo uninit5 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + uninitialized: @echo uninitialized @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index 0da281d2..4cb91498 100644 --- a/test/Maketests +++ b/test/Maketests @@ -200,6 +200,16 @@ exitval2: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +fcall_exit: + @echo fcall_exit + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +fcall_exit2: + @echo fcall_exit2 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + fldchg: @echo fldchg @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -245,6 +255,11 @@ fordel: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +forref: + @echo forref + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + forsimp: @echo forsimp @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @@ -770,6 +785,11 @@ uninit4: @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +uninit5: + @echo uninit5 + @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + uninitialized: @echo uninitialized @AWKPATH=$(srcdir) $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/fcall_exit.awk b/test/fcall_exit.awk new file mode 100644 index 00000000..931b6073 --- /dev/null +++ b/test/fcall_exit.awk @@ -0,0 +1,24 @@ +#!/bin/awk -f + +function crash () { + exit 1 +} + +function true (a,b,c) { + return 0 +} + +BEGIN { + if (ARGV[1] == 1) { + print "true(1, 1, crash()) => crash properly." + true(1, 1, crash()) + } else if (ARGV[1] == 2) { + print "true(1, crash(), 1) => do not crash properly." + true(1, crash(),1) + } else { + print "true(1, crash()) => do not crash properly." + true(1, crash()) + } +} + +# FdF diff --git a/test/fcall_exit.ok b/test/fcall_exit.ok new file mode 100644 index 00000000..b289c6d5 --- /dev/null +++ b/test/fcall_exit.ok @@ -0,0 +1,2 @@ +true(1, crash()) => do not crash properly. +EXIT CODE: 1 diff --git a/test/fcall_exit2.awk b/test/fcall_exit2.awk new file mode 100644 index 00000000..cbf20820 --- /dev/null +++ b/test/fcall_exit2.awk @@ -0,0 +1,25 @@ +#!/bin/awk -f + +function crash () { + exit 1 +} + +function true (a,b,c) { + return 1 +} + +BEGIN { + if (ARGV[2] == 1) { + print "<BEGIN CONTEXT> true(1, crash()) => crash properly." + true(1, crash()) + # ADR: Added: + delete ARGV[2] + } +} + +{ + print "<RULE CONTEXT> true(1, crash()) => do not crash properly." + true(1, crash()) +} + +# FdF diff --git a/test/fcall_exit2.in b/test/fcall_exit2.in new file mode 100644 index 00000000..f7050c9f --- /dev/null +++ b/test/fcall_exit2.in @@ -0,0 +1 @@ +dummy input line diff --git a/test/fcall_exit2.ok b/test/fcall_exit2.ok new file mode 100644 index 00000000..6cc3da20 --- /dev/null +++ b/test/fcall_exit2.ok @@ -0,0 +1,2 @@ +<RULE CONTEXT> true(1, crash()) => do not crash properly. +EXIT CODE: 1 diff --git a/test/forref.awk b/test/forref.awk new file mode 100644 index 00000000..5f9ad350 --- /dev/null +++ b/test/forref.awk @@ -0,0 +1,11 @@ +BEGIN { + names[1] = "s" + names[2] = "m" + for (i in names) { + x[names[i]] = i + print i, names[i], x[names[i]] + } + print x["s"] +# adump(x) +# adump(names) +} diff --git a/test/forref.ok b/test/forref.ok new file mode 100644 index 00000000..e8088d01 --- /dev/null +++ b/test/forref.ok @@ -0,0 +1,3 @@ +1 s 1 +2 m 2 +1 diff --git a/test/hsprint.ok b/test/hsprint.ok index 88fa832a..f0a9e9cb 100644 --- a/test/hsprint.ok +++ b/test/hsprint.ok @@ -32,21 +32,21 @@ %-+ #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| + %0| zap| *|-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| + %#0| zap| *|-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| + % 0| zap| *|-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| + % #0| zap| *|-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| + %+0| zap| *|-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| + %+#0| zap| *|-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| + %+ 0| zap| *|-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| +%+ #0| zap| *|-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 | diff --git a/test/lc_num1.awk b/test/lc_num1.awk index c982a146..c9b98ecf 100644 --- a/test/lc_num1.awk +++ b/test/lc_num1.awk @@ -1,4 +1,19 @@ # Bug reported by Ulrich Drepper. +# BEGIN { +# printf("%'d %d\n", 1000000, 1000000) +# } + +# April 2010: +# This needs to be a smarter test so that systems without the %'d flag +# don't generate a needless failure. + BEGIN { - printf("%'d %d\n", 1000000, 1000000) + s = sprintf("%'d", 1234) + if (s == "1,234" || s == "1234") + print "ok, or at least the quote flag isn't supported" + else { + command = "od -c" + print("fail:", s) | command + close(command) + } } diff --git a/test/lc_num1.ok b/test/lc_num1.ok index 1f65708e..36a9eae3 100644 --- a/test/lc_num1.ok +++ b/test/lc_num1.ok @@ -1 +1 @@ -1,000,000 1000000 +ok, or at least the quote flag isn't supported diff --git a/test/localenl.ok b/test/localenl.ok index a6a1cffa..47a0748f 100644 --- a/test/localenl.ok +++ b/test/localenl.ok @@ -1,5 +1,4 @@ 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 index 2c7e78ce..ec1ad31c 100755 --- a/test/localenl.sh +++ b/test/localenl.sh @@ -35,7 +35,8 @@ AWK=${AWK:-../gawk} -for LC_ALL in C UNKNOWN POSIX en_US.ISO-8859-1 en_US.UTF-8 +# April 2010: Remove UNKNOWN, causes spurious failures on some systems +for LC_ALL in C POSIX en_US.ISO-8859-1 en_US.UTF-8 #UNKNOWN do export LC_ALL cat <<EOF | diff --git a/test/uninit5.awk b/test/uninit5.awk new file mode 100644 index 00000000..e63abe11 --- /dev/null +++ b/test/uninit5.awk @@ -0,0 +1,111 @@ +#From gregfjohnson@yahoo.com Sun Aug 30 08:36:36 2009 +#Return-Path: <gregfjohnson@yahoo.com> +#Received: from aahz (localhost [127.0.0.1]) +# by skeeve.com (8.14.1/8.14.1) with ESMTP id n7U5WoJ2003836 +# for <arnold@localhost>; Sun, 30 Aug 2009 08:36:36 +0300 +#X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on server1.f7.net +#X-Spam-Level: +#X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED +# autolearn=ham version=3.2.4 +#X-Envelope-From: gregfjohnson@yahoo.com +#X-Envelope-To: <arnold@skeeve.com> +#Received: from server1.f7.net [64.34.169.74] +# by aahz with IMAP (fetchmail-6.3.7) +# for <arnold@localhost> (single-drop); Sun, 30 Aug 2009 08:36:36 +0300 (IDT) +#Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) +# by f7.net (8.11.7-20030920/8.11.7) with ESMTP id n7U33m709453 +# for <arnold@skeeve.com>; Sat, 29 Aug 2009 22:03:48 -0500 +#Received: from mail.gnu.org ([199.232.76.166]:42095 helo=mx10.gnu.org) +# by fencepost.gnu.org with esmtp (Exim 4.67) +# (envelope-from <gregfjohnson@yahoo.com>) +# id 1Mhai6-0004Qt-3R +# for bug-gawk@gnu.org; Sat, 29 Aug 2009 23:04:06 -0400 +#Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) +# (envelope-from <gregfjohnson@yahoo.com>) +# id 1Mhai5-00062I-EM +# for bug-gawk@gnu.org; Sat, 29 Aug 2009 23:04:05 -0400 +#Received: from web33507.mail.mud.yahoo.com ([68.142.206.156]:28597) +# by monty-python.gnu.org with smtp (Exim 4.60) +# (envelope-from <gregfjohnson@yahoo.com>) +# id 1Mhai5-00061w-2n +# for bug-gawk@gnu.org; Sat, 29 Aug 2009 23:04:05 -0400 +#Received: (qmail 68722 invoked by uid 60001); 30 Aug 2009 03:04:03 -0000 +#DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1251601443; bh=9h2ZOOgxUh+s8Ow5/ZMWUxcviy2L4rpiaNamPAXxhEk=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=tWxCQq/aTOT5lhtdPc5hxtXzOjDFmLU6Ao0BSlwbeeBsd9Wl6DU3JCR4gTkoL0aVUOTdjMjgRY7I72yCht+YruDiqZrvtSKvUoAvZAKcPG26RE4jzxUlxQklEHZG9mq9h2gpTIiLYehYDiC0975wukwi/e7ePADfkFwg8eTnT44= +#DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; +# s=s1024; d=yahoo.com; +# h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; +# b=LWfhVgxojFG1eYoRrxtrS3YOfH3MTUVTYZle/4utMQEPZQfsmrn6GBwBfThryGqJyZfg38/7JfK9cz/Q3Yt+mf8+xl9/m+Srckc+Xvi42CE0OmoN439vCyhAD8A74XOJsmfKDjJ/+LtioShStUohj1iYDDmRTN4RnnP9X4xnt3c=; +#Message-ID: <410222.68490.qm@web33507.mail.mud.yahoo.com> +#X-YMail-OSG: mfjax.MVM1lI2q5gcl6bChbn6zHgNgj1fByHWJSzB8ZZUmI2QCH6pNwV_IaHxcqecu.VqjKUR6HQhXbziUnX.v5E2nOE61ass9AzqfdVOtKTEAzTPQJ8Z7QB7fq7BMtjn8yohDR6mwOyVTqv3RZh0m1Us7sLit6UmcgeSvJo2rROAmeceq.FBwk2XnEp2_QsljjPHak_WXyvtAK81klDv5qQORWQWqR9q79x7yxORL6fLWwb_x6mZZMSOUaA0p8.ucT453eqT1L8NGkthF.fXmOM3_EYd03zUgr9Sb.zvMvbDC3MCMnVr0JT1uroLmFtVIdTojrFJYFQEDFSB9zT3Ua80ZpGXrjQGx3rZw-- +#Received: from [71.165.246.171] by web33507.mail.mud.yahoo.com via HTTP; Sat, 29 Aug 2009 20:04:03 PDT +#X-Mailer: YahooMailClassic/6.1.2 YahooMailWebService/0.7.338.2 +#Date: Sat, 29 Aug 2009 20:04:03 -0700 (PDT) +#From: Greg Johnson <gregfjohnson@yahoo.com> +#Subject: bugs in passing uninitialized array to a function +#To: bug-gawk@gnu.org +#MIME-Version: 1.0 +#Content-Type: multipart/mixed; boundary="0-1690489838-1251601443=:68490" +#X-detected-operating-system: by monty-python.gnu.org: FreeBSD 6.x (1) +#Status: RO +# +#--0-1690489838-1251601443=:68490 +#Content-Type: text/plain; charset=us-ascii +# +#I am using gawk version 3.1.7. +# +#The attached programs illustrate what look to me like two bugs +#in the handling of uninitialized variables to functions that treat +#them as arrays. +# +#Greg Johnson +# +# +# +#--0-1690489838-1251601443=:68490 +#Content-Type: application/octet-stream; name=b1 +#Content-Transfer-Encoding: base64 +#Content-Disposition: attachment; filename="b1" + +# bug? on uninitialized array, length(a) prints as 3, then the loop +# behaves differently, iterating once. so, length() behaves differently +# on two calls to the same variable, which was not changed. + +function prt1(a, len) +{ + print "length: " length(a) + + for (i = 1; i <= length(a); i++) + printf "<" i "," a[i] "> " + + print "\n" +} + +BEGIN { + prt1(zzz) +} + +#--0-1690489838-1251601443=:68490 +#Content-Type: application/octet-stream; name=b2 +#Content-Transfer-Encoding: base64 +#Content-Disposition: attachment; filename="b2" + +# shouldn't an uninitialized array have length zero? +# length is printed as 1, and the loop iterates once. + +function prt(a, len) +{ + len = length(a) + print "length: " len + + for (i = 1; i <= len; i++) + printf "<" i "," a[i] "> " + + print "\n" +} + +BEGIN { + prt(zzz) +} + +#--0-1690489838-1251601443=:68490-- + diff --git a/test/uninit5.ok b/test/uninit5.ok new file mode 100644 index 00000000..88663131 --- /dev/null +++ b/test/uninit5.ok @@ -0,0 +1,10 @@ +gawk: uninit5.awk:75: warning: `length(array)' is a gawk extension +gawk: uninit5.awk:75: warning: length: untyped parameter argument will be forced to scalar +length: 0 +gawk: uninit5.awk:77: warning: length: untyped parameter argument will be forced to scalar + + +gawk: uninit5.awk:97: warning: length: untyped parameter argument will be forced to scalar +length: 0 + + |