Unverified Commit 3e39ea0b authored by Oran Agra's avatar Oran Agra Committed by GitHub
Browse files

tests: prevent name clash in variables leading to wrong test name (#8995)

running the "geo" unit would have shown that it completed a unit named
"north". this was because the variable `$name` was overwritten.
This commit isn't perfect, but it slightly reduces the chance for
variable name clash.

```
$ ./runtest --single unit/geo
.......
Testing unit/geo
.......
[1/1 done]: north (15 seconds)
```
parent 91f3689b
...@@ -127,11 +127,11 @@ set ::numclients 16 ...@@ -127,11 +127,11 @@ set ::numclients 16
# a "run" command from the server, with a filename as data. # a "run" command from the server, with a filename as data.
# It will run the specified test source file and signal it to the # It will run the specified test source file and signal it to the
# test server when finished. # test server when finished.
proc execute_test_file name { proc execute_test_file __testname {
set path "tests/$name.tcl" set path "tests/$__testname.tcl"
set ::curfile $path set ::curfile $path
source $path source $path
send_data_packet $::test_server_fd done "$name" send_data_packet $::test_server_fd done "$__testname"
} }
# This function is called by one of the test clients when it receives # This function is called by one of the test clients when it receives
...@@ -139,10 +139,10 @@ proc execute_test_file name { ...@@ -139,10 +139,10 @@ proc execute_test_file name {
# as argument, and an associated name. # as argument, and an associated name.
# It will run the specified code and signal it to the test server when # It will run the specified code and signal it to the test server when
# finished. # finished.
proc execute_test_code {name filename code} { proc execute_test_code {__testname filename code} {
set ::curfile $filename set ::curfile $filename
eval $code eval $code
send_data_packet $::test_server_fd done "$name" send_data_packet $::test_server_fd done "$__testname"
} }
# Setup a list to hold a stack of server configs. When calls to start_server # Setup a list to hold a stack of server configs. When calls to start_server
......
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