summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <dkf@noemail.net>2016-07-24 12:45:07 (GMT)
committerdkf <dkf@noemail.net>2016-07-24 12:45:07 (GMT)
commit9f70ebe36f3cac61d2cb8bc730719f2cbf2296f7 (patch)
tree769178d3b08dab20ce4611d92ab525b6093fb3e8
parenta0b39883581560555a13d45bf4f44f7b54c562b8 (diff)
downloadtcl-9f70ebe36f3cac61d2cb8bc730719f2cbf2296f7.zip
tcl-9f70ebe36f3cac61d2cb8bc730719f2cbf2296f7.tar.gz
tcl-9f70ebe36f3cac61d2cb8bc730719f2cbf2296f7.tar.bz2
Make a few tests more resilient to differences in the semantics of pipes between operating systems.
FossilOrigin-Name: 4d292bc19449bba4ac31cc6030f17708e59ab309
-rw-r--r--doc/chan.n12
-rw-r--r--tests/zlib.test12
2 files changed, 20 insertions, 4 deletions
diff --git a/doc/chan.n b/doc/chan.n
index 7ea0d19..cc53d3b 100644
--- a/doc/chan.n
+++ b/doc/chan.n
@@ -547,6 +547,18 @@ this, spawn with "2>@" or
">@" redirection operators onto the write side of a pipe, and then
immediately close it in the parent. This is necessary to get an EOF on
the read side once the child has exited or otherwise closed its output.
+.RS
+.PP
+Note that the pipe buffering semantics can vary at the operating system level
+substantially; it is not safe to assume that a write performed on the output
+side of the pipe will appear instantly to the input side. This is a
+fundamental difference and Tcl cannot conceal it. The overall stream semantics
+\fIare\fR compatible, so blocking reads and writes will not see most of the
+differences, but the details of what exactly gets written when are not. This
+is most likely to show up when using pipelines for testing; care should be
+taken to ensure that deadlocks do not occur and that potential short reads are
+allowed for.
+.RE
.VE 8.6
.TP
\fBchan pop \fIchannelId\fR
diff --git a/tests/zlib.test b/tests/zlib.test
index c9e5f10..8a040d8 100644
--- a/tests/zlib.test
+++ b/tests/zlib.test
@@ -251,9 +251,10 @@ test zlib-8.8 {transformation and fconfigure} -setup {
} -constraints zlib -body {
zlib push compress $outSide -dictionary $spdyDict
fconfigure $outSide -blocking 0 -translation binary -buffering none
- fconfigure $inSide -blocking 0 -translation binary
+ fconfigure $inSide -blocking 1 -translation binary
puts -nonewline $outSide $spdyHeaders
chan pop $outSide
+ chan close $outSide
set compressed [read $inSide]
catch {zlib decompress $compressed} err opt
list [string length [zlib compress $spdyHeaders]] \
@@ -269,10 +270,11 @@ test zlib-8.9 {transformation and fconfigure} -setup {
} -constraints zlib -body {
zlib push compress $outSide -dictionary $spdyDict
fconfigure $outSide -blocking 0 -translation binary -buffering none
- fconfigure $inSide -blocking 0 -translation binary
+ fconfigure $inSide -blocking 1 -translation binary
puts -nonewline $outSide $spdyHeaders
set result [fconfigure $outSide -checksum]
chan pop $outSide
+ chan close $outSide
$strm put -dictionary $spdyDict [read $inSide]
lappend result [string length $spdyHeaders] [string length [$strm get]]
} -cleanup {
@@ -285,9 +287,10 @@ test zlib-8.10 {transformation and fconfigure} -setup {
} -constraints {zlib recentZlib} -body {
zlib push deflate $outSide -dictionary $spdyDict
fconfigure $outSide -blocking 0 -translation binary -buffering none
- fconfigure $inSide -blocking 0 -translation binary
+ fconfigure $inSide -blocking 1 -translation binary
puts -nonewline $outSide $spdyHeaders
chan pop $outSide
+ chan close $outSide
set compressed [read $inSide]
catch {
zlib inflate $compressed
@@ -306,9 +309,10 @@ test zlib-8.11 {transformation and fconfigure} -setup {
} -constraints zlib -body {
zlib push deflate $outSide -dictionary $spdyDict
fconfigure $outSide -blocking 0 -translation binary -buffering none
- fconfigure $inSide -blocking 0 -translation binary
+ fconfigure $inSide -blocking 1 -translation binary
puts -nonewline $outSide $spdyHeaders
chan pop $outSide
+ chan close $outSide
$strm put -dictionary $spdyDict [read $inSide]
list [string length $spdyHeaders] [string length [$strm get]]
} -cleanup {