diff --git a/tests/support/test.tcl b/tests/support/test.tcl index f5b4c8bef..54d323fa2 100644 --- a/tests/support/test.tcl +++ b/tests/support/test.tcl @@ -190,5 +190,4 @@ proc test {name code {okpattern undefined} {options undefined}} { send_data_packet $::test_server_fd err "Detected a memory leak in test '$name': $output" } } - unset ::cur_test } diff --git a/tests/support/util.tcl b/tests/support/util.tcl index ed4ff713a..b9a65358f 100644 --- a/tests/support/util.tcl +++ b/tests/support/util.tcl @@ -508,8 +508,13 @@ proc populate {num prefix size} { proc get_child_pid {idx} { set pid [srv $idx pid] - set fd [open "|ps --ppid $pid -o pid" "r"] - set child_pid [string trim [lindex [split [read $fd] \n] 1]] + if {[string match {*Darwin*} [exec uname -a]]} { + set fd [open "|pgrep -P $pid" "r"] + set child_pid [string trim [lindex [split [read $fd] \n] 0]] + } else { + set fd [open "|ps --ppid $pid -o pid" "r"] + set child_pid [string trim [lindex [split [read $fd] \n] 1]] + } close $fd return $child_pid