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`

(cherry picked from commit 0a1e734193)
This commit is contained in:
Oran Agra 2020-09-08 14:12:03 +03:00
parent 874c3a9978
commit 643d3e0b79

View File

@ -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,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"
}
}
set ::cur_test $prev_test
}