diff options
author | dgp <dgp@users.sourceforge.net> | 2011-09-09 14:40:04 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2011-09-09 14:40:04 (GMT) |
commit | 2ef078fcde8663a017bc1af6eb823f97ea9dda6a (patch) | |
tree | 1f2ea36470234f28638e9369bae23ee06684bcbe /tests/chanio.test | |
parent | c7afb0bda83f1ddc3ed320444c519903406f9508 (diff) | |
download | tcl-2ef078fcde8663a017bc1af6eb823f97ea9dda6a.zip tcl-2ef078fcde8663a017bc1af6eb823f97ea9dda6a.tar.gz tcl-2ef078fcde8663a017bc1af6eb823f97ea9dda6a.tar.bz2 |
3389733 Convert [testthread] use to Thread package use in chan-io-70.1.
Eliminates a memory leak in `make valgrind TESTFLAGS="-file chanio.test"`.
Diffstat (limited to 'tests/chanio.test')
-rw-r--r-- | tests/chanio.test | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/tests/chanio.test b/tests/chanio.test index 5569385..6a8524c 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -37,7 +37,7 @@ namespace eval ::tcl::test::io { testConstraint testfevent [llength [info commands testfevent]] testConstraint testchannelevent [llength [info commands testchannelevent]] testConstraint testmainthread [llength [info commands testmainthread]] - testConstraint testthread [llength [info commands testthread]] + testConstraint thread [expr {0 == [catch {package require Thread 2.6}]}] # You need a *very* special environment to do some tests. In particular, # many file systems do not support large-files... @@ -7413,7 +7413,6 @@ test chan-io-59.1 {Thread reference of channels} {testmainthread testchannel} { # More complicated tests (like that the reference changes as a channel is # moved from thread to thread) can be done only in the extension which # fully implements the moving of channels between threads, i.e. 'Threads'. - # Or we have to extend [testthread] as well. set f [open $path(longfile) r] set result [testchannel mthread $f] chan close $f @@ -7494,37 +7493,26 @@ test chan-io-70.0 {Cutting & Splicing channels} -setup { chan close $c removeFile cutsplice } -result {0 1 0} -# Duplicate of code in "thread.test". Find a better way of doing this without -# duplication. Maybe placement into a proc which transforms to nop after the -# first call, and placement of its defintion in a central location. -if {[testConstraint testthread]} { - testthread errorproc ThreadError - proc ThreadError {id info} { - global threadError - set threadError $info - } - proc ThreadNullError {id info} { - # ignore - } -} + test chan-io-70.1 {Transfer channel} -setup { set f [makeFile {... dummy ...} cutsplice] set res {} -} -constraints {testchannel testthread} -body { +} -constraints {testchannel thread} -body { set c [open $f r] lappend res [catch {chan seek $c 0 start}] testchannel cut $c lappend res [catch {chan seek $c 0 start}] - set tid [testthread create] - testthread send $tid [list set c $c] - lappend res [testthread send $tid { + set tid [thread::create -preserved] + thread::send $tid [list set c $c] + thread::send $tid {load {} Tcltest} + lappend res [thread::send $tid { testchannel splice $c set res [catch {chan seek $c 0 start}] chan close $c set res }] } -cleanup { - tcltest::threadReap + thread::release removeFile cutsplice } -result {0 1 0} |