summaryrefslogtreecommitdiffstats
path: root/tests/ioCmd.test
diff options
context:
space:
mode:
authorferrieux <ferrieux@users.sourceforge.net>2011-08-17 20:35:19 (GMT)
committerferrieux <ferrieux@users.sourceforge.net>2011-08-17 20:35:19 (GMT)
commit1d11a7f1fd50b863d05886dbe18ca3ed326e5df8 (patch)
tree16f9a76306580477ee6938b7d71fe10ac3b28c5d /tests/ioCmd.test
parent703f1a10e054dc8c26566bc3ad5fa463a5289be9 (diff)
downloadtcl-1d11a7f1fd50b863d05886dbe18ca3ed326e5df8.zip
tcl-1d11a7f1fd50b863d05886dbe18ca3ed326e5df8.tar.gz
tcl-1d11a7f1fd50b863d05886dbe18ca3ed326e5df8.tar.bz2
[Bug 2946474] Consistently resume backgrounded flushes+closes when exiting.
Diffstat (limited to 'tests/ioCmd.test')
-rw-r--r--tests/ioCmd.test31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ioCmd.test b/tests/ioCmd.test
index 82f83db..6536072 100644
--- a/tests/ioCmd.test
+++ b/tests/ioCmd.test
@@ -2592,9 +2592,40 @@ test iocmd.tf-24.15 {chan write, EAGAIN means that writing is not allowed at thi
} -cleanup {
rename foo {}
unset res
+ update
} -result {{write rc* ABC} {watch rc* write} {}} \
-constraints {testchannel testthread}
+test iocmd.tf-24.16 {chan write, note the background flush setup by close due to the EAGAIN leaving data in buffers.} -match glob -setup {
+ set res {}
+ proc foo {args} {
+ oninit; onfinal; track
+ # Note: The EAGAIN signals that the channel cannot accept
+ # write requests right now, this in turn causes the IO core to
+ # request the generation of writable events (see expected
+ # result below, and compare to case 24.14 above).
+ error EAGAIN
+ }
+ set c [chan create {r w} foo]
+} -body {
+ notes [inthread $c {
+ note [puts -nonewline $c ABC ; flush $c]
+ close $c
+ notes
+ } c]
+ # Replace handler with all-tracking one which doesn't error.
+ # This will tell us if a write-due-flush is there.
+ proc foo {args} { note BG ; track }
+ # Flush (sic!) the event-queue to capture the write from a
+ # BG-flush.
+ update
+ set res
+} -cleanup {
+ rename foo {}
+ unset res
+} -result {{write rc* ABC} {watch rc* write} {} BG {write rc* ABC}} \
+ -constraints {testchannel testthread}
+
# --- === *** ###########################
# method cgetall