From 4c8046df1368a00dae6075a4f1e493991cd95742 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Sat, 2 May 2020 16:28:53 +1000 Subject: [PATCH] tests/runall.tcl: support tests that fork Because we use catch -exit { ... }, if a test uses os.fork we will return in both the parent in the child. To fix this, require the child to use exit 99, and detect this case and exit from the child in this case. Signed-off-by: Steve Bennett --- tests/runall.tcl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/runall.tcl b/tests/runall.tcl index 2b1c15a..4dfa539 100644 --- a/tests/runall.tcl +++ b/tests/runall.tcl @@ -44,6 +44,13 @@ if {[info commands interp] eq ""} { if {[info returncode $opts(-code)] eq "error"} { puts [format "%16s: --- error ($msg)" $script] incr total(fail) + } elseif {[info return $opts(-code)] eq "exit"} { + # if the test explicitly called exit 99, + # it must be from a child process via os.fork, so + # silently exit + if {$msg eq "99"} { + exit 0 + } } # Extract the counts -- 2.11.4.GIT