diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2005-07-28 10:55:26 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2005-07-28 10:55:26 (GMT) |
commit | 97b69e6ac0b3bfe72f1e3e4a490af5a45fb22776 (patch) | |
tree | b6f48053c0501e02ccac6dcd024853731f4caa79 /tests | |
parent | 41ae541c110c5729d4467ce0c5c0a5bc9aa24d48 (diff) | |
download | tcl-97b69e6ac0b3bfe72f1e3e4a490af5a45fb22776.zip tcl-97b69e6ac0b3bfe72f1e3e4a490af5a45fb22776.tar.gz tcl-97b69e6ac0b3bfe72f1e3e4a490af5a45fb22776.tar.bz2 |
* generic/tclPipe.c (TclCreatePipeline): Arrange for POSIX systems to
* unix/tclUnixPipe.c (TclpOpenFile): use the O_APPEND flag for
* tests/exec.test (exec-19.1): files opened in a pipeline
like ">>this". Note that Windows cannot support such access; there is
no equivalent flag on the handle that can be set at the kernel-call
level. The test is unix-specific in every way. [Bug 1245953]
Diffstat (limited to 'tests')
-rw-r--r-- | tests/exec.test | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/exec.test b/tests/exec.test index 930a4d3..a80aaeb 100644 --- a/tests/exec.test +++ b/tests/exec.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: exec.test,v 1.22 2004/07/02 23:31:30 hobbs Exp $ +# RCS: @(#) $Id: exec.test,v 1.23 2005/07/28 10:55:37 dkf Exp $ package require tcltest 2 namespace import -force ::tcltest::* @@ -600,6 +600,34 @@ test exec-18.1 { exec cat deals with weird file names} {exec tempNotWin} { set res } {0 contents} +# Note that this test cannot be adapted to work on Windows; that platform has +# no kernel support for an analog of O_APPEND. +test exec-19.1 {exec >> uses O_APPEND} { + -constraints {exec unix} + -setup { + set tmpfile [makeFile {0} tmpfile.exec-19.1] + } + -body { + # Note that we have to allow for the current contents of the + # temporary file, which is why the result is 14 and not 12 + exec /bin/sh -c \ + {for a in 1 2 3; do sleep 1; echo $a; done} >>$tmpfile & + exec /bin/sh -c \ + {for a in a b c; do sleep 1; echo $a; done} >>$tmpfile & + # The above two shell invokations take about 3 seconds to + # finish, so allow 5s (in case the machine is busy) + after 5000 + # Check that no bytes have got lost through mixups with + # overlapping appends, which is only guaranteed to work when + # we set O_APPEND on the file descriptor in the [exec >>...] + file size $tmpfile + } + -cleanup { + removeFile $tmpfile + } + -result 14 +} + # cleanup foreach file {script gorp.file gorp.file2 echo cat wc sh sleep exit err} { |