diff --git a/tests/support/test.tcl b/tests/support/test.tcl index f5b4c8bef..55937b8f4 100644 --- a/tests/support/test.tcl +++ b/tests/support/test.tcl @@ -4,6 +4,7 @@ set ::num_failed 0 set ::num_skipped 0 set ::num_aborted 0 set ::tests_failed {} +set ::cur_test "" proc fail {msg} { error "assertion:$msg" @@ -136,6 +137,7 @@ proc test {name code {okpattern undefined} {options undefined}} { # set a cur_test global to be logged into new servers that are spown # and log the test name in all existing servers + set prev_test $::cur_test set ::cur_test "$name in $::curfile" if {!$::external} { foreach srv $::servers { @@ -190,5 +192,5 @@ 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 + set ::cur_test $prev_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