gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, select, updated. gawk-4.1.0-1066-gcb5838


From: Andrew J. Schorr
Subject: [gawk-diffs] [SCM] gawk branch, select, updated. gawk-4.1.0-1066-gcb5838c
Date: Mon, 05 Jan 2015 21:36:31 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, select has been updated
       via  cb5838c3c261f9a775fae45adfa70e1514e8bfe0 (commit)
      from  a97507159ee06523c9dd6ec809199a0774976498 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=cb5838c3c261f9a775fae45adfa70e1514e8bfe0

commit cb5838c3c261f9a775fae45adfa70e1514e8bfe0
Author: Andrew J. Schorr <address@hidden>
Date:   Mon Jan 5 16:36:17 2015 -0500

    Add test of get_file API.

diff --git a/test/ChangeLog b/test/ChangeLog
index 36dbfaa..0fa59a6 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,5 +1,12 @@
 2015-01-05         Andrew J. Schorr     <address@hidden>
 
+       * Makefile.am (EXTRA_DIST): Add getfile.awk and getfile.ok.
+       (SHLIB_TESTS): Add gefile.
+       (getfile): New test.
+       * getfile.awk, getfile.ok: New files.
+
+2015-01-05         Andrew J. Schorr     <address@hidden>
+
        * Makefile.am (EXTRA_DIST): Add timeout.awk and timeout.ok.
        (BASIC_TESTS): Remove errno.
        (GAWK_EXT_TESTS): Add errno and timeout.
diff --git a/test/Makefile.am b/test/Makefile.am
index 3ac9a69..c31e882 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -337,6 +337,8 @@ EXTRA_DIST = \
        gensub.ok \
        gensub2.awk \
        gensub2.ok \
+       getfile.awk \
+       getfile.ok \
        getline.awk \
        getline.in \
        getline.ok \
@@ -1057,7 +1059,7 @@ LOCALE_CHARSET_TESTS = \
        mbprintf1 mbprintf2 mbprintf3 mbprintf4 rebt8b2 rtlenmb sort1 sprintfc
 
 SHLIB_TESTS = \
-       fnmatch filefuncs fork fork2 fts functab4 inplace1 inplace2 inplace3 \
+       fnmatch filefuncs fork fork2 fts functab4 getfile inplace1 inplace2 
inplace3 \
        ordchr ordchr2 readdir readfile readfile2 revout revtwoway rwarray 
testext time
 
 # List of the tests which should be run with --lint option:
@@ -1898,6 +1900,11 @@ testext::
        @$(AWK) -f ./testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@ testext.awk
 
+getfile:
+       @echo $@
+       @$(AWK) -v TESTEXT_QUIET=1 -ltestext -f $(srcdir)/address@hidden 
$(srcdir)/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 readdir:
        @if [ "`uname`" = Linux ] && [ "`stat -f . 2>/dev/null | awk 'NR == 2 { 
print $$NF }'`" = nfs ];  then \
        echo This test may fail on GNU/Linux systems when run on an NFS 
filesystem.; \
diff --git a/test/Makefile.in b/test/Makefile.in
index 874a92d..1ab2c8a 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -584,6 +584,8 @@ EXTRA_DIST = \
        gensub.ok \
        gensub2.awk \
        gensub2.ok \
+       getfile.awk \
+       getfile.ok \
        getline.awk \
        getline.in \
        getline.ok \
@@ -1300,7 +1302,7 @@ LOCALE_CHARSET_TESTS = \
        mbprintf1 mbprintf2 mbprintf3 mbprintf4 rebt8b2 rtlenmb sort1 sprintfc
 
 SHLIB_TESTS = \
-       fnmatch filefuncs fork fork2 fts functab4 inplace1 inplace2 inplace3 \
+       fnmatch filefuncs fork fork2 fts functab4 getfile inplace1 inplace2 
inplace3 \
        ordchr ordchr2 readdir readfile readfile2 revout revtwoway rwarray 
testext time
 
 
@@ -2323,6 +2325,11 @@ testext::
        @$(AWK) -f ./testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@ testext.awk
 
+getfile:
+       @echo $@
+       @$(AWK) -v TESTEXT_QUIET=1 -ltestext -f $(srcdir)/address@hidden 
$(srcdir)/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 readdir:
        @if [ "`uname`" = Linux ] && [ "`stat -f . 2>/dev/null | awk 'NR == 2 { 
print $$NF }'`" = nfs ];  then \
        echo This test may fail on GNU/Linux systems when run on an NFS 
filesystem.; \
diff --git a/test/getfile.awk b/test/getfile.awk
new file mode 100644
index 0000000..6ee783f
--- /dev/null
+++ b/test/getfile.awk
@@ -0,0 +1,35 @@
+function basename(x) {
+       return gensub(/^.*\//, "", 1, x)
+}
+
+BEGIN {
+       print "BEGIN"
+
+       cmd = "echo hello; echo goodbye"
+       rc = get_file(cmd, "<<", -1, res)
+       print "expected error result", rc, ERRNO
+       print "get_file returned", get_file(cmd, "|<", -1, res)
+       print "input_name", basename(res["input_name"])
+       print (cmd | getline x)
+       print x
+
+       # check that calling get_file on "" triggers the BEGINFILE rule
+       print "get_file returned", get_file("", "", -1, res)
+       print "input_name", basename(res["input_name"])
+       print "end BEGIN"
+}
+
+BEGINFILE {
+       printf "BEGINFILE (%s) ERRNO (%s)\n", basename(FILENAME), ERRNO
+}
+
+ENDFILE {
+       printf "ENDFILE (%s) ERRNO (%s)\n", basename(FILENAME), ERRNO
+}
+
+END {
+       print "END"
+       print (cmd | getline x)
+       print x
+       print close(cmd)
+}
diff --git a/test/getfile.ok b/test/getfile.ok
new file mode 100644
index 0000000..92c915f
--- /dev/null
+++ b/test/getfile.ok
@@ -0,0 +1,17 @@
+BEGIN
+gawk: ./getfile.awk:9: warning: cannot open unrecognized file type `<<' for 
`echo hello; echo goodbye'
+get_file: get_file(echo hello; echo goodbye, <<, -1) failed
+expected error result 0 
+get_file returned 1
+input_name echo hello; echo goodbye
+1
+hello
+BEGINFILE (getfile.awk) ERRNO ()
+get_file returned 1
+input_name getfile.awk
+end BEGIN
+ENDFILE (getfile.awk) ERRNO ()
+END
+1
+goodbye
+0

-----------------------------------------------------------------------

Summary of changes:
 test/ChangeLog   |    7 +++++++
 test/Makefile.am |    9 ++++++++-
 test/Makefile.in |    9 ++++++++-
 test/getfile.awk |   35 +++++++++++++++++++++++++++++++++++
 test/getfile.ok  |   17 +++++++++++++++++
 5 files changed, 75 insertions(+), 2 deletions(-)
 create mode 100644 test/getfile.awk
 create mode 100644 test/getfile.ok


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]