diff options
author | dgp <dgp@users.sourceforge.net> | 2004-10-28 04:17:39 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2004-10-28 04:17:39 (GMT) |
commit | d7ff3329f865713723d696c68a3bbde36ca6a7fe (patch) | |
tree | 0e002a71d428a20da5f5b859aae67851305e963d /tests/socket.test | |
parent | 98e166525bea4632d8c876f9864349bc60b5a3fa (diff) | |
download | tcl-d7ff3329f865713723d696c68a3bbde36ca6a7fe.zip tcl-d7ff3329f865713723d696c68a3bbde36ca6a7fe.tar.gz tcl-d7ff3329f865713723d696c68a3bbde36ca6a7fe.tar.bz2 |
* tests/socket.test (socket-13.1): Balanced [makeFile] and
[removeFile] commands.
Diffstat (limited to 'tests/socket.test')
-rw-r--r-- | tests/socket.test | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/tests/socket.test b/tests/socket.test index 7c15398..5a7388e 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: socket.test,v 1.32 2004/07/16 19:20:09 andreas_kupries Exp $ +# RCS: @(#) $Id: socket.test,v 1.33 2004/10/28 04:17:39 dgp Exp $ # Running socket tests with a remote server: # ------------------------------------------ @@ -1621,40 +1621,40 @@ test socket-12.3 {testing inheritance of accepted sockets} {socket stdio exec} { } {accepted socket was not inherited} test socket-13.1 {Testing use of shared socket between two threads} \ - {socket testthread} { + -constraints {socket testthread} -setup { - file delete $path(script1) threadReap - makeFile { - set f [socket -server accept 0] - set listen [lindex [fconfigure $f -sockname] 2] - proc accept {s a p} { + set path(script) [makeFile { + set f [socket -server accept 0] + set listen [lindex [fconfigure $f -sockname] 2] + proc accept {s a p} { fileevent $s readable [list echo $s] fconfigure $s -buffering line } - proc echo {s} { - global i + proc echo {s} { + global i set l [gets $s] if {[eof $s]} { global x close $s set x done - } else { - incr i + } else { + incr i puts $s $l } - } - set i 0 - vwait x - close $f + } + set i 0 + vwait x + close $f - # thread cleans itself up. - testthread exit - } script - + # thread cleans itself up. + testthread exit + } script] + +} -body { # create a thread - set serverthread [testthread create { source script } ] + set serverthread [testthread create { source $path(script) } ] update set port [testthread send $serverthread {set listen}] update @@ -1664,18 +1664,18 @@ test socket-13.1 {Testing use of shared socket between two threads} \ fconfigure $s -buffering line catch { - puts $s "hello" - gets $s result + puts $s "hello" + gets $s result } close $s update after 2000 lappend result [threadReap] - - set result +} -cleanup { + removeFile script +} -result {hello 1} -} {hello 1} removeFile script1 removeFile script2 |