aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog10
-rw-r--r--test/iolint.awk19
-rw-r--r--test/iolint.ok5
-rw-r--r--test/rwarray.awk5
4 files changed, 31 insertions, 8 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index a6f3e4d6..5832fa95 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,13 @@
+2021-11-18 Arnold D. Robbins <arnold@skeeve.com>
+
+ * rwarray.awk: Improve test, add string and numbers.
+
+ Unrelated:
+
+ * iolint.awk: Restore the disabled test using eval in the child to
+ run different commands. Thanks to Miguel Pineiro Jr.,
+ <mpj@pineiro.cc>.
+
2021-11-14 Arnold D. Robbins <arnold@skeeve.com>
* iolint.awk: Disable test with race condition. Thanks to
diff --git a/test/iolint.awk b/test/iolint.awk
index 58fd746f..042f743b 100644
--- a/test/iolint.awk
+++ b/test/iolint.awk
@@ -55,15 +55,20 @@ BEGIN {
print close("cat")
fflush()
- # 11/2021: Disable this test since it's a race condition
- # and fails intermittently on some systems.
+ # 11/2021: Use a nice trick to avoid race conditions in
+ # child processes. Thanks to Miguel Pineiro Jr. <mpj@pineiro.cc>.
#
# `%.*s' used for input pipe and output pipe
- # "echo hello" | getline junk
- # print "hello" | "echo hello"
- # print close("echo hello")
- # print close("echo hello")
- # fflush()
+ pipecmd = "eval $CMD_TO_RUN"
+
+ ENVIRON["CMD_TO_RUN"] = "echo hello"
+ pipecmd | getline junk
+ ENVIRON["CMD_TO_RUN"] = "read junk"
+ print "hello" | pipecmd
+
+ print close(pipecmd)
+ print close(pipecmd)
+ fflush()
# `%.*s' used for output file and output pipe"
BINMODE = 2
diff --git a/test/iolint.ok b/test/iolint.ok
index 620a70f3..7a165aa9 100644
--- a/test/iolint.ok
+++ b/test/iolint.ok
@@ -23,7 +23,10 @@ gawk: iolint.awk:53: warning: `cat' used for output file and output pipe
0
hello
0
-gawk: iolint.awk:71: warning: `cksum' used for output file and output pipe
+gawk: iolint.awk:67: warning: `eval $CMD_TO_RUN' used for input pipe and output pipe
+0
+0
+gawk: iolint.awk:76: warning: `cksum' used for output file and output pipe
3015617425 6
0
0
diff --git a/test/rwarray.awk b/test/rwarray.awk
index eae22304..dfd74ce0 100644
--- a/test/rwarray.awk
+++ b/test/rwarray.awk
@@ -14,6 +14,11 @@ BEGIN {
bool_sub = "bool-sub"
dict[bool_sub] = mkbool(1)
+ dict["x"] = "x"
+
+ dict["42"] = 42
+ dict["42.42"] = 42.42
+
n = asorti(dict, dictindices)
for (i = 1; i <= n; i++)
printf("dict[%s] = %s\n", dictindices[i], dict[dictindices[i]]) > "orig.out"