sl@0: # This file tests the tclWinFCmd.c file. sl@0: # sl@0: # This file contains a collection of tests for one or more of the Tcl sl@0: # built-in commands. Sourcing this file into Tcl runs the tests and sl@0: # generates output for errors. No output means no errors were found. sl@0: # sl@0: # Copyright (c) 1996-1997 Sun Microsystems, Inc. sl@0: # Copyright (c) 1998-1999 by Scriptics Corporation. sl@0: # sl@0: # See the file "license.terms" for information on usage and redistribution sl@0: # of this file, and for a DISCLAIMER OF ALL WARRANTIES. sl@0: # sl@0: # RCS: @(#) $Id: winFCmd.test,v 1.20.2.9 2006/03/19 22:47:30 vincentdarley Exp $ sl@0: # sl@0: sl@0: if {[lsearch [namespace children] ::tcltest] == -1} { sl@0: package require tcltest sl@0: namespace import -force ::tcltest::* sl@0: } sl@0: sl@0: proc createfile {file {string a}} { sl@0: set f [open $file w] sl@0: puts -nonewline $f $string sl@0: close $f sl@0: return $string sl@0: } sl@0: sl@0: proc contents {file} { sl@0: set f [open $file r] sl@0: set r [read $f] sl@0: close $f sl@0: set r sl@0: } sl@0: sl@0: proc cleanup {args} { sl@0: foreach p ". $args" { sl@0: set x "" sl@0: catch { sl@0: set x [glob -directory $p tf* td*] sl@0: } sl@0: if {$x != ""} { sl@0: catch {eval file delete -force -- $x} sl@0: } sl@0: } sl@0: } sl@0: sl@0: if {[string equal $tcl_platform(platform) "windows"]} { sl@0: if {[string equal $tcl_platform(os) "Windows NT"] \ sl@0: && [string equal [string index $tcl_platform(osVersion) 0] "5"]} { sl@0: tcltest::testConstraint win2000orXP 1 sl@0: tcltest::testConstraint winOlderThan2000 0 sl@0: } else { sl@0: tcltest::testConstraint win2000orXP 0 sl@0: tcltest::testConstraint winOlderThan2000 1 sl@0: } sl@0: } else { sl@0: tcltest::testConstraint win2000orXP 0 sl@0: tcltest::testConstraint winOlderThan2000 0 sl@0: } sl@0: sl@0: set ::tcltest::testConstraints(cdrom) 0 sl@0: set ::tcltest::testConstraints(exdev) 0 sl@0: sl@0: # find a CD-ROM so we can test read-only filesystems. sl@0: sl@0: set cdrom {} sl@0: if { [info commands ::testvolumetype] ne {} } { sl@0: foreach p {d e f g h i j k l m n o p q r s t u v w x y z} { sl@0: if { ! [catch { testvolumetype ${p}: } result] && $result eq {CDFS} } { sl@0: set cdrom ${p}: sl@0: } sl@0: } sl@0: } sl@0: sl@0: proc findfile {dir} { sl@0: foreach p [glob $dir/*] { sl@0: if {[file type $p] == "file"} { sl@0: return $p sl@0: } sl@0: } sl@0: foreach p [glob $dir/*] { sl@0: if {[file type $p] == "directory"} { sl@0: set f [findfile $p] sl@0: if {$f != ""} { sl@0: return $f sl@0: } sl@0: } sl@0: } sl@0: return "" sl@0: } sl@0: sl@0: if {$cdrom != ""} { sl@0: set ::tcltest::testConstraints(cdrom) 1 sl@0: set cdfile [findfile $cdrom] sl@0: } sl@0: sl@0: if {[file exists c:/] && [file exists d:/]} { sl@0: catch {file delete d:/tf1} sl@0: if {[catch {close [open d:/tf1 w]}] == 0} { sl@0: file delete d:/tf1 sl@0: set ::tcltest::testConstraints(exdev) 1 sl@0: } sl@0: } sl@0: sl@0: file delete -force -- td1 sl@0: set foo [catch {open td1 w} testfile] sl@0: if {$foo} { sl@0: set ::tcltest::testConstraints(longFileNames) 0 sl@0: } else { sl@0: close $testfile sl@0: set ::tcltest::testConstraints(longFileNames) 1 sl@0: file delete -force -- td1 sl@0: } sl@0: sl@0: # A really long file name sl@0: # length of longname is 1216 chars, which should be greater than any static sl@0: # buffer or allowable filename. sl@0: sl@0: set longname "abcdefghihjllmnopqrstuvwxyz01234567890" sl@0: append longname $longname sl@0: append longname $longname sl@0: append longname $longname sl@0: append longname $longname sl@0: append longname $longname sl@0: sl@0: # Uses the "testfile" command instead of the "file" command. The "file" sl@0: # command provides several layers of sanity checks on the arguments and sl@0: # it can be difficult to actually forward "insane" arguments to the sl@0: # low-level posix emulation layer. sl@0: sl@0: test winFCmd-1.1 {TclpRenameFile: errno: EACCES} {pcOnly cdrom} { sl@0: list [catch {testfile mv $cdfile $cdrom/dummy~~.fil} msg] $msg sl@0: } {1 EACCES} sl@0: test winFCmd-1.2 {TclpRenameFile: errno: EEXIST} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1/td2/td3 sl@0: file mkdir td2 sl@0: list [catch {testfile mv td2 td1/td2} msg] $msg sl@0: } {1 EEXIST} sl@0: test winFCmd-1.3 {TclpRenameFile: errno: EINVAL} {pcOnly} { sl@0: cleanup sl@0: list [catch {testfile mv / td1} msg] $msg sl@0: } {1 EINVAL} sl@0: test winFCmd-1.4 {TclpRenameFile: errno: EINVAL} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: list [catch {testfile mv td1 td1/td2} msg] $msg sl@0: } {1 EINVAL} sl@0: test winFCmd-1.5 {TclpRenameFile: errno: EISDIR} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: createfile tf1 sl@0: list [catch {testfile mv tf1 td1} msg] $msg sl@0: } {1 EISDIR} sl@0: test winFCmd-1.6 {TclpRenameFile: errno: ENOENT} {pcOnly} { sl@0: cleanup sl@0: list [catch {testfile mv tf1 tf2} msg] $msg sl@0: } {1 ENOENT} sl@0: test winFCmd-1.7 {TclpRenameFile: errno: ENOENT} {pcOnly} { sl@0: cleanup sl@0: list [catch {testfile mv "" tf2} msg] $msg sl@0: } {1 ENOENT} sl@0: test winFCmd-1.8 {TclpRenameFile: errno: ENOENT} {pcOnly} { sl@0: cleanup sl@0: createfile tf1 sl@0: list [catch {testfile mv tf1 ""} msg] $msg sl@0: } {1 ENOENT} sl@0: test winFCmd-1.9 {TclpRenameFile: errno: ENOTDIR} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: createfile tf1 sl@0: list [catch {testfile mv td1 tf1} msg] $msg sl@0: } {1 ENOTDIR} sl@0: test winFCmd-1.10 {TclpRenameFile: errno: EXDEV} {pcOnly exdev} { sl@0: file delete -force d:/tf1 sl@0: file mkdir c:/tf1 sl@0: set msg [list [catch {testfile mv c:/tf1 d:/tf1} msg] $msg] sl@0: file delete -force c:/tf1 sl@0: set msg sl@0: } {1 EXDEV} sl@0: test winFCmd-1.11 {TclpRenameFile: errno: EACCES} {pcOnly} { sl@0: cleanup sl@0: set fd [open tf1 w] sl@0: set msg [list [catch {testfile mv tf1 tf2} msg] $msg] sl@0: close $fd sl@0: set msg sl@0: } {1 EACCES} sl@0: test winFCmd-1.12 {TclpRenameFile: errno: EACCES} {pcOnly} { sl@0: cleanup sl@0: createfile tf1 sl@0: set fd [open tf2 w] sl@0: set msg [list [catch {testfile mv tf1 tf2} msg] $msg] sl@0: close $fd sl@0: set msg sl@0: } {1 EACCES} sl@0: test winFCmd-1.13 {TclpRenameFile: errno: EACCES} {pcOnly win2000orXP} { sl@0: cleanup sl@0: list [catch {testfile mv nul tf1} msg] $msg sl@0: } {1 EINVAL} sl@0: test winFCmd-1.13.1 {TclpRenameFile: errno: EACCES} {pcOnly winOlderThan2000} { sl@0: cleanup sl@0: list [catch {testfile mv nul tf1} msg] $msg sl@0: } {1 EACCES} sl@0: test winFCmd-1.14 {TclpRenameFile: errno: EACCES} {pcOnly 95} { sl@0: cleanup sl@0: createfile tf1 sl@0: list [catch {testfile mv tf1 nul} msg] $msg sl@0: } {1 EACCES} sl@0: test winFCmd-1.15 {TclpRenameFile: errno: EEXIST} {pcOnly nt} { sl@0: cleanup sl@0: createfile tf1 sl@0: list [catch {testfile mv tf1 nul} msg] $msg sl@0: } {1 EEXIST} sl@0: test winFCmd-1.16 {TclpRenameFile: MoveFile() != FALSE} {pcOnly} { sl@0: cleanup sl@0: createfile tf1 tf1 sl@0: testfile mv tf1 tf2 sl@0: list [file exists tf1] [contents tf2] sl@0: } {0 tf1} sl@0: test winFCmd-1.17 {TclpRenameFile: MoveFile() == FALSE} {pcOnly} { sl@0: cleanup sl@0: list [catch {testfile mv tf1 tf2} msg] $msg sl@0: } {1 ENOENT} sl@0: test winFCmd-1.18 {TclpRenameFile: srcAttr == -1} {pcOnly} { sl@0: cleanup sl@0: list [catch {testfile mv tf1 tf2} msg] $msg sl@0: } {1 ENOENT} sl@0: test winFCmd-1.19 {TclpRenameFile: errno == EACCES} {pcOnly win2000orXP} { sl@0: cleanup sl@0: list [catch {testfile mv nul tf1} msg] $msg sl@0: } {1 EINVAL} sl@0: test winFCmd-1.19.1 {TclpRenameFile: errno == EACCES} {pcOnly winOlderThan2000} { sl@0: cleanup sl@0: list [catch {testfile mv nul tf1} msg] $msg sl@0: } {1 EACCES} sl@0: test winFCmd-1.20 {TclpRenameFile: src is dir} {pcOnly nt} { sl@0: # under 95, this would actually succeed and move the current dir out from sl@0: # under the current process! sl@0: cleanup sl@0: file delete /tf1 sl@0: list [catch {testfile mv [pwd] /tf1} msg] $msg sl@0: } {1 EACCES} sl@0: test winFCmd-1.21 {TclpRenameFile: long src} {pcOnly} { sl@0: cleanup sl@0: list [catch {testfile mv $longname tf1} msg] $msg sl@0: } {1 ENAMETOOLONG} sl@0: test winFCmd-1.22 {TclpRenameFile: long dst} {pcOnly} { sl@0: cleanup sl@0: createfile tf1 sl@0: list [catch {testfile mv tf1 $longname} msg] $msg sl@0: } {1 ENAMETOOLONG} sl@0: test winFCmd-1.23 {TclpRenameFile: move dir into self} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: list [catch {testfile mv [pwd]/td1 td1/td2} msg] $msg sl@0: } {1 EINVAL} sl@0: test winFCmd-1.24 {TclpRenameFile: move a root dir} {pcOnly} { sl@0: cleanup sl@0: list [catch {testfile mv / c:/} msg] $msg sl@0: } {1 EINVAL} sl@0: test winFCmd-1.25 {TclpRenameFile: cross file systems} {pcOnly cdrom} { sl@0: cleanup sl@0: file mkdir td1 sl@0: list [catch {testfile mv td1 $cdrom/td1} msg] $msg sl@0: } {1 EXDEV} sl@0: test winFCmd-1.26 {TclpRenameFile: readonly fs} {pcOnly cdrom} { sl@0: cleanup sl@0: list [catch {testfile mv $cdfile $cdrom/dummy~~.fil} msg] $msg sl@0: } {1 EACCES} sl@0: test winFCmd-1.27 {TclpRenameFile: open file} {pcOnly} { sl@0: cleanup sl@0: set fd [open tf1 w] sl@0: set msg [list [catch {testfile mv tf1 tf2} msg] $msg] sl@0: close $fd sl@0: set msg sl@0: } {1 EACCES} sl@0: test winFCmd-1.28 {TclpRenameFile: errno == EEXIST} {pcOnly} { sl@0: cleanup sl@0: createfile tf1 sl@0: createfile tf2 sl@0: testfile mv tf1 tf2 sl@0: list [file exists tf1] [file exists tf2] sl@0: } {0 1} sl@0: test winFCmd-1.29 {TclpRenameFile: src is dir} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: createfile tf1 sl@0: list [catch {testfile mv td1 tf1} msg] $msg sl@0: } {1 ENOTDIR} sl@0: test winFCmd-1.30 {TclpRenameFile: dst is dir} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: file mkdir td2/td2 sl@0: list [catch {testfile mv td1 td2} msg] $msg sl@0: } {1 EEXIST} sl@0: test winFCmd-1.31 {TclpRenameFile: TclpRemoveDirectory fails} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: file mkdir td2/td2 sl@0: list [catch {testfile mv td1 td2} msg] $msg sl@0: } {1 EEXIST} sl@0: test winFCmd-1.32 {TclpRenameFile: TclpRemoveDirectory succeeds} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1/td2 sl@0: file mkdir td2 sl@0: testfile mv td1 td2 sl@0: list [file exists td1] [file exists td2] [file exists td2/td2] sl@0: } {0 1 1} sl@0: test winFCmd-1.33 {TclpRenameFile: After removing dst dir, MoveFile fails} \ sl@0: {pcOnly exdev} { sl@0: file mkdir d:/td1 sl@0: testchmod 000 d:/td1 sl@0: file mkdir c:/tf1 sl@0: set msg [list [catch {testfile mv c:/tf1 d:/td1} msg] $msg] sl@0: set msg "$msg [file writable d:/td1]" sl@0: file delete d:/td1 sl@0: file delete -force c:/tf1 sl@0: set msg sl@0: } {1 EXDEV 0} sl@0: test winFCmd-1.34 {TclpRenameFile: src is dir, dst is not} {pcOnly} { sl@0: file mkdir td1 sl@0: createfile tf1 sl@0: list [catch {testfile mv td1 tf1} msg] $msg sl@0: } {1 ENOTDIR} sl@0: test winFCmd-1.35 {TclpRenameFile: src is not dir, dst is} {pcOnly} { sl@0: file mkdir td1 sl@0: createfile tf1 sl@0: list [catch {testfile mv tf1 td1} msg] $msg sl@0: } {1 EISDIR} sl@0: test winFCmd-1.36 {TclpRenameFile: src and dst not dir} {pcOnly} { sl@0: createfile tf1 tf1 sl@0: createfile tf2 tf2 sl@0: testfile mv tf1 tf2 sl@0: contents tf2 sl@0: } {tf1} sl@0: test winFCmd-1.37 {TclpRenameFile: need to restore temp file} {pcOnly} { sl@0: # Can't figure out how to cause this. sl@0: # Need a file that can't be copied. sl@0: } {} sl@0: sl@0: test winFCmd-2.1 {TclpCopyFile: errno: EACCES} {pcOnly cdrom} { sl@0: cleanup sl@0: list [catch {testfile cp $cdfile $cdrom/dummy~~.fil} msg] $msg sl@0: } {1 EACCES} sl@0: test winFCmd-2.2 {TclpCopyFile: errno: EISDIR} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: list [catch {testfile cp td1 tf1} msg] $msg sl@0: } {1 EISDIR} sl@0: test winFCmd-2.3 {TclpCopyFile: errno: EISDIR} {pcOnly} { sl@0: cleanup sl@0: createfile tf1 sl@0: file mkdir td1 sl@0: list [catch {testfile cp tf1 td1} msg] $msg sl@0: } {1 EISDIR} sl@0: test winFCmd-2.4 {TclpCopyFile: errno: ENOENT} {pcOnly} { sl@0: cleanup sl@0: list [catch {testfile cp tf1 tf2} msg] $msg sl@0: } {1 ENOENT} sl@0: test winFCmd-2.5 {TclpCopyFile: errno: ENOENT} {pcOnly} { sl@0: cleanup sl@0: list [catch {testfile cp "" tf2} msg] $msg sl@0: } {1 ENOENT} sl@0: test winFCmd-2.6 {TclpCopyFile: errno: ENOENT} {pcOnly} { sl@0: cleanup sl@0: createfile tf1 sl@0: list [catch {testfile cp tf1 ""} msg] $msg sl@0: } {1 ENOENT} sl@0: test winFCmd-2.7 {TclpCopyFile: errno: EACCES} {pcOnly 95} { sl@0: cleanup sl@0: createfile tf1 sl@0: set fd [open tf2 w] sl@0: set msg [list [catch {testfile cp tf1 tf2} msg] $msg] sl@0: close $fd sl@0: set msg sl@0: } {1 EACCES} sl@0: test winFCmd-2.8 {TclpCopyFile: errno: EACCES} {pcOnly win2000orXP} { sl@0: cleanup sl@0: list [catch {testfile cp nul tf1} msg] $msg sl@0: } {1 EINVAL} sl@0: test winFCmd-2.8.1 {TclpCopyFile: errno: EACCES} {pcOnly nt winOlderThan2000} { sl@0: cleanup sl@0: list [catch {testfile cp nul tf1} msg] $msg sl@0: } {1 EACCES} sl@0: test winFCmd-2.9 {TclpCopyFile: errno: ENOENT} {pcOnly 95} { sl@0: cleanup sl@0: list [catch {testfile cp nul tf1} msg] $msg sl@0: } {1 ENOENT} sl@0: test winFCmd-2.10 {TclpCopyFile: CopyFile succeeds} {pcOnly} { sl@0: cleanup sl@0: createfile tf1 tf1 sl@0: testfile cp tf1 tf2 sl@0: list [contents tf1] [contents tf2] sl@0: } {tf1 tf1} sl@0: test winFCmd-2.11 {TclpCopyFile: CopyFile succeeds} {pcOnly} { sl@0: cleanup sl@0: createfile tf1 tf1 sl@0: createfile tf2 tf2 sl@0: testfile cp tf1 tf2 sl@0: list [contents tf1] [contents tf2] sl@0: } {tf1 tf1} sl@0: test winFCmd-2.12 {TclpCopyFile: CopyFile succeeds} {pcOnly} { sl@0: cleanup sl@0: createfile tf1 tf1 sl@0: testchmod 000 tf1 sl@0: testfile cp tf1 tf2 sl@0: list [contents tf2] [file writable tf2] sl@0: } {tf1 0} sl@0: test winFCmd-2.13 {TclpCopyFile: CopyFile fails} {pcOnly} { sl@0: cleanup sl@0: createfile tf1 sl@0: file mkdir td1 sl@0: list [catch {testfile cp tf1 td1} msg] $msg sl@0: } {1 EISDIR} sl@0: test winFCmd-2.14 {TclpCopyFile: errno == EACCES} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: list [catch {testfile cp td1 tf1} msg] $msg sl@0: } {1 EISDIR} sl@0: test winFCmd-2.15 {TclpCopyFile: src is directory} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: list [catch {testfile cp td1 tf1} msg] $msg sl@0: } {1 EISDIR} sl@0: test winFCmd-2.16 {TclpCopyFile: dst is directory} {pcOnly} { sl@0: cleanup sl@0: createfile tf1 sl@0: file mkdir td1 sl@0: list [catch {testfile cp tf1 td1} msg] $msg sl@0: } {1 EISDIR} sl@0: test winFCmd-2.17 {TclpCopyFile: dst is readonly} {pcOnly} { sl@0: cleanup sl@0: createfile tf1 tf1 sl@0: createfile tf2 tf2 sl@0: testchmod 000 tf2 sl@0: testfile cp tf1 tf2 sl@0: list [file writable tf2] [contents tf2] sl@0: } {1 tf1} sl@0: test winFCmd-2.18 {TclpCopyFile: still can't copy onto dst} {pcOnly 95} { sl@0: cleanup sl@0: createfile tf1 sl@0: createfile tf2 sl@0: testchmod 000 tf2 sl@0: set fd [open tf2] sl@0: set msg [list [catch {testfile cp tf1 tf2} msg] $msg] sl@0: close $fd sl@0: set msg "$msg [file writable tf2]" sl@0: } {1 EACCES 0} sl@0: sl@0: test winFCmd-3.1 {TclpDeleteFile: errno: EACCES} {pcOnly cdrom} { sl@0: list [catch {testfile rm $cdfile $cdrom/dummy~~.fil} msg] $msg sl@0: } {1 EACCES} sl@0: test winFCmd-3.2 {TclpDeleteFile: errno: EISDIR} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: list [catch {testfile rm td1} msg] $msg sl@0: } {1 EISDIR} sl@0: test winFCmd-3.3 {TclpDeleteFile: errno: ENOENT} {pcOnly} { sl@0: cleanup sl@0: list [catch {testfile rm tf1} msg] $msg sl@0: } {1 ENOENT} sl@0: test winFCmd-3.4 {TclpDeleteFile: errno: ENOENT} {pcOnly} { sl@0: cleanup sl@0: list [catch {testfile rm ""} msg] $msg sl@0: } {1 ENOENT} sl@0: test winFCmd-3.5 {TclpDeleteFile: errno: EACCES} {pcOnly} { sl@0: cleanup sl@0: set fd [open tf1 w] sl@0: set msg [list [catch {testfile rm tf1} msg] $msg] sl@0: close $fd sl@0: set msg sl@0: } {1 EACCES} sl@0: test winFCmd-3.6 {TclpDeleteFile: errno: EACCES} {pcOnly} { sl@0: cleanup sl@0: list [catch {testfile rm nul} msg] $msg sl@0: } {1 EACCES} sl@0: test winFCmd-3.7 {TclpDeleteFile: DeleteFile succeeds} {pcOnly} { sl@0: cleanup sl@0: createfile tf1 sl@0: testfile rm tf1 sl@0: file exists tf1 sl@0: } {0} sl@0: test winFCmd-3.8 {TclpDeleteFile: DeleteFile fails} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: list [catch {testfile rm td1} msg] $msg sl@0: } {1 EISDIR} sl@0: test winFCmd-3.9 {TclpDeleteFile: errno == EACCES} {pcOnly} { sl@0: cleanup sl@0: set fd [open tf1 w] sl@0: set msg [list [catch {testfile rm tf1} msg] $msg] sl@0: close $fd sl@0: set msg sl@0: } {1 EACCES} sl@0: test winFCmd-3.10 {TclpDeleteFile: path is readonly} {pcOnly} { sl@0: cleanup sl@0: createfile tf1 sl@0: testchmod 000 tf1 sl@0: testfile rm tf1 sl@0: file exists tf1 sl@0: } {0} sl@0: test winFCmd-3.11 {TclpDeleteFile: still can't remove path} {pcOnly} { sl@0: cleanup sl@0: set fd [open tf1 w] sl@0: testchmod 000 tf1 sl@0: set msg [list [catch {testfile rm tf1} msg] $msg] sl@0: close $fd sl@0: set msg sl@0: } {1 EACCES} sl@0: sl@0: test winFCmd-4.1 {TclpCreateDirectory: errno: EACCES} {pcOnly nt cdrom} { sl@0: list [catch {testfile mkdir $cdrom/dummy~~.dir} msg] $msg sl@0: } {1 EACCES} sl@0: test winFCmd-4.2 {TclpCreateDirectory: errno: EACCES} {pcOnly 95 cdrom} { sl@0: list [catch {testfile mkdir $cdrom/dummy~~.dir} msg] $msg sl@0: } {1 ENOSPC} sl@0: test winFCmd-4.3 {TclpCreateDirectory: errno: EEXIST} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: list [catch {testfile mkdir td1} msg] $msg sl@0: } {1 EEXIST} sl@0: test winFCmd-4.4 {TclpCreateDirectory: errno: ENOENT} {pcOnly} { sl@0: cleanup sl@0: list [catch {testfile mkdir td1/td2} msg] $msg sl@0: } {1 ENOENT} sl@0: test winFCmd-4.5 {TclpCreateDirectory: CreateDirectory succeeds} {pcOnly} { sl@0: cleanup sl@0: testfile mkdir td1 sl@0: file type td1 sl@0: } {directory} sl@0: sl@0: test winFCmd-5.1 {TclpCopyDirectory: calls TraverseWinTree} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: testfile cpdir td1 td2 sl@0: list [file type td1] [file type td2] sl@0: } {directory directory} sl@0: sl@0: test winFCmd-6.1 {TclpRemoveDirectory: errno: EACCES} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: testchmod 000 td1 sl@0: testfile rmdir td1 sl@0: file exists td1 sl@0: } {0} sl@0: test winFCmd-6.2 {TclpRemoveDirectory: errno: EEXIST} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1/td2 sl@0: list [catch {testfile rmdir td1} msg] [file tail $msg] sl@0: } {1 {td1 EEXIST}} sl@0: test winFCmd-6.3 {TclpRemoveDirectory: errno: EACCES} {pcOnly} { sl@0: # can't test this w/o removing everything on your hard disk first! sl@0: # testfile rmdir / sl@0: } {} sl@0: test winFCmd-6.4 {TclpRemoveDirectory: errno: ENOENT} {pcOnly} { sl@0: cleanup sl@0: list [catch {testfile rmdir td1} msg] [file tail $msg] sl@0: } {1 {td1 ENOENT}} sl@0: test winFCmd-6.5 {TclpRemoveDirectory: errno: ENOENT} {pcOnly} { sl@0: cleanup sl@0: list [catch {testfile rmdir ""} msg] $msg sl@0: } {1 ENOENT} sl@0: test winFCmd-6.6 {TclpRemoveDirectory: errno: ENOTDIR} {pcOnly} { sl@0: cleanup sl@0: createfile tf1 sl@0: list [catch {testfile rmdir tf1} msg] [file tail $msg] sl@0: } {1 {tf1 ENOTDIR}} sl@0: test winFCmd-6.7 {TclpRemoveDirectory: RemoveDirectory succeeds} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: testfile rmdir td1 sl@0: file exists td1 sl@0: } {0} sl@0: test winFCmd-6.8 {TclpRemoveDirectory: RemoveDirectory fails} {pcOnly} { sl@0: cleanup sl@0: createfile tf1 sl@0: list [catch {testfile rmdir tf1} msg] [file tail $msg] sl@0: } {1 {tf1 ENOTDIR}} sl@0: test winFCmd-6.9 {TclpRemoveDirectory: errno == EACCES} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: testchmod 000 td1 sl@0: testfile rmdir td1 sl@0: file exists td1 sl@0: } {0} sl@0: test winFCmd-6.10 {TclpRemoveDirectory: attr == -1} {pcOnly 95} { sl@0: cleanup sl@0: list [catch {testfile rmdir nul} msg] $msg sl@0: } {1 {nul EACCES}} sl@0: test winFCmd-6.11 {TclpRemoveDirectory: attr == -1} {pcOnly nt} { sl@0: cleanup sl@0: set res [list [catch {testfile rmdir /} msg] $msg] sl@0: # WinXP returns EEXIST, WinNT seems to return EACCES. No policy sl@0: # decision has been made as to which is correct. sl@0: regsub {E(ACCES|EXIST)} $res "EACCES or EEXIST" res sl@0: # Don't mind which drive we're on sl@0: regsub {[A-Z]:} $res "" sl@0: } {1 {/ EACCES or EEXIST}} sl@0: test winFCmd-6.12 {TclpRemoveDirectory: errno == EACCES} {pcOnly 95} { sl@0: cleanup sl@0: createfile tf1 sl@0: list [catch {testfile rmdir tf1} msg] $msg sl@0: } {1 {tf1 ENOTDIR}} sl@0: test winFCmd-6.13 {TclpRemoveDirectory: write-protected} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: testchmod 000 td1 sl@0: testfile rmdir td1 sl@0: file exists td1 sl@0: } {0} sl@0: test winFCmd-6.14 {TclpRemoveDirectory: check if empty dir} {pcOnly 95} { sl@0: cleanup sl@0: file mkdir td1/td2 sl@0: list [catch {testfile rmdir td1} msg] $msg sl@0: } {1 {td1 EEXIST}} sl@0: test winFCmd-6.15 {TclpRemoveDirectory: !recursive} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1/td2 sl@0: list [catch {testfile rmdir td1} msg] [file tail $msg] sl@0: } {1 {td1 EEXIST}} sl@0: test winFCmd-6.16 {TclpRemoveDirectory: recursive, but errno != EEXIST} {pcOnly} { sl@0: cleanup sl@0: createfile tf1 sl@0: list [catch {testfile rmdir -force tf1} msg] $msg sl@0: } {1 {tf1 ENOTDIR}} sl@0: test winFCmd-6.17 {TclpRemoveDirectory: calls TraverseWinTree} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1/td2 sl@0: testfile rmdir -force td1 sl@0: file exists td1 sl@0: } {0} sl@0: sl@0: test winFCmd-7.1 {TraverseWinTree: targetPtr == NULL} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1/td2/td3 sl@0: testfile rmdir -force td1 sl@0: file exists td1 sl@0: } {0} sl@0: test winFCmd-7.2 {TraverseWinTree: targetPtr != NULL} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1/td2/td3 sl@0: testfile cpdir td1 td2 sl@0: list [file exists td1] [file exists td2] sl@0: } {1 1} sl@0: test winFCmd-7.3 {TraverseWinTree: sourceAttr == -1} {pcOnly} { sl@0: cleanup sl@0: list [catch {testfile cpdir td1 td2} msg] $msg sl@0: } {1 {td1 ENOENT}} sl@0: test winFCmd-7.4 {TraverseWinTree: source isn't directory} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: createfile td1/tf1 tf1 sl@0: testfile cpdir td1 td2 sl@0: contents td2/tf1 sl@0: } {tf1} sl@0: test winFCmd-7.5 {TraverseWinTree: call TraversalCopy: DOTREE_F} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: createfile td1/tf1 tf1 sl@0: testfile cpdir td1 td2 sl@0: contents td2/tf1 sl@0: } {tf1} sl@0: test winFCmd-7.6 {TraverseWinTree: call TraversalDelete: DOTREE_F} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: createfile td1/tf1 tf1 sl@0: testfile rmdir -force td1 sl@0: file exists td1 sl@0: } {0} sl@0: test winFCmd-7.7 {TraverseWinTree: append \ to source if necessary} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: createfile td1/tf1 tf1 sl@0: testfile cpdir td1 td2 sl@0: contents td2/tf1 sl@0: } {tf1} sl@0: test winFCmd-7.8 {TraverseWinTree: append \ to source if necessary} {pcOnly 95 cdrom} { sl@0: # cdrom can return either d:\ or D:/, but we only care about the errcode sl@0: list [catch {testfile rmdir $cdrom/} msg] [lindex $msg 1] sl@0: } {1 EEXIST} sl@0: test winFCmd-7.9 {TraverseWinTree: append \ to source if necessary} {pcOnly nt cdrom} { sl@0: list [catch {testfile rmdir $cdrom/} msg] [lindex $msg 1] sl@0: } {1 EACCES} sl@0: test winFCmd-7.10 {TraverseWinTree: can't read directory: handle == INVALID} \ sl@0: {pcOnly} { sl@0: # can't make it happen sl@0: } {} sl@0: test winFCmd-7.11 {TraverseWinTree: call TraversalCopy: DOTREE_PRED} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: createfile td1/tf1 tf1 sl@0: testchmod 000 td1 sl@0: testfile cpdir td1 td2 sl@0: list [file exists td2] [file writable td2] sl@0: } {1 1} sl@0: test winFCmd-7.12 {TraverseWinTree: call TraversalDelete: DOTREE_PRED} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: createfile td1/tf1 tf1 sl@0: testfile rmdir -force td1 sl@0: file exists td1 sl@0: } {0} sl@0: test winFCmd-7.13 {TraverseWinTree: append \ to target if necessary} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: createfile td1/tf1 tf1 sl@0: testfile cpdir td1 td2 sl@0: contents td2/tf1 sl@0: } {tf1} sl@0: test winFCmd-7.14 {TraverseWinTree: append \ to target if necessary} {pcOnly 95} { sl@0: cleanup sl@0: file mkdir td1 sl@0: list [catch {testfile cpdir td1 /} msg] $msg sl@0: } {1 {/ EEXIST}} sl@0: test winFCmd-7.15 {TraverseWinTree: append \ to target if necessary} {pcOnly nt} { sl@0: cleanup sl@0: file mkdir td1 sl@0: list [catch {testfile cpdir td1 /} msg] $msg sl@0: } {1 {/ EACCES}} sl@0: test winFCmd-7.16 {TraverseWinTree: recurse on files: no files} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: testfile cpdir td1 td2 sl@0: } {} sl@0: test winFCmd-7.17 {TraverseWinTree: recurse on files: one file} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: createfile td1/td2 sl@0: testfile cpdir td1 td2 sl@0: glob td2/* sl@0: } {td2/td2} sl@0: test winFCmd-7.18 {TraverseWinTree: recurse on files: several files and dir} \ sl@0: {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: createfile td1/tf1 sl@0: createfile td1/tf2 sl@0: file mkdir td1/td2/td3 sl@0: createfile td1/tf3 sl@0: createfile td1/tf4 sl@0: testfile cpdir td1 td2 sl@0: lsort [glob td2/*] sl@0: } {td2/td2 td2/tf1 td2/tf2 td2/tf3 td2/tf4} sl@0: test winFCmd-7.19 {TraverseWinTree: call TraversalCopy: DOTREE_POSTD} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: createfile td1/tf1 tf1 sl@0: testchmod 000 td1 sl@0: testfile cpdir td1 td2 sl@0: list [file exists td2] [file writable td2] sl@0: } {1 1} sl@0: test winFCmd-7.20 {TraverseWinTree: call TraversalDelete: DOTREE_POSTD} \ sl@0: {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: createfile td1/tf1 tf1 sl@0: testfile rmdir -force td1 sl@0: file exists td1 sl@0: } {0} sl@0: test winFCmd-7.21 {TraverseWinTree: fill errorPtr} {pcOnly} { sl@0: cleanup sl@0: list [catch {testfile cpdir td1 td2} msg] $msg sl@0: } {1 {td1 ENOENT}} sl@0: sl@0: test winFCmd-8.1 {TraversalCopy: DOTREE_F} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: list [catch {testfile cpdir td1 td1} msg] $msg sl@0: } {1 {td1 EEXIST}} sl@0: test winFCmd-8.2 {TraversalCopy: DOTREE_PRED} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1/td2 sl@0: testchmod 000 td1 sl@0: testfile cpdir td1 td2 sl@0: list [file writable td1] [file writable td1/td2] sl@0: } {0 1} sl@0: test winFCmd-8.3 {TraversalCopy: DOTREE_POSTD} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: testfile cpdir td1 td2 sl@0: } {} sl@0: sl@0: test winFCmd-9.1 {TraversalDelete: DOTREE_F} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: createfile td1/tf1 sl@0: testfile rmdir -force td1 sl@0: } {} sl@0: test winFCmd-9.2 {TraversalDelete: DOTREE_F} {pcOnly 95} { sl@0: cleanup sl@0: file mkdir td1 sl@0: set fd [open td1/tf1 w] sl@0: set msg [list [catch {testfile rmdir -force td1} msg] $msg] sl@0: close $fd sl@0: set msg sl@0: } {1 {td1\tf1 EACCES}} sl@0: test winFCmd-9.3 {TraversalDelete: DOTREE_PRED} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1/td2 sl@0: testchmod 000 td1 sl@0: testfile rmdir -force td1 sl@0: file exists td1 sl@0: } {0} sl@0: test winFCmd-9.4 {TraversalDelete: DOTREE_POSTD} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1/td1/td3/td4/td5 sl@0: testfile rmdir -force td1 sl@0: } {} sl@0: sl@0: test winFCmd-10.1 {AttributesPosixError - get} {pcOnly} { sl@0: cleanup sl@0: list [catch {file attributes td1 -archive} msg] $msg sl@0: } {1 {could not read "td1": no such file or directory}} sl@0: test winFCmd-10.2 {AttributesPosixError - set} {pcOnly} { sl@0: cleanup sl@0: list [catch {file attributes td1 -archive 0} msg] $msg sl@0: } {1 {could not read "td1": no such file or directory}} sl@0: sl@0: test winFCmd-11.1 {GetWinFileAttributes} {pcOnly} { sl@0: cleanup sl@0: close [open td1 w] sl@0: list [catch {file attributes td1 -archive} msg] $msg [cleanup] sl@0: } {0 1 {}} sl@0: test winFCmd-11.2 {GetWinFileAttributes} {pcOnly} { sl@0: cleanup sl@0: close [open td1 w] sl@0: list [catch {file attributes td1 -readonly} msg] $msg [cleanup] sl@0: } {0 0 {}} sl@0: test winFCmd-11.3 {GetWinFileAttributes} {pcOnly} { sl@0: cleanup sl@0: close [open td1 w] sl@0: list [catch {file attributes td1 -hidden} msg] $msg [cleanup] sl@0: } {0 0 {}} sl@0: test winFCmd-11.4 {GetWinFileAttributes} {pcOnly} { sl@0: cleanup sl@0: close [open td1 w] sl@0: list [catch {file attributes td1 -system} msg] $msg [cleanup] sl@0: } {0 0 {}} sl@0: test winFCmd-11.5 {GetWinFileAttributes} {pcOnly} { sl@0: # attr of relative paths that resolve to root was failing sl@0: # don't care about answer, just that test runs. sl@0: sl@0: set old [pwd] sl@0: cd c:/ sl@0: file attr c: sl@0: file attr c:. sl@0: file attr . sl@0: cd $old sl@0: } {} sl@0: test winFCmd-11.6 {GetWinFileAttributes} {pcOnly} { sl@0: file attr c:/ -hidden sl@0: } {0} sl@0: sl@0: test winFCmd-12.1 {ConvertFileNameFormat} {pcOnly} { sl@0: cleanup sl@0: close [open td1 w] sl@0: list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup] sl@0: } {0 td1 {}} sl@0: test winFCmd-12.2 {ConvertFileNameFormat} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: close [open td1/td1 w] sl@0: list [catch {string tolower [file attributes td1/td1 -longname]} msg] $msg [cleanup] sl@0: } {0 td1/td1 {}} sl@0: test winFCmd-12.3 {ConvertFileNameFormat} {pcOnly} { sl@0: cleanup sl@0: file mkdir td1 sl@0: file mkdir td1/td2 sl@0: close [open td1/td3 w] sl@0: list [catch {string tolower [file attributes td1/td2/../td3 -longname]} msg] $msg [cleanup] sl@0: } {0 td1/td2/../td3 {}} sl@0: test winFCmd-12.4 {ConvertFileNameFormat} {pcOnly} { sl@0: cleanup sl@0: close [open td1 w] sl@0: list [catch {string tolower [file attributes ./td1 -longname]} msg] $msg [cleanup] sl@0: } {0 ./td1 {}} sl@0: test winFCmd-12.5 {ConvertFileNameFormat: absolute path} {pcOnly} { sl@0: list [file attributes / -longname] [file attributes \\ -longname] sl@0: } {/ /} sl@0: test winFCmd-12.6 {ConvertFileNameFormat: absolute path with drive} {pcOnly} { sl@0: catch {file delete -force -- c:/td1} sl@0: close [open c:/td1 w] sl@0: list [catch {string tolower [file attributes c:/td1 -longname]} msg] $msg [file delete -force -- c:/td1] sl@0: } {0 c:/td1 {}} sl@0: test winFCmd-12.7 {ConvertFileNameFormat} {nonPortable pcOnly} { sl@0: string tolower [file attributes //bisque/tcl/ws -longname] sl@0: } {//bisque/tcl/ws} sl@0: test winFCmd-12.8 {ConvertFileNameFormat} {pcOnly longFileNames} { sl@0: cleanup sl@0: close [open td1 w] sl@0: list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup] sl@0: } {0 td1 {}} sl@0: test winFCmd-12.10 {ConvertFileNameFormat} {longFileNames pcOnly} { sl@0: cleanup sl@0: close [open td1td1td1 w] sl@0: list [catch {file attributes td1td1td1 -shortname}] [cleanup] sl@0: } {0 {}} sl@0: test winFCmd-12.11 {ConvertFileNameFormat} {longFileNames pcOnly} { sl@0: cleanup sl@0: close [open td1 w] sl@0: list [catch {string tolower [file attributes td1 -shortname]} msg] $msg [cleanup] sl@0: } {0 td1 {}} sl@0: sl@0: test winFCmd-13.1 {GetWinFileLongName} {pcOnly} { sl@0: cleanup sl@0: close [open td1 w] sl@0: list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup] sl@0: } {0 td1 {}} sl@0: sl@0: test winFCmd-14.1 {GetWinFileShortName} {pcOnly} { sl@0: cleanup sl@0: close [open td1 w] sl@0: list [catch {string tolower [file attributes td1 -shortname]} msg] $msg [cleanup] sl@0: } {0 td1 {}} sl@0: sl@0: test winFCmd-15.1 {SetWinFileAttributes} {pcOnly} { sl@0: cleanup sl@0: list [catch {file attributes td1 -archive 0} msg] $msg sl@0: } {1 {could not read "td1": no such file or directory}} sl@0: test winFCmd-15.2 {SetWinFileAttributes - archive} {pcOnly} { sl@0: cleanup sl@0: close [open td1 w] sl@0: list [catch {file attributes td1 -archive 1} msg] $msg [file attributes td1 -archive] [cleanup] sl@0: } {0 {} 1 {}} sl@0: test winFCmd-15.3 {SetWinFileAttributes - archive} {pcOnly} { sl@0: cleanup sl@0: close [open td1 w] sl@0: list [catch {file attributes td1 -archive 0} msg] $msg [file attributes td1 -archive] [cleanup] sl@0: } {0 {} 0 {}} sl@0: test winFCmd-15.4 {SetWinFileAttributes - hidden} {pcOnly} { sl@0: cleanup sl@0: close [open td1 w] sl@0: list [catch {file attributes td1 -hidden 1} msg] $msg [file attributes td1 -hidden] [file attributes td1 -hidden 0] [cleanup] sl@0: } {0 {} 1 {} {}} sl@0: test winFCmd-15.5 {SetWinFileAttributes - hidden} {pcOnly} { sl@0: cleanup sl@0: close [open td1 w] sl@0: list [catch {file attributes td1 -hidden 0} msg] $msg [file attributes td1 -hidden] [cleanup] sl@0: } {0 {} 0 {}} sl@0: test winFCmd-15.6 {SetWinFileAttributes - readonly} {pcOnly} { sl@0: cleanup sl@0: close [open td1 w] sl@0: list [catch {file attributes td1 -readonly 1} msg] $msg [file attributes td1 -readonly] [cleanup] sl@0: } {0 {} 1 {}} sl@0: test winFCmd-15.7 {SetWinFileAttributes - readonly} {pcOnly} { sl@0: cleanup sl@0: close [open td1 w] sl@0: list [catch {file attributes td1 -readonly 0} msg] $msg [file attributes td1 -readonly] [cleanup] sl@0: } {0 {} 0 {}} sl@0: test winFCmd-15.8 {SetWinFileAttributes - system} {pcOnly} { sl@0: cleanup sl@0: close [open td1 w] sl@0: list [catch {file attributes td1 -system 1} msg] $msg [file attributes td1 -system] [cleanup] sl@0: } {0 {} 1 {}} sl@0: test winFCmd-15.9 {SetWinFileAttributes - system} {pcOnly} { sl@0: cleanup sl@0: close [open td1 w] sl@0: list [catch {file attributes td1 -system 0} msg] $msg [file attributes td1 -system] [cleanup] sl@0: } {0 {} 0 {}} sl@0: test winFCmd-15.10 {SetWinFileAttributes - failing} {pcOnly cdrom} { sl@0: cleanup sl@0: catch {file attributes $cdfile -archive 1} sl@0: } {1} sl@0: test winFCmd-16.1 {Windows file normalization} {pcOnly} { sl@0: list [file normalize c:/] [file normalize C:/] sl@0: } {C:/ C:/} sl@0: test winFCmd-16.2 {Windows file normalization} {pcOnly} { sl@0: close [open td1... w] sl@0: set res [file tail [file normalize td1]] sl@0: file delete td1... sl@0: set res sl@0: } {td1} sl@0: sl@0: set pwd [pwd] sl@0: set d [string index $pwd 0] sl@0: sl@0: test winFCmd-16.3 {Windows file normalization} {pcOnly} { sl@0: file norm ${d}:foo sl@0: } [file join $pwd foo] sl@0: test winFCmd-16.4 {Windows file normalization} {pcOnly} { sl@0: file norm [string tolower ${d}]:foo sl@0: } [file join $pwd foo] sl@0: test winFCmd-16.5 {Windows file normalization} {pcOnly} { sl@0: file norm ${d}:foo/bar sl@0: } [file join $pwd foo/bar] sl@0: test winFCmd-16.6 {Windows file normalization} {pcOnly} { sl@0: file norm ${d}:foo\\bar sl@0: } [file join $pwd foo/bar] sl@0: test winFCmd-16.7 {Windows file normalization} {pcOnly} { sl@0: file norm /bar sl@0: } "${d}:/bar" sl@0: test winFCmd-16.8 {Windows file normalization} {pcOnly} { sl@0: file norm ///bar sl@0: } "${d}:/bar" sl@0: test winFCmd-16.9 {Windows file normalization} {pcOnly} { sl@0: file norm /bar/foo sl@0: } "${d}:/bar/foo" sl@0: if {$d eq "C"} { set dd "D" } else { set dd "C" } sl@0: test winFCmd-16.10 {Windows file normalization} {pcOnly} { sl@0: file norm ${dd}:foo sl@0: } "${dd}:/foo" sl@0: test winFCmd-16.11 {Windows file normalization} {pcOnly cdrom} { sl@0: cd ${d}: sl@0: cd $cdrom sl@0: cd ${d}: sl@0: cd $cdrom sl@0: # Must not crash sl@0: set result "no crash" sl@0: } {no crash} sl@0: test winFCmd-16.12 {Windows file normalization} {pcOnly} { sl@0: set oldhome "" sl@0: catch {set oldhome $::env(HOME)} sl@0: set ::env(HOME) ${d}: sl@0: cd sl@0: set result [pwd]; # <- Must not crash sl@0: set ::env(HOME) $oldhome sl@0: set result sl@0: } ${d}:/ sl@0: sl@0: cd $pwd sl@0: unset d dd pwd sl@0: sl@0: test winFCmd-18.1 {Windows reserved path names} -constraints win -body { sl@0: file pathtype com1 sl@0: } -result "absolute" sl@0: sl@0: test winFCmd-18.1.2 {Windows reserved path names} -constraints win -body { sl@0: file pathtype com4 sl@0: } -result "absolute" sl@0: sl@0: test winFCmd-18.1.3 {Windows reserved path names} -constraints win -body { sl@0: file pathtype com5 sl@0: } -result "relative" sl@0: sl@0: test winFCmd-18.1.4 {Windows reserved path names} -constraints win -body { sl@0: file pathtype lpt3 sl@0: } -result "absolute" sl@0: sl@0: test winFCmd-18.1.5 {Windows reserved path names} -constraints win -body { sl@0: file pathtype lpt4 sl@0: } -result "relative" sl@0: sl@0: test winFCmd-18.1.6 {Windows reserved path names} -constraints win -body { sl@0: file pathtype nul sl@0: } -result "absolute" sl@0: sl@0: test winFCmd-18.1.7 {Windows reserved path names} -constraints win -body { sl@0: file pathtype null sl@0: } -result "relative" sl@0: sl@0: test winFCmd-18.2 {Windows reserved path names} -constraints win -body { sl@0: file pathtype com1: sl@0: } -result "absolute" sl@0: sl@0: test winFCmd-18.3 {Windows reserved path names} -constraints win -body { sl@0: file pathtype COM1 sl@0: } -result "absolute" sl@0: sl@0: test winFCmd-18.4 {Windows reserved path names} -constraints win -body { sl@0: file pathtype CoM1: sl@0: } -result "absolute" sl@0: sl@0: test winFCmd-18.5 {Windows reserved path names} -constraints win -body { sl@0: file normalize com1: sl@0: } -result COM1 sl@0: sl@0: test winFCmd-18.6 {Windows reserved path names} -constraints win -body { sl@0: file normalize COM1: sl@0: } -result COM1 sl@0: sl@0: test winFCmd-18.7 {Windows reserved path names} -constraints win -body { sl@0: file normalize cOm1 sl@0: } -result COM1 sl@0: sl@0: test winFCmd-18.8 {Windows reserved path names} -constraints win -body { sl@0: file normalize cOm1: sl@0: } -result COM1 sl@0: sl@0: # This block of code used to occur after the "return" call, so I'm sl@0: # commenting it out and assuming that this code is still under construction. sl@0: #foreach source {tef ted tnf tnd "" nul com1} { sl@0: # foreach chmodsrc {000 755} { sl@0: # foreach dest "tfn tfe tdn tdempty tdfull td1/td2 $p $p/td1 {} nul" { sl@0: # foreach chmoddst {000 755} { sl@0: # puts hi sl@0: # cleanup sl@0: # file delete -force ted tef sl@0: # file mkdir ted sl@0: # createfile tef sl@0: # createfile tfe sl@0: # file mkdir tdempty sl@0: # file mkdir tdfull/td1/td2 sl@0: # sl@0: # catch {testchmod $chmodsrc $source} sl@0: # catch {testchmod $chmoddst $dest} sl@0: # sl@0: # if [catch {file rename $source $dest} msg] { sl@0: # puts "file rename $source ($chmodsrc) $dest ($chmoddst)" sl@0: # puts $msg sl@0: # } sl@0: # } sl@0: # } sl@0: # } sl@0: #} sl@0: sl@0: # cleanup sl@0: cleanup sl@0: ::tcltest::cleanupTests sl@0: return