handle cur_test for nested tests
if there are nested tests and nested servers, we need to restore the previous value of cur_test when a test exist. example: ``` test{test 1} { start_server { test{test 1.1 - master only} { } start_server { test{test 1.2 - with replication} { } } } } ``` when `test 1.1 - master only exists`, we're still inside `test 1`
This commit is contained in:
parent
f22fa9594d
commit
0a1e734193
@ -4,6 +4,7 @@ set ::num_failed 0
|
|||||||
set ::num_skipped 0
|
set ::num_skipped 0
|
||||||
set ::num_aborted 0
|
set ::num_aborted 0
|
||||||
set ::tests_failed {}
|
set ::tests_failed {}
|
||||||
|
set ::cur_test ""
|
||||||
|
|
||||||
proc fail {msg} {
|
proc fail {msg} {
|
||||||
error "assertion:$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
|
# set a cur_test global to be logged into new servers that are spown
|
||||||
# and log the test name in all existing servers
|
# and log the test name in all existing servers
|
||||||
|
set prev_test $::cur_test
|
||||||
set ::cur_test "$name in $::curfile"
|
set ::cur_test "$name in $::curfile"
|
||||||
if {!$::external} {
|
if {!$::external} {
|
||||||
foreach srv $::servers {
|
foreach srv $::servers {
|
||||||
@ -190,4 +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"
|
send_data_packet $::test_server_fd err "Detected a memory leak in test '$name': $output"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
set ::cur_test $prev_test
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user