diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/socket.test | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/tests/socket.test b/tests/socket.test index 0538b28..46b4601 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.45 2010/11/04 15:40:08 rmax Exp $ +# RCS: @(#) $Id: socket.test,v 1.46 2010/11/04 15:59:23 rmax Exp $ # Running socket tests with a remote server: # ------------------------------------------ @@ -253,7 +253,7 @@ test socket_$af-1.14 {arg parsing for socket command} -constraints [list socket set path(script) [makeFile {} script] -test socket_$af-2.1 {tcp connection} -constraints [list socket stdio supported_$af] -setup { +test socket_$af-2.1 {tcp connection} -constraints [list socket supported_$af stdio] -setup { file delete $path(script) set f [open $path(script) w] puts $f { @@ -307,7 +307,7 @@ test socket_$af-2.2 {tcp connection with client port specified} -setup { set f [open "|[list [interpreter] $path(script)]" r] gets $f x gets $f listen -} -constraints [list socket stdio supported_$af] -body { +} -constraints [list socket supported_$af stdio] -body { # $x == "ready" at this point set sock [socket -myport $port $localhost $listen] puts $sock hello @@ -341,7 +341,7 @@ test socket_$af-2.3 {tcp connection with client interface specified} -setup { set f [open "|[list [interpreter] $path(script)]" r] gets $f listen gets $f x -} -constraints [list socket stdio supported_$af] -body { +} -constraints [list socket supported_$af stdio] -body { # $x == "ready" at this point set sock [socket -myaddr $localhost $localhost $listen] puts $sock hello @@ -375,7 +375,7 @@ test socket_$af-2.4 {tcp connection with server interface specified} -setup { set f [open "|[list [interpreter] $path(script)]" r] gets $f x gets $f listen -} -constraints [list socket stdio supported_$af] -body { +} -constraints [list socket supported_$af stdio] -body { # $x == "ready" at this point set sock [socket $localhost $listen] puts $sock hello @@ -408,7 +408,7 @@ test socket_$af-2.5 {tcp connection with redundant server port} -setup { set f [open "|[list [interpreter] $path(script)]" r] gets $f x gets $f listen -} -constraints [list socket stdio supported_$af] -body { +} -constraints [list socket supported_$af stdio] -body { # $x == "ready" at this point set sock [socket $localhost $listen] puts $sock hello @@ -429,7 +429,7 @@ test socket_$af-2.6 {tcp connection} -constraints [list socket supported_$af] -b } set status } -result ok -test socket_$af-2.7 {echo server, one line} -constraints [list socket stdio supported_$af] -setup { +test socket_$af-2.7 {echo server, one line} -constraints [list socket supported_$af stdio] -setup { file delete $path(script) set f [open $path(script) w] puts $f { @@ -503,7 +503,7 @@ test socket_$af-2.8 {echo server, loop 50 times, single connection} -setup { set f [open "|[list [interpreter] $path(script)]" r] gets $f gets $f listen -} -constraints [list socket stdio supported_$af] -body { +} -constraints [list socket supported_$af stdio] -body { set s [socket $localhost $listen] fconfigure $s -buffering line catch { @@ -520,7 +520,7 @@ test socket_$af-2.8 {echo server, loop 50 times, single connection} -setup { removeFile script } -result {done 50} set path(script) [makeFile {} script] -test socket_$af-2.9 {socket conflict} -constraints [list socket stdio supported_$af] -body { +test socket_$af-2.9 {socket conflict} -constraints [list socket supported_$af stdio] -body { set s [socket -server accept 0] file delete $path(script) set f [open $path(script) w] @@ -588,7 +588,7 @@ test socket_$af-2.11 {detecting new data} -constraints [list socket supported_$a close $sock } -result {a:one b: c:two} -test socket_$af-3.1 {socket conflict} -constraints [list socket stdio supported_$af] -setup { +test socket_$af-3.1 {socket conflict} -constraints [list socket supported_$af stdio] -setup { file delete $path(script) set f [open $path(script) w] puts $f [list set localhost $localhost] @@ -648,7 +648,7 @@ test socket_$af-3.2 {server with several clients} -setup { set f [open "|[list [interpreter] $path(script)]" r+] set x [gets $f] gets $f listen -} -constraints [list socket stdio supported_$af] -body { +} -constraints [list socket supported_$af stdio] -body { # $x == "ready" here set s1 [socket $localhost $listen] fconfigure $s1 -buffering line @@ -695,7 +695,7 @@ test socket_$af-4.1 {server with several clients} -setup { fconfigure $p2 -buffering line set p3 [open "|[list [interpreter] $path(script)]" r+] fconfigure $p3 -buffering line -} -constraints [list socket stdio supported_$af] -body { +} -constraints [list socket supported_$af stdio] -body { proc accept {s a p} { fconfigure $s -buffering line fileevent $s readable [list echo $s] @@ -748,7 +748,7 @@ test socket_$af-5.1 {byte order problems, socket numbers, htons} -body { return {htons problem, should be disallowed, are you running as SU?} } return {couldn't open socket: not owner} -} -constraints [list socket unix notRoot supported_$af] -result {couldn't open socket: not owner} +} -constraints [list socket supported_$af unix notRoot] -result {couldn't open socket: not owner} test socket_$af-5.2 {byte order problems, socket numbers, htons} -body { if {![catch {socket -server dodo 0x10000} msg]} { close $msg @@ -762,9 +762,9 @@ test socket_$af-5.3 {byte order problems, socket numbers, htons} -body { return {htons problem, should be disallowed, are you running as SU?} } return {couldn't open socket: not owner} -} -constraints [list socket unix notRoot supported_$af] -result {couldn't open socket: not owner} +} -constraints [list socket supported_$af unix notRoot] -result {couldn't open socket: not owner} -test socket_$af-6.1 {accept callback error} -constraints [list socket stdio supported_$af] -setup { +test socket_$af-6.1 {accept callback error} -constraints [list socket supported_$af stdio] -setup { proc myHandler {msg options} { variable x $msg } @@ -813,7 +813,7 @@ test socket_$af-7.1 {testing socket specific options} -setup { gets $f gets $f listen set l "" -} -constraints [list socket stdio supported_$af] -body { +} -constraints [list socket supported_$af stdio] -body { set s [socket $localhost $listen] set p [fconfigure $s -peername] close $s @@ -843,7 +843,7 @@ test socket_$af-7.2 {testing socket specific options} -setup { set f [open "|[list [interpreter] $path(script)]" r] gets $f gets $f listen -} -constraints [list socket stdio supported_$af] -body { +} -constraints [list socket supported_$af stdio] -body { set s [socket $localhost $listen] set p [fconfigure $s -sockname] close $s @@ -882,7 +882,7 @@ test socket_$af-7.4 {testing socket specific options} -constraints [list socket test socket_$af-7.5 {testing socket specific options} -setup { set timer [after 10000 "set x timed_out"] set l "" -} -constraints [list socket unixOrPc supported_$af] -body { +} -constraints [list socket supported_$af unixOrPc] -body { set s [socket -server accept 0] proc accept {s a p} { global x @@ -1086,7 +1086,7 @@ test socket_$af-11.1 {tcp connection} -setup { } getPort $server }] -} -constraints [list socket doTestsWithRemoteServer supported_$af] -body { +} -constraints [list socket supported_$af doTestsWithRemoteServer] -body { set s [socket $remoteServerIP $port] gets $s } -cleanup { @@ -1103,7 +1103,7 @@ test socket_$af-11.2 {client specifies its port} -setup { } getPort $server }] -} -constraints [list socket doTestsWithRemoteServer supported_$af] -body { +} -constraints [list socket supported_$af doTestsWithRemoteServer] -body { set s [socket -myport $lport $remoteServerIP $rport] set r [gets $s] expr {$r==$lport ? "ok" : "broken: $r != $port"} @@ -1120,7 +1120,7 @@ test socket_$af-11.3 {trying to connect, no server} -body { close $s } return $status -} -constraints [list socket doTestsWithRemoteServer supported_$af] -result ok +} -constraints [list socket supported_$af doTestsWithRemoteServer] -result ok test socket_$af-11.4 {remote echo, one line} -setup { set port [sendCommand { set server [socket -server accept 0] @@ -1138,7 +1138,7 @@ test socket_$af-11.4 {remote echo, one line} -setup { } getPort $server }] -} -constraints [list socket doTestsWithRemoteServer supported_$af] -body { +} -constraints [list socket supported_$af doTestsWithRemoteServer] -body { set f [socket $remoteServerIP $port] fconfigure $f -translation crlf -buffering line puts $f hello @@ -1164,7 +1164,7 @@ test socket_$af-11.5 {remote echo, 50 lines} -setup { } getPort $server }] -} -constraints [list socket doTestsWithRemoteServer supported_$af] -body { +} -constraints [list socket supported_$af doTestsWithRemoteServer] -body { set f [socket $remoteServerIP $port] fconfigure $f -translation crlf -buffering line for {set cnt 0} {$cnt < 50} {incr cnt} { @@ -1180,7 +1180,7 @@ test socket_$af-11.5 {remote echo, 50 lines} -setup { } -result 50 test socket_$af-11.6 {socket conflict} -setup { set s1 [socket -server accept -myaddr $localhost 0] -} -constraints [list socket doTestsWithRemoteServer supported_$af] -body { +} -constraints [list socket supported_$af doTestsWithRemoteServer] -body { set s2 [socket -server accept -myaddr $localhost [getPort $s1]] list [getPort $s2] [close $s2] } -cleanup { @@ -1203,7 +1203,7 @@ test socket_$af-11.7 {server with several clients} -setup { } getPort $server }] -} -constraints [list socket doTestsWithRemoteServer supported_$af] -body { +} -constraints [list socket supported_$af doTestsWithRemoteServer] -body { set s1 [socket $remoteServerIP $port] fconfigure $s1 -buffering line set s2 [socket $remoteServerIP $port] @@ -1236,7 +1236,7 @@ test socket_$af-11.8 {client with several servers} -setup { } list [getPort $s1] [getPort $s2] [getPort $s3] }] p1 p2 p3 -} -constraints [list socket doTestsWithRemoteServer supported_$af] -body { +} -constraints [list socket supported_$af doTestsWithRemoteServer] -body { set s1 [socket $remoteServerIP $p1] set s2 [socket $remoteServerIP $p2] set s3 [socket $remoteServerIP $p3] @@ -1252,7 +1252,7 @@ test socket_$af-11.8 {client with several servers} -setup { close $s3 } } -result {server1 {} 1 server2 {} 1 server3 {} 1} -test socket_$af-11.9 {accept callback error} -constraints [list socket doTestsWithRemoteServer supported_$af] -setup { +test socket_$af-11.9 {accept callback error} -constraints [list socket supported_$af doTestsWithRemoteServer] -setup { proc myHandler {msg options} { variable x $msg } @@ -1286,7 +1286,7 @@ test socket_$af-11.10 {testing socket specific options} -setup { proc accept {s a p} {close $s} getPort $server }] -} -constraints [list socket doTestsWithRemoteServer supported_$af] -body { +} -constraints [list socket supported_$af doTestsWithRemoteServer] -body { set s [socket $remoteServerIP $port] set p [fconfigure $s -peername] set n [fconfigure $s -sockname] @@ -1314,7 +1314,7 @@ test socket_$af-11.11 {testing spurious events} -setup { set spurious 0 set done 0 set timer [after 40000 "set done timed_out"] -} -constraints [list socket doTestsWithRemoteServer supported_$af] -body { +} -constraints [list socket supported_$af doTestsWithRemoteServer] -body { proc readlittle {s} { global spurious done len set l [read $s 1] @@ -1337,7 +1337,7 @@ test socket_$af-11.11 {testing spurious events} -setup { after cancel $timer sendCommand {close $server} } -result {0 2690 1} -test socket_$af-11.12 {testing EOF stickyness} -constraints [list socket doTestsWithRemoteServer supported_$af] -setup { +test socket_$af-11.12 {testing EOF stickyness} -constraints [list socket supported_$af doTestsWithRemoteServer] -setup { set counter 0 set done 0 set port [sendCommand { @@ -1407,7 +1407,7 @@ test socket_$af-11.13 {testing async write, async flush, async close} -setup { getPort $l }] set timer [after 10000 "set done timed_out"] -} -constraints [list socket doTestsWithRemoteServer supported_$af] -body { +} -constraints [list socket supported_$af doTestsWithRemoteServer] -body { proc readit {s} { global count done set l [read $s] @@ -1461,7 +1461,7 @@ test socket_$af-12.1 {testing inheritance of server sockets} -setup { vwait forever } close $f -} -constraints [list socket stdio exec supported_$af] -body { +} -constraints [list socket supported_$af stdio exec] -body { # Launch script2 and wait 5 seconds ### exec [interpreter] script2 & set p [open "|[list [interpreter] $path(script2)]" r] @@ -1509,7 +1509,7 @@ test socket_$af-12.2 {testing inheritance of client sockets} -setup { # must have inherited the client. set failed 0 after 10000 [list set failed 1] -} -constraints [list socket stdio exec supported_$af] -body { +} -constraints [list socket supported_$af stdio exec] -body { # Create the server socket set server [socket -server accept -myaddr $localhost 0] proc accept { file host port } { @@ -1577,7 +1577,7 @@ test socket_$af-12.3 {testing inheritance of accepted sockets} -setup { vwait forever } close $f -} -constraints [list socket stdio exec supported_$af] -body { +} -constraints [list socket supported_$af stdio exec] -body { # Launch the script2 process and connect to it. See how long the socket # stays open ## exec [interpreter] script2 & @@ -1648,7 +1648,7 @@ test socket_$af-13.1 {Testing use of shared socket between two threads} -setup { # thread cleans itself up. testthread exit }] script] -} -constraints [list socket testthread supported_$af] -body { +} -constraints [list socket supported_$af testthread] -body { # create a thread set serverthread [testthread create [list source $path(script) ] ] update |