Unverified Commit 0a1e7341 authored by Oran Agra's avatar Oran Agra Committed by GitHub
Browse files

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`
parent f22fa959
...@@ -4,6 +4,7 @@ set ::num_failed 0 ...@@ -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}} { ...@@ -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}} { ...@@ -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
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment