From 8bcdb359a0c7217dfebc73c61037a005bb65717d Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Sun, 8 May 2022 15:16:46 +1000 Subject: tests: add tests for wait -1 Only on unix systems, wait for any child process This was broken with a recent commit, so add an explicit test Signed-off-by: Steve Bennett --- tests/exec.test | 4 ++++ tests/exec2.test | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/tests/exec.test b/tests/exec.test index 11a4661..d20cc83 100644 --- a/tests/exec.test +++ b/tests/exec.test @@ -445,4 +445,8 @@ test exec-17.2 {redirecting to command pipeline} -setup { file delete sleepx +# Now we probably have a lot of unreaped zombies at this point +# so reap them to avoid confusing further tests +wait + testreport diff --git a/tests/exec2.test b/tests/exec2.test index b1af8ab..b1d0263 100644 --- a/tests/exec2.test +++ b/tests/exec2.test @@ -171,4 +171,11 @@ test exec2-5.5 {wait for all children} -constraints {after jim} -body { wait } -result {} +test exec2-5.6 {wait -1 to wait for any child} -constraints {after jim nomingw32} -body { + set pid [exec sleep 0.1 &] + # Now wait for any child + lassign [wait -1] status waitpid code + list $status $($waitpid == $pid) $code +} -result {CHILDSTATUS 1 0} + testreport -- cgit v1.1