diff options
author | dgp <dgp@users.sourceforge.net> | 2011-09-09 15:37:38 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2011-09-09 15:37:38 (GMT) |
commit | 1eb28ddde35dc2cf6762759f2a990e1d145802df (patch) | |
tree | 0f2c5c77d07135447358156342992a023e710b95 /tests/io.test | |
parent | 5ed3fcf7d82df65d65a38e7083e89077bde5da3a (diff) | |
download | tcl-1eb28ddde35dc2cf6762759f2a990e1d145802df.zip tcl-1eb28ddde35dc2cf6762759f2a990e1d145802df.tar.gz tcl-1eb28ddde35dc2cf6762759f2a990e1d145802df.tar.bz2 |
3389733 Convert [testthread] use to Thread package use in *io-70.1.
Eliminates a memory leak in `make valgrind`.
Diffstat (limited to 'tests/io.test')
-rw-r--r-- | tests/io.test | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/tests/io.test b/tests/io.test index e28948f..8a7cc51 100644 --- a/tests/io.test +++ b/tests/io.test @@ -37,7 +37,7 @@ testConstraint fcopy [llength [info commands fcopy]] 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... @@ -7435,7 +7435,7 @@ test 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. + # threads, i.e. 'Threads'. set f [open $path(longfile) r] set result [testchannel mthread $f] @@ -7527,25 +7527,7 @@ test io-70.0 {Cutting & Splicing channels} {testchannel} { } {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 io-70.1 {Transfer channel} {testchannel testthread} { +test io-70.1 {Transfer channel} {testchannel thread} { set f [makeFile {... dummy ...} cutsplice] set c [open $f r] @@ -7554,16 +7536,17 @@ test io-70.1 {Transfer channel} {testchannel testthread} { testchannel cut $c lappend res [catch {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 {seek $c 0 start}] close $c set res }] - tcltest::threadReap + thread::release $tid removeFile cutsplice set res |