summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2014-06-05 19:09:51 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2014-06-05 19:09:51 (GMT)
commitf1bac0e8becc22f505069ad52dae904eae5e004d (patch)
treec5175906e8b8d81926dedaeea30254ef3875ff6f /tests
parent852f44abf1e24dce23b456d6cfa857bb5649300e (diff)
downloadtcl-f1bac0e8becc22f505069ad52dae904eae5e004d.zip
tcl-f1bac0e8becc22f505069ad52dae904eae5e004d.tar.gz
tcl-f1bac0e8becc22f505069ad52dae904eae5e004d.tar.bz2
Robust async connect tests by temporarely switching off auto continuation. Ticket [13d3af3ad5]
Diffstat (limited to 'tests')
-rw-r--r--tests/socket.test15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/socket.test b/tests/socket.test
index 0c9320a..b006cb4 100644
--- a/tests/socket.test
+++ b/tests/socket.test
@@ -67,10 +67,19 @@ namespace import -force ::tcltest::*
testConstraint thread [expr {0 == [catch {package require Thread 2.7-}]}]
testConstraint exec [llength [info commands exec]]
+
# Produce a random port number in the Dynamic/Private range
# from 49152 through 65535.
proc randport {} { expr {int(rand()*16383+49152)} }
+# Check if socket_test option is available
+testConstraint sockettest [expr {![catch {
+ set h [socket -async localhost [randport]]
+ fconfigure $h -unsupported1 1
+ close $h
+ }]}]
+
+
# Test the latency of tcp connections over the loopback interface. Some OSes
# (e.g. NetBSD) seem to use the Nagle algorithm and delayed ACKs, so it takes
# up to 200ms for a packet sent to localhost to arrive. We're measuring this
@@ -2148,7 +2157,7 @@ test socket-14.10.1 {pending [socket -async] and nonblocking [puts], server is I
close $sock
} -result {{} ok}
test socket-14.11.0 {pending [socket -async] and nonblocking [puts], no listener, no flush} \
- -constraints {socket} \
+ -constraints {socket } \
-body {
set sock [socket -async localhost [randport]]
fconfigure $sock -blocking 0
@@ -2161,12 +2170,14 @@ test socket-14.11.0 {pending [socket -async] and nonblocking [puts], no listener
unset x
} -result {socket is not connected} -returnCodes 1
test socket-14.11.1 {pending [socket -async] and nonblocking [puts], no listener, flush} \
- -constraints {socket} \
+ -constraints {socket sockettest} \
-body {
set sock [socket -async localhost [randport]]
+ fconfigure $sock -unsupported1 1
fconfigure $sock -blocking 0
puts $sock ok
flush $sock
+ fconfigure $sock -unsupported1 0
fileevent $sock writable {set x 1}
vwait x
close $sock