diff options
author | dgp <dgp@users.sourceforge.net> | 2022-10-28 12:55:40 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2022-10-28 12:55:40 (GMT) |
commit | 0b20d5aff1c281bc34289c99f781cf54817a60f8 (patch) | |
tree | a99a799e4b5577cf08ed21e34fca28b2aa601957 /tests/http.test | |
parent | c0cffed37f1950c005805fe0b43a8993dad46f49 (diff) | |
download | tcl-0b20d5aff1c281bc34289c99f781cf54817a60f8.zip tcl-0b20d5aff1c281bc34289c99f781cf54817a60f8.tar.gz tcl-0b20d5aff1c281bc34289c99f781cf54817a60f8.tar.bz2 |
Restore test suite fix. If [try] is too confusing, then I will use [eval].
The stack is a stack of commands.
Test hygiene. This was creating one more thread than it destroyed.
In a -singleproc 1 test run, this caused tests in later test files to fail
because the stray thread causes test results to be different.
Diffstat (limited to 'tests/http.test')
-rw-r--r-- | tests/http.test | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/http.test b/tests/http.test index 6826448..b422b2a 100644 --- a/tests/http.test +++ b/tests/http.test @@ -47,6 +47,7 @@ if {![file exists $httpdFile]} { catch {package require Thread 2.7-} if {[catch {package present Thread}] == 0 && [file exists $httpdFile]} { set httpthread [thread::create -preserved] + lappend threadStack [list thread::release $httpthread] thread::send $httpthread [list source $httpdFile] thread::send $httpthread [list set bindata $bindata] thread::send $httpthread {httpd_init 0; set port} port @@ -64,6 +65,7 @@ if {[catch {package present Thread}] == 0 && [file exists $httpdFile]} { catch {unset port} return } + set threadStack {} } if {![info exists ThreadLevel]} { @@ -78,6 +80,7 @@ if {![info exists ThreadLevel]} { foreach ThreadLevel $ValueRange { source [info script] } + eval [lpop threadStack] catch {unset ThreadLevel} catch {unset ValueRange} return @@ -1168,8 +1171,8 @@ catch {unset url} catch {unset badurl} catch {unset port} catch {unset data} -if {[info exists httpthread]} { - thread::release $httpthread +if {[llength $threadStack]} { + eval [lpop threadStack] } else { close $listen } |