diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-03-31 18:47:26 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-03-31 18:47:26 (GMT) |
commit | 7e30bd73bdf1406fbbff99255256f0b9d2ba0181 (patch) | |
tree | 412d59b079017abb778b9483c6d182a31216e9fa /tests | |
parent | 92bec6e359c2f911e7d60eaa4dd21d2cefa0db09 (diff) | |
parent | f4cedcbce197fa8bedcd0bdbff05b9434adef7b4 (diff) | |
download | tcl-7e30bd73bdf1406fbbff99255256f0b9d2ba0181.zip tcl-7e30bd73bdf1406fbbff99255256f0b9d2ba0181.tar.gz tcl-7e30bd73bdf1406fbbff99255256f0b9d2ba0181.tar.bz2 |
merge trunk
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ioCmd.test | 14 | ||||
-rw-r--r-- | tests/ioTrans.test | 19 | ||||
-rw-r--r-- | tests/iogt.test | 35 |
3 files changed, 68 insertions, 0 deletions
diff --git a/tests/ioCmd.test b/tests/ioCmd.test index 03242be..a150d59 100644 --- a/tests/ioCmd.test +++ b/tests/ioCmd.test @@ -1051,6 +1051,20 @@ test iocmd-23.10 {chan read, EAGAIN means no data, yet no eof either} -match glo rename foo {} unset res } -result {{read rc* 4096} {} 0} +test iocmd-23.11 {chan read, close pulls the rug out} -match glob -body { + set res {} + proc foo {args} { + oninit; onfinal; track + set args [lassign $args sub id] + if {$sub ne "read"} {return} + close $id + return {} + } + set c [chan create {r} foo] + note [read $c] + rename foo {} + set res +} -result {{read rc* 4096} {}} # --- === *** ########################### # method write diff --git a/tests/ioTrans.test b/tests/ioTrans.test index 5a8874c..b21d894 100644 --- a/tests/ioTrans.test +++ b/tests/ioTrans.test @@ -540,6 +540,25 @@ test iortrans-4.8 {chan read, read, bug 2921116} -setup { rename foo {} } -result {{read rt* {test data }} file*} +test iortrans-4.8.1 {chan read, bug 721ec69271} -setup { + set res {} +} -match glob -body { + proc foo {fd args} { + handle.initialize + handle.finalize + lappend ::res $args + # Kill and recreate transform while it is operating + chan pop $fd + chan push $fd [list foo $fd] + } + set c [chan push [set c [tempchan]] [list foo $c]] + chan configure $c -buffersize 2 + lappend res [read $c] +} -cleanup { + tempdone + rename foo {} +} -result {{read rt* {test data +}} file*} test iortrans-4.9 {chan read, gets, bug 2921116} -setup { set res {} } -match glob -body { diff --git a/tests/iogt.test b/tests/iogt.test index d4c31d2..bd3c67b 100644 --- a/tests/iogt.test +++ b/tests/iogt.test @@ -220,6 +220,26 @@ proc id_fulltrail {var op data} { return $res } +proc id_torture {chan op data} { + switch -- $op { + create/write - + create/read - + delete/write - + delete/read - + clear_read {;#ignore} + flush/write - + flush/read - + write - + read { + testchannel unstack $chan + testchannel transform $chan \ + -command [namespace code [list id_torture $chan]] + return $data + } + query/maxRead {return -1} + } +} + proc counter {var op data} { namespace upvar [namespace current] $var n @@ -326,6 +346,11 @@ proc audit_ops {var -attach channel} { proc audit_flow {var -attach channel} { testchannel transform $channel -command [namespace code [list id_fulltrail $var]] } + +proc torture {-attach channel} { + testchannel transform $channel -command [namespace code [list id_torture $channel]] +} + proc stopafter {var n -attach channel} { namespace upvar [namespace current] $var vn set vn $n @@ -546,6 +571,16 @@ delete/read {} *ignored* flush/write {} {} delete/write {} *ignored*} +test iogt-2.4 {basic I/O, mixed trail} {testchannel} { + set fh [open $path(dummy) r] + torture -attach $fh + chan configure $fh -buffersize 2 + set x [read $fh] + testchannel unstack $fh + close $fh + set x +} {} + test iogt-3.0 {Tcl_Channel valid after stack/unstack, fevent handling} -setup { proc DoneCopy {n {err {}}} { variable copy 1 |