summaryrefslogtreecommitdiffstats
path: root/tests/event.test
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2006-11-28 16:29:47 (GMT)
committerKevin B Kenny <kennykb@acm.org>2006-11-28 16:29:47 (GMT)
commit78afab8ec5cb163b94f8fed86fb67d9e339d9268 (patch)
tree2a4153277da51a6fe37fa2b23a1c880874e8872f /tests/event.test
parent6da4a8974f27a03af1fd2ef3ded24be102f381bd (diff)
downloadtcl-78afab8ec5cb163b94f8fed86fb67d9e339d9268.zip
tcl-78afab8ec5cb163b94f8fed86fb67d9e339d9268.tar.gz
tcl-78afab8ec5cb163b94f8fed86fb67d9e339d9268.tar.bz2
* unix/tclUnixChan.c (TclUnixWaitForFile):
* tests/event.test (event-14.*): Corrected a bug where TclUnixWaitForFile would present select() with the wrong mask on an LP64 machine if a fd number exceeds 32. Thanks to Jean-Luc Fontaine for reporting and diagnosing [Bug 1602208].
Diffstat (limited to 'tests/event.test')
-rw-r--r--tests/event.test211
1 files changed, 210 insertions, 1 deletions
diff --git a/tests/event.test b/tests/event.test
index 0cf627b..98e660d 100644
--- a/tests/event.test
+++ b/tests/event.test
@@ -9,7 +9,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: event.test,v 1.20 2002/07/10 11:56:44 dgp Exp $
+# RCS: @(#) $Id: event.test,v 1.20.2.1 2006/11/28 16:29:47 kennykb Exp $
package require tcltest 2
namespace import -force ::tcltest::*
@@ -586,6 +586,215 @@ test event-13.8 {Tcl_WaitForFile procedure, waiting indefinitely} testfilewait {
set result
} {{} readable}
+
+test event-14.1 {Tcl_WaitForFile procedure, readable, big fd} \
+ -constraints {testfilehandler unix} \
+ -setup {
+ set chanList {}
+ for {set i 0} {$i < 32} {incr i} {
+ lappend chanList [open /dev/null r]
+ }
+ } \
+ -body {
+ foreach i [after info] {
+ after cancel $i
+ }
+ after 100 set x timeout
+ testfilehandler close
+ testfilehandler create 1 off off
+ set x "no timeout"
+ set result [testfilehandler wait 1 readable 0]
+ update
+ testfilehandler close
+ list $result $x
+ } \
+ -result {{} {no timeout}} \
+ -cleanup {
+ foreach chan $chanList {close $chan}
+ }
+
+test event-14.2 {Tcl_WaitForFile procedure, readable, big fd} \
+ -constraints {testfilehandler unix} \
+ -setup {
+ set chanList {}
+ for {set i 0} {$i < 32} {incr i} {
+ lappend chanList [open /dev/null r]
+ }
+ } \
+ -body {
+ foreach i [after info] {
+ after cancel $i
+ }
+ after 100 set x timeout
+ testfilehandler close
+ testfilehandler create 1 off off
+ set x "no timeout"
+ set result [testfilehandler wait 1 readable 100]
+ update
+ testfilehandler close
+ list $result $x
+ } \
+ -result {{} timeout} \
+ -cleanup {
+ foreach chan $chanList {close $chan}
+ }
+
+test event-14.3 {Tcl_WaitForFile procedure, readable, big fd} \
+ -constraints {testfilehandler unix} \
+ -setup {
+ set chanList {}
+ for {set i 0} {$i < 32} {incr i} {
+ lappend chanList [open /dev/null r]
+ }
+ } \
+ -body {
+ foreach i [after info] {
+ after cancel $i
+ }
+ after 100 set x timeout
+ testfilehandler close
+ testfilehandler create 1 off off
+ testfilehandler fillpartial 1
+ set x "no timeout"
+ set result [testfilehandler wait 1 readable 100]
+ update
+ testfilehandler close
+ list $result $x
+ } \
+ -result {readable {no timeout}} \
+ -cleanup {
+ foreach chan $chanList {close $chan}
+ }
+
+test event-14.4 {Tcl_WaitForFile procedure, writable, big fd} \
+ -constraints {testfilehandler unix nonPortable} \
+ -setup {
+ set chanList {}
+ for {set i 0} {$i < 32} {incr i} {
+ lappend chanList [open /dev/null r]
+ }
+ } \
+ -body {
+ foreach i [after info] {
+ after cancel $i
+ }
+ after 100 set x timeout
+ testfilehandler close
+ testfilehandler create 1 off off
+ testfilehandler fill 1
+ set x "no timeout"
+ set result [testfilehandler wait 1 writable 0]
+ update
+ testfilehandler close
+ list $result $
+ } \
+ -result {{} {no timeout}} \
+ -cleanup {
+ foreach chan $chanList {close $chan}
+ }
+
+test event-14.5 {Tcl_WaitForFile procedure, writable, big fd} \
+ -constraints {testfilehandler unix nonPortable} \
+ -setup {
+ set chanList {}
+ for {set i 0} {$i < 32} {incr i} {
+ lappend chanList [open /dev/null r]
+ }
+ } \
+ -body {
+ foreach i [after info] {
+ after cancel $i
+ }
+ after 100 set x timeout
+ testfilehandler close
+ testfilehandler create 1 off off
+ testfilehandler fill 1
+ set x "no timeout"
+ set result [testfilehandler wait 1 writable 100]
+ update
+ testfilehandler close
+ list $result $x
+ } \
+ -result {{} timeout} \
+ -cleanup {
+ foreach chan $chanList {close $chan}
+ }
+
+test event-14.6 {Tcl_WaitForFile procedure, writable, big fd} \
+ -constraints {testfilehandler unix} \
+ -setup {
+ set chanList {}
+ for {set i 0} {$i < 32} {incr i} {
+ lappend chanList [open /dev/null r]
+ }
+ } \
+ -body {
+ foreach i [after info] {
+ after cancel $i
+ }
+ after 100 set x timeout
+ testfilehandler close
+ testfilehandler create 1 off off
+ set x "no timeout"
+ set result [testfilehandler wait 1 writable 100]
+ update
+ testfilehandler close
+ list $result $x
+ } \
+ -result {writable {no timeout}} \
+ -cleanup {
+ foreach chan $chanList {close $chan}
+ }
+
+test event-14.7 {Tcl_WaitForFile, don't call other event handlers, big fd} \
+ -constraints {testfilehandler unix} \
+ -setup {
+ set chanList {}
+ for {set i 0} {$i < 32} {incr i} {
+ lappend chanList [open /dev/null r]
+ }
+ } \
+ -body {
+ foreach i [after info] {
+ after cancel $i
+ }
+ after 100 lappend x timeout
+ after idle lappend x idle
+ testfilehandler close
+ testfilehandler create 1 off off
+ set x ""
+ set result [list [testfilehandler wait 1 readable 200] $x]
+ update
+ testfilehandler close
+ lappend result $x
+ } \
+ -result {{} {} {timeout idle}} \
+ -cleanup {
+ foreach chan $chanList {close $chan}
+ }
+
+
+test event-14.8 {Tcl_WaitForFile procedure, waiting indefinitely, big fd} \
+ -constraints {testfilewait unix} \
+ -body {
+ set f [open "|sleep 2" r]
+ set result ""
+ lappend result [testfilewait $f readable 100]
+ lappend result [testfilewait $f readable -1]
+ close $f
+ set result
+ } \
+ -setup {
+ set chanList {}
+ for {set i 0} {$i < 32} {incr i} {
+ lappend chanList [open /dev/null r]
+ }
+ } \
+ -result {{} readable} \
+ -cleanup {
+ foreach chan $chanList {close $chan}
+ }
+
# cleanup
foreach i [after info] {
after cancel $i