about summary refs log tree commit diff
path: root/Test
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2014-10-26 19:04:47 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2014-10-26 19:04:47 +0000
commit9a551ca85999ff329714fd2cca138ce2f7d3c3d9 (patch)
treed51276834fd385725b41064f631500b05f10de82 /Test
parentb4f7ccecd93ca9e64c3c3c774fdaefae83d7204a (diff)
downloadzsh-9a551ca85999ff329714fd2cca138ce2f7d3c3d9.tar.gz
zsh-9a551ca85999ff329714fd2cca138ce2f7d3c3d9.tar.xz
zsh-9a551ca85999ff329714fd2cca138ce2f7d3c3d9.zip
33542: test logic for waiting for already exited processes
Diffstat (limited to 'Test')
-rw-r--r--Test/A05execution.ztst29
1 files changed, 27 insertions, 2 deletions
diff --git a/Test/A05execution.ztst b/Test/A05execution.ztst
index ca97f4f41..589815f7c 100644
--- a/Test/A05execution.ztst
+++ b/Test/A05execution.ztst
@@ -190,9 +190,9 @@
                    print "${pipestatus[@]}")
 	ZTST_hashmark
   done | sort | uniq -c | sed 's/^ *//'
-0:Check whether `$pipestatus[]' behaves.
+0:Check whether '$pipestatus[]' behaves.
 >2048 2 1 0
-F:This test checks for a bug in `$pipestatus[]' handling.  If it breaks then
+F:This test checks for a bug in '$pipestatus[]' handling.  If it breaks then
 F:the bug is still there or it reappeared. See workers-29973 for details.
 
   { setopt MONITOR } 2>/dev/null
@@ -244,3 +244,28 @@ F:anonymous function, and a descriptor leak when backgrounding a pipeline
 >autoload_redir () {
 >	print Autoloaded ksh style
 >} > autoload.log
+
+# This tests that we record the status of processes that have already exited
+# for when we wait for them.
+#
+# Actually, we don't guarantee here that the jobs have already exited, but
+# the order of the waits means it's highly likely we do need to recall a
+# previous status, barring accidents which shouldn't happen very often.  In
+# other words, we rely on the test working repeatedly rather than just
+# once.  The monitor option is irrelevant to the logic, so we'll make
+# our job easier by turning it off.
+  unsetopt monitor
+  (exit 1) &
+  one=$!
+  (exit 2) &
+  two=$!
+  (exit 3) &
+  three=$!
+  wait $three
+  print $?
+  wait $two
+  print $?
+  wait $one
+1:The status of recently exited background jobs is recorded
+>3
+>2