==== socket-2.1 tcp connection FAILED ==== Contents of test case: file delete $path(script) set f [open $path(script) w] puts $f { set timer [after 10000 "set x timed_out"] set f [socket -server accept 0] proc accept {file addr port} { global x set x done close $file } puts ready puts [lindex [fconfigure $f -sockname] 2] vwait x after cancel $timer close $f puts $x } close $f set f [open "|[list [interpreter] $path(script)]" r] gets $f x gets $f listen if {[catch {socket 127.0.0.1 $listen} msg]} { set x $msg } else { lappend x [gets $f] close $msg } lappend x [gets $f] close $f set x ---- Result was: couldn't open socket: connection refused timed_out ---- Result should have been (exact matching): ready done {} ==== socket-2.1 FAILED ==== socket-2.2 tcp connection with client port specified FAILED ==== Contents of test case: file delete $path(script) set f [open $path(script) w] puts $f { set timer [after 10000 "set x timeout"] set f [socket -server accept 0] proc accept {file addr port} { global x puts "[gets $file] $port" close $file set x done } puts ready puts [lindex [fconfigure $f -sockname] 2] vwait x after cancel $timer close $f } close $f set f [open "|[list [interpreter] $path(script)]" r] gets $f x gets $f listen global port if {[catch {socket -myport $port 127.0.0.1 $listen} sock]} { set x $sock close [socket 127.0.0.1 $listen] puts stderr $sock } else { puts $sock hello flush $sock lappend x [gets $f] close $sock } close $f set x ---- Test generated error; Return code was: 1 ---- Return code should have been one of: 0 2 ---- errorInfo: couldn't open socket: connection refused while executing "socket 127.0.0.1 $listen" invoked from within "if {[catch {socket -myport $port 127.0.0.1 $listen} sock]} { set x $sock close [socket 127.0.0.1 $listen] puts stderr $sock } else { ..." ("uplevel" body line 24) invoked from within "uplevel 1 $script" ---- errorCode: POSIX ECONNREFUSED {connection refused} ==== socket-2.2 FAILED ==== socket-2.5 tcp connection with redundant server port FAILED ==== Contents of test case: file delete $path(script) set f [open $path(script) w] puts $f { set timer [after 10000 "set x timeout"] set f [socket -server accept 0] proc accept {file addr port} { global x puts "[gets $file]" close $file set x done } puts ready puts [lindex [fconfigure $f -sockname] 2] vwait x after cancel $timer close $f } close $f set f [open "|[list [interpreter] $path(script)]" r] gets $f x gets $f listen if {[catch {socket 127.0.0.1 $listen} sock]} { set x $sock } else { puts $sock hello flush $sock lappend x [gets $f] close $sock } close $f set x ---- Result was: couldn't open socket: connection refused ---- Result should have been (exact matching): ready hello ==== socket-2.5 FAILED ==== socket-2.7 echo server, one line FAILED ==== Contents of test case: file delete $path(script) set f [open $path(script) w] puts $f { set timer [after 10000 "set x timeout"] set f [socket -server accept 0] proc accept {s a p} { fileevent $s readable [list echo $s] fconfigure $s -translation lf -buffering line } proc echo {s} { set l [gets $s] if {[eof $s]} { global x close $s set x done } else { puts $s $l } } puts ready puts [lindex [fconfigure $f -sockname] 2] vwait x after cancel $timer close $f puts $x } close $f set f [open "|[list [interpreter] $path(script)]" r] gets $f gets $f listen set s [socket 127.0.0.1 $listen] fconfigure $s -buffering line -translation lf puts $s "hello abcdefghijklmnop" after 1000 set x [gets $s] close $s set y [gets $f] close $f list $x $y ---- Test generated error; Return code was: 1 ---- Return code should have been one of: 0 2 ---- errorInfo: couldn't open socket: connection refused while executing "socket 127.0.0.1 $listen" invoked from within "set s [socket 127.0.0.1 $listen]" ("uplevel" body line 32) invoked from within "uplevel 1 $script" ---- errorCode: POSIX ECONNREFUSED {connection refused} ==== socket-2.7 FAILED ==== socket-12.2 testing inheritance of client sockets FAILED ==== Contents of test case: file delete $path(script1) file delete $path(script2) # Script1 is just a 20 second delay. If the server socket # is inherited, it will be held open for 10 seconds set f [open $path(script1) w] puts $f { after 20000 exit vwait forever } close $f # Script2 opens the client socket and writes to it. It then # launches script1 and exits. If the child process inherited the # client socket, the socket will still be open. set f [open $path(script2) w] puts $f [list set tcltest [interpreter]] puts -nonewline $f { gets stdin port set f [socket 127.0.0.1 $port] exec $tcltest } puts $f [list $path(script1) &] puts $f { puts $f testing flush $f after 1000 exit vwait forever } close $f # Create the server socket set server [socket -server accept 0] proc accept { file host port } { # When the client connects, establish the read handler global server close $server fileevent $file readable [list getdata $file] fconfigure $file -buffering line -blocking 0 return } proc getdata { file } { # Read handler on the accepted socket. global x global failed set status [catch {read $file} data] if {$status != 0} { set x {read failed, error was $data} catch { close $file } } elseif {[string compare {} $data]} { } elseif {[fblocked $file]} { } elseif {[eof $file]} { if {$failed} { set x {client socket was inherited} } else { set x {client socket was not inherited} } catch { close $file } } else { set x {impossible case} catch { close $file } } return } # If the socket doesn't hit end-of-file in 10 seconds, the # script1 process must have inherited the client. set failed 0 after 10000 [list set failed 1] # Launch the script2 process ### exec [interpreter] script2 & set p [open "|[list [interpreter] $path(script2)]" w] puts $p [lindex [fconfigure $server -sockname] 2] ; flush $p vwait x if {!$failed} { vwait failed } close $p set x ---- Result was: client socket was inherited ---- Result should have been (exact matching): client socket was not inherited ==== socket-12.2 FAILED