diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ChangeLog | 113 | ||||
-rw-r--r-- | test/Makefile.am | 106 | ||||
-rw-r--r-- | test/Makefile.in | 193 | ||||
-rw-r--r-- | test/Maketests | 24 | ||||
-rw-r--r-- | test/assignconst.awk | 58 | ||||
-rw-r--r-- | test/assignconst.ok | 42 | ||||
-rw-r--r-- | test/badargs.ok | 1 | ||||
-rw-r--r-- | test/fnmatch.awk | 11 | ||||
-rw-r--r-- | test/fnmatch.ok | 9 | ||||
-rw-r--r-- | test/fts.awk | 121 | ||||
-rw-r--r-- | test/hello.awk | 3 | ||||
-rw-r--r-- | test/incdupe.ok | 3 | ||||
-rw-r--r-- | test/incdupe2.ok | 2 | ||||
-rw-r--r-- | test/incdupe3.ok | 2 | ||||
-rw-r--r-- | test/incdupe4.ok | 2 | ||||
-rw-r--r-- | test/incdupe5.ok | 2 | ||||
-rw-r--r-- | test/incdupe6.ok | 3 | ||||
-rw-r--r-- | test/incdupe7.ok | 3 | ||||
-rw-r--r-- | test/inchello.awk | 1 | ||||
-rw-r--r-- | test/inclib.awk | 7 | ||||
-rw-r--r-- | test/include.awk | 5 | ||||
-rw-r--r-- | test/include.ok | 2 | ||||
-rw-r--r-- | test/include2.ok | 2 | ||||
-rw-r--r-- | test/ordchr.awk | 5 | ||||
-rw-r--r-- | test/ordchr.ok | 4 | ||||
-rw-r--r-- | test/readdir.awk | 7 | ||||
-rw-r--r-- | test/readdir0.awk | 9 | ||||
-rw-r--r-- | test/rwarray.awk | 33 | ||||
-rw-r--r-- | test/rwarray.in | 780 | ||||
-rw-r--r-- | test/rwarray.ok | 3 | ||||
-rw-r--r-- | test/testext.ok | 67 | ||||
-rw-r--r-- | test/time.awk | 22 | ||||
-rw-r--r-- | test/time.ok | 3 |
33 files changed, 1590 insertions, 58 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 7b7da93f..d0d7799e 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,116 @@ +2012-08-11 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * 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 <arnold@skeeve.com> + + * Makefile.am (fts): New test. + * fts.awk: New file. + +2012-07-30 Arnold D. Robbins <arnold@skeeve.com> + + * 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 <arnold@skeeve.com> + + * Makefile.am (readdir): New test. + * readdir0.awk, readdir.awk: New files. + +2012-07-16 Arnold D. Robbins <arnold@skeeve.com> + + * fnmatch.awk, fnmatch.ok: Portability updates. + +2012-07-15 Arnold D. Robbins <arnold@skeeve.com> + + * testext.ok: Update contents. + +2012-07-12 Arnold D. Robbins <arnold@skeeve.com> + + * 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 <aschorr@telemetry-investments.com> + + * 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 <arnold@skeeve.com> + + * Makefile.am (rwarray): New test. + * rwarray.awk, rwarray.in, rwarray.ok: New files. + +2012-06-21 Arnold D. Robbins <arnold@skeeve.com> + + * testext.ok: Update contents. + +2012-06-20 Arnold D. Robbins <arnold@skeeve.com> + + * testext.ok: Update contents. + +2012-06-19 Arnold D. Robbins <arnold@skeeve.com> + + * testext.ok: Update contents. + +2012-06-18 Arnold D. Robbins <arnold@skeeve.com> + + * 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. + +2012-06-12 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (clean): Add fork.tmp.* to the list. + +2012-06-10 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * 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 <arnold@skeeve.com> + + * Makefile.am (clean): Add readfile.ok to list of files to removed. + +2012-05-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * 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 <arnold@skeeve.com> + + * Makefile.am (readfile): Don't copy the Makefile over readfile.ok + if there's a problem. + +2012-05-24 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * Makefile.am (fmtspcl, include2, incdupe, incdup2, incdupe3): Fix + paths to work properly when built in another directory. + +2012-05-19 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * 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-14 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (jarebug): Move to charset tests. Adjust to check diff --git a/test/Makefile.am b/test/Makefile.am index 457fd163..d7af60b1 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 \ @@ -230,6 +232,8 @@ EXTRA_DIST = \ fnasgnm.awk \ fnasgnm.in \ fnasgnm.ok \ + fnmatch.awk \ + fnmatch.ok \ fnmisc.awk \ fnmisc.ok \ fnparydl.awk \ @@ -271,6 +275,7 @@ EXTRA_DIST = \ fstabplus.awk \ fstabplus.in \ fstabplus.ok \ + fts.awk \ funlen.awk \ funlen.in \ funlen.ok \ @@ -347,6 +352,7 @@ EXTRA_DIST = \ gsubtst8.in \ gsubtst8.ok \ gtlnbufv.awk \ + hello.awk \ hex.awk \ hex.ok \ hsprint.awk \ @@ -367,6 +373,18 @@ EXTRA_DIST = \ ignrcase.ok \ ignrcas2.awk \ ignrcas2.ok \ + inclib.awk \ + include.awk \ + include.ok \ + include2.ok \ + incdupe.ok \ + incdupe2.ok \ + incdupe3.ok \ + inchello.awk \ + incdupe4.ok \ + incdupe5.ok \ + incdupe6.ok \ + incdupe7.ok \ indirectcall.awk \ indirectcall.in \ indirectcall.ok \ @@ -611,6 +629,8 @@ EXTRA_DIST = \ range1.awk \ range1.in \ range1.ok \ + readdir0.awk \ + readdir.awk \ rebt8b1.awk \ rebt8b1.ok \ rebt8b2.awk \ @@ -681,6 +701,9 @@ EXTRA_DIST = \ rtlen.sh \ rtlen01.ok \ rtlen01.sh \ + rwarray.awk \ + rwarray.in \ + rwarray.ok \ scalar.awk \ scalar.ok \ sclforin.awk \ @@ -749,6 +772,9 @@ EXTRA_DIST = \ synerr1.ok \ synerr2.awk \ synerr2.ok \ + testext.ok \ + time.awk \ + time.ok \ tradanch.awk \ tradanch.in \ tradanch.ok \ @@ -858,7 +884,9 @@ 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 \ + incdupe4 incdupe5 incdupe6 incdupe7 EXTRA_TESTS = inftest regtest @@ -872,7 +900,9 @@ LOCALE_CHARSET_TESTS = \ asort asorti fmttest fnarydel fnparydl jarebug lc_num1 mbfw1 \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc -SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs +SHLIB_TESTS = \ + assignconst fnmatch filefuncs fork fork2 fts ordchr ordchr2 \ + readdir readfile rwarray testext time # List of the tests which should be run with --lint option: NEED_LINT = \ @@ -891,7 +921,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) @@ -1149,7 +1179,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 @@ -1544,11 +1574,77 @@ 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 _$@ || cp -p Makefile $@.ok +include2:: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) -i inclib 'BEGIN {print sandwich("a", "b", "c")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +incdupe:: + @echo $@ + @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 $@ + @AWKPATH=$(srcdir) $(AWK) --lint -f inclib -f inclib.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +incdupe3:: + @echo $@ + @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 + @$(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 AWKPATH=$(srcdir) $(AWK) -f $@.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] + +fts: + @echo $@ + @$(AWK) -f $(srcdir)/fts.awk + @-$(CMP) $@.out1 $@.out2 && rm -f $@.out[12] + # Targets generated for other tests: include Maketests @@ -1557,7 +1653,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 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 2696573a..b82d13c5 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,12 @@ 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@ +GAWKLIBEXT = @GAWKLIBEXT@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ @@ -150,7 +143,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 +152,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 +172,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 +187,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 +230,7 @@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +subdirs = @subdirs@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ @@ -334,6 +315,8 @@ EXTRA_DIST = \ asort.ok \ asorti.awk \ asorti.ok \ + assignconst.awk \ + assignconst.ok \ awkpath.ok \ back89.awk \ back89.in \ @@ -462,6 +445,8 @@ EXTRA_DIST = \ fnasgnm.awk \ fnasgnm.in \ fnasgnm.ok \ + fnmatch.awk \ + fnmatch.ok \ fnmisc.awk \ fnmisc.ok \ fnparydl.awk \ @@ -503,6 +488,7 @@ EXTRA_DIST = \ fstabplus.awk \ fstabplus.in \ fstabplus.ok \ + fts.awk \ funlen.awk \ funlen.in \ funlen.ok \ @@ -579,6 +565,7 @@ EXTRA_DIST = \ gsubtst8.in \ gsubtst8.ok \ gtlnbufv.awk \ + hello.awk \ hex.awk \ hex.ok \ hsprint.awk \ @@ -599,6 +586,18 @@ EXTRA_DIST = \ ignrcase.ok \ ignrcas2.awk \ ignrcas2.ok \ + inclib.awk \ + include.awk \ + include.ok \ + include2.ok \ + incdupe.ok \ + incdupe2.ok \ + incdupe3.ok \ + inchello.awk \ + incdupe4.ok \ + incdupe5.ok \ + incdupe6.ok \ + incdupe7.ok \ indirectcall.awk \ indirectcall.in \ indirectcall.ok \ @@ -843,6 +842,8 @@ EXTRA_DIST = \ range1.awk \ range1.in \ range1.ok \ + readdir0.awk \ + readdir.awk \ rebt8b1.awk \ rebt8b1.ok \ rebt8b2.awk \ @@ -913,6 +914,9 @@ EXTRA_DIST = \ rtlen.sh \ rtlen01.ok \ rtlen01.sh \ + rwarray.awk \ + rwarray.in \ + rwarray.ok \ scalar.awk \ scalar.ok \ sclforin.awk \ @@ -981,6 +985,9 @@ EXTRA_DIST = \ synerr1.ok \ synerr2.awk \ synerr2.ok \ + testext.ok \ + time.awk \ + time.ok \ tradanch.awk \ tradanch.in \ tradanch.ok \ @@ -1090,7 +1097,9 @@ 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 \ + incdupe4 incdupe5 incdupe6 incdupe7 EXTRA_TESTS = inftest regtest INET_TESTS = inetdayu inetdayt inetechu inetecht @@ -1100,7 +1109,10 @@ LOCALE_CHARSET_TESTS = \ asort asorti fmttest fnarydel fnparydl jarebug lc_num1 mbfw1 \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc -SHLIB_TESTS = ordchr ordchr2 fork fork2 readfile filefuncs +SHLIB_TESTS = \ + assignconst fnmatch filefuncs fork fork2 fts ordchr ordchr2 \ + readdir readfile rwarray testext time + # List of the tests which should be run with --lint option: NEED_LINT = \ @@ -1122,7 +1134,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) @@ -1162,12 +1174,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: @@ -1242,7 +1248,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 @@ -1294,7 +1300,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 @@ -1308,16 +1314,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. @@ -1557,7 +1562,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 @@ -1952,10 +1957,76 @@ 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 _$@ || cp -p Makefile $@.ok + +include2:: + @echo $@ + @AWKPATH=$(srcdir) $(AWK) -i inclib 'BEGIN {print sandwich("a", "b", "c")}' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +incdupe:: + @echo $@ + @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 $@ + @AWKPATH=$(srcdir) $(AWK) --lint -f inclib -f inclib.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +incdupe3:: + @echo $@ + @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 + @$(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 AWKPATH=$(srcdir) $(AWK) -f $@.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] + +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: @@ -3093,6 +3164,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: $$? >>_$@ @@ -3152,7 +3228,12 @@ sprintfc: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ -ordchr: +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: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ @@ -3167,7 +3248,17 @@ 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: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ @@ -3181,7 +3272,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 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/Maketests b/test/Maketests index e6a985b0..0a4e5820 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: $$? >>_$@ @@ -1194,7 +1199,12 @@ sprintfc: @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ -ordchr: +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: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ @@ -1209,7 +1219,17 @@ 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: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ 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..97698b27 --- /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 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/fnmatch.awk b/test/fnmatch.awk new file mode 100644 index 00000000..c0885074 --- /dev/null +++ b/test/fnmatch.awk @@ -0,0 +1,11 @@ +@load "fnmatch" + +BEGIN { + print "FNM_NOMATCH =", FNM_NOMATCH + # can't print the values; they vary from system to system + for (i in FNM) + 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 new file mode 100644 index 00000000..fd8a78ce --- /dev/null +++ b/test/fnmatch.ok @@ -0,0 +1,9 @@ +FNM_NOMATCH = 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 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 +} 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/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" 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 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 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 +} 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 diff --git a/test/testext.ok b/test/testext.ok new file mode 100644 index 00000000..132179c2 --- /dev/null +++ b/test/testext.ok @@ -0,0 +1,67 @@ +pets has 5 elements +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_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 +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 +test_array2["subarray"]["hello"] = world +test_array2["subarray"]["answer"] = 42 + +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 +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" +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 diff --git a/test/time.awk b/test/time.awk new file mode 100644 index 00000000..517377e2 --- /dev/null +++ b/test/time.awk @@ -0,0 +1,22 @@ +@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 + t0 = timecheck() + printf "sleep(%s) = %s\n",delta,sleep(delta) + 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", + 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 |