summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2015-01-05 13:07:47 -0500
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2015-01-05 13:07:47 -0500
commit4323eba6170c7aee1661d834a9b7c177a10b7764 (patch)
tree6134edf6a8226d72be8f22a38669b1dca266dded
parent0d867aa42ea8c3487678dcceea484c10c88914cb (diff)
downloadgawk-4323eba6170c7aee1661d834a9b7c177a10b7764.tar.gz
Add new errno test to make sure PROCINFO["errno"] is working.
-rw-r--r--test/ChangeLog7
-rw-r--r--test/Makefile.am10
-rw-r--r--test/errno.awk10
-rw-r--r--test/errno.in3
-rw-r--r--test/errno.ok3
5 files changed, 32 insertions, 1 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index 7ff3e422..49b26843 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,10 @@
+2015-01-05 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * Makefile.am (EXTRA_DIST): Add errno.awk, errno.in, and errno.ok.
+ (BASIC_TESTS): Add errno.
+ (errno): New test.
+ * errno.awk, errno.in, errno.ok: New files.
+
2014-12-24 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (badbuild): New test.
diff --git a/test/Makefile.am b/test/Makefile.am
index 7335da32..0feaebc5 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -208,6 +208,9 @@ EXTRA_DIST = \
dynlj.ok \
eofsplit.awk \
eofsplit.ok \
+ errno.awk \
+ errno.in \
+ errno.ok \
exit.ok \
exit.sh \
exit2.awk \
@@ -983,7 +986,7 @@ BASIC_TESTS = \
childin clobber closebad clsflnam compare compare2 concat1 concat2 \
concat3 concat4 convfmt \
datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \
- eofsplit exit2 exitval1 exitval2 \
+ eofsplit errno exit2 exitval1 exitval2 \
fcall_exit fcall_exit2 fldchg fldchgnf fnamedat fnarray fnarray2 \
fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fsrs fsspcoln \
fstabplus funsemnl funsmnam funstack \
@@ -1310,6 +1313,11 @@ devfd::
@$(AWK) 1 /dev/fd/4 /dev/fd/5 4<"$(srcdir)"/devfd.in4 5<"$(srcdir)"/devfd.in5 >_$@ 2>&1 || echo EXIT CODE: $$? >> _$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+errno:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
fflush::
@echo $@
@"$(srcdir)"/fflush.sh >_$@
diff --git a/test/errno.awk b/test/errno.awk
new file mode 100644
index 00000000..bcb77614
--- /dev/null
+++ b/test/errno.awk
@@ -0,0 +1,10 @@
+BEGIN {
+ # check that PROCINFO["errno"] is working properly
+ getline
+ if (close(FILENAME)) {
+ print "Error `" ERRNO "' closing input file"
+ print "errno =", PROCINFO["errno"]
+ }
+ getline < (FILENAME "/bogus")
+ print (PROCINFO["errno"] > 0), ERRNO
+}
diff --git a/test/errno.in b/test/errno.in
new file mode 100644
index 00000000..a92d664b
--- /dev/null
+++ b/test/errno.in
@@ -0,0 +1,3 @@
+line 1
+line 2
+line 3
diff --git a/test/errno.ok b/test/errno.ok
new file mode 100644
index 00000000..181afdaf
--- /dev/null
+++ b/test/errno.ok
@@ -0,0 +1,3 @@
+Error `close of redirection that was never opened' closing input file
+errno = 0
+1 Not a directory