diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | tests/socket.test | 50 |
2 files changed, 28 insertions, 26 deletions
@@ -1,9 +1,11 @@ 2004-10-27 Don Porter <dgp@users.sourceforge.net> + * tests/socket.test (socket-13.1): Balanced [makeFile] and + [removeFile] commands. + * tests/clock.test: Correct duplicate test names. * tests/namespace.test: * tests/string.test: - * tests/io.test (io-50.4): Use namespace variables. 2004-10-27 David Gravereaux <davygrvy@pobox.com> 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 |