From 9a551ca85999ff329714fd2cca138ce2f7d3c3d9 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 26 Oct 2014 19:04:47 +0000 Subject: 33542: test logic for waiting for already exited processes --- ChangeLog | 2 ++ Test/A05execution.ztst | 29 +++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c75b870de..3fbc9d7d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2014-10-26 Peter Stephenson + * 33542: Test/A05execution.ztst: test previous patch. + * 33531 (plus fix to test job pointer and removing lastpid_status): Doc/Zsh/builtins.yo, Doc/Zsh/options.yo, Src/exec.c, Src/init.c, Src/jobs.c, Src/linklist.c, 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 -- cgit 1.4.1