From cdf892a07fa67c635997e41ee8fe175aaafb2431 Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Sat, 19 May 2012 23:45:07 -0400 Subject: Add -i option, append .awk if initial search fails, and allow -f repeats. --- test/ChangeLog | 11 +++++++++++ test/Makefile.am | 33 +++++++++++++++++++++++++++++++-- test/Makefile.in | 38 ++++++++++++++++++++++++++++++++++++-- test/Maketests | 5 +++++ test/badargs.ok | 1 + test/hello.awk | 3 +++ test/incdupe.ok | 3 +++ test/incdupe2.ok | 2 ++ test/incdupe3.ok | 2 ++ test/inclib.awk | 7 +++++++ test/include.awk | 5 +++++ test/include.ok | 2 ++ test/include2.ok | 2 ++ 13 files changed, 110 insertions(+), 4 deletions(-) create mode 100644 test/hello.awk create mode 100644 test/incdupe.ok create mode 100644 test/incdupe2.ok create mode 100644 test/incdupe3.ok create mode 100644 test/inclib.awk create mode 100644 test/include.awk create mode 100644 test/include.ok create mode 100644 test/include2.ok (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 95bd42dd..755caeb2 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,14 @@ +2012-05-19 Andrew J. Schorr + + * Makefile.am (EXTRA_DIST): Add new files hello.awk, inclib.awk, + include.awk, include.ok, include2.ok, incdupe.ok, incdupe2.ok and + incdupe3.ok. + (GAWK_EXT_TESTS): Add include, include2, incdupe, incdupe2 and incdupe3. + (include2, incdupe, incdupe2, incdupe3): New tests. + * badargs.ok: Fix usage message to include new -i option. + * hello.awk, incdupe.ok, incdupe2.ok, incdupe3.ok, inclib.awk, + include.awk, include.ok, include2.ok: New files. + 2012-05-09 Arnold D. Robbins * Makefile.am (jarebug): New test. diff --git a/test/Makefile.am b/test/Makefile.am index 726c89ce..e782d1c0 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -347,6 +347,7 @@ EXTRA_DIST = \ gsubtst8.in \ gsubtst8.ok \ gtlnbufv.awk \ + hello.awk \ hex.awk \ hex.ok \ hsprint.awk \ @@ -367,6 +368,13 @@ EXTRA_DIST = \ ignrcase.ok \ ignrcas2.awk \ ignrcas2.ok \ + inclib.awk \ + include.awk \ + include.ok \ + include2.ok \ + incdupe.ok \ + incdupe2.ok \ + incdupe3.ok \ indirectcall.awk \ indirectcall.in \ indirectcall.ok \ @@ -859,7 +867,8 @@ GAWK_EXT_TESTS = \ profile1 profile2 profile3 pty1 \ rebuf regx8bit reint reint2 rsstart1 \ rsstart2 rsstart3 rstest6 shadow sortfor sortu splitarg4 strftime \ - strtonum switch2 + strtonum switch2 \ + include include2 incdupe incdupe2 incdupe3 EXTRA_TESTS = inftest regtest @@ -892,7 +901,7 @@ CHECK_MPFR = \ rand fnarydel fnparydl # List of the files that appear in manual tests or are for reserve testing: -GENTESTS_UNUSED = Makefile.in gtlnbufv.awk printfloat.awk +GENTESTS_UNUSED = Makefile.in gtlnbufv.awk printfloat.awk inclib.awk hello.awk CMP = cmp AWKPROG = ../gawk$(EXEEXT) @@ -1548,6 +1557,26 @@ readfile:: @$(AWK) -l readfile 'BEGIN {printf "%s", readfile("Makefile")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) Makefile _$@ && rm -f _$@ || cp -p Makefile $@.ok +include2:: + @echo $@ + @$(AWK) -i inclib 'BEGIN {print sandwich("a", "b", "c")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +incdupe:: + @echo $@ + @$(AWK) --lint -i inclib -i inclib.awk 'BEGIN {print sandwich("a", "b", "c")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +incdupe2:: + @echo $@ + @$(AWK) --lint -f inclib -f inclib.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +incdupe3:: + @echo $@ + @$(AWK) --lint -f hello -f hello.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + # Targets generated for other tests: include Maketests diff --git a/test/Makefile.in b/test/Makefile.in index fb48935d..d6ffc309 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -579,6 +579,7 @@ EXTRA_DIST = \ gsubtst8.in \ gsubtst8.ok \ gtlnbufv.awk \ + hello.awk \ hex.awk \ hex.ok \ hsprint.awk \ @@ -599,6 +600,13 @@ EXTRA_DIST = \ ignrcase.ok \ ignrcas2.awk \ ignrcas2.ok \ + inclib.awk \ + include.awk \ + include.ok \ + include2.ok \ + incdupe.ok \ + incdupe2.ok \ + incdupe3.ok \ indirectcall.awk \ indirectcall.in \ indirectcall.ok \ @@ -1091,7 +1099,8 @@ GAWK_EXT_TESTS = \ profile1 profile2 profile3 pty1 \ rebuf regx8bit reint reint2 rsstart1 \ rsstart2 rsstart3 rstest6 shadow sortfor sortu splitarg4 strftime \ - strtonum switch2 + strtonum switch2 \ + include include2 incdupe incdupe2 incdupe3 EXTRA_TESTS = inftest regtest INET_TESTS = inetdayu inetdayt inetechu inetecht @@ -1123,7 +1132,7 @@ CHECK_MPFR = \ # List of the files that appear in manual tests or are for reserve testing: -GENTESTS_UNUSED = Makefile.in gtlnbufv.awk printfloat.awk +GENTESTS_UNUSED = Makefile.in gtlnbufv.awk printfloat.awk inclib.awk hello.awk CMP = cmp AWKPROG = ../gawk$(EXEEXT) @@ -1955,6 +1964,26 @@ readfile:: @echo $@ @$(AWK) -l readfile 'BEGIN {printf "%s", readfile("Makefile")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) Makefile _$@ && rm -f _$@ || cp -p Makefile $@.ok + +include2:: + @echo $@ + @$(AWK) -i inclib 'BEGIN {print sandwich("a", "b", "c")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +incdupe:: + @echo $@ + @$(AWK) --lint -i inclib -i inclib.awk 'BEGIN {print sandwich("a", "b", "c")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +incdupe2:: + @echo $@ + @$(AWK) --lint -f inclib -f inclib.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +incdupe3:: + @echo $@ + @$(AWK) --lint -f hello -f hello.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: @@ -3092,6 +3121,11 @@ switch2: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +include: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + double1: @echo $@ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index e6a985b0..6856b870 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1135,6 +1135,11 @@ switch2: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +include: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + double1: @echo $@ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/badargs.ok b/test/badargs.ok index 35c7d027..1be81ec3 100644 --- a/test/badargs.ok +++ b/test/badargs.ok @@ -15,6 +15,7 @@ Short options: GNU long options: (extensions) -E file --exec=file -g --gen-pot -h --help + -i includefile --include=includefile -l library --load=library -L [fatal] --lint[=fatal] -n --non-decimal-data diff --git a/test/hello.awk b/test/hello.awk new file mode 100644 index 00000000..9e6d569d --- /dev/null +++ b/test/hello.awk @@ -0,0 +1,3 @@ +BEGIN { + print "Hello" +} diff --git a/test/incdupe.ok b/test/incdupe.ok new file mode 100644 index 00000000..63c85e41 --- /dev/null +++ b/test/incdupe.ok @@ -0,0 +1,3 @@ +gawk: warning: already included source file `inclib.awk' +Include library loaded. +abc diff --git a/test/incdupe2.ok b/test/incdupe2.ok new file mode 100644 index 00000000..11787238 --- /dev/null +++ b/test/incdupe2.ok @@ -0,0 +1,2 @@ +gawk: inclib.awk:5: error: function name `sandwich' previously defined +EXIT CODE: 1 diff --git a/test/incdupe3.ok b/test/incdupe3.ok new file mode 100644 index 00000000..af17d2f8 --- /dev/null +++ b/test/incdupe3.ok @@ -0,0 +1,2 @@ +Hello +Hello diff --git a/test/inclib.awk b/test/inclib.awk new file mode 100644 index 00000000..51785283 --- /dev/null +++ b/test/inclib.awk @@ -0,0 +1,7 @@ +BEGIN { + print "Include library loaded." +} + +function sandwich(pfx,x,sfx) { + return (pfx x sfx) +} diff --git a/test/include.awk b/test/include.awk new file mode 100644 index 00000000..8fc7837d --- /dev/null +++ b/test/include.awk @@ -0,0 +1,5 @@ +@include "inclib.awk" + +BEGIN { + print sandwich("a", "b", "c") +} diff --git a/test/include.ok b/test/include.ok new file mode 100644 index 00000000..a720efca --- /dev/null +++ b/test/include.ok @@ -0,0 +1,2 @@ +Include library loaded. +abc diff --git a/test/include2.ok b/test/include2.ok new file mode 100644 index 00000000..a720efca --- /dev/null +++ b/test/include2.ok @@ -0,0 +1,2 @@ +Include library loaded. +abc -- cgit v1.2.3 From 29f456563c740cb79f7668bc3dc282aac6a92de1 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sun, 20 May 2012 22:27:56 +0300 Subject: Build infrastructure updated. --- test/Makefile.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/Makefile.in b/test/Makefile.in index d6ffc309..0fabf7b4 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -84,9 +84,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libsigsegv.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/longlong.m4 \ - $(top_srcdir)/m4/mpfr.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/nls.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/mpfr.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/noreturn.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/readline.m4 \ $(top_srcdir)/m4/socket.m4 $(top_srcdir)/m4/ulonglong.m4 \ -- cgit v1.2.3 From c62b9d773bc064bc1dd5d8db35207fd4e6d42f1e Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Mon, 21 May 2012 22:52:45 -0400 Subject: Move libtool from top configure.ac into extension directory. --- test/Makefile.in | 61 ++++++++++++++++---------------------------------------- 1 file changed, 17 insertions(+), 44 deletions(-) (limited to 'test') diff --git a/test/Makefile.in b/test/Makefile.in index 0fabf7b4..c0462abb 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -83,14 +83,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/arch.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/libsigsegv.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/mpfr.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/noreturn.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/readline.m4 \ - $(top_srcdir)/m4/socket.m4 $(top_srcdir)/m4/ulonglong.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/mpfr.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/noreturn.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/readline.m4 $(top_srcdir)/m4/socket.m4 \ + $(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -107,7 +104,6 @@ am__can_run_installinfo = \ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -129,15 +125,11 @@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -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@ @@ -150,7 +142,6 @@ 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@ @@ -160,25 +151,17 @@ LIBREADLINE = @LIBREADLINE@ LIBS = @LIBS@ LIBSIGSEGV = @LIBSIGSEGV@ LIBSIGSEGV_PREFIX = @LIBSIGSEGV_PREFIX@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ LTLIBSIGSEGV = @LTLIBSIGSEGV@ MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ 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@ @@ -188,8 +171,6 @@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ POSUB = @POSUB@ -RANLIB = @RANLIB@ -SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOCKET_LIBS = @SOCKET_LIBS@ @@ -205,9 +186,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ acl_shlibext = @acl_shlibext@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ @@ -250,6 +229,7 @@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ @@ -1172,12 +1152,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: @@ -1252,7 +1226,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 @@ -1304,7 +1278,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 @@ -1318,16 +1292,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. -- cgit v1.2.3 From 577c3fc31a2718461fba2e599d162de96fe838fa Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Thu, 24 May 2012 15:34:17 -0400 Subject: First working version of new API mechanism (probably has memory leaks). --- test/ChangeLog | 5 +++++ test/Makefile.am | 10 +++++----- test/Makefile.in | 10 +++++----- 3 files changed, 15 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 755caeb2..72c7b9e8 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2012-05-24 Andrew J. Schorr + + * Makefile.am (fmtspcl, include2, incdupe, incdup2, incdupe3): Fix + paths to work properly when built in another directory. + 2012-05-19 Andrew J. Schorr * Makefile.am (EXTRA_DIST): Add new files hello.awk, inclib.awk, diff --git a/test/Makefile.am b/test/Makefile.am index e782d1c0..2af0e38b 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1159,7 +1159,7 @@ fmtspcl.ok: fmtspcl.tok Makefile fmtspcl: fmtspcl.ok @echo $@ @$(AWK) -f $(srcdir)/fmtspcl.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-if test -z "$$AWKFLAGS" ; then $(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ ; else \ + @-if test -z "$$AWKFLAGS" ; then $(CMP) $@.ok _$@ && rm -f _$@ ; else \ $(CMP) $(srcdir)/$@-mpfr.ok _$@ && rm -f _$@ ; \ fi @@ -1559,22 +1559,22 @@ readfile:: include2:: @echo $@ - @$(AWK) -i inclib 'BEGIN {print sandwich("a", "b", "c")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -i inclib 'BEGIN {print sandwich("a", "b", "c")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ incdupe:: @echo $@ - @$(AWK) --lint -i inclib -i inclib.awk 'BEGIN {print sandwich("a", "b", "c")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) --lint -i inclib -i inclib.awk 'BEGIN {print sandwich("a", "b", "c")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ incdupe2:: @echo $@ - @$(AWK) --lint -f inclib -f inclib.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) --lint -f inclib -f inclib.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ incdupe3:: @echo $@ - @$(AWK) --lint -f hello -f hello.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) --lint -f hello -f hello.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ # Targets generated for other tests: diff --git a/test/Makefile.in b/test/Makefile.in index c0462abb..0c990912 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1540,7 +1540,7 @@ fmtspcl.ok: fmtspcl.tok Makefile fmtspcl: fmtspcl.ok @echo $@ @$(AWK) -f $(srcdir)/fmtspcl.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-if test -z "$$AWKFLAGS" ; then $(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ ; else \ + @-if test -z "$$AWKFLAGS" ; then $(CMP) $@.ok _$@ && rm -f _$@ ; else \ $(CMP) $(srcdir)/$@-mpfr.ok _$@ && rm -f _$@ ; \ fi @@ -1940,22 +1940,22 @@ readfile:: include2:: @echo $@ - @$(AWK) -i inclib 'BEGIN {print sandwich("a", "b", "c")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) -i inclib 'BEGIN {print sandwich("a", "b", "c")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ incdupe:: @echo $@ - @$(AWK) --lint -i inclib -i inclib.awk 'BEGIN {print sandwich("a", "b", "c")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) --lint -i inclib -i inclib.awk 'BEGIN {print sandwich("a", "b", "c")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ incdupe2:: @echo $@ - @$(AWK) --lint -f inclib -f inclib.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) --lint -f inclib -f inclib.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ incdupe3:: @echo $@ - @$(AWK) --lint -f hello -f hello.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @AWKPATH=$(srcdir) $(AWK) --lint -f hello -f hello.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program -- cgit v1.2.3 From eec7101174a3b2807fb282272f75cc13d4b953c3 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 25 May 2012 15:18:43 +0300 Subject: Additional changes / some cleanups. --- test/ChangeLog | 5 +++++ test/Makefile.am | 2 +- test/Makefile.in | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 72c7b9e8..563f8e05 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2012-05-25 Arnold D. Robbins + + * Makefile.am (readfile): Don't copy the Makefile over readfile.ok + if there's a problem. + 2012-05-24 Andrew J. Schorr * Makefile.am (fmtspcl, include2, incdupe, incdup2, incdupe3): Fix diff --git a/test/Makefile.am b/test/Makefile.am index 2af0e38b..ea7e9a9e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1555,7 +1555,7 @@ ordchr2:: readfile:: @echo $@ @$(AWK) -l readfile 'BEGIN {printf "%s", readfile("Makefile")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) Makefile _$@ && rm -f _$@ || cp -p Makefile $@.ok + @-$(CMP) Makefile _$@ && rm -f _$@ include2:: @echo $@ diff --git a/test/Makefile.in b/test/Makefile.in index 0c990912..34b7e930 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1936,7 +1936,7 @@ ordchr2:: readfile:: @echo $@ @$(AWK) -l readfile 'BEGIN {printf "%s", readfile("Makefile")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) Makefile _$@ && rm -f _$@ || cp -p Makefile $@.ok + @-$(CMP) Makefile _$@ && rm -f _$@ include2:: @echo $@ -- cgit v1.2.3 From 62d890d4384a70c7550876c617b3a34e28dab234 Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Sat, 26 May 2012 10:44:07 -0400 Subject: Install gawkapi.h, fix is_off_limits_var, and enhance ordchr test. --- test/ChangeLog | 8 ++++++++ test/Makefile.am | 3 ++- test/Makefile.in | 3 ++- test/ordchr.awk | 5 +++++ test/ordchr.ok | 4 ++++ 5 files changed, 21 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 563f8e05..6031ca09 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,11 @@ +2012-05-26 Andrew J. Schorr + + * Makefile.am (readfile): Revert previous patch, and add comment + explaining that we need to create readfile.ok on failure so that + "make diffout" will work properly. + (ordchr.awk, ordchr.ok): Add more tests to catch type conversion + problems. + 2012-05-25 Arnold D. Robbins * Makefile.am (readfile): Don't copy the Makefile over readfile.ok diff --git a/test/Makefile.am b/test/Makefile.am index ea7e9a9e..c0293ba5 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1552,10 +1552,11 @@ ordchr2:: @$(AWK) -l ordchr 'BEGIN {print chr(ord("z"))}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +# N.B. If the test fails, create readfile.ok so that "make diffout" will work readfile:: @echo $@ @$(AWK) -l readfile 'BEGIN {printf "%s", readfile("Makefile")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) Makefile _$@ && rm -f _$@ + @-$(CMP) Makefile _$@ && rm -f _$@ || cp -p Makefile $@.ok include2:: @echo $@ diff --git a/test/Makefile.in b/test/Makefile.in index 34b7e930..683ba8a9 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1933,10 +1933,11 @@ ordchr2:: @$(AWK) -l ordchr 'BEGIN {print chr(ord("z"))}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +# N.B. If the test fails, create readfile.ok so that "make diffout" will work readfile:: @echo $@ @$(AWK) -l readfile 'BEGIN {printf "%s", readfile("Makefile")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) Makefile _$@ && rm -f _$@ + @-$(CMP) Makefile _$@ && rm -f _$@ || cp -p Makefile $@.ok include2:: @echo $@ diff --git a/test/ordchr.awk b/test/ordchr.awk index abb793a0..0295105e 100644 --- a/test/ordchr.awk +++ b/test/ordchr.awk @@ -2,4 +2,9 @@ BEGIN { print chr(ord("A")) + print chr(ord("0")) + print ord(chr(65)) + # test if type conversion between strings and numbers is working properly + print chr(ord(0)) + print ord(chr("65")) } diff --git a/test/ordchr.ok b/test/ordchr.ok index f70f10e4..86d901e9 100644 --- a/test/ordchr.ok +++ b/test/ordchr.ok @@ -1 +1,5 @@ A +0 +65 +0 +65 -- cgit v1.2.3 From 04dc190623f0d99d80387b33ca747b8cbad37724 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 29 May 2012 23:33:27 +0300 Subject: Further API work. --- test/ChangeLog | 4 ++++ test/Makefile.am | 2 +- test/Makefile.in | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 6031ca09..c4ac50de 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2012-05-29 Arnold D. Robbins + + * Makefile.am (clean): Add readfile.ok to list of files to removed. + 2012-05-26 Andrew J. Schorr * Makefile.am (readfile): Revert previous patch, and add comment diff --git a/test/Makefile.am b/test/Makefile.am index c0293ba5..348d4df2 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1586,7 +1586,7 @@ $(srcdir)/Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests $(AWK) -f $(srcdir)/Gentests "$(srcdir)/Makefile.am" $$files > $(srcdir)/Maketests clean: - rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ + rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok # An attempt to print something that can be grepped for in build logs pass-fail: diff --git a/test/Makefile.in b/test/Makefile.in index 683ba8a9..0afe5e05 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -3188,7 +3188,7 @@ $(srcdir)/Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests $(AWK) -f $(srcdir)/Gentests "$(srcdir)/Makefile.am" $$files > $(srcdir)/Maketests clean: - rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ + rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok # An attempt to print something that can be grepped for in build logs pass-fail: -- cgit v1.2.3 From 7891af5ec56ff4ed99435433c135079a9e24e037 Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Sun, 10 Jun 2012 21:03:48 -0400 Subject: Add time extension providing gettimeofday and sleep. --- test/ChangeLog | 6 ++++++ test/Makefile.am | 4 +++- test/Makefile.in | 9 ++++++++- test/Maketests | 5 +++++ test/time.awk | 12 ++++++++++++ test/time.ok | 3 +++ 6 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 test/time.awk create mode 100644 test/time.ok (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index c4ac50de..72a7c9ff 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,9 @@ +2012-06-10 Andrew J. Schorr + + * Makefile.am (EXTRA_DIST): Add new files time.awk and time.ok. + (SHLIB_TESTS): Add time. + * time.awk, time.ok: New files. + 2012-05-29 Arnold D. Robbins * Makefile.am (clean): Add readfile.ok to list of files to removed. diff --git a/test/Makefile.am b/test/Makefile.am index 348d4df2..6c65ae3c 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -757,6 +757,8 @@ EXTRA_DIST = \ synerr1.ok \ synerr2.awk \ synerr2.ok \ + time.awk \ + time.ok \ tradanch.awk \ tradanch.in \ tradanch.ok \ @@ -882,7 +884,7 @@ LOCALE_CHARSET_TESTS = \ asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc -SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs +SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs time # List of the tests which should be run with --lint option: NEED_LINT = \ diff --git a/test/Makefile.in b/test/Makefile.in index 0afe5e05..2ec90244 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -969,6 +969,8 @@ EXTRA_DIST = \ synerr1.ok \ synerr2.awk \ synerr2.ok \ + time.awk \ + time.ok \ tradanch.awk \ tradanch.in \ tradanch.ok \ @@ -1090,7 +1092,7 @@ LOCALE_CHARSET_TESTS = \ asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc -SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs +SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs time # List of the tests which should be run with --lint option: NEED_LINT = \ @@ -3179,6 +3181,11 @@ filefuncs: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +time: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + # end of file Maketests # Targets generated for other tests: diff --git a/test/Maketests b/test/Maketests index 6856b870..64cd8e71 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1219,4 +1219,9 @@ filefuncs: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +time: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + # end of file Maketests diff --git a/test/time.awk b/test/time.awk new file mode 100644 index 00000000..eeabc7bb --- /dev/null +++ b/test/time.awk @@ -0,0 +1,12 @@ +@load "time" + +BEGIN { + delta = 1.3 + printf "gettimeofday - systime = %d\n", (t0 = gettimeofday())-systime() + printf "sleep(%s) = %s\n",delta,sleep(delta) + printf "gettimeofday - systime = %d\n", (t1 = gettimeofday())-systime() + slept = t1-t0 + if ((slept < 0.9*delta) || (slept > 1.3*delta)) + printf "Warning: tried to sleep %.2f secs, but slept for %.2f secs\n", + delta,slept +} diff --git a/test/time.ok b/test/time.ok new file mode 100644 index 00000000..46606bfe --- /dev/null +++ b/test/time.ok @@ -0,0 +1,3 @@ +gettimeofday - systime = 0 +sleep(1.3) = 0 +gettimeofday - systime = 0 -- cgit v1.2.3 From 820b6a2ccb7859e15ade36af6ac1d0d08c1da4b1 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 12 Jun 2012 22:10:31 +0300 Subject: Further cleanups and improvements in API. --- test/ChangeLog | 4 ++++ test/Makefile.am | 2 +- test/Makefile.in | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 72a7c9ff..ac8737d6 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2012-06-12 Arnold D. Robbins + + * Makefile.am (clean): Add fork.tmp.* to the list. + 2012-06-10 Andrew J. Schorr * Makefile.am (EXTRA_DIST): Add new files time.awk and time.ok. diff --git a/test/Makefile.am b/test/Makefile.am index 6c65ae3c..6b052f1d 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1588,7 +1588,7 @@ $(srcdir)/Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests $(AWK) -f $(srcdir)/Gentests "$(srcdir)/Makefile.am" $$files > $(srcdir)/Maketests clean: - rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok + rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok fork.tmp.* # An attempt to print something that can be grepped for in build logs pass-fail: diff --git a/test/Makefile.in b/test/Makefile.in index 2ec90244..05f9db13 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -3195,7 +3195,7 @@ $(srcdir)/Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests $(AWK) -f $(srcdir)/Gentests "$(srcdir)/Makefile.am" $$files > $(srcdir)/Maketests clean: - rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok + rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok fork.tmp.* # An attempt to print something that can be grepped for in build logs pass-fail: -- cgit v1.2.3 From b0f08ac2443e239b0ed9cc4421758f0ed3f7a94f Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 18 Jun 2012 21:14:33 +0300 Subject: Add testext to list of shared library tests. --- test/ChangeLog | 6 ++++++ test/Makefile.am | 11 +++++++++-- test/Makefile.in | 11 +++++++++-- test/testext.ok | 30 ++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 test/testext.ok (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index ac8737d6..a1717010 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,9 @@ +2012-06-18 Arnold D. Robbins + + * Makefile.am (testext): New test. + (clean): Add testext.awk to the list. + * testext.ok: New file. + 2012-06-12 Arnold D. Robbins * Makefile.am (clean): Add fork.tmp.* to the list. diff --git a/test/Makefile.am b/test/Makefile.am index 6b052f1d..c520b722 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -757,6 +757,7 @@ EXTRA_DIST = \ synerr1.ok \ synerr2.awk \ synerr2.ok \ + testext.ok \ time.awk \ time.ok \ tradanch.awk \ @@ -884,7 +885,7 @@ LOCALE_CHARSET_TESTS = \ asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc -SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs time +SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs testext time # List of the tests which should be run with --lint option: NEED_LINT = \ @@ -1580,6 +1581,12 @@ incdupe3:: @AWKPATH=$(srcdir) $(AWK) --lint -f hello -f hello.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +testext:: + @echo $@ + @$(AWK) '/^(@load|BEGIN)/,/^}/' $(top_srcdir)/extension/testext.c > testext.awk + @$(AWK) -f testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ testext.awk + # Targets generated for other tests: include Maketests @@ -1588,7 +1595,7 @@ $(srcdir)/Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests $(AWK) -f $(srcdir)/Gentests "$(srcdir)/Makefile.am" $$files > $(srcdir)/Maketests clean: - rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok fork.tmp.* + rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok fork.tmp.* testext.awk # An attempt to print something that can be grepped for in build logs pass-fail: diff --git a/test/Makefile.in b/test/Makefile.in index 05f9db13..57ccbd99 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -969,6 +969,7 @@ EXTRA_DIST = \ synerr1.ok \ synerr2.awk \ synerr2.ok \ + testext.ok \ time.awk \ time.ok \ tradanch.awk \ @@ -1092,7 +1093,7 @@ LOCALE_CHARSET_TESTS = \ asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc -SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs time +SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs testext time # List of the tests which should be run with --lint option: NEED_LINT = \ @@ -1960,6 +1961,12 @@ incdupe3:: @echo $@ @AWKPATH=$(srcdir) $(AWK) --lint -f hello -f hello.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +testext:: + @echo $@ + @$(AWK) '/^(@load|BEGIN)/,/^}/' $(top_srcdir)/extension/testext.c > testext.awk + @$(AWK) -f testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ testext.awk Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: @@ -3195,7 +3202,7 @@ $(srcdir)/Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests $(AWK) -f $(srcdir)/Gentests "$(srcdir)/Makefile.am" $$files > $(srcdir)/Maketests clean: - rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok fork.tmp.* + rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok fork.tmp.* testext.awk # An attempt to print something that can be grepped for in build logs pass-fail: diff --git a/test/testext.ok b/test/testext.ok new file mode 100644 index 00000000..9cac57ad --- /dev/null +++ b/test/testext.ok @@ -0,0 +1,30 @@ +var_test: sym_lookup of ARGC passed - did not get a value +var_test: sym_update("testvar") succeeded +var_test() returned 1, test_var = 42 + +test_errno() returned 1, ERRNO = No child processes + +length of test_array is 10, should be 10 +test_array_size: incoming size is 10 +test_array_size() returned 1, length is now 0 + +test_array_elem: a["3"] = "three" +test_array_elem() returned 1, test_array2[3] = 42 +test_array_elem did remove element "5" +test_array_elem added element "7" --> seven + +Initial value of LINT is 0 +print_do_lint: lint = 0 +print_do_lint() returned 1 +Changed value of LINT is 1 +print_do_lint: lint = 1 +print_do_lint() returned 1 + +answer_num = 42 +message_string = hello, world +new_array["hello"] = "world" +new_array["answer"] = "42" + +at_exit2 called (should be first): data = NULL, exit_status = 0 +at_exit1 called (should be second): (data is & data_for_1), data value = 0xdeadbeef, exit_status = 0 +at_exit0 called (should be third): data = NULL, exit_status = 0 -- cgit v1.2.3 From 1e3ac8a49caeeb991d8163042a576a66db51c74b Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 18 Jun 2012 23:00:58 +0300 Subject: Get most of array flattening done. --- test/ChangeLog | 2 ++ test/testext.ok | 10 ++++++++++ 2 files changed, 12 insertions(+) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index a1717010..f8fc382e 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,6 +1,8 @@ 2012-06-18 Arnold D. Robbins * Makefile.am (testext): New test. + (EXTRA_DIST): Add new file testext.ok. + (SHLIB_TESTS): Add testext. (clean): Add testext.awk to the list. * testext.ok: New file. diff --git a/test/testext.ok b/test/testext.ok index 9cac57ad..83711a7b 100644 --- a/test/testext.ok +++ b/test/testext.ok @@ -1,3 +1,13 @@ +pets has 5 elements +dump_array: sym_lookup of pets passed +dump_array: incoming size is 5 + pets["1"] = "blacky" + pets["2"] = "rusty" + pets["3"] = "sophie" + pets["4"] = "raincloud" + pets["5"] = "lucky" +dump_array(pets) returned 1 + var_test: sym_lookup of ARGC passed - did not get a value var_test: sym_update("testvar") succeeded var_test() returned 1, test_var = 42 -- cgit v1.2.3 From fd3c1195711270a001d860770098b8c0d9118c10 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 19 Jun 2012 20:54:19 +0300 Subject: Delete marked elements from flattened array. --- test/ChangeLog | 4 ++++ test/testext.ok | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index f8fc382e..44af6057 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2012-06-19 Arnold D. Robbins + + * testext.ok: Update contents. + 2012-06-18 Arnold D. Robbins * Makefile.am (testext): New test. diff --git a/test/testext.ok b/test/testext.ok index 83711a7b..2f54668a 100644 --- a/test/testext.ok +++ b/test/testext.ok @@ -1,12 +1,14 @@ pets has 5 elements -dump_array: sym_lookup of pets passed -dump_array: incoming size is 5 +dump_array_and_delete: sym_lookup of pets passed +dump_array_and_delete: incoming size is 5 pets["1"] = "blacky" pets["2"] = "rusty" pets["3"] = "sophie" +dump_array_and_delete: marking element "3" for deletion pets["4"] = "raincloud" pets["5"] = "lucky" -dump_array(pets) returned 1 +dump_array_and_delete(pets) returned 1 +dump_array_and_delete() did remove index "3"! var_test: sym_lookup of ARGC passed - did not get a value var_test: sym_update("testvar") succeeded -- cgit v1.2.3 From d66f3c9922e36bb2e760e0ac36364c1a5aa11442 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 20 Jun 2012 21:41:15 +0300 Subject: API: Add set_parameter function and test. --- test/ChangeLog | 4 ++++ test/testext.ok | 8 ++++++++ 2 files changed, 12 insertions(+) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 44af6057..71edf199 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2012-06-20 Arnold D. Robbins + + * testext.ok: Update contents. + 2012-06-19 Arnold D. Robbins * testext.ok: Update contents. diff --git a/test/testext.ok b/test/testext.ok index 2f54668a..08e272d0 100644 --- a/test/testext.ok +++ b/test/testext.ok @@ -25,6 +25,14 @@ test_array_elem() returned 1, test_array2[3] = 42 test_array_elem did remove element "5" test_array_elem added element "7" --> seven +test_array_param() returned 1 +isarray(a_new_array) = 1 +a_new_array["hello"] = world +a_new_array["answer"] = 42 +test_array_param: argument is not undefined (1) +test_array_param() returned 0 +isarray(a_scalar) = 0 + Initial value of LINT is 0 print_do_lint: lint = 0 print_do_lint() returned 1 -- cgit v1.2.3 From 898eb2ad1d514887993994e60fe860ac3ee1bba8 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 21 Jun 2012 22:20:38 +0300 Subject: Further API code and test code. --- test/ChangeLog | 4 ++++ test/testext.ok | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 71edf199..6d363108 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2012-06-21 Arnold D. Robbins + + * testext.ok: Update contents. + 2012-06-20 Arnold D. Robbins * testext.ok: Update contents. diff --git a/test/testext.ok b/test/testext.ok index 08e272d0..619d97ba 100644 --- a/test/testext.ok +++ b/test/testext.ok @@ -22,8 +22,10 @@ test_array_size() returned 1, length is now 0 test_array_elem: a["3"] = "three" test_array_elem() returned 1, test_array2[3] = 42 -test_array_elem did remove element "5" -test_array_elem added element "7" --> seven +test_array_elem() did remove element "5" +test_array_elem() added element "7" --> seven +test_array2["subarray"]["hello"] = world +test_array2["subarray"]["answer"] = 42 test_array_param() returned 1 isarray(a_new_array) = 1 -- cgit v1.2.3 From 2d0d82f7453b1c5ad5e1baa8c02c2f6d5e5ccb67 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 25 Jun 2012 22:05:42 +0300 Subject: Add rwarray to extension tests. --- test/ChangeLog | 5 + test/Makefile.am | 7 +- test/Makefile.in | 17 +- test/Maketests | 9 +- test/rwarray.awk | 33 +++ test/rwarray.in | 780 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/rwarray.ok | 3 + 7 files changed, 848 insertions(+), 6 deletions(-) create mode 100644 test/rwarray.awk create mode 100644 test/rwarray.in create mode 100644 test/rwarray.ok (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 6d363108..a0f7a649 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2012-06-25 Arnold D. Robbins + + * Makefile.am (rwarray): New test. + * rwarray.awk, rwarray.in, rwarray.ok: New files. + 2012-06-21 Arnold D. Robbins * testext.ok: Update contents. diff --git a/test/Makefile.am b/test/Makefile.am index c520b722..58fddfc0 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -689,6 +689,9 @@ EXTRA_DIST = \ rtlen.sh \ rtlen01.ok \ rtlen01.sh \ + rwarray.awk \ + rwarray.in \ + rwarray.ok \ scalar.awk \ scalar.ok \ sclforin.awk \ @@ -885,7 +888,9 @@ LOCALE_CHARSET_TESTS = \ asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc -SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs testext time +SHLIB_TESTS = \ + filefuncs fork fork2 ordchr ordchr2 readfile rwarray \ + testext time # List of the tests which should be run with --lint option: NEED_LINT = \ diff --git a/test/Makefile.in b/test/Makefile.in index 57ccbd99..3e170f84 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -901,6 +901,9 @@ EXTRA_DIST = \ rtlen.sh \ rtlen01.ok \ rtlen01.sh \ + rwarray.awk \ + rwarray.in \ + rwarray.ok \ scalar.awk \ scalar.ok \ sclforin.awk \ @@ -1093,7 +1096,10 @@ LOCALE_CHARSET_TESTS = \ asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc -SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs testext time +SHLIB_TESTS = \ + filefuncs fork fork2 ordchr ordchr2 readfile rwarray \ + testext time + # List of the tests which should be run with --lint option: NEED_LINT = \ @@ -3168,7 +3174,7 @@ sprintfc: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ -ordchr: +filefuncs: @echo $@ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ @@ -3183,11 +3189,16 @@ fork2: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ -filefuncs: +ordchr: @echo $@ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +rwarray: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + time: @echo $@ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index 64cd8e71..b10e1756 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1199,7 +1199,7 @@ sprintfc: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ -ordchr: +filefuncs: @echo $@ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ @@ -1214,11 +1214,16 @@ fork2: @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ -filefuncs: +ordchr: @echo $@ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +rwarray: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + time: @echo $@ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/rwarray.awk b/test/rwarray.awk new file mode 100644 index 00000000..5d1b7e9d --- /dev/null +++ b/test/rwarray.awk @@ -0,0 +1,33 @@ +@load "rwarray" + +BEGIN { + while ((getline word) > 0) + dict[word] = word word + + n = asorti(dict, dictindices) + for (i = 1; i <= n; i++) + printf("dict[%s] = %s\n", dictindices[i], dict[dictindices[i]]) > "orig.out" + close("orig.out"); + + ret = writea("orig.bin", dict) + printf "writea() returned %d, expecting 1\n", ret + + + ret = reada("orig.bin", dict) + printf "reada() returned %d, expecting 1\n", ret + + n = asorti(dict, dictindices) + for (i = 1; i <= n; i++) + printf("dict[%s] = %s\n", dictindices[i], dict[dictindices[i]]) > "new.out" + close("new.out"); + + ret = system("cmp orig.out new.out") + + if (ret == 0) + print "old and new are equal - GOOD" + else + print "old and new are not equal - BAD" + + if (ret == 0 && !("KEEPIT" in ENVIRON)) + system("rm -f orig.bin orig.out new.out") +} diff --git a/test/rwarray.in b/test/rwarray.in new file mode 100644 index 00000000..aff88306 --- /dev/null +++ b/test/rwarray.in @@ -0,0 +1,780 @@ +a +aardvark +aardvark's +aardvarks +abaci +aback +abacus +abacus's +abacuses +abaft +abalone +abalone's +abalones +abandon +abandoned +abandoning +abandonment +abandonment's +abandons +abase +abased +abasement +abases +abash +abashed +abashes +abashing +abasing +abate +abated +b +baa +baaed +baaing +baas +babble +babbled +babbler +babbler's +babblers +babbles +babbling +babe +babe's +babel +babels +babes +babied +babier +babies +babiest +baboon +baboon's +baboons +babushka +babushka's +babushkas +baby +baby's +babyhood +c +cab +cab's +cabal +cabal's +cabals +cabana +cabana's +cabanas +cabaret +cabaret's +cabarets +cabbage +cabbage's +cabbages +cabbed +cabbie +cabbies +cabbing +cabby +cabby's +cabin +cabin's +cabinet +cabinet's +cabinetmaker +cabinetmaker's +cabinetmakers +cabinets +cabins +d +d'arezzo +d'estaing +dab +dabbed +dabbing +dabble +dabbled +dabbler +dabbler's +dabblers +dabbles +dabbling +dabs +dacha +dacha's +dachas +dachshund +dachshund's +dachshunds +dactyl +dactyl's +dactylic +dactylics +dactyls +dad +dad's +daddies +db +db's +e +e'er +each +eager +eager's +eagerer +eagerest +eagerly +eagerness +eagerness's +eagle +eagle's +eagles +eaglet +eaglet's +eaglets +ear +ear's +earache +earache's +earaches +eardrum +eardrum's +eardrums +earful +earful's +earfuls +earl +ebay +ebay's +f +fa +fa's +fable +fable's +fabled +fables +fabric +fabric's +fabricate +fabricated +fabricates +fabricating +fabrication +fabrication's +fabrications +fabrics +fabulous +fabulously +facade +facade's +facades +face +face's +faced +faceless +facelift +facelifts +faces +facet +g +gab +gabardine +gabardine's +gabardines +gabbed +gabbier +gabbiest +gabbing +gabble +gabbled +gabbles +gabbling +gabby +gaberdine +gaberdine's +gaberdines +gable +gable's +gabled +gables +gabling +gabs +gad +gadabout +gadabout's +gadabouts +gadded +gadding +gadflies +h +h'm +ha +haberdasher +haberdasher's +haberdasheries +haberdashers +haberdashery +haberdashery's +habit +habit's +habitability +habitability's +habitable +habitat +habitat's +habitation +habitation's +habitations +habitats +habits +habitual +habitually +habituals +habituate +habituated +habituates +habituating +habituation +habituation's +i +iamb +iamb's +iambic +iambics +iambs +ibex +ibex's +ibexes +ibices +ibis +ibis's +ibises +ibuprofen +ice +ice's +iceberg +iceberg's +icebergs +icebound +icebox +icebox's +iceboxes +icebreaker +icebreaker's +icebreakers +icecap +icecap's +icecaps +iced +j +jab +jabbed +jabber +jabbered +jabberer +jabberer's +jabberers +jabbering +jabbers +jabbing +jabot +jabot's +jabots +jabs +jack +jack's +jackal +jackal's +jackals +jackass +jackass's +jackasses +jackboot +jackboot's +jackboots +jackdaw +jackdaw's +jackdaws +jacked +k +kabob +kabob's +kabobs +kaboom +kale +kale's +kaleidoscope +kaleidoscope's +kaleidoscopes +kaleidoscopic +kamikaze +kamikaze's +kamikazes +kangaroo +kangaroo's +kangarooed +kangarooing +kangaroos +kaolin +kaolin's +kapok +kapok's +kaput +kaput's +karakul +karakul's +khz +khz's +kw +l +la +la's +lab +lab's +label +label's +labeled +labeling +labelled +labelling +labels +labia +labia's +labial +labials +labium +labor +labor's +laboratories +laboratory +laboratory's +labored +laborer +laborer's +laborers +laboring +laborious +laboriously +labors +m +ma +ma'am +ma's +macabre +macadam +macadam's +macaroni +macaroni's +macaroon +macaroon's +macaroons +macaw +macaw's +macaws +mace +mace's +maced +macerate +macerated +macerates +macerating +maceration +maceration's +maces +machete +machete's +machetes +machination +machination's +n +nab +nabbed +nabbing +nabob +nabob's +nabobs +nabs +nacho +nachos +nacre +nacre's +nadir +nadir's +nadirs +nag +nagged +nagging +nags +naiad +naiad's +naiades +naiads +nail +nail's +nailbrush +nailbrush's +nailbrushes +nailed +nailing +o +o'clock +o'er +oaf +oaf's +oafish +oafs +oak +oak's +oaken +oaks +oakum +oakum's +oar +oar's +oared +oaring +oarlock +oarlock's +oarlocks +oars +oarsman +oarsman's +oarsmen +oases +oasis +oasis's +oat +oat's +oaten +p +pa +pa's +pace +pace's +paced +pacemaker +pacemaker's +pacemakers +paces +pacesetter +pacesetter's +pacesetters +pachyderm +pachyderm's +pachyderms +pacific +pacifically +pacification +pacification's +pacified +pacifier +pacifier's +pacifiers +pacifies +pacifism +pacifism's +pacifist +ph +ph's +q +qua +quack +quacked +quackery +quackery's +quacking +quacks +quad +quad's +quadrangle +quadrangle's +quadrangles +quadrangular +quadrangular's +quadrant +quadrant's +quadrants +quadraphonic +quadraphonics +quadratic +quadratic's +quadrature +quadrature's +quadrennial +quadriceps +quadriceps's +quadricepses +quadrilateral +quadrilaterals +r +rabbi +rabbi's +rabbies +rabbinate +rabbinate's +rabbinical +rabbis +rabbit +rabbit's +rabbited +rabbiting +rabbits +rabble +rabble's +rabbles +rabid +rabies +raccoon +raccoon's +raccoons +race +race's +racecourse +racecourse's +racecourses +raced +racehorse +racehorse's +racehorses +s +sabbatical +sabbaticals +saber +saber's +sabers +sable +sable's +sabled +sables +sabling +sabotage +sabotage's +sabotaged +sabotages +sabotaging +saboteur +saboteur's +saboteurs +sabre +sabres +sac +sac's +saccharin +saccharin's +saccharine +sacerdotal +sachem +sachem's +sachems +t +tab +tab's +tabbed +tabbies +tabbing +tabby +tabernacle +tabernacle's +tabernacles +table +table's +tableau +tableau's +tableaus +tableaux +tablecloth +tablecloth's +tablecloths +tabled +tableland +tableland's +tablelands +tables +tablespoon +tablespoon's +tablespoonful +tablespoonful's +tablespoonfuls +tablespoons +u +ubiquitous +ubiquitously +ubiquity +udder +udder's +udders +ugh +uglied +uglier +uglies +ugliest +ugliness +ugliness's +ugly +uglying +uh +ukulele +ukulele's +ukuleles +ulcer +ulcer's +ulcerate +ulcerated +ulcerates +ulcerating +ulceration +ulceration's +ulcered +ulcering +v +vacancies +vacancy +vacancy's +vacant +vacantly +vacate +vacated +vacates +vacating +vacation +vacation's +vacationed +vacationer +vacationers +vacationing +vacations +vaccinate +vaccinated +vaccinates +vaccinating +vaccination +vaccination's +vaccinations +vaccine +vaccine's +vaccines +vacillate +vacillated +vacillates +w +wackes +wackier +wackiest +wackiness +wackiness's +wacko +wackos +wacky +wad +wad's +wadded +wadding +wadding's +waddle +waddled +waddles +waddling +wade +waded +wader +wader's +waders +wades +wadi +wadi's +wadies +wading +wadis +wads +x +xenon +xenon's +xenophobia +xenophobia's +xenophobic +xenophon's +xerographic +xerography +xerography's +xerox +xerox's +xeroxed +xeroxes +xeroxing +xerxes +xerxes's +xhosa +xhosa's +xi'an +xiaoping +xiaoping's +xingu +xylem +xylem's +xylophone +xylophone's +xylophones +xylophonist +xylophonists +y +y'all +ya +yacht +yacht's +yachted +yachting +yachting's +yachts +yachtsman +yachtsmen +yahoo +yahoo's +yahoos +yak +yak's +yakked +yakking +yaks +yam +yam's +yammer +yammered +yammering +yammers +yams +yank +yanked +yanking +yanks +z +zanied +zanier +zanies +zaniest +zaniness +zaniness's +zany +zanying +zap +zapped +zapping +zaps +zeal +zeal's +zealot +zealot's +zealots +zealous +zealously +zealousness +zealousness's +zebra +zebra's +zebras +zebu +zebu's +zebus +zed +zed's diff --git a/test/rwarray.ok b/test/rwarray.ok new file mode 100644 index 00000000..8392135e --- /dev/null +++ b/test/rwarray.ok @@ -0,0 +1,3 @@ +writea() returned 1, expecting 1 +reada() returned 1, expecting 1 +old and new are equal - GOOD -- cgit v1.2.3 From 47828911ae88038eda1051cfa2232f46eda95fd8 Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Thu, 28 Jun 2012 10:37:36 -0400 Subject: Protect against race condition in test/time.awk. --- test/ChangeLog | 5 +++++ test/time.awk | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index a0f7a649..057434f9 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2012-06-28 Andrew J. Schorr + + * time.awk: Avoid possibly throwing a spurious error by protecting + a race condition that depends on the order of expression evaluation. + 2012-06-25 Arnold D. Robbins * Makefile.am (rwarray): New test. diff --git a/test/time.awk b/test/time.awk index eeabc7bb..517377e2 100644 --- a/test/time.awk +++ b/test/time.awk @@ -1,10 +1,20 @@ @load "time" +# make sure gettimeofday() is consistent with systime(). We must call +# gettimeofday() before systime() to make sure the subtraction gives 0 +# without risk of rolling over to the next second. +function timecheck(st,res) { + res = gettimeofday() + st = systime() + printf "gettimeofday - systime = %d\n", res-st + return res +} + BEGIN { delta = 1.3 - printf "gettimeofday - systime = %d\n", (t0 = gettimeofday())-systime() + t0 = timecheck() printf "sleep(%s) = %s\n",delta,sleep(delta) - printf "gettimeofday - systime = %d\n", (t1 = gettimeofday())-systime() + t1 = timecheck() slept = t1-t0 if ((slept < 0.9*delta) || (slept > 1.3*delta)) printf "Warning: tried to sleep %.2f secs, but slept for %.2f secs\n", -- cgit v1.2.3 From 33b647ef23daa8a310701c767098f11ee48cf4e8 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 12 Jul 2012 21:08:52 +0300 Subject: Add fnmatch extension. --- test/ChangeLog | 5 +++++ test/Makefile.am | 4 +++- test/Makefile.in | 9 ++++++++- test/Maketests | 5 +++++ test/fnmatch.awk | 10 ++++++++++ test/fnmatch.ok | 9 +++++++++ 6 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 test/fnmatch.awk create mode 100644 test/fnmatch.ok (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 057434f9..019d2f34 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2012-07-12 Arnold D. Robbins + + * Makefile.am (fnmatch): New test. + * fnmatch.awk, fnmatch.ok: New files. + 2012-06-28 Andrew J. Schorr * time.awk: Avoid possibly throwing a spurious error by protecting diff --git a/test/Makefile.am b/test/Makefile.am index 58fddfc0..a244c6a0 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -230,6 +230,8 @@ EXTRA_DIST = \ fnasgnm.awk \ fnasgnm.in \ fnasgnm.ok \ + fnmatch.awk \ + fnmatch.ok \ fnmisc.awk \ fnmisc.ok \ fnparydl.awk \ @@ -889,7 +891,7 @@ LOCALE_CHARSET_TESTS = \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc SHLIB_TESTS = \ - filefuncs fork fork2 ordchr ordchr2 readfile rwarray \ + fnmatch filefuncs fork fork2 ordchr ordchr2 readfile rwarray \ testext time # List of the tests which should be run with --lint option: diff --git a/test/Makefile.in b/test/Makefile.in index 3e170f84..61e32b1b 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -442,6 +442,8 @@ EXTRA_DIST = \ fnasgnm.awk \ fnasgnm.in \ fnasgnm.ok \ + fnmatch.awk \ + fnmatch.ok \ fnmisc.awk \ fnmisc.ok \ fnparydl.awk \ @@ -1097,7 +1099,7 @@ LOCALE_CHARSET_TESTS = \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc SHLIB_TESTS = \ - filefuncs fork fork2 ordchr ordchr2 readfile rwarray \ + fnmatch filefuncs fork fork2 ordchr ordchr2 readfile rwarray \ testext time @@ -3174,6 +3176,11 @@ sprintfc: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +fnmatch: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + filefuncs: @echo $@ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index b10e1756..0a4e5820 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1199,6 +1199,11 @@ sprintfc: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +fnmatch: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + filefuncs: @echo $@ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/fnmatch.awk b/test/fnmatch.awk new file mode 100644 index 00000000..e8ef9377 --- /dev/null +++ b/test/fnmatch.awk @@ -0,0 +1,10 @@ +@load "fnmatch" + +BEGIN { + print "FNM_NOMATCH =", FNM_NOMATCH + for (i in FNM) + printf("FNM[\"%s\"] = %d\n", i, FNM[i]) + + printf("fnmatch(\"*.a\", \"foo.a\", 0) = %d\n", fnmatch("*.a", "foo.a", 0) ) + printf("fnmatch(\"*.a\", \"foo.c\", 0) = %d\n", fnmatch("*.a", "foo.c", 0)) +} diff --git a/test/fnmatch.ok b/test/fnmatch.ok new file mode 100644 index 00000000..cc17c6b1 --- /dev/null +++ b/test/fnmatch.ok @@ -0,0 +1,9 @@ +FNM_NOMATCH = 1 +FNM["LEADING_DIR"] = 8 +FNM["CASEFOLD"] = 16 +FNM["NOESCAPE"] = 2 +FNM["PERIOD"] = 4 +FNM["PATHNAME"] = 1 +FNM["FILE_NAME"] = 1 +fnmatch("*.a", "foo.a", 0) = 0 +fnmatch("*.a", "foo.c", 0) = 1 -- cgit v1.2.3 From 28daef44c3c08f16002c678319a30b816f6972fd Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 12 Jul 2012 22:45:25 +0300 Subject: Allow creation of constants from extensions. --- test/ChangeLog | 3 +++ test/Makefile.am | 13 ++++++++++-- test/Makefile.in | 13 ++++++++++-- test/assignconst.awk | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ test/assignconst.ok | 42 +++++++++++++++++++++++++++++++++++++ 5 files changed, 125 insertions(+), 4 deletions(-) create mode 100644 test/assignconst.awk create mode 100644 test/assignconst.ok (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 019d2f34..50dcd27c 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -3,6 +3,9 @@ * Makefile.am (fnmatch): New test. * fnmatch.awk, fnmatch.ok: New files. + * Makefile.am (assignconst): New test. + * assignconst.awk, assignconst.ok: New files. + 2012-06-28 Andrew J. Schorr * time.awk: Avoid possibly throwing a spurious error by protecting diff --git a/test/Makefile.am b/test/Makefile.am index a244c6a0..78fd3117 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -102,6 +102,8 @@ EXTRA_DIST = \ asort.ok \ asorti.awk \ asorti.ok \ + assignconst.awk \ + assignconst.ok \ awkpath.ok \ back89.awk \ back89.in \ @@ -891,8 +893,8 @@ LOCALE_CHARSET_TESTS = \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc SHLIB_TESTS = \ - fnmatch filefuncs fork fork2 ordchr ordchr2 readfile rwarray \ - testext time + assignconst fnmatch filefuncs fork fork2 ordchr ordchr2 \ + readfile rwarray testext time # List of the tests which should be run with --lint option: NEED_LINT = \ @@ -1594,6 +1596,13 @@ testext:: @$(AWK) -f testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ testext.awk +assignconst: + @echo $@ + @for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; \ + do $(AWK) -f $(srcdir)/$@.awk $$i ; \ + done 2>&1 | grep -v at_exit > _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + # Targets generated for other tests: include Maketests diff --git a/test/Makefile.in b/test/Makefile.in index 61e32b1b..d12139cf 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -314,6 +314,8 @@ EXTRA_DIST = \ asort.ok \ asorti.awk \ asorti.ok \ + assignconst.awk \ + assignconst.ok \ awkpath.ok \ back89.awk \ back89.in \ @@ -1099,8 +1101,8 @@ LOCALE_CHARSET_TESTS = \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc SHLIB_TESTS = \ - fnmatch filefuncs fork fork2 ordchr ordchr2 readfile rwarray \ - testext time + assignconst fnmatch filefuncs fork fork2 ordchr ordchr2 \ + readfile rwarray testext time # List of the tests which should be run with --lint option: @@ -1975,6 +1977,13 @@ testext:: @$(AWK) '/^(@load|BEGIN)/,/^}/' $(top_srcdir)/extension/testext.c > testext.awk @$(AWK) -f testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ testext.awk + +assignconst: + @echo $@ + @for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; \ + do $(AWK) -f $(srcdir)/$@.awk $$i ; \ + done 2>&1 | grep -v at_exit > _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: diff --git a/test/assignconst.awk b/test/assignconst.awk new file mode 100644 index 00000000..907987c7 --- /dev/null +++ b/test/assignconst.awk @@ -0,0 +1,58 @@ +@load "testext" + +BEGIN { + print "" + print "test:", ARGV[1] + switch (ARGV[1] + 0) { + case 1: + answer_num = 43 + break + case 2: + ++answer_num + break + case 3: + --answer_num + break + case 4: + answer_num++ + break + case 5: + answer_num-- + break + case 6: + answer_num += 1 + break + case 7: + answer_num -= 1 + break + case 8: + answer_num *= 1 + break + case 9: + answer_num /= 1 + break + case 10: + answer_num ^= 1 + break + case 11: + answer_num = answer_num "foo" + break + case 12: + sub(/2/, "3", answer_num) + break + case 13: + a[1] = 1 + for (answer_num in a) + print answer_num, a[answer_num] + break + case 14: + test_func(answer_num) + break + } +} + +function test_func(val) +{ + val++ + print "in test_func, val now =", val +} diff --git a/test/assignconst.ok b/test/assignconst.ok new file mode 100644 index 00000000..e2bc7494 --- /dev/null +++ b/test/assignconst.ok @@ -0,0 +1,42 @@ + +test: 1 +gawk: ./assignconst.awk:8: fatal: cannot assign to defined constant + +test: 2 +gawk: ./assignconst.awk:11: fatal: cannot assign to defined constant + +test: 3 +gawk: ./assignconst.awk:14: fatal: cannot assign to defined constant + +test: 4 +gawk: ./assignconst.awk:17: fatal: cannot assign to defined constant + +test: 5 +gawk: ./assignconst.awk:20: fatal: cannot assign to defined constant + +test: 6 +gawk: ./assignconst.awk:23: fatal: cannot assign to defined constant + +test: 7 +gawk: ./assignconst.awk:26: fatal: cannot assign to defined constant + +test: 8 +gawk: ./assignconst.awk:29: fatal: cannot assign to defined constant + +test: 9 +gawk: ./assignconst.awk:32: fatal: cannot assign to defined constant + +test: 10 +gawk: ./assignconst.awk:35: fatal: cannot assign to defined constant + +test: 11 +gawk: ./assignconst.awk:38: fatal: cannot assign to defined constant + +test: 12 +gawk: ./assignconst.awk:41: fatal: cannot assign to defined constant + +test: 13 +gawk: ./assignconst.awk:45: fatal: cannot assign to defined constant + +test: 14 +in test_func, val now = 43 -- cgit v1.2.3 From 518a62884ff2b87b94cbfa1e2fa759f1829f6bd9 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sun, 15 Jul 2012 22:38:46 +0300 Subject: Additional test for AWK_SCALAR. --- test/ChangeLog | 4 ++++ test/testext.ok | 15 +++++++++++++++ 2 files changed, 19 insertions(+) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 50dcd27c..bb270e91 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2012-07-15 Arnold D. Robbins + + * testext.ok: Update contents. + 2012-07-12 Arnold D. Robbins * Makefile.am (fnmatch): New test. diff --git a/test/testext.ok b/test/testext.ok index 619d97ba..132179c2 100644 --- a/test/testext.ok +++ b/test/testext.ok @@ -42,6 +42,21 @@ Changed value of LINT is 1 print_do_lint: lint = 1 print_do_lint() returned 1 +test_scalar(1) returned 1, the_scalar is 1 +test_scalar(3) returned 1, the_scalar is 3 +test_scalar(5) returned 1, the_scalar is 5 +test_scalar(7) returned 1, the_scalar is 7 +test_scalar(9) returned 1, the_scalar is 9 +test_scalar(11) returned 1, the_scalar is 11 +test_scalar(the) returned 1, the_scalar is the +test_scalar(quick) returned 1, the_scalar is quick +test_scalar(brown) returned 1, the_scalar is brown +test_scalar(fox) returned 1, the_scalar is fox +test_scalar(jumps) returned 1, the_scalar is jumps +test_scalar(over) returned 1, the_scalar is over +test_scalar(the) returned 1, the_scalar is the +test_scalar(lazy) returned 1, the_scalar is lazy +test_scalar(dog) returned 1, the_scalar is dog answer_num = 42 message_string = hello, world new_array["hello"] = "world" -- cgit v1.2.3 From b06c8780cef407a0a6421691f60496ffd7d369de Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 16 Jul 2012 21:15:16 +0300 Subject: fnmatch extension improvements. --- test/ChangeLog | 4 ++++ test/fnmatch.awk | 3 ++- test/fnmatch.ok | 12 ++++++------ 3 files changed, 12 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index bb270e91..b38cf279 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2012-07-16 Arnold D. Robbins + + * fnmatch.awk, fnmatch.ok: Portability updates. + 2012-07-15 Arnold D. Robbins * testext.ok: Update contents. diff --git a/test/fnmatch.awk b/test/fnmatch.awk index e8ef9377..c0885074 100644 --- a/test/fnmatch.awk +++ b/test/fnmatch.awk @@ -2,8 +2,9 @@ BEGIN { print "FNM_NOMATCH =", FNM_NOMATCH + # can't print the values; they vary from system to system for (i in FNM) - printf("FNM[\"%s\"] = %d\n", i, FNM[i]) + printf("\"%s\" is an element in FNM\n", i) printf("fnmatch(\"*.a\", \"foo.a\", 0) = %d\n", fnmatch("*.a", "foo.a", 0) ) printf("fnmatch(\"*.a\", \"foo.c\", 0) = %d\n", fnmatch("*.a", "foo.c", 0)) diff --git a/test/fnmatch.ok b/test/fnmatch.ok index cc17c6b1..fd8a78ce 100644 --- a/test/fnmatch.ok +++ b/test/fnmatch.ok @@ -1,9 +1,9 @@ FNM_NOMATCH = 1 -FNM["LEADING_DIR"] = 8 -FNM["CASEFOLD"] = 16 -FNM["NOESCAPE"] = 2 -FNM["PERIOD"] = 4 -FNM["PATHNAME"] = 1 -FNM["FILE_NAME"] = 1 +"LEADING_DIR" is an element in FNM +"CASEFOLD" is an element in FNM +"NOESCAPE" is an element in FNM +"PERIOD" is an element in FNM +"PATHNAME" is an element in FNM +"FILE_NAME" is an element in FNM fnmatch("*.a", "foo.a", 0) = 0 fnmatch("*.a", "foo.c", 0) = 1 -- cgit v1.2.3 From 0fff60287fb9cc41288b3373f47031ab3dd597ac Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Wed, 25 Jul 2012 12:48:37 -0400 Subject: Minor configure.ac/Makefile.am change for more elegant shared library support. --- test/Makefile.in | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/Makefile.in b/test/Makefile.in index d12139cf..4868bdc6 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -130,6 +130,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +GAWKLIBEXT = @GAWKLIBEXT@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ -- cgit v1.2.3 From 82816b279615b27f7c4f87349a8c830a96939d8c Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sun, 29 Jul 2012 16:33:00 +0300 Subject: Finish work on iop management. New readdir test. --- test/ChangeLog | 5 +++++ test/Makefile.am | 11 ++++++++++- test/Makefile.in | 11 ++++++++++- test/readdir.awk | 7 +++++++ test/readdir0.awk | 9 +++++++++ 5 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 test/readdir.awk create mode 100644 test/readdir0.awk (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index b38cf279..a3fb627a 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2012-07-29 Arnold D. Robbins + + * Makefile.am (readdir): New test. + * readdir0.awk, readdir.awk: New files. + 2012-07-16 Arnold D. Robbins * fnmatch.awk, fnmatch.ok: Portability updates. diff --git a/test/Makefile.am b/test/Makefile.am index 78fd3117..5aa31b41 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -623,6 +623,8 @@ EXTRA_DIST = \ range1.awk \ range1.in \ range1.ok \ + readdir0.awk \ + readdir.awk \ rebt8b1.awk \ rebt8b1.ok \ rebt8b2.awk \ @@ -894,7 +896,7 @@ LOCALE_CHARSET_TESTS = \ SHLIB_TESTS = \ assignconst fnmatch filefuncs fork fork2 ordchr ordchr2 \ - readfile rwarray testext time + readdir readfile rwarray testext time # List of the tests which should be run with --lint option: NEED_LINT = \ @@ -1603,6 +1605,13 @@ assignconst: done 2>&1 | grep -v at_exit > _$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +readdir: + @echo $@ + @touch $@.out1 $@.out2 # create directory entries first + @ls -fli | sed 1d | $(AWK) -f $(srcdir)/readdir0.awk > $@.out1 + @$(AWK) -f $(srcdir)/readdir.awk . > $@.out2 + @-$(CMP) $@.out1 $@.out2 && rm -f $@.out[12] + # Targets generated for other tests: include Maketests diff --git a/test/Makefile.in b/test/Makefile.in index 4868bdc6..5375aaee 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -836,6 +836,8 @@ EXTRA_DIST = \ range1.awk \ range1.in \ range1.ok \ + readdir0.awk \ + readdir.awk \ rebt8b1.awk \ rebt8b1.ok \ rebt8b2.awk \ @@ -1103,7 +1105,7 @@ LOCALE_CHARSET_TESTS = \ SHLIB_TESTS = \ assignconst fnmatch filefuncs fork fork2 ordchr ordchr2 \ - readfile rwarray testext time + readdir readfile rwarray testext time # List of the tests which should be run with --lint option: @@ -1985,6 +1987,13 @@ assignconst: do $(AWK) -f $(srcdir)/$@.awk $$i ; \ done 2>&1 | grep -v at_exit > _$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +readdir: + @echo $@ + @touch $@.out1 $@.out2 # create directory entries first + @ls -fli | sed 1d | $(AWK) -f $(srcdir)/readdir0.awk > $@.out1 + @$(AWK) -f $(srcdir)/readdir.awk . > $@.out2 + @-$(CMP) $@.out1 $@.out2 && rm -f $@.out[12] Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: diff --git a/test/readdir.awk b/test/readdir.awk new file mode 100644 index 00000000..4d35be6a --- /dev/null +++ b/test/readdir.awk @@ -0,0 +1,7 @@ +@load "readdir" + +BEGIN { + readdir_do_ftype(1) +} + +{ print } diff --git a/test/readdir0.awk b/test/readdir0.awk new file mode 100644 index 00000000..54306f10 --- /dev/null +++ b/test/readdir0.awk @@ -0,0 +1,9 @@ +{ + ino = $1 + name = $NF + type = substr($2, 1, 1) + if (type == "-") + type = "f" + + printf "%s/%s/%s\n", ino, name, type +} -- cgit v1.2.3 From 030501c017701733c2d88cddd2656cb3a12b56bf Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 30 Jul 2012 21:43:45 +0300 Subject: Update assignconst test. --- test/ChangeLog | 6 ++++++ test/Makefile.am | 2 +- test/Makefile.in | 2 +- test/assignconst.ok | 26 +++++++++++++------------- 4 files changed, 21 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index a3fb627a..c012513a 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,9 @@ +2012-07-30 Arnold D. Robbins + + * Makefile.am (assignconst): Use AWKPATH to get results that will + be consistent no matter where the test is run. + * assignconst.ok: Updated. + 2012-07-29 Arnold D. Robbins * Makefile.am (readdir): New test. diff --git a/test/Makefile.am b/test/Makefile.am index 5aa31b41..270cc2fc 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1601,7 +1601,7 @@ testext:: assignconst: @echo $@ @for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; \ - do $(AWK) -f $(srcdir)/$@.awk $$i ; \ + do AWKPATH=$(srcdir) $(AWK) -f $@.awk $$i ; \ done 2>&1 | grep -v at_exit > _$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ diff --git a/test/Makefile.in b/test/Makefile.in index 5375aaee..4b6d5439 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1984,7 +1984,7 @@ testext:: assignconst: @echo $@ @for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; \ - do $(AWK) -f $(srcdir)/$@.awk $$i ; \ + do AWKPATH=$(srcdir) $(AWK) -f $@.awk $$i ; \ done 2>&1 | grep -v at_exit > _$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ diff --git a/test/assignconst.ok b/test/assignconst.ok index e2bc7494..97698b27 100644 --- a/test/assignconst.ok +++ b/test/assignconst.ok @@ -1,42 +1,42 @@ test: 1 -gawk: ./assignconst.awk:8: fatal: cannot assign to defined constant +gawk: assignconst.awk:8: fatal: cannot assign to defined constant test: 2 -gawk: ./assignconst.awk:11: fatal: cannot assign to defined constant +gawk: assignconst.awk:11: fatal: cannot assign to defined constant test: 3 -gawk: ./assignconst.awk:14: fatal: cannot assign to defined constant +gawk: assignconst.awk:14: fatal: cannot assign to defined constant test: 4 -gawk: ./assignconst.awk:17: fatal: cannot assign to defined constant +gawk: assignconst.awk:17: fatal: cannot assign to defined constant test: 5 -gawk: ./assignconst.awk:20: fatal: cannot assign to defined constant +gawk: assignconst.awk:20: fatal: cannot assign to defined constant test: 6 -gawk: ./assignconst.awk:23: fatal: cannot assign to defined constant +gawk: assignconst.awk:23: fatal: cannot assign to defined constant test: 7 -gawk: ./assignconst.awk:26: fatal: cannot assign to defined constant +gawk: assignconst.awk:26: fatal: cannot assign to defined constant test: 8 -gawk: ./assignconst.awk:29: fatal: cannot assign to defined constant +gawk: assignconst.awk:29: fatal: cannot assign to defined constant test: 9 -gawk: ./assignconst.awk:32: fatal: cannot assign to defined constant +gawk: assignconst.awk:32: fatal: cannot assign to defined constant test: 10 -gawk: ./assignconst.awk:35: fatal: cannot assign to defined constant +gawk: assignconst.awk:35: fatal: cannot assign to defined constant test: 11 -gawk: ./assignconst.awk:38: fatal: cannot assign to defined constant +gawk: assignconst.awk:38: fatal: cannot assign to defined constant test: 12 -gawk: ./assignconst.awk:41: fatal: cannot assign to defined constant +gawk: assignconst.awk:41: fatal: cannot assign to defined constant test: 13 -gawk: ./assignconst.awk:45: fatal: cannot assign to defined constant +gawk: assignconst.awk:45: fatal: cannot assign to defined constant test: 14 in test_func, val now = 43 -- cgit v1.2.3 From 88e81c931345aa485e55c6d6c7f3ad61dc200fed Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 8 Aug 2012 22:37:55 +0300 Subject: Add fts() extension, support, doc, and test. --- test/ChangeLog | 5 +++ test/Makefile.am | 10 ++++- test/Makefile.in | 10 ++++- test/fts.awk | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 142 insertions(+), 4 deletions(-) create mode 100644 test/fts.awk (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index c012513a..2b1ac648 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2012-08-08 Arnold D. Robbins + + * Makefile.am (fts): New test. + * fts.awk: New file. + 2012-07-30 Arnold D. Robbins * Makefile.am (assignconst): Use AWKPATH to get results that will diff --git a/test/Makefile.am b/test/Makefile.am index 270cc2fc..3a8e48ca 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -275,6 +275,7 @@ EXTRA_DIST = \ fstabplus.awk \ fstabplus.in \ fstabplus.ok \ + fts.awk \ funlen.awk \ funlen.in \ funlen.ok \ @@ -895,7 +896,7 @@ LOCALE_CHARSET_TESTS = \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc SHLIB_TESTS = \ - assignconst fnmatch filefuncs fork fork2 ordchr ordchr2 \ + assignconst fnmatch filefuncs fork fork2 fts ordchr ordchr2 \ readdir readfile rwarray testext time # List of the tests which should be run with --lint option: @@ -1612,6 +1613,11 @@ readdir: @$(AWK) -f $(srcdir)/readdir.awk . > $@.out2 @-$(CMP) $@.out1 $@.out2 && rm -f $@.out[12] +fts: + @echo $@ + @$(AWK) -f $(srcdir)/fts.awk + @-$(CMP) $@.out1 $@.out2 && rm -f $@.out[12] + # Targets generated for other tests: include Maketests @@ -1620,7 +1626,7 @@ $(srcdir)/Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests $(AWK) -f $(srcdir)/Gentests "$(srcdir)/Makefile.am" $$files > $(srcdir)/Maketests clean: - rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok fork.tmp.* testext.awk + rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok fork.tmp.* testext.awk fts.out1 fts.out2 # An attempt to print something that can be grepped for in build logs pass-fail: diff --git a/test/Makefile.in b/test/Makefile.in index 4b6d5439..0ba7c5c5 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -488,6 +488,7 @@ EXTRA_DIST = \ fstabplus.awk \ fstabplus.in \ fstabplus.ok \ + fts.awk \ funlen.awk \ funlen.in \ funlen.ok \ @@ -1104,7 +1105,7 @@ LOCALE_CHARSET_TESTS = \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc SHLIB_TESTS = \ - assignconst fnmatch filefuncs fork fork2 ordchr ordchr2 \ + assignconst fnmatch filefuncs fork fork2 fts ordchr ordchr2 \ readdir readfile rwarray testext time @@ -1994,6 +1995,11 @@ readdir: @ls -fli | sed 1d | $(AWK) -f $(srcdir)/readdir0.awk > $@.out1 @$(AWK) -f $(srcdir)/readdir.awk . > $@.out2 @-$(CMP) $@.out1 $@.out2 && rm -f $@.out[12] + +fts: + @echo $@ + @$(AWK) -f $(srcdir)/fts.awk + @-$(CMP) $@.out1 $@.out2 && rm -f $@.out[12] Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: @@ -3239,7 +3245,7 @@ $(srcdir)/Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests $(AWK) -f $(srcdir)/Gentests "$(srcdir)/Makefile.am" $$files > $(srcdir)/Maketests clean: - rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok fork.tmp.* testext.awk + rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ readfile.ok fork.tmp.* testext.awk fts.out1 fts.out2 # An attempt to print something that can be grepped for in build logs pass-fail: diff --git a/test/fts.awk b/test/fts.awk new file mode 100644 index 00000000..b90adfb5 --- /dev/null +++ b/test/fts.awk @@ -0,0 +1,121 @@ +@load "filefuncs" + +BEGIN { + Level = 0 + + system("rm -fr d1 d2") + system("mkdir d1 d2 ; touch d1/f1 d1/f2 d2/f1 d2/f2") + pathlist[1] = "d1" + pathlist[2] = "d2" + flags = FTS_PHYSICAL + fts(pathlist, flags, data) + + output = "fts.out1" + traverse(data) + close(output) + + ftswalk(pathlist, data2) + output = "fts.out2" + traverse(data2) + close(output) + + system("rm -fr d1 d2") +} + +function indent( i) +{ + for (i = 1; i <= Level; i++) + printf("\t") > output +} + +function sort_traverse(data, sorted, i) +{ + asorti(data, sorted) + for (i = 1; i in sorted; i++) { + indent() + printf("%s --> %s\n", sorted[i], data[sorted[i]]) > output + } +} + +function traverse(data, i) +{ + for (i in data) { + if (isarray(data[i])) { + indent() + printf("%s:\n", i) > output + + Level++ + if (("mtime" in data[i]) && ! isarray(data[i][mtime])) { + sort_traverse(data[i]) + } else { + traverse(data[i]) + } + Level-- + } else { + indent() + printf("%s --> %s\n", i, data[i]) > output + } + } +} + + +function ftswalk(pathlist, data, i, toppath) +{ + delete data + for (i = 1; i in pathlist; i++) { + toppath = pathlist[i] + data[toppath]["junk"]++ # create array + delete data[toppath]["junk"] + process(pathlist[i], data) + } +} + +# enter process with pathname, array for that path already created but +# empty + +function process(pathname, data_array, + stat_data, i, direntry, command, shortname) # locals +{ + stat(pathname, stat_data) + if (stat_data["type"] == "file") { + shortname = strrstr(pathname, "/") + data_array["path"] = pathname + for (i in stat_data) { + if (i == "name") + data_array["stat"][i] = shortname + else + data_array["stat"][i] = stat_data[i] + } + + return + } + + # stuff for a directory + + data_array[pathname]["."]["path"] = pathname + for (i in stat_data) + data_array[pathname]["."]["stat"][i] = stat_data[i] + + command = ("ls -f " pathname) + while ((command | getline direntry) > 0) { + if (direntry == "." || direntry == "..") + continue + data_array[pathname][direntry]["junk"]++ + delete data_array[pathname][direntry]["junk"] + process(pathname "/" direntry, + data_array[pathname][direntry]) + } + close(command) +} + +function strrstr(string, delim, ind) +{ + if ((ind = index(string, delim)) == 0) + return string + + do { + string = substr(string, ind + 1) + } while ((ind = index(string, delim)) > 0) + + return string +} -- cgit v1.2.3 From 8d5a66b529a220239037a3cd7a2421aab85de53d Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Sat, 11 Aug 2012 17:07:24 -0400 Subject: Make it a fatal error to load the same file with -f and -i (or @include). --- test/ChangeLog | 8 ++++++++ test/Makefile.am | 28 +++++++++++++++++++++++++++- test/Makefile.in | 28 +++++++++++++++++++++++++++- test/incdupe4.ok | 2 ++ test/incdupe5.ok | 2 ++ test/incdupe6.ok | 3 +++ test/incdupe7.ok | 3 +++ test/inchello.awk | 1 + 8 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 test/incdupe4.ok create mode 100644 test/incdupe5.ok create mode 100644 test/incdupe6.ok create mode 100644 test/incdupe7.ok create mode 100644 test/inchello.awk (limited to 'test') diff --git a/test/ChangeLog b/test/ChangeLog index 2b1ac648..94c6ef18 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,11 @@ +2012-08-11 Andrew J. Schorr + + * Makefile.am (EXTRA_DIST): Add inchello.awk and incdupe[4-7].ok. + (GAWK_EXT_TESTS): Add incdupe[4-7]. + (incdupe[4-7]): New tests to ensure that mixing -f with include + causes a fatal error. + * incdupe[4-7].ok, inchello.awk: New files. + 2012-08-08 Arnold D. Robbins * Makefile.am (fts): New test. diff --git a/test/Makefile.am b/test/Makefile.am index 3a8e48ca..c067f669 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -380,6 +380,11 @@ EXTRA_DIST = \ incdupe.ok \ incdupe2.ok \ incdupe3.ok \ + inchello.awk \ + incdupe4.ok \ + incdupe5.ok \ + incdupe6.ok \ + incdupe7.ok \ indirectcall.awk \ indirectcall.in \ indirectcall.ok \ @@ -881,7 +886,8 @@ GAWK_EXT_TESTS = \ rebuf regx8bit reint reint2 rsstart1 \ rsstart2 rsstart3 rstest6 shadow sortfor sortu splitarg4 strftime \ strtonum switch2 \ - include include2 incdupe incdupe2 incdupe3 + include include2 incdupe incdupe2 incdupe3 \ + incdupe4 incdupe5 incdupe6 incdupe7 EXTRA_TESTS = inftest regtest @@ -1593,6 +1599,26 @@ incdupe3:: @AWKPATH=$(srcdir) $(AWK) --lint -f hello -f hello.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +incdupe4:: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) --lint -f hello -i hello.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +incdupe5:: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) --lint -i hello -f hello.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +incdupe6:: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) --lint -i inchello -f hello.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +incdupe7:: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) --lint -f hello -i inchello >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + testext:: @echo $@ @$(AWK) '/^(@load|BEGIN)/,/^}/' $(top_srcdir)/extension/testext.c > testext.awk diff --git a/test/Makefile.in b/test/Makefile.in index 0ba7c5c5..10d7b6a5 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -593,6 +593,11 @@ EXTRA_DIST = \ incdupe.ok \ incdupe2.ok \ incdupe3.ok \ + inchello.awk \ + incdupe4.ok \ + incdupe5.ok \ + incdupe6.ok \ + incdupe7.ok \ indirectcall.awk \ indirectcall.in \ indirectcall.ok \ @@ -1094,7 +1099,8 @@ GAWK_EXT_TESTS = \ rebuf regx8bit reint reint2 rsstart1 \ rsstart2 rsstart3 rstest6 shadow sortfor sortu splitarg4 strftime \ strtonum switch2 \ - include include2 incdupe incdupe2 incdupe3 + include include2 incdupe incdupe2 incdupe3 \ + incdupe4 incdupe5 incdupe6 incdupe7 EXTRA_TESTS = inftest regtest INET_TESTS = inetdayu inetdayt inetechu inetecht @@ -1976,6 +1982,26 @@ incdupe3:: @AWKPATH=$(srcdir) $(AWK) --lint -f hello -f hello.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +incdupe4:: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) --lint -f hello -i hello.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +incdupe5:: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) --lint -i hello -f hello.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +incdupe6:: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) --lint -i inchello -f hello.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +incdupe7:: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) --lint -f hello -i inchello >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + testext:: @echo $@ @$(AWK) '/^(@load|BEGIN)/,/^}/' $(top_srcdir)/extension/testext.c > testext.awk diff --git a/test/incdupe4.ok b/test/incdupe4.ok new file mode 100644 index 00000000..a6fc26e2 --- /dev/null +++ b/test/incdupe4.ok @@ -0,0 +1,2 @@ +gawk: fatal: can't include `hello.awk' and use it as a program file +EXIT CODE: 2 diff --git a/test/incdupe5.ok b/test/incdupe5.ok new file mode 100644 index 00000000..a6fc26e2 --- /dev/null +++ b/test/incdupe5.ok @@ -0,0 +1,2 @@ +gawk: fatal: can't include `hello.awk' and use it as a program file +EXIT CODE: 2 diff --git a/test/incdupe6.ok b/test/incdupe6.ok new file mode 100644 index 00000000..42a4f9fd --- /dev/null +++ b/test/incdupe6.ok @@ -0,0 +1,3 @@ +gawk: inchello:1: warning: `include' is a gawk extension +gawk: inchello:2: fatal: can't include `hello' and use it as a program file +EXIT CODE: 2 diff --git a/test/incdupe7.ok b/test/incdupe7.ok new file mode 100644 index 00000000..42a4f9fd --- /dev/null +++ b/test/incdupe7.ok @@ -0,0 +1,3 @@ +gawk: inchello:1: warning: `include' is a gawk extension +gawk: inchello:2: fatal: can't include `hello' and use it as a program file +EXIT CODE: 2 diff --git a/test/inchello.awk b/test/inchello.awk new file mode 100644 index 00000000..148d4bef --- /dev/null +++ b/test/inchello.awk @@ -0,0 +1 @@ +@include "hello" -- cgit v1.2.3