summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-07-28 15:27:55 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-07-28 15:27:55 (GMT)
commit425be14f5a21104533dbeb1df9edd1bc5363b2b1 (patch)
tree7ba16447fabfdc490e4f2e994c70b93f0f086cad /tests
parenta11fa9c7b80f3d0e7ef52862e03d260647cb05ea (diff)
downloadtcl-425be14f5a21104533dbeb1df9edd1bc5363b2b1.zip
tcl-425be14f5a21104533dbeb1df9edd1bc5363b2b1.tar.gz
tcl-425be14f5a21104533dbeb1df9edd1bc5363b2b1.tar.bz2
Backport of fix for [Bug 1245953]
Diffstat (limited to 'tests')
-rw-r--r--tests/exec.test30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/exec.test b/tests/exec.test
index 3613cba..bb6ecd4 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.16.2.4 2004/10/28 00:01:06 dgp Exp $
+# RCS: @(#) $Id: exec.test,v 1.16.2.5 2005/07/28 15:27:59 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} {