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)
```
This commit is contained in:
Oran Agra 2021-06-06 17:35:30 +03:00 committed by GitHub
parent 91f3689bf5
commit 3e39ea0b83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -127,11 +127,11 @@ set ::numclients 16
# a "run" command from the server, with a filename as data.
# It will run the specified test source file and signal it to the
# test server when finished.
proc execute_test_file name {
set path "tests/$name.tcl"
proc execute_test_file __testname {
set path "tests/$__testname.tcl"
set ::curfile $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
@ -139,10 +139,10 @@ proc execute_test_file name {
# as argument, and an associated name.
# It will run the specified code and signal it to the test server when
# finished.
proc execute_test_code {name filename code} {
proc execute_test_code {__testname filename code} {
set ::curfile $filename
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