diff options
author | andreas_kupries <akupries@shaw.ca> | 2010-03-09 21:13:13 (GMT) |
---|---|---|
committer | andreas_kupries <akupries@shaw.ca> | 2010-03-09 21:13:13 (GMT) |
commit | 9e9589c93aa74b20f3d626142697dd1687512762 (patch) | |
tree | d7537d3bde356fe98e8bbcb212ffc8f84e59dbb3 /tests | |
parent | c06d403baef36b9cefc85590d18795a36bd0427c (diff) | |
download | tcl-9e9589c93aa74b20f3d626142697dd1687512762.zip tcl-9e9589c93aa74b20f3d626142697dd1687512762.tar.gz tcl-9e9589c93aa74b20f3d626142697dd1687512762.tar.bz2 |
* generic/tclIORChan.c: [Bug 2936225]: Thanks to Alexandre Ferrieux
* doc/refchan.n: <ferrieux@users.sourceforge.net> for debugging and fixing
* tests/ioCmd.test: the problem. It is the write-side equivalent
to the bug fixed 2009-08-06.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ioCmd.test | 78 |
1 files changed, 77 insertions, 1 deletions
diff --git a/tests/ioCmd.test b/tests/ioCmd.test index 4dde148..999e25c 100644 --- a/tests/ioCmd.test +++ b/tests/ioCmd.test @@ -13,7 +13,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: ioCmd.test,v 1.36.2.7 2010/02/11 15:25:25 dkf Exp $ +# RCS: @(#) $Id: ioCmd.test,v 1.36.2.8 2010/03/09 21:13:13 andreas_kupries Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -1155,6 +1155,40 @@ test iocmd-24.13 {chan write, failed write, level is ignored} -match glob -body rename foo {} set res } -result {{write rc* snarfsnarfsnarf} 1 *bad code* {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo *bad code*subcommand "write"*}} +test iocmd-24.14 {chan write, no EAGAIN means that writing is allowed at this time, bug 2936225} -match glob -setup { + set res {} + proc foo {args} { + oninit; onfinal; track + return 3 + } + set c [chan create {r w} foo] +} -body { + note [puts -nonewline $c ABC ; flush $c] + set res +} -cleanup { + close $c + rename foo {} + unset res +} -result {{write rc* ABC} {}} +test iocmd-24.15 {chan write, EAGAIN means that writing is not allowed at this time, bug 2936225} -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 { + note [puts -nonewline $c ABC ; flush $c] + set res +} -cleanup { + close $c + rename foo {} + unset res +} -result {{write rc* ABC} {watch rc* write} {}} # --- === *** ########################### # method cgetall @@ -2472,6 +2506,48 @@ test iocmd.tf-24.13 {chan write, failed write, level is ignored} -match glob -bo set res } -result {{write rc* snarfsnarfsnarf} 1 *bad code* {-code 1 -level 0 -errorcode NONE -errorline 1 -errorinfo *bad code*subcommand "write"*}} \ -constraints {testchannel testthread} +test iocmd.tf-24.14 {chan write, no EAGAIN means that writing is allowed at this time, bug 2936225} -match glob -setup { + set res {} + proc foo {args} { + oninit; onfinal; track + return 3 + } + set c [chan create {r w} foo] +} -body { + notes [inthread $c { + note [puts -nonewline $c ABC ; flush $c] + close $c + notes + } c] + set res +} -cleanup { + rename foo {} + unset res +} -result {{write rc* ABC} {}} \ + -constraints {testchannel testthread} +test iocmd.tf-24.15 {chan write, EAGAIN means that writing is not allowed at this time, bug 2936225} -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] + set res +} -cleanup { + rename foo {} + unset res +} -result {{write rc* ABC} {watch rc* write} {}} \ + -constraints {testchannel testthread} # --- === *** ########################### # method cgetall |