diff options
author | dgp <dgp@users.sourceforge.net> | 2014-04-16 20:11:05 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-04-16 20:11:05 (GMT) |
commit | e827fc803e4afed0de2b1f9b37cd53379ef7118b (patch) | |
tree | 0cb51679567890cb745a261b7066f96262f8b372 /tests/socket.test | |
parent | 60a84571795909d2b51dff06349107716ae3ab6d (diff) | |
parent | ca6f13bb3001d560ccd18ff40400afca249ebe28 (diff) | |
download | tcl-e827fc803e4afed0de2b1f9b37cd53379ef7118b.zip tcl-e827fc803e4afed0de2b1f9b37cd53379ef7118b.tar.gz tcl-e827fc803e4afed0de2b1f9b37cd53379ef7118b.tar.bz2 |
merge 8.5
Diffstat (limited to 'tests/socket.test')
-rw-r--r-- | tests/socket.test | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/socket.test b/tests/socket.test index 0ae5abd..1b7c5fa 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -67,6 +67,10 @@ namespace import -force ::tcltest::* testConstraint testthread [llength [info commands testthread]] 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)} } + # If remoteServerIP or remoteServerPort are not set, check in the # environment variables for externally set values. # @@ -1683,6 +1687,37 @@ if {[string match sock* $commandSocket] == 1} { } catch {close $commandSocket} catch {close $remoteProcChan} +test socket-14.13 {testing writable event when quick failure} -constraints {socket win supported_inet} -body { + # Test for bug 336441ed59 where a quick background fail was ignored + + # Test only for windows as socket -async 255.255.255.255 fails + # directly on unix + + # The following connect should fail very quickly + set a1 [after 2000 {set x timeout}] + set s [socket -async 255.255.255.255 43434] + fileevent $s writable {set x writable} + vwait x + set x +} -cleanup { + catch {close $s} + after cancel $a1 +} -result writable + +test socket-14.14 {testing fileevent readable on failed async socket connect} -constraints [list socket] -body { + # Test for bug 581937ab1e + + set a1 [after 5000 {set x timeout}] + # This connect should fail + set s [socket -async localhost [randport]] + fileevent $s readable {set x readable} + vwait x + set x +} -cleanup { + catch {close $s} + after cancel $a1 +} -result readable + ::tcltest::cleanupTests flush stdout return |