summaryrefslogtreecommitdiffstats
path: root/tests/socket.test
diff options
context:
space:
mode:
authormax <max@tclers.tk>2011-06-28 14:42:29 (GMT)
committermax <max@tclers.tk>2011-06-28 14:42:29 (GMT)
commitaff501ecb18b44cb1c8920d32937ba3e7f404017 (patch)
tree709efdae1928d546164b3326551d33a6946ba033 /tests/socket.test
parent1543959a9b88e49df5b1f1ba37872eeae9eabb1e (diff)
downloadtcl-aff501ecb18b44cb1c8920d32937ba3e7f404017.zip
tcl-aff501ecb18b44cb1c8920d32937ba3e7f404017.tar.gz
tcl-aff501ecb18b44cb1c8920d32937ba3e7f404017.tar.bz2
replace socket-14.3 with a test that is more useful and less likely to randomly fail depending on the local network environment.
Diffstat (limited to 'tests/socket.test')
-rw-r--r--tests/socket.test29
1 files changed, 17 insertions, 12 deletions
diff --git a/tests/socket.test b/tests/socket.test
index 363f141..8efa79e 100644
--- a/tests/socket.test
+++ b/tests/socket.test
@@ -1718,7 +1718,7 @@ catch {close $commandSocket}
catch {close $remoteProcChan}
}
unset ::tcl::unsupported::socketAF
-test socket-14.0 {[socket -async] when server only listens on one address family} \
+test socket-14.0 {[socket -async] when server only listens on IPv4} \
-constraints [list socket supported_any] \
-setup {
proc accept {s a p} {
@@ -1784,23 +1784,28 @@ test socket-14.2 {[socket -async] fileevent connection refused} \
close $client
unset x
} -result "connection refused"
-test socket-14.3 {[socket -async] fileevent host unreachable} \
+test socket-14.3 {[socket -async] when server only listens on IPv6} \
-constraints [list socket supported_any] \
- -body {
- # address from rfc5737
- set client [socket -async 192.0.2.42 [randport]]
- fileevent $client writable {set x [fconfigure $client -error]}
- set after [after 5000 {set x timeout}]
- vwait x
- if {$x eq "timeout"} {
- append x ": [fconfigure $client -error]"
+ -setup {
+ proc accept {s a p} {
+ global x
+ puts $s bye
+ close $s
+ set x ok
}
+ set server [socket -server accept -myaddr ::1 0]
+ set port [lindex [fconfigure $server -sockname] 2]
+ } -body {
+ set client [socket -async localhost $port]
+ set after [after 1000 {set x [fconfigure $client -error]}]
+ vwait x
set x
} -cleanup {
after cancel $after
+ close $server
close $client
unset x
- } -result "host is unreachable"
+ } -result ok
test socket-14.4 {[socket -async] and both, readdable and writable fileevents} \
-constraints [list socket supported_any] \
-setup {
@@ -1832,7 +1837,7 @@ test socket-14.5 {[socket -async] which fails before any connect() can be made}
-constraints [list socket supported_any] \
-body {
# addresses from rfc5737
- socket -async -myaddr 192.0.2.42 198.51.100.42 [randport]
+ socket -async -myaddr 192.0.2.42 127.0.0.1 [randport]
} \
-returnCodes 1 \
-result {couldn't open socket: cannot assign requested address}