diff options
author | andreas_kupries <akupries@shaw.ca> | 2006-03-16 18:22:54 (GMT) |
---|---|---|
committer | andreas_kupries <akupries@shaw.ca> | 2006-03-16 18:22:54 (GMT) |
commit | 25f7e2b1839da7e468041414cb962fd468bfa35c (patch) | |
tree | 9a1ede11503c4ab3597c045e1fee0c877cfb1a48 /tests | |
parent | 50eba7c70e2d665ecb30510700338e784228439b (diff) | |
download | tcl-25f7e2b1839da7e468041414cb962fd468bfa35c.zip tcl-25f7e2b1839da7e468041414cb962fd468bfa35c.tar.gz tcl-25f7e2b1839da7e468041414cb962fd468bfa35c.tar.bz2 |
* generic/tclIOUtil.c (TclGetOpenMode): Added the flag O_APPEND to
the list of POSIX modes used when opening a file for
'a'ppend. This enables the proper automatic seek-to-end-on-write
by the OS. See [Bug 680143] for longer discussion.
* tests/ioCmd.test (iocmd-13.7.*): Extended the testsuite to check
the new handling of 'a'.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ioCmd.test | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/tests/ioCmd.test b/tests/ioCmd.test index 9a06744..ed09720 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.27 2006/02/17 16:16:47 dgp Exp $ +# RCS: @(#) $Id: ioCmd.test,v 1.28 2006/03/16 18:23:00 andreas_kupries Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -503,6 +503,38 @@ test iocmd-13.9 {errors in open command} { list [catch {open $path(test1) r++} msg] $msg } {1 {illegal access mode "r++"}} +test iocmd-13.10.1 {open for append, a mode} -setup { + set log [makeFile {} out] + set chans {} +} -body { + foreach i { 0 1 2 3 4 5 6 7 8 9 } { + puts [set ch [open $log a]] $i + lappend chans $ch + } + foreach ch $chans {catch {close $ch}} + lsort [split [string trim [viewFile out]] \n] +} -cleanup { + removeFile out + # Ensure that channels are gone, even if body failed to do so + foreach ch $chans {catch {close $ch}} +} -result {0 1 2 3 4 5 6 7 8 9} + +test iocmd-13.10.2 {open for append, O_APPEND} -setup { + set log [makeFile {} out] + set chans {} +} -body { + foreach i { 0 1 2 3 4 5 6 7 8 9 } { + puts [set ch [open $log {WRONLY CREAT APPEND}]] $i + lappend chans $ch + } + foreach ch $chans {catch {close $ch}} + lsort [split [string trim [viewFile out]] \n] +} -cleanup { + removeFile out + # Ensure that channels are gone, even if body failed to do so + foreach ch $chans {catch {close $ch}} +} -result {0 1 2 3 4 5 6 7 8 9} + test iocmd-14.1 {file id parsing errors} { list [catch {eof gorp} msg] $msg $errorCode } {1 {can not find channel named "gorp"} NONE} |