summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormax <max@tclers.tk>2014-04-01 14:00:04 (GMT)
committermax <max@tclers.tk>2014-04-01 14:00:04 (GMT)
commit8d1bb4056046a74a3f04fa04992d2eb9d7346776 (patch)
treea67079cddf0be81e7fc702cf9c3cde98f7c6e470
parenta34d5fc9fb803e7cd3b123445f615018c2e1e23c (diff)
downloadtcl-8d1bb4056046a74a3f04fa04992d2eb9d7346776.zip
tcl-8d1bb4056046a74a3f04fa04992d2eb9d7346776.tar.gz
tcl-8d1bb4056046a74a3f04fa04992d2eb9d7346776.tar.bz2
Centralize and clarify the user of 169.254.0.0 as a non-reachable address.
-rw-r--r--tests/socket.test12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/socket.test b/tests/socket.test
index 5a6d9cd..9ffe506 100644
--- a/tests/socket.test
+++ b/tests/socket.test
@@ -63,6 +63,12 @@
package require tcltest 2
namespace import -force ::tcltest::*
+# For some tests we need an IP address that never responds.
+# 169.254.0.0 seems to be a good candidate, because it is from a
+# reserved part of the zeroconf address space. Should it ever cause
+# any problems, a different known-unreachable adress can be set here.
+set unreachableIP 169.254.0.0
+
# Some tests require the testthread and exec commands
testConstraint testthread [llength [info commands testthread]]
testConstraint exec [llength [info commands exec]]
@@ -1675,7 +1681,7 @@ test socket-13.1 {Testing use of shared socket between two threads} \
test socket-14.11.0 {pending [socket -async] and blocking [puts], no listener, no flush} \
-constraints {socket} \
-body {
- set sock [socket -async 169.254.0.0 42424]
+ set sock [socket -async $unreachableIP 42424]
fconfigure $sock -blocking 0
puts $sock ok
fileevent $sock writable {set x 1}
@@ -1688,7 +1694,7 @@ test socket-14.11.0 {pending [socket -async] and blocking [puts], no listener, n
test socket-14.11.1 {pending [socket -async] and blocking [puts], no listener, flush} \
-constraints {socket} \
-body {
- set sock [socket -async 169.254.0.0 42424]
+ set sock [socket -async $unreachableIP 42424]
fconfigure $sock -blocking 0
puts $sock ok
flush $sock
@@ -1697,7 +1703,7 @@ test socket-14.11.1 {pending [socket -async] and blocking [puts], no listener, f
close $sock
} -cleanup {
catch {close $sock}
- catch {unset x}
+ unset x
} -result {host is unreachable} -returnCodes 1
removeFile script1