summaryrefslogtreecommitdiff
path: root/tcl/tests/fCmd.test
diff options
context:
space:
mode:
Diffstat (limited to 'tcl/tests/fCmd.test')
-rw-r--r--tcl/tests/fCmd.test577
1 files changed, 323 insertions, 254 deletions
diff --git a/tcl/tests/fCmd.test b/tcl/tests/fCmd.test
index 02862cdcc7d..c2a98304070 100644
--- a/tcl/tests/fCmd.test
+++ b/tcl/tests/fCmd.test
@@ -5,6 +5,7 @@
# generates output for errors. No output means no errors were found.
#
# Copyright (c) 1996-1997 Sun Microsystems, Inc.
+# Copyright (c) 1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -12,22 +13,39 @@
# RCS: @(#) $Id$
#
-if {[string compare test [info procs test]] == 1} then {source defs}
-
-set platform [testgetplatform]
+if {[lsearch [namespace children] ::tcltest] == -1} {
+ package require tcltest
+ namespace import -force ::tcltest::*
+}
-if {$user == "root"} {
- puts "Skipping fCmd tests. They depend on not being able to write to"
- puts "certain directories. It would be too dangerous to run them as root."
+if {[string compare testgetplatform [info commands testgetplatform]] != 0} {
+ puts "This application hasn't been compiled with the \"testgetplatform\""
+ puts "command, therefore I am skipping all of these tests."
+ ::tcltest::cleanupTests
return
}
+set platform [testgetplatform]
+
if {"[info commands testchmod]" != "testchmod"} {
puts "Skipping fCmd tests. This application does not seem to have the"
puts "testchmod command that is needed to run these tests."
+ ::tcltest::cleanupTests
return
}
+# Several tests require need to match results against the unix username
+set user {}
+if {$tcl_platform(platform) == "unix"} {
+ catch {set user [exec whoami]}
+ if {$user == ""} {
+ catch {regexp {^[^(]*\(([^)]*)\)} [exec id] dummy user}
+ }
+ if {$user == ""} {
+ set user "root"
+ }
+}
+
proc createfile {file {string a}} {
set f [open $file w]
puts -nonewline $f $string
@@ -71,8 +89,8 @@ proc cleanup {args} {
}
foreach file $x {
if {[catch {file delete -force -- $file}]} {
- openup $file
- file delete -force -- $file
+ catch {openup $file}
+ catch {file delete -force -- $file}
}
}
}
@@ -85,35 +103,27 @@ proc contents {file} {
set r
}
-set testConfig(NT) 0
-set testConfig(95) 0
-
-switch $tcl_platform(os) {
- "Windows NT" {set testConfig(NT) 1}
- "Windows 95" {set testConfig(95) 1}
-}
-
-set testConfig(fileSharing) 0
-set testConfig(notFileSharing) 1
+set ::tcltest::testConstraints(fileSharing) 0
+set ::tcltest::testConstraints(notFileSharing) 1
if {$tcl_platform(platform) == "macintosh"} {
catch {file delete -force foo.dir}
file mkdir foo.dir
if {[catch {file attributes foo.dir -readonly 1}] == 0} {
- set testConfig(fileSharing) 1
- set testConfig(notFileSharing) 0
+ set ::tcltest::testConstraints(fileSharing) 1
+ set ::tcltest::testConstraints(notFileSharing) 0
}
file delete -force foo.dir
}
-set testConfig(xdev) 0
+set ::tcltest::testConstraints(xdev) 0
if {$tcl_platform(platform) == "unix"} {
if {[catch {set m1 [exec df .]; set m2 [exec df /tmp]}] == 0} {
set m1 [string range $m1 0 [expr [string first " " $m1]-1]]
set m2 [string range $m2 0 [expr [string first " " $m2]-1]]
if {$m1 != "" && $m2 != "" && $m1 != $m2 && [file exists $m1] && [file exists $m2]} {
- set testConfig(xdev) 1
+ set ::tcltest::testConstraints(xdev) 1
}
}
}
@@ -131,77 +141,78 @@ append long $long
append long $long
append long $long
-test fCmd-1.1 {TclFileRenameCmd} {
+test fCmd-1.1 {TclFileRenameCmd} {notRoot} {
cleanup
createfile tf1
file rename tf1 tf2
glob tf*
} {tf2}
-test fCmd-2.1 {TclFileCopyCmd} {
+test fCmd-2.1 {TclFileCopyCmd} {notRoot} {
cleanup
createfile tf1
file copy tf1 tf2
lsort [glob tf*]
} {tf1 tf2}
-test fCmd-3.1 {FileCopyRename: FileForceOption fails} {
+test fCmd-3.1 {FileCopyRename: FileForceOption fails} {notRoot} {
list [catch {file rename -xyz} msg] $msg
} {1 {bad option "-xyz": should be -force or --}}
-test fCmd-3.2 {FileCopyRename: not enough args} {
+test fCmd-3.2 {FileCopyRename: not enough args} {notRoot} {
list [catch {file rename xyz} msg] $msg
} {1 {wrong # args: should be "file rename ?options? source ?source ...? target"}}
-test fCmd-3.3 {FileCopyRename: Tcl_TranslateFileName fails} {
- list [catch {file rename xyz ~nonexistantuser} msg] $msg
-} {1 {user "nonexistantuser" doesn't exist}}
-test fCmd-3.4 {FileCopyRename: Tcl_TranslateFileName passes} {
+test fCmd-3.3 {FileCopyRename: Tcl_TranslateFileName fails} {notRoot} {
+ list [catch {file rename xyz ~_totally_bogus_user} msg] $msg
+} {1 {user "_totally_bogus_user" doesn't exist}}
+test fCmd-3.4 {FileCopyRename: Tcl_TranslateFileName passes} {notRoot} {
cleanup
list [catch {file copy tf1 ~} msg] $msg
} {1 {error copying "tf1": no such file or directory}}
-test fCmd-3.5 {FileCopyRename: target doesn't exist: stat(target) != 0} {
+test fCmd-3.5 {FileCopyRename: target doesn't exist: stat(target) != 0} {notRoot} {
cleanup
list [catch {file rename tf1 tf2 tf3} msg] $msg
} {1 {error renaming: target "tf3" is not a directory}}
-test fCmd-3.6 {FileCopyRename: target tf3 is not a directory: !S_ISDIR(target)} {
+test fCmd-3.6 {FileCopyRename: target tf3 is not a dir: !S_ISDIR(target)} \
+ {notRoot} {
cleanup
createfile tf3
list [catch {file rename tf1 tf2 tf3} msg] $msg
} {1 {error renaming: target "tf3" is not a directory}}
-test fCmd-3.7 {FileCopyRename: target exists & is directory} {
+test fCmd-3.7 {FileCopyRename: target exists & is directory} {notRoot} {
cleanup
file mkdir td1
createfile tf1 tf1
file rename tf1 td1
contents [file join td1 tf1]
} {tf1}
-test fCmd-3.8 {FileCopyRename: too many arguments: argc - i > 2} {
+test fCmd-3.8 {FileCopyRename: too many arguments: argc - i > 2} {notRoot} {
cleanup
list [catch {file rename tf1 tf2 tf3} msg] $msg
} {1 {error renaming: target "tf3" is not a directory}}
-test fCmd-3.9 {FileCopyRename: too many arguments: argc - i > 2} {
+test fCmd-3.9 {FileCopyRename: too many arguments: argc - i > 2} {notRoot} {
cleanup
list [catch {file copy -force -- tf1 tf2 tf3} msg] $msg
} {1 {error copying: target "tf3" is not a directory}}
-test fCmd-3.10 {FileCopyRename: just 2 arguments} {
+test fCmd-3.10 {FileCopyRename: just 2 arguments} {notRoot} {
cleanup
createfile tf1 tf1
file rename tf1 tf2
contents tf2
} {tf1}
-test fCmd-3.11 {FileCopyRename: just 2 arguments} {
+test fCmd-3.11 {FileCopyRename: just 2 arguments} {notRoot} {
cleanup
createfile tf1 tf1
file rename -force -force -- tf1 tf2
contents tf2
} {tf1}
-test fCmd-3.12 {FileCopyRename: move each source: 1 source} {
+test fCmd-3.12 {FileCopyRename: move each source: 1 source} {notRoot} {
cleanup
createfile tf1 tf1
file mkdir td1
file rename tf1 td1
contents [file join td1 tf1]
} {tf1}
-test fCmd-3.13 {FileCopyRename: move each source: multiple sources} {
+test fCmd-3.13 {FileCopyRename: move each source: multiple sources} {notRoot} {
cleanup
createfile tf1 tf1
createfile tf2 tf2
@@ -212,17 +223,17 @@ test fCmd-3.13 {FileCopyRename: move each source: multiple sources} {
list [contents [file join td1 tf1]] [contents [file join td1 tf2]] \
[contents [file join td1 tf3]] [contents [file join td1 tf4]]
} {tf1 tf2 tf3 tf4}
-test fCmd-3.14 {FileCopyRename: FileBasename fails} {
+test fCmd-3.14 {FileCopyRename: FileBasename fails} {notRoot} {
cleanup
file mkdir td1
- list [catch {file rename ~nonexistantuser td1} msg] $msg
-} {1 {user "nonexistantuser" doesn't exist}}
-test fCmd-3.15 {FileCopyRename: source[0] == '\0'} {unixOrPc} {
+ list [catch {file rename ~_totally_bogus_user td1} msg] $msg
+} {1 {user "_totally_bogus_user" doesn't exist}}
+test fCmd-3.15 {FileCopyRename: source[0] == '\0'} {notRoot unixOrPc} {
cleanup
file mkdir td1
list [catch {file rename / td1} msg] $msg
} {1 {error renaming "/" to "td1": file already exists}}
-test fCmd-3.16 {FileCopyRename: break on first error} {
+test fCmd-3.16 {FileCopyRename: break on first error} {notRoot} {
cleanup
createfile tf1
createfile tf2
@@ -233,60 +244,62 @@ test fCmd-3.16 {FileCopyRename: break on first error} {
list [catch {file rename tf1 tf2 tf3 tf4 td1} msg] $msg
} [subst {1 {error renaming "tf3" to "[file join td1 tf3]": file already exists}}]
-test fCmd-4.1 {TclFileMakeDirsCmd: make each dir: 1 dir} {
+test fCmd-4.1 {TclFileMakeDirsCmd: make each dir: 1 dir} {notRoot} {
cleanup
file mkdir td1
glob td*
} {td1}
-test fCmd-4.2 {TclFileMakeDirsCmd: make each dir: multiple dirs} {
+test fCmd-4.2 {TclFileMakeDirsCmd: make each dir: multiple dirs} {notRoot} {
cleanup
file mkdir td1 td2 td3
lsort [glob td*]
} {td1 td2 td3}
-test fCmd-4.3 {TclFileMakeDirsCmd: stops on first error} {
+test fCmd-4.3 {TclFileMakeDirsCmd: stops on first error} {notRoot} {
cleanup
createfile tf1
catch {file mkdir td1 td2 tf1 td3 td4}
glob td1 td2 tf1 td3 td4
} {td1 td2 tf1}
-test fCmd-4.4 {TclFileMakeDirsCmd: Tcl_TranslateFileName fails} {
+test fCmd-4.4 {TclFileMakeDirsCmd: Tcl_TranslateFileName fails} {notRoot} {
cleanup
- list [catch {file mkdir ~nonexistantuser} msg] $msg
-} {1 {user "nonexistantuser" doesn't exist}}
-test fCmd-4.5 {TclFileMakeDirsCmd: Tcl_SplitPath returns 0: *name == '\0'} {
+ list [catch {file mkdir ~_totally_bogus_user} msg] $msg
+} {1 {user "_totally_bogus_user" doesn't exist}}
+test fCmd-4.5 {TclFileMakeDirsCmd: Tcl_SplitPath returns 0: *name == '\0'} \
+ {notRoot} {
cleanup
list [catch {file mkdir ""} msg] $msg
} {1 {can't create directory "": no such file or directory}}
-test fCmd-4.6 {TclFileMakeDirsCmd: one level deep} {
+test fCmd-4.6 {TclFileMakeDirsCmd: one level deep} {notRoot} {
cleanup
file mkdir td1
glob td1
} {td1}
-test fCmd-4.7 {TclFileMakeDirsCmd: multi levels deep} {
+test fCmd-4.7 {TclFileMakeDirsCmd: multi levels deep} {notRoot} {
cleanup
file mkdir [file join td1 td2 td3 td4]
glob td1 [file join td1 td2]
} "td1 [file join td1 td2]"
-test fCmd-4.8 {TclFileMakeDirsCmd: already exist: lstat(target) == 0} {
+test fCmd-4.8 {TclFileMakeDirsCmd: already exist: lstat(target) == 0} {notRoot} {
cleanup
file mkdir td1
set x [file exist td1]
file mkdir td1
list $x [file exist td1]
} {1 1}
-test fCmd-4.9 {TclFileMakeDirsCmd: exists, not dir} {
+test fCmd-4.9 {TclFileMakeDirsCmd: exists, not dir} {notRoot} {
cleanup
createfile tf1
list [catch {file mkdir tf1} msg] $msg
} [subst {1 {can't create directory "[file join tf1]": file already exists}}]
-test fCmd-4.10 {TclFileMakeDirsCmd: exists, is dir} {
+test fCmd-4.10 {TclFileMakeDirsCmd: exists, is dir} {notRoot} {
cleanup
file mkdir td1
set x [file exist td1]
file mkdir td1
list $x [file exist td1]
} {1 1}
-test fCmd-4.11 {TclFileMakeDirsCmd: doesn't exist: errno != ENOENT} {unixOnly} {
+test fCmd-4.11 {TclFileMakeDirsCmd: doesn't exist: errno != ENOENT} \
+ {unixOnly notRoot} {
cleanup
file mkdir td1/td2/td3
testchmod 000 td1/td2
@@ -298,13 +311,14 @@ test fCmd-4.12 {TclFileMakeDirsCmd: doesn't exist: errno != ENOENT} {macOnly} {
cleanup
list [catch {file mkdir nonexistantvolume:} msg] $msg
} {1 {can't create directory "nonexistantvolume:": invalid argument}}
-test fCmd-4.13 {TclFileMakeDirsCmd: doesn't exist: errno == ENOENT} {
+test fCmd-4.13 {TclFileMakeDirsCmd: doesn't exist: errno == ENOENT} {notRoot} {
cleanup
set x [file exist td1]
file mkdir td1
list $x [file exist td1]
} {0 1}
-test fCmd-4.14 {TclFileMakeDirsCmd: TclpCreateDirectory fails} {unixOnly} {
+test fCmd-4.14 {TclFileMakeDirsCmd: TclpCreateDirectory fails} \
+ {unixOnly notRoot} {
cleanup
file delete -force foo
file mkdir foo
@@ -316,19 +330,19 @@ test fCmd-4.14 {TclFileMakeDirsCmd: TclpCreateDirectory fails} {unixOnly} {
test fCmd-4.15 {TclFileMakeDirsCmd: TclpCreateDirectory fails} {macOnly} {
list [catch {file mkdir ${root}:} msg] $msg
} [subst {1 {can't create directory "${root}:": no such file or directory}}]
-test fCmd-4.16 {TclFileMakeDirsCmd: TclpCreateDirectory succeeds} {
+test fCmd-4.16 {TclFileMakeDirsCmd: TclpCreateDirectory succeeds} {notRoot} {
cleanup
file mkdir tf1
file exists tf1
} {1}
-test fCmd-5.1 {TclFileDeleteCmd: FileForceOption fails} {
+test fCmd-5.1 {TclFileDeleteCmd: FileForceOption fails} {notRoot} {
list [catch {file delete -xyz} msg] $msg
} {1 {bad option "-xyz": should be -force or --}}
-test fCmd-5.2 {TclFileDeleteCmd: not enough args} {
+test fCmd-5.2 {TclFileDeleteCmd: not enough args} {notRoot} {
list [catch {file delete -force -force} msg] $msg
} {1 {wrong # args: should be "file delete ?options? file ?file ...?"}}
-test fCmd-5.3 {TclFileDeleteCmd: 1 file} {
+test fCmd-5.3 {TclFileDeleteCmd: 1 file} {notRoot} {
cleanup
createfile tf1
createfile tf2
@@ -336,7 +350,7 @@ test fCmd-5.3 {TclFileDeleteCmd: 1 file} {
file delete tf2
glob tf* td*
} {tf1 td1}
-test fCmd-5.4 {TclFileDeleteCmd: multiple files} {
+test fCmd-5.4 {TclFileDeleteCmd: multiple files} {notRoot} {
cleanup
createfile tf1
createfile tf2
@@ -345,7 +359,7 @@ test fCmd-5.4 {TclFileDeleteCmd: multiple files} {
file delete tf1 td1 tf2
lappend x [file exist tf1] [file exist tf2] [file exist tf3]
} {1 1 1 0 0 0}
-test fCmd-5.5 {TclFileDeleteCmd: stop at first error} {unixOrPc} {
+test fCmd-5.5 {TclFileDeleteCmd: stop at first error} {notRoot unixOrPc} {
cleanup
createfile tf1
createfile tf2
@@ -353,55 +367,55 @@ test fCmd-5.5 {TclFileDeleteCmd: stop at first error} {unixOrPc} {
catch {file delete tf1 td1 $root tf2}
list [file exist tf1] [file exist tf2] [file exist td1]
} {0 1 0}
-test fCmd-5.6 {TclFileDeleteCmd: Tcl_TranslateFileName fails} {
- list [catch {file delete ~nonexistantuser} msg] $msg
-} {1 {user "nonexistantuser" doesn't exist}}
-test fCmd-5.7 {TclFileDeleteCmd: Tcl_TranslateFileName succeeds} {
+test fCmd-5.6 {TclFileDeleteCmd: Tcl_TranslateFileName fails} {notRoot} {
+ list [catch {file delete ~_totally_bogus_user} msg] $msg
+} {1 {user "_totally_bogus_user" doesn't exist}}
+test fCmd-5.7 {TclFileDeleteCmd: Tcl_TranslateFileName succeeds} {notRoot} {
catch {file delete ~/tf1}
createfile ~/tf1
file delete ~/tf1
} {}
-test fCmd-5.8 {TclFileDeleteCmd: file doesn't exist: lstat(name) != 0} {
+test fCmd-5.8 {TclFileDeleteCmd: file doesn't exist: lstat(name) != 0} {notRoot} {
cleanup
set x [file exist tf1]
file delete tf1
list $x [file exist tf1]
} {0 0}
-test fCmd-5.9 {TclFileDeleteCmd: is directory} {
+test fCmd-5.9 {TclFileDeleteCmd: is directory} {notRoot} {
cleanup
file mkdir td1
file delete td1
file exist td1
} {0}
-test fCmd-5.10 {TclFileDeleteCmd: TclpRemoveDirectory fails} {
+test fCmd-5.10 {TclFileDeleteCmd: TclpRemoveDirectory fails} {notRoot} {
cleanup
file mkdir td1/td2
list [catch {file delete td1} msg] $msg
} {1 {error deleting "td1": directory not empty}}
-test fCmd-6.1 {CopyRenameOneFile: bad source} {
+test fCmd-6.1 {CopyRenameOneFile: bad source} {notRoot} {
# can't test this, because it's caught by FileCopyRename
} {}
-test fCmd-6.2 {CopyRenameOneFile: bad target} {
+test fCmd-6.2 {CopyRenameOneFile: bad target} {notRoot} {
# can't test this, because it's caught by FileCopyRename
} {}
-test fCmd-6.3 {CopyRenameOneFile: lstat(source) != 0} {
+test fCmd-6.3 {CopyRenameOneFile: lstat(source) != 0} {notRoot} {
cleanup
list [catch {file rename tf1 tf2} msg] $msg
} {1 {error renaming "tf1": no such file or directory}}
-test fCmd-6.4 {CopyRenameOneFile: lstat(source) == 0} {
+test fCmd-6.4 {CopyRenameOneFile: lstat(source) == 0} {notRoot} {
cleanup
createfile tf1
file rename tf1 tf2
glob tf*
} {tf2}
-test fCmd-6.5 {CopyRenameOneFile: lstat(target) != 0} {
+test fCmd-6.5 {CopyRenameOneFile: lstat(target) != 0} {notRoot} {
cleanup
createfile tf1
file rename tf1 tf2
glob tf*
} {tf2}
-test fCmd-6.6 {CopyRenameOneFile: errno != ENOENT} {unixOnly} {
+test fCmd-6.6 {CopyRenameOneFile: errno != ENOENT} {unixOnly notRoot} {
cleanup
file mkdir td1
testchmod 000 td1
@@ -420,45 +434,45 @@ test fCmd-6.8 {CopyRenameOneFile: errno != ENOENT} {macOnly} {
createfile tf1
list [catch {file rename tf1 $long} msg] $msg
} [subst {1 {error renaming "tf1" to "$long": file name too long}}]
-test fCmd-6.9 {CopyRenameOneFile: errno == ENOENT} {unixOnly} {
+test fCmd-6.9 {CopyRenameOneFile: errno == ENOENT} {unixOnly notRoot} {
cleanup
createfile tf1
file rename tf1 tf2
glob tf*
} {tf2}
-test fCmd-6.10 {CopyRenameOneFile: lstat(target) == 0} {
+test fCmd-6.10 {CopyRenameOneFile: lstat(target) == 0} {notRoot} {
cleanup
createfile tf1
createfile tf2
list [catch {file rename tf1 tf2} msg] $msg
} {1 {error renaming "tf1" to "tf2": file already exists}}
-test fCmd-6.11 {CopyRenameOneFile: force == 0} {
+test fCmd-6.11 {CopyRenameOneFile: force == 0} {notRoot} {
cleanup
createfile tf1
createfile tf2
list [catch {file rename tf1 tf2} msg] $msg
} {1 {error renaming "tf1" to "tf2": file already exists}}
-test fCmd-6.12 {CopyRenameOneFile: force != 0} {
+test fCmd-6.12 {CopyRenameOneFile: force != 0} {notRoot} {
cleanup
createfile tf1
createfile tf2
file rename -force tf1 tf2
glob tf*
} {tf2}
-test fCmd-6.13 {CopyRenameOneFile: source is dir, target is file} {
+test fCmd-6.13 {CopyRenameOneFile: source is dir, target is file} {notRoot} {
cleanup
file mkdir td1
file mkdir td2
createfile [file join td2 td1]
list [catch {file rename -force td1 td2} msg] $msg
} [subst {1 {can't overwrite file "[file join td2 td1]" with directory "td1"}}]
-test fCmd-6.14 {CopyRenameOneFile: source is file, target is dir} {
+test fCmd-6.14 {CopyRenameOneFile: source is file, target is dir} {notRoot} {
cleanup
createfile tf1
file mkdir [file join td1 tf1]
list [catch {file rename -force tf1 td1} msg] $msg
} [subst {1 {can't overwrite directory "[file join td1 tf1]" with file "tf1"}}]
-test fCmd-6.15 {CopyRenameOneFile: TclpRenameFile succeeds} {
+test fCmd-6.15 {CopyRenameOneFile: TclpRenameFile succeeds} {notRoot} {
cleanup
file mkdir [file join td1 td2]
file mkdir td2
@@ -466,28 +480,26 @@ test fCmd-6.15 {CopyRenameOneFile: TclpRenameFile succeeds} {
file rename -force td2 td1
file exists [file join td1 td2 tf1]
} {1}
-test fCmd-6.16 {CopyRenameOneFile: TclpCopyRenameOneFile fails} {
+test fCmd-6.16 {CopyRenameOneFile: TclpCopyRenameOneFile fails} {notRoot} {
cleanup
file mkdir [file join td1 td2]
createfile [file join td1 td2 tf1]
file mkdir td2
list [catch {file rename -force td2 td1} msg] $msg
} [subst {1 {error renaming "td2" to "[file join td1 td2]": file already exists}}]
-test fCmd-6.17 {CopyRenameOneFile: errno == EINVAL} {!$testConfig(win32s) || ($root == "C:/")} {
- # Don't run this test under Win32s on a drive mounted from an NT
- # machine; it causes the NT machine to die.
+test fCmd-6.17 {CopyRenameOneFile: errno == EINVAL} {notRoot} {
cleanup
list [catch {file rename -force $root tf1} msg] $msg
} [subst {1 {error renaming "$root" to "tf1": trying to rename a volume or move a directory into itself}}]
-test fCmd-6.18 {CopyRenameOneFile: errno != EXDEV} {
+test fCmd-6.18 {CopyRenameOneFile: errno != EXDEV} {notRoot} {
cleanup
file mkdir [file join td1 td2]
createfile [file join td1 td2 tf1]
file mkdir td2
list [catch {file rename -force td2 td1} msg] $msg
} [subst {1 {error renaming "td2" to "[file join td1 td2]": file already exists}}]
-test fCmd-6.19 {CopyRenameOneFile: errno == EXDEV} {unixOnly} {
+test fCmd-6.19 {CopyRenameOneFile: errno == EXDEV} {unixOnly notRoot} {
cleanup /tmp
createfile tf1
file rename tf1 /tmp
@@ -504,19 +516,22 @@ test fCmd-6.20 {CopyRenameOneFile: errno == EXDEV} {pcOnly} {
set msg
}
} {d:/tcl8975@}
-test fCmd-6.21 {CopyRenameOneFile: copy/rename: S_ISDIR(source)} {unixOnly} {
+test fCmd-6.21 {CopyRenameOneFile: copy/rename: S_ISDIR(source)} \
+ {unixOnly notRoot} {
cleanup /tmp
file mkdir td1
file rename td1 /tmp
glob td* /tmp/td*
} {/tmp/td1}
-test fCmd-6.22 {CopyRenameOneFile: copy/rename: !S_ISDIR(source)} {unixOnly} {
+test fCmd-6.22 {CopyRenameOneFile: copy/rename: !S_ISDIR(source)} \
+ {unixOnly notRoot} {
cleanup /tmp
createfile tf1
file rename tf1 /tmp
glob tf* /tmp/tf*
} {/tmp/tf1}
-test fCmd-6.23 {CopyRenameOneFile: TclpCopyDirectory failed} {unixOnly xdev} {
+test fCmd-6.23 {CopyRenameOneFile: TclpCopyDirectory failed} \
+ {unixOnly notRoot xdev} {
cleanup /tmp
file mkdir td1/td2/td3
exec chmod 000 td1
@@ -524,7 +539,8 @@ test fCmd-6.23 {CopyRenameOneFile: TclpCopyDirectory failed} {unixOnly xdev} {
exec chmod 755 td1
set msg
} {1 {error renaming "td1": permission denied}}
-test fCmd-6.24 {CopyRenameOneFile: error uses original name} {unixOnly} {
+test fCmd-6.24 {CopyRenameOneFile: error uses original name} \
+ {unixOnly notRoot} {
cleanup
file mkdir ~/td1/td2
exec chmod 000 [file join [file dirname ~] [file tail ~] td1]
@@ -533,7 +549,8 @@ test fCmd-6.24 {CopyRenameOneFile: error uses original name} {unixOnly} {
file delete -force ~/td1
set msg
} {1 {error copying "~/td1": permission denied}}
-test fCmd-6.25 {CopyRenameOneFile: error uses original name} {unixOnly} {
+test fCmd-6.25 {CopyRenameOneFile: error uses original name} \
+ {unixOnly notRoot} {
cleanup
file mkdir td2
file mkdir ~/td1
@@ -543,7 +560,8 @@ test fCmd-6.25 {CopyRenameOneFile: error uses original name} {unixOnly} {
file delete -force ~/td1
set msg
} {1 {error copying "td2" to "~/td1/td2": permission denied}}
-test fCmd-6.26 {CopyRenameOneFile: doesn't use original name} {unixOnly} {
+test fCmd-6.26 {CopyRenameOneFile: doesn't use original name} \
+ {unixOnly notRoot} {
cleanup
file mkdir ~/td1/td2
exec chmod 000 [file join [file dirname ~] [file tail ~] td1 td2]
@@ -552,14 +570,16 @@ test fCmd-6.26 {CopyRenameOneFile: doesn't use original name} {unixOnly} {
file delete -force ~/td1
set msg
} "1 {error copying \"~/td1\" to \"td1\": \"[file join [file dirname ~] [file tail ~] td1 td2]\": permission denied}"
-test fCmd-6.27 {CopyRenameOneFile: TclpCopyDirectory failed} {unixOnly xdev} {
+test fCmd-6.27 {CopyRenameOneFile: TclpCopyDirectory failed} \
+ {unixOnly notRoot xdev} {
cleanup /tmp
file mkdir td1/td2/td3
file mkdir /tmp/td1
createfile /tmp/td1/tf1
list [catch {file rename -force td1 /tmp} msg] $msg
} {1 {error renaming "td1" to "/tmp/td1": file already exists}}
-test fCmd-6.28 {CopyRenameOneFile: TclpCopyDirectory failed} {unixOnly xdev} {
+test fCmd-6.28 {CopyRenameOneFile: TclpCopyDirectory failed} \
+ {unixOnly notRoot xdev} {
cleanup /tmp
file mkdir td1/td2/td3
exec chmod 000 td1/td2/td3
@@ -567,73 +587,81 @@ test fCmd-6.28 {CopyRenameOneFile: TclpCopyDirectory failed} {unixOnly xdev} {
exec chmod 755 td1/td2/td3
set msg
} {1 {error renaming "td1" to "/tmp/td1": "td1/td2/td3": permission denied}}
-test fCmd-6.29 {CopyRenameOneFile: TclpCopyDirectory passed} {unixOnly xdev} {
+test fCmd-6.29 {CopyRenameOneFile: TclpCopyDirectory passed} \
+ {unixOnly notRoot xdev} {
cleanup /tmp
file mkdir td1/td2/td3
file rename td1 /tmp
glob td* /tmp/td1/t*
} {/tmp/td1/td2}
-test fCmd-6.30 {CopyRenameOneFile: TclpRemoveDirectory failed} {unixOnly} {
+test fCmd-6.30 {CopyRenameOneFile: TclpRemoveDirectory failed} \
+ {unixOnly notRoot} {
cleanup
file mkdir foo/bar
file attr foo -perm 040555
- set msg [list [catch {file rename foo/bar /tmp} msg] $msg]
- set a1 {1 {can't unlink "foo/bar": permission denied}}
- set result [expr {$msg == $a1}]
+ set catchResult [catch {file rename foo/bar /tmp} msg]
+ set msg [lindex [split $msg :] end]
catch {file delete /tmp/bar}
catch {file attr foo -perm 040777}
catch {file delete -force foo}
- set result
-} {1}
-test fCmd-6.31 {CopyRenameOneFile: TclpDeleteFile passed} {unixOnly xdev} {
+ list $catchResult $msg
+} {1 { permission denied}}
+test fCmd-6.31 {CopyRenameOneFile: TclpDeleteFile passed} \
+ {unixOnly notRoot xdev} {
catch {cleanup /tmp}
file mkdir /tmp/td1
createfile /tmp/td1/tf1
file rename /tmp/td1/tf1 tf1
list [file exists /tmp/td1/tf1] [file exists tf1]
} {0 1}
-test fCmd-6.32 {CopyRenameOneFile: copy} {
+test fCmd-6.32 {CopyRenameOneFile: copy} {notRoot} {
cleanup
list [catch {file copy tf1 tf2} msg] $msg
} {1 {error copying "tf1": no such file or directory}}
catch {cleanup /tmp}
-test fCmd-7.1 {FileForceOption: none} {
+test fCmd-7.1 {FileForceOption: none} {notRoot} {
cleanup
file mkdir [file join tf1 tf2]
list [catch {file delete tf1} msg] $msg
} {1 {error deleting "tf1": directory not empty}}
-test fCmd-7.2 {FileForceOption: -force} {
+test fCmd-7.2 {FileForceOption: -force} {notRoot} {
cleanup
file mkdir [file join tf1 tf2]
file delete -force tf1
} {}
-test fCmd-7.3 {FileForceOption: --} {
+test fCmd-7.3 {FileForceOption: --} {notRoot} {
createfile -tf1
file delete -- -tf1
} {}
-test fCmd-7.4 {FileForceOption: bad option} {
+test fCmd-7.4 {FileForceOption: bad option} {notRoot} {
createfile -tf1
set msg [list [catch {file delete -tf1} msg] $msg]
file delete -- -tf1
set msg
} {1 {bad option "-tf1": should be -force or --}}
-test fCmd-7.5 {FileForceOption: multiple times through loop} {
+test fCmd-7.5 {FileForceOption: multiple times through loop} {notRoot} {
createfile --
createfile -force
file delete -force -force -- -- -force
list [catch {glob -- -- -force} msg] $msg
} {1 {no files matched glob patterns "-- -force"}}
-test fCmd-8.1 {FileBasename: basename of ~user: argc == 1 && *path == ~} {unixOnly} {
+test fCmd-8.1 {FileBasename: basename of ~user: argc == 1 && *path == ~} \
+ {unixOnly notRoot knownBug} {
+ # Labelled knownBug because it is dangerous [Bug: 3881]
file mkdir td1
file attr td1 -perm 040000
set result [list [catch {file rename ~$user td1} msg] $msg]
file delete -force td1
set result
} "1 {error renaming \"~$user\" to \"td1/[file tail ~$user]\": permission denied}"
+test fCmd-8.2 {FileBasename: basename of ~user: argc == 1 && *path == ~} \
+ {unixOnly notRoot} {
+ file tail ~$user
+} "$user"
-test fCmd-9.1 {file rename: comprehensive: EACCES} {unixOnly} {
+test fCmd-9.1 {file rename: comprehensive: EACCES} {unixOnly notRoot} {
cleanup
file mkdir td1
file mkdir td2
@@ -643,11 +671,11 @@ test fCmd-9.1 {file rename: comprehensive: EACCES} {unixOnly} {
file delete -force td1
set result
} {1 {error renaming "td1" to "td2/td1": permission denied}}
-test fCmd-9.2 {file rename: comprehensive: source doesn't exist} {
+test fCmd-9.2 {file rename: comprehensive: source doesn't exist} {notRoot} {
cleanup
list [catch {file rename tf1 tf2} msg] $msg
} {1 {error renaming "tf1": no such file or directory}}
-test fCmd-9.3 {file rename: comprehensive: file to new name} {
+test fCmd-9.3 {file rename: comprehensive: file to new name} {notRoot} {
cleanup
createfile tf1
createfile tf2
@@ -656,7 +684,7 @@ test fCmd-9.3 {file rename: comprehensive: file to new name} {
file rename tf2 tf4
list [lsort [glob tf*]] [file writable tf3] [file writable tf4]
} {{tf3 tf4} 1 0}
-test fCmd-9.4 {file rename: comprehensive: dir to new name} {unixOrPc} {
+test fCmd-9.4 {file rename: comprehensive: dir to new name} {unixOrPc notRoot} {
cleanup
file mkdir td1 td2
testchmod 555 td2
@@ -664,7 +692,7 @@ test fCmd-9.4 {file rename: comprehensive: dir to new name} {unixOrPc} {
file rename td2 td4
list [lsort [glob td*]] [file writable td3] [file writable td4]
} {{td3 td4} 1 0}
-test fCmd-9.5 {file rename: comprehensive: file to self} {
+test fCmd-9.5 {file rename: comprehensive: file to self} {notRoot} {
cleanup
createfile tf1 tf1
createfile tf2 tf2
@@ -673,7 +701,7 @@ test fCmd-9.5 {file rename: comprehensive: file to self} {
file rename -force tf2 tf2
list [contents tf1] [contents tf2] [file writable tf1] [file writable tf2]
} {tf1 tf2 1 0}
-test fCmd-9.6 {file rename: comprehensive: dir to self} {unixOrPc} {
+test fCmd-9.6 {file rename: comprehensive: dir to self} {notRoot unixOrPc} {
cleanup
file mkdir td1
file mkdir td2
@@ -682,7 +710,7 @@ test fCmd-9.6 {file rename: comprehensive: dir to self} {unixOrPc} {
file rename -force td2 .
list [lsort [glob td*]] [file writable td1] [file writable td2]
} {{td1 td2} 1 0}
-test fCmd-9.7 {file rename: comprehensive: file to existing file} {
+test fCmd-9.7 {file rename: comprehensive: file to existing file} {notRoot} {
cleanup
createfile tf1
createfile tf2
@@ -705,7 +733,7 @@ test fCmd-9.7 {file rename: comprehensive: file to existing file} {
file rename -force tfs4 tfd4
list [lsort [glob tf*]] $msg [file writable tfd1] [file writable tfd2] [file writable tfd3] [file writable tfd4]
} {{tf1 tf2 tfd1 tfd2 tfd3 tfd4} {1 {error renaming "tf1" to "tf2": file already exists}} 1 1 0 0}
-test fCmd-9.8 {file rename: comprehensive: dir to empty dir} {
+test fCmd-9.8 {file rename: comprehensive: dir to empty dir} {notRoot} {
# Under unix, you can rename a read-only directory, but you can't
# move it into another directory.
@@ -743,7 +771,7 @@ test fCmd-9.8 {file rename: comprehensive: dir to empty dir} {
list [lsort [glob td*]] $msg [file writable [file join tdd1 tds1]] \
[file writable [file join tdd2 tds2]] $w3 $w4
} [subst {{td1 td2 tdd1 tdd2 tdd3 tdd4} {1 {error renaming "td1" to "[file join td2 td1]": file already exists}} 1 1 0 0}]
-test fCmd-9.9 {file rename: comprehensive: dir to non-empty dir} {
+test fCmd-9.9 {file rename: comprehensive: dir to non-empty dir} {notRoot} {
cleanup
file mkdir tds1
file mkdir tds2
@@ -761,7 +789,7 @@ test fCmd-9.9 {file rename: comprehensive: dir to non-empty dir} {
}
list [lsort [glob td*]] $a1 $a2 [file writable tds1] $w2
} [subst {{tdd1 tdd2 tds1 tds2} {1 {error renaming "tds1" to "[file join tdd1 tds1]": file already exists}} {1 {error renaming "tds2" to "[file join tdd2 tds2]": file already exists}} 1 0}]
-test fCmd-9.10 {file rename: comprehensive: file to new name and dir} {
+test fCmd-9.10 {file rename: comprehensive: file to new name and dir} {notRoot} {
cleanup
createfile tf1
createfile tf2
@@ -772,7 +800,7 @@ test fCmd-9.10 {file rename: comprehensive: file to new name and dir} {
list [catch {glob tf*}] [lsort [glob [file join td1 t*]]] \
[file writable [file join td1 tf3]] [file writable [file join td1 tf4]]
} [subst {1 {[file join td1 tf3] [file join td1 tf4]} 1 0}]
-test fCmd-9.11 {file rename: comprehensive: dir to new name and dir} {
+test fCmd-9.11 {file rename: comprehensive: dir to new name and dir} {notRoot} {
cleanup
file mkdir td1
file mkdir td2
@@ -790,7 +818,7 @@ test fCmd-9.11 {file rename: comprehensive: dir to new name and dir} {
list [lsort [glob td*]] [lsort [glob [file join td3 t*]]] \
[file writable [file join td3 td3]] $w4
} [subst {td3 {[file join td3 td3] [file join td3 td4]} 1 0}]
-test fCmd-9.12 {file rename: comprehensive: target exists} {
+test fCmd-9.12 {file rename: comprehensive: target exists} {notRoot} {
cleanup
file mkdir [file join td1 td2] [file join td2 td1]
if {$tcl_platform(platform) != "macintosh"} {
@@ -805,34 +833,36 @@ test fCmd-9.12 {file rename: comprehensive: target exists} {
}
set msg
} [subst {0 1 1 {error renaming "td1" to "[file join td2 td1]": file already exists}}]
-test fCmd-9.13 {file rename: comprehensive: can't overwrite target} {
+test fCmd-9.13 {file rename: comprehensive: can't overwrite target} {notRoot} {
cleanup
file mkdir [file join td1 td2] [file join td2 td1 td4]
list [catch {file rename -force td1 td2} msg] $msg
} [subst {1 {error renaming "td1" to "[file join td2 td1]": file already exists}}]
-test fCmd-9.14 {file rename: comprehensive: dir into self} {
+test fCmd-9.14 {file rename: comprehensive: dir into self} {notRoot} {
cleanup
file mkdir td1
list [glob td*] [list [catch {file rename td1 td1} msg] $msg]
} [subst {td1 {1 {error renaming "td1" to "[file join td1 td1]": trying to rename a volume or move a directory into itself}}}]
-test fCmd-9.15 {file rename: comprehensive: source and target incompatible} {
+test fCmd-9.15 {file rename: comprehensive: source and target incompatible} \
+ {notRoot} {
cleanup
file mkdir td1
createfile tf1
list [catch {file rename -force td1 tf1} msg] $msg
} {1 {can't overwrite file "tf1" with directory "td1"}}
-test fCmd-9.16 {file rename: comprehensive: source and target incompatible} {
+test fCmd-9.16 {file rename: comprehensive: source and target incompatible} \
+ {notRoot} {
cleanup
file mkdir td1/tf1
createfile tf1
list [catch {file rename -force tf1 td1} msg] $msg
} [subst {1 {can't overwrite directory "[file join td1 tf1]" with file "tf1"}}]
-test fCmd-10.1 {file copy: comprehensive: source doesn't exist} {
+test fCmd-10.1 {file copy: comprehensive: source doesn't exist} {notRoot} {
cleanup
list [catch {file copy tf1 tf2} msg] $msg
} {1 {error copying "tf1": no such file or directory}}
-test fCmd-10.2 {file copy: comprehensive: file to new name} {
+test fCmd-10.2 {file copy: comprehensive: file to new name} {notRoot} {
cleanup
createfile tf1 tf1
createfile tf2 tf2
@@ -841,7 +871,7 @@ test fCmd-10.2 {file copy: comprehensive: file to new name} {
file copy tf2 tf4
list [lsort [glob tf*]] [contents tf3] [contents tf4] [file writable tf3] [file writable tf4]
} {{tf1 tf2 tf3 tf4} tf1 tf2 1 0}
-test fCmd-10.3 {file copy: comprehensive: dir to new name} {unixOrPc} {
+test fCmd-10.3 {file copy: comprehensive: dir to new name} {notRoot unixOrPc} {
cleanup
file mkdir [file join td1 tdx]
file mkdir [file join td2 tdy]
@@ -856,7 +886,7 @@ test fCmd-10.3 {file copy: comprehensive: dir to new name} {unixOrPc} {
}
set msg
} [subst {{td1 td2 td3 td4} [file join td3 tdx] [file join td4 tdy] 1 0}]
-test fCmd-10.4 {file copy: comprehensive: file to existing file} {
+test fCmd-10.4 {file copy: comprehensive: file to existing file} {notRoot} {
cleanup
createfile tf1
createfile tf2
@@ -879,7 +909,7 @@ test fCmd-10.4 {file copy: comprehensive: file to existing file} {
file copy -force tfs4 tfd4
list [lsort [glob tf*]] $msg [file writable tfd1] [file writable tfd2] [file writable tfd3] [file writable tfd4]
} {{tf1 tf2 tfd1 tfd2 tfd3 tfd4 tfs1 tfs2 tfs3 tfs4} {1 {error copying "tf1" to "tf2": file already exists}} 1 1 0 0}
-test fCmd-10.5 {file copy: comprehensive: dir to empty dir} {
+test fCmd-10.5 {file copy: comprehensive: dir to empty dir} {notRoot} {
cleanup
file mkdir td1
file mkdir [file join td2 td1]
@@ -904,7 +934,8 @@ test fCmd-10.5 {file copy: comprehensive: dir to empty dir} {
set a5 [catch {file copy -force tds4 tdd4}]
list [lsort [glob td*]] $a1 $a2 $a3 $a4 $a5
} [subst {{td1 td2 tdd1 tdd2 tdd3 tdd4 tds1 tds2 tds3 tds4} {1 {error copying "td1" to "[file join td2 td1]": file already exists}} {1 {error copying "tds1" to "[file join tdd1 tds1]": file already exists}} 1 1 1}]
-test fCmd-10.6 {file copy: comprehensive: dir to non-empty dir} {unixOrPc} {
+test fCmd-10.6 {file copy: comprehensive: dir to non-empty dir} \
+ {notRoot unixOrPc} {
cleanup
file mkdir tds1
file mkdir tds2
@@ -915,7 +946,7 @@ test fCmd-10.6 {file copy: comprehensive: dir to non-empty dir} {unixOrPc} {
set a2 [list [catch {file copy -force tds2 tdd2} msg] $msg]
list [lsort [glob td*]] $a1 $a2 [file writable tds1] [file writable tds2]
} [subst {{tdd1 tdd2 tds1 tds2} {1 {error copying "tds1" to "[file join tdd1 tds1]": file already exists}} {1 {error copying "tds2" to "[file join tdd2 tds2]": file already exists}} 1 0}]
-test fCmd-10.7 {file rename: comprehensive: file to new name and dir} {
+test fCmd-10.7 {file rename: comprehensive: file to new name and dir} {notRoot} {
cleanup
createfile tf1
createfile tf2
@@ -926,7 +957,8 @@ test fCmd-10.7 {file rename: comprehensive: file to new name and dir} {
list [lsort [glob tf*]] [lsort [glob [file join td1 t*]]] \
[file writable [file join td1 tf3]] [file writable [file join td1 tf4]]
} [subst {{tf1 tf2} {[file join td1 tf3] [file join td1 tf4]} 1 0}]
-test fCmd-10.8 {file rename: comprehensive: dir to new name and dir} {unixOrPc} {
+test fCmd-10.8 {file rename: comprehensive: dir to new name and dir} \
+ {notRoot unixOrPc} {
cleanup
file mkdir td1
file mkdir td2
@@ -937,13 +969,15 @@ test fCmd-10.8 {file rename: comprehensive: dir to new name and dir} {unixOrPc}
list [lsort [glob td*]] [lsort [glob [file join td3 t*]]] \
[file writable [file join td3 td3]] [file writable [file join td3 td4]]
} [subst {{td1 td2 td3} {[file join td3 td3] [file join td3 td4]} 1 0}]
-test fCmd-10.9 {file copy: comprehensive: source and target incompatible} {
+test fCmd-10.9 {file copy: comprehensive: source and target incompatible} \
+ {notRoot} {
cleanup
file mkdir td1
createfile tf1
list [catch {file copy -force td1 tf1} msg] $msg
} {1 {can't overwrite file "tf1" with directory "td1"}}
-test fCmd-10.10 {file copy: comprehensive: source and target incompatible} {
+test fCmd-10.10 {file copy: comprehensive: source and target incompatible} \
+ {notRoot} {
cleanup
file mkdir [file join td1 tf1]
createfile tf1
@@ -953,7 +987,7 @@ cleanup
# old tests
-test fCmd-11.1 {TclFileRenameCmd: -- option } {
+test fCmd-11.1 {TclFileRenameCmd: -- option } {notRoot} {
catch {file delete -force -- -tfa1}
set s [createfile -tfa1]
file rename -- -tfa1 tfa2
@@ -962,7 +996,7 @@ test fCmd-11.1 {TclFileRenameCmd: -- option } {
set result
} {1}
-test fCmd-11.2 {TclFileRenameCmd: bad option } {
+test fCmd-11.2 {TclFileRenameCmd: bad option } {notRoot} {
catch {file delete -force -- tfa1}
set s [createfile tfa1]
set r1 [catch {file rename -x tfa1 tfa2}]
@@ -975,7 +1009,7 @@ test fCmd-11.3 {TclFileRenameCmd: bad \# args} {
catch {file rename -- }
} {1}
-test fCmd-11.4 {TclFileRenameCmd: target filename translation failing} {
+test fCmd-11.4 {TclFileRenameCmd: target filename translation failing} {notRoot} {
global env
set temp $env(HOME)
unset env(HOME)
@@ -984,7 +1018,7 @@ test fCmd-11.4 {TclFileRenameCmd: target filename translation failing} {
set result
} {1}
-test fCmd-11.5 {TclFileRenameCmd: more than one source and target is not a directory} {
+test fCmd-11.5 {TclFileRenameCmd: > 1 source & target is not a dir} {notRoot} {
catch {file delete -force -- tfa1 tfa2 tfa3}
createfile tfa1
createfile tfa2
@@ -994,7 +1028,7 @@ test fCmd-11.5 {TclFileRenameCmd: more than one source and target is not a direc
set result
} {1}
-test fCmd-11.6 {TclFileRenameCmd: : single file into directory } {
+test fCmd-11.6 {TclFileRenameCmd: : single file into directory} {notRoot} {
catch {file delete -force -- tfa1 tfad}
set s [createfile tfa1]
file mkdir tfad
@@ -1004,7 +1038,7 @@ test fCmd-11.6 {TclFileRenameCmd: : single file into directory } {
set result
} {1}
-test fCmd-11.7 {TclFileRenameCmd: : multiple files into directory } {
+test fCmd-11.7 {TclFileRenameCmd: : multiple files into directory} {notRoot} {
catch {file delete -force -- tfa1 tfa2 tfad}
set s1 [createfile tfa1 ]
set s2 [createfile tfa2 ]
@@ -1019,7 +1053,7 @@ test fCmd-11.7 {TclFileRenameCmd: : multiple files into directory } {
set result
} {1}
-test fCmd-11.8 {TclFileRenameCmd: error renaming file to directory } {
+test fCmd-11.8 {TclFileRenameCmd: error renaming file to directory} {notRoot} {
catch {file delete -force -- tfa tfad}
set s [createfile tfa ]
file mkdir tfad
@@ -1035,7 +1069,7 @@ test fCmd-11.8 {TclFileRenameCmd: error renaming file to directory } {
#
# Coverage tests for renamefile() ;
#
-test fCmd-12.1 {renamefile: source filename translation failing} {
+test fCmd-12.1 {renamefile: source filename translation failing} {notRoot} {
global env
set temp $env(HOME)
unset env(HOME)
@@ -1044,7 +1078,7 @@ test fCmd-12.1 {renamefile: source filename translation failing} {
set result
} {1}
-test fCmd-12.2 {renamefile: src filename translation failing} {
+test fCmd-12.2 {renamefile: src filename translation failing} {notRoot} {
global env
set temp $env(HOME)
unset env(HOME)
@@ -1056,13 +1090,13 @@ test fCmd-12.2 {renamefile: src filename translation failing} {
set result
} {1}
-test fCmd-12.3 {renamefile: stat failing on source} {
+test fCmd-12.3 {renamefile: stat failing on source} {notRoot} {
catch {file delete -force -- tfa1 tfa2}
set r1 [catch {file rename tfa1 tfa2}]
expr {$r1 && ![file exists tfa1] && ![file exists tfa2]}
} {1}
-test fCmd-12.4 {renamefile: error renaming file to directory } {
+test fCmd-12.4 {renamefile: error renaming file to directory} {notRoot} {
catch {file delete -force -- tfa tfad}
set s1 [createfile tfa ]
file mkdir tfad
@@ -1075,7 +1109,7 @@ test fCmd-12.4 {renamefile: error renaming file to directory } {
set result
} {1}
-test fCmd-12.5 {renamefile: error renaming directory to file } {
+test fCmd-12.5 {renamefile: error renaming directory to file} {notRoot} {
catch {file delete -force -- tfa tfad}
file mkdir tfa
file mkdir tfad
@@ -1089,7 +1123,7 @@ test fCmd-12.5 {renamefile: error renaming directory to file } {
set result
} {1}
-test fCmd-12.6 {renamefile: TclRenameFile succeeding } {
+test fCmd-12.6 {renamefile: TclRenameFile succeeding} {notRoot} {
catch {file delete -force -- tfa1 tfa2}
set s [createfile tfa1]
file rename tfa1 tfa2
@@ -1098,7 +1132,7 @@ test fCmd-12.6 {renamefile: TclRenameFile succeeding } {
set result
} {1}
-test fCmd-12.7 {renamefile: renaming directory into offspring} {
+test fCmd-12.7 {renamefile: renaming directory into offspring} {notRoot} {
catch {file delete -force -- tfad}
file mkdir tfad
file mkdir tfad/dir
@@ -1107,7 +1141,7 @@ test fCmd-12.7 {renamefile: renaming directory into offspring} {
set result
} {1}
-test fCmd-12.8 {renamefile: generic error } {unixOnly} {
+test fCmd-12.8 {renamefile: generic error} {unixOnly notRoot} {
catch {file delete -force -- tfa}
file mkdir tfa
file mkdir tfa/dir
@@ -1119,7 +1153,7 @@ test fCmd-12.8 {renamefile: generic error } {unixOnly} {
} {1}
-test fCmd-12.9 {renamefile: moving a file across volumes } {unixOnly} {
+test fCmd-12.9 {renamefile: moving a file across volumes} {unixOnly notRoot} {
catch {file delete -force -- tfa /tmp/tfa}
set s [createfile tfa ]
file rename tfa /tmp
@@ -1128,7 +1162,8 @@ test fCmd-12.9 {renamefile: moving a file across volumes } {unixOnly} {
set result
} {1}
-test fCmd-12.10 {renamefile: moving a directory across volumes } {unixOnly} {
+test fCmd-12.10 {renamefile: moving a directory across volumes } \
+ {unixOnly notRoot} {
catch {file delete -force -- tfad /tmp/tfad}
file mkdir tfad
set s [createfile tfad/a ]
@@ -1141,7 +1176,7 @@ test fCmd-12.10 {renamefile: moving a directory across volumes } {unixOnly} {
#
# Coverage tests for TclCopyFilesCmd()
#
-test fCmd-13.1 {TclCopyFilesCmd: -force option } {
+test fCmd-13.1 {TclCopyFilesCmd: -force option} {notRoot} {
catch {file delete -force -- tfa1}
set s [createfile tfa1]
file copy -force tfa1 tfa2
@@ -1150,7 +1185,7 @@ test fCmd-13.1 {TclCopyFilesCmd: -force option } {
set result
} {1}
-test fCmd-13.2 {TclCopyFilesCmd: -- option } {
+test fCmd-13.2 {TclCopyFilesCmd: -- option} {notRoot} {
catch {file delete -force -- tfa1}
set s [createfile -tfa1]
file copy -- -tfa1 tfa2
@@ -1159,7 +1194,7 @@ test fCmd-13.2 {TclCopyFilesCmd: -- option } {
set result
} {1}
-test fCmd-13.3 {TclCopyFilesCmd: bad option } {
+test fCmd-13.3 {TclCopyFilesCmd: bad option} {notRoot} {
catch {file delete -force -- tfa1}
set s [createfile tfa1]
set r1 [catch {file copy -x tfa1 tfa2}]
@@ -1168,7 +1203,7 @@ test fCmd-13.3 {TclCopyFilesCmd: bad option } {
set result
} {1}
-test fCmd-13.4 {TclCopyFilesCmd: bad \# args} {
+test fCmd-13.4 {TclCopyFilesCmd: bad \# args} {notRoot} {
catch {file copy -- }
} {1}
@@ -1181,7 +1216,7 @@ test fCmd-13.5 {TclCopyFilesCmd: target filename translation failing} {
set result
} {1}
-test fCmd-13.6 {TclCopyFilesCmd: more than one source and target is not a directory} {
+test fCmd-13.6 {TclCopyFilesCmd: > 1 source & target is not a dir} {notRoot} {
catch {file delete -force -- tfa1 tfa2 tfa3}
createfile tfa1
createfile tfa2
@@ -1191,7 +1226,7 @@ test fCmd-13.6 {TclCopyFilesCmd: more than one source and target is not a direct
set result
} {1}
-test fCmd-13.7 {TclCopyFilesCmd: : single file into directory } {
+test fCmd-13.7 {TclCopyFilesCmd: single file into directory} {notRoot} {
catch {file delete -force -- tfa1 tfad}
set s [createfile tfa1]
file mkdir tfad
@@ -1201,7 +1236,7 @@ test fCmd-13.7 {TclCopyFilesCmd: : single file into directory } {
set result
} {1}
-test fCmd-13.8 {TclCopyFilesCmd: : multiple files into directory } {
+test fCmd-13.8 {TclCopyFilesCmd: multiple files into directory} {notRoot} {
catch {file delete -force -- tfa1 tfa2 tfad}
set s1 [createfile tfa1 ]
set s2 [createfile tfa2 ]
@@ -1217,7 +1252,7 @@ test fCmd-13.8 {TclCopyFilesCmd: : multiple files into directory } {
set result
} {1}
-test fCmd-13.9 {TclCopyFilesCmd: error copying file to directory } {
+test fCmd-13.9 {TclCopyFilesCmd: error copying file to directory} {notRoot} {
catch {file delete -force -- tfa tfad}
set s [createfile tfa ]
file mkdir tfad
@@ -1233,7 +1268,7 @@ test fCmd-13.9 {TclCopyFilesCmd: error copying file to directory } {
#
# Coverage tests for copyfile()
#
-test fCmd-14.1 {copyfile: source filename translation failing} {
+test fCmd-14.1 {copyfile: source filename translation failing} {notRoot} {
global env
set temp $env(HOME)
unset env(HOME)
@@ -1242,7 +1277,7 @@ test fCmd-14.1 {copyfile: source filename translation failing} {
set result
} {1}
-test fCmd-14.2 {copyfile: dst filename translation failing} {
+test fCmd-14.2 {copyfile: dst filename translation failing} {notRoot} {
global env
set temp $env(HOME)
unset env(HOME)
@@ -1255,13 +1290,13 @@ test fCmd-14.2 {copyfile: dst filename translation failing} {
set result
} {1}
-test fCmd-14.3 {copyfile: stat failing on source} {
+test fCmd-14.3 {copyfile: stat failing on source} {notRoot} {
catch {file delete -force -- tfa1 tfa2}
set r1 [catch {file copy tfa1 tfa2}]
expr $r1 && ![file exists tfa1] && ![file exists tfa2]
} {1}
-test fCmd-14.4 {copyfile: error copying file to directory } {
+test fCmd-14.4 {copyfile: error copying file to directory} {notRoot} {
catch {file delete -force -- tfa tfad}
set s1 [createfile tfa ]
file mkdir tfad
@@ -1275,7 +1310,7 @@ test fCmd-14.4 {copyfile: error copying file to directory } {
set result
} {1}
- test fCmd-14.5 {copyfile: error copying directory to file } {
+ test fCmd-14.5 {copyfile: error copying directory to file} {notRoot} {
catch {file delete -force -- tfa tfad}
file mkdir tfa
file mkdir tfad
@@ -1289,7 +1324,7 @@ test fCmd-14.4 {copyfile: error copying file to directory } {
set result
} {1}
-test fCmd-14.6 {copyfile: copy file succeeding } {
+test fCmd-14.6 {copyfile: copy file succeeding} {notRoot} {
catch {file delete -force -- tfa tfa2}
set s [createfile tfa]
file copy tfa tfa2
@@ -1298,7 +1333,7 @@ test fCmd-14.6 {copyfile: copy file succeeding } {
set result
} {1}
-test fCmd-14.7 {copyfile: copy directory succeeding } {
+test fCmd-14.7 {copyfile: copy directory succeeding} {notRoot} {
catch {file delete -force -- tfa tfa2}
file mkdir tfa
set s [createfile tfa/file]
@@ -1308,7 +1343,7 @@ test fCmd-14.7 {copyfile: copy directory succeeding } {
set result
} {1}
-test fCmd-14.8 {copyfile: copy directory failing } {unixOnly} {
+test fCmd-14.8 {copyfile: copy directory failing} {unixOnly notRoot} {
catch {file delete -force -- tfa}
file mkdir tfa/dir/a/b/c
exec chmod 000 tfa/dir
@@ -1322,7 +1357,7 @@ test fCmd-14.8 {copyfile: copy directory failing } {unixOnly} {
#
# Coverage tests for TclMkdirCmd()
#
-test fCmd-15.1 {TclMakeDirsCmd: target filename translation failing} {
+test fCmd-15.1 {TclMakeDirsCmd: target filename translation failing} {notRoot} {
global env
set temp $env(HOME)
unset env(HOME)
@@ -1334,7 +1369,7 @@ test fCmd-15.1 {TclMakeDirsCmd: target filename translation failing} {
# Can Tcl_SplitPath return argc == 0? If so them we need a
# test for that code.
#
-test fCmd-15.2 {TclMakeDirsCmd - one directory } {
+test fCmd-15.2 {TclMakeDirsCmd - one directory } {notRoot} {
catch {file delete -force -- tfa}
file mkdir tfa
set result [file isdirectory tfa]
@@ -1342,7 +1377,7 @@ test fCmd-15.2 {TclMakeDirsCmd - one directory } {
set result
} {1}
-test fCmd-15.3 {TclMakeDirsCmd: - two directories } {
+test fCmd-15.3 {TclMakeDirsCmd: - two directories} {notRoot} {
catch {file delete -force -- tfa1 tfa2}
file mkdir tfa1 tfa2
set result [expr [file isdirectory tfa1] && [file isdirectory tfa2]]
@@ -1350,7 +1385,7 @@ test fCmd-15.3 {TclMakeDirsCmd: - two directories } {
set result
} {1}
-test fCmd-15.4 {TclMakeDirsCmd - stat failing } {unixOnly} {
+test fCmd-15.4 {TclMakeDirsCmd - stat failing} {unixOnly notRoot} {
catch {file delete -force -- tfa}
file mkdir tfa
createfile tfa/file
@@ -1361,7 +1396,8 @@ test fCmd-15.4 {TclMakeDirsCmd - stat failing } {unixOnly} {
set result
} {1}
-test fCmd-15.5 {TclMakeDirsCmd: - making a directory several levels deep } {
+test fCmd-15.5 {TclMakeDirsCmd: - making a directory several levels deep} \
+ {notRoot} {
catch {file delete -force -- tfa}
file mkdir tfa/a/b/c
set result [file isdir tfa/a/b/c]
@@ -1370,7 +1406,7 @@ test fCmd-15.5 {TclMakeDirsCmd: - making a directory several levels deep } {
} {1}
-test fCmd-15.6 {TclMakeDirsCmd: - trying to overwrite a file } {
+test fCmd-15.6 {TclMakeDirsCmd: - trying to overwrite a file} {notRoot} {
catch {file delete -force -- tfa}
set s [createfile tfa]
set r1 [catch {file mkdir tfa}]
@@ -1381,7 +1417,7 @@ test fCmd-15.6 {TclMakeDirsCmd: - trying to overwrite a file } {
set result
} {1}
-test fCmd-15.7 {TclMakeDirsCmd - making several directories } {
+test fCmd-15.7 {TclMakeDirsCmd - making several directories} {notRoot} {
catch {file delete -force -- tfa1 tfa2}
file mkdir tfa1 tfa2/a/b/c
set result [expr [file isdir tfa1] && [file isdir tfa2/a/b/c]]
@@ -1389,7 +1425,7 @@ test fCmd-15.7 {TclMakeDirsCmd - making several directories } {
set result
} {1}
-test fCmd-15.8 {TclFileMakeDirsCmd: trying to create an existing dir} {
+test fCmd-15.8 {TclFileMakeDirsCmd: trying to create an existing dir} {notRoot} {
file mkdir tfa
file mkdir tfa
set result [file isdir tfa]
@@ -1399,21 +1435,21 @@ test fCmd-15.8 {TclFileMakeDirsCmd: trying to create an existing dir} {
# Coverage tests for TclDeleteFilesCommand()
-test fCmd-16.1 { test the -- argument } {
+test fCmd-16.1 { test the -- argument } {notRoot} {
catch {file delete -force -- tfa}
createfile tfa
file delete -- tfa
file exists tfa
} {0}
-test fCmd-16.2 { test the -force and -- arguments } {
+test fCmd-16.2 { test the -force and -- arguments } {notRoot} {
catch {file delete -force -- tfa}
createfile tfa
file delete -force -- tfa
file exists tfa
} {0}
-test fCmd-16.3 { test bad option } {
+test fCmd-16.3 { test bad option } {notRoot} {
catch {file delete -force -- tfa}
createfile tfa
set result [catch {file delete -dog tfa}]
@@ -1421,15 +1457,15 @@ test fCmd-16.3 { test bad option } {
set result
} {1}
-test fCmd-16.4 { test not enough args } {
+test fCmd-16.4 { test not enough args } {notRoot} {
catch {file delete}
} {1}
-test fCmd-16.5 { test not enough args with options } {
+test fCmd-16.5 { test not enough args with options } {notRoot} {
catch {file delete --}
} {1}
-test fCmd-16.6 {delete: source filename translation failing} {
+test fCmd-16.6 {delete: source filename translation failing} {notRoot} {
global env
set temp $env(HOME)
unset env(HOME)
@@ -1438,7 +1474,7 @@ test fCmd-16.6 {delete: source filename translation failing} {
set result
} {1}
-test fCmd-16.7 {remove a non-empty directory without -force } {
+test fCmd-16.7 {remove a non-empty directory without -force } {notRoot} {
catch {file delete -force -- tfa}
file mkdir tfa
createfile tfa/a
@@ -1447,7 +1483,7 @@ test fCmd-16.7 {remove a non-empty directory without -force } {
set result
} {1}
-test fCmd-16.8 {remove a normal file } {
+test fCmd-16.8 {remove a normal file } {notRoot} {
catch {file delete -force -- tfa}
file mkdir tfa
createfile tfa/a
@@ -1456,7 +1492,7 @@ test fCmd-16.8 {remove a normal file } {
set result
} {1}
-test fCmd-16.9 {error while deleting file } {unixOnly} {
+test fCmd-16.9 {error while deleting file } {unixOnly notRoot} {
catch {file delete -force -- tfa}
file mkdir tfa
createfile tfa/a
@@ -1472,7 +1508,7 @@ test fCmd-16.9 {error while deleting file } {unixOnly} {
set result
} {1}
-test fCmd-16.10 {deleting multiple files } {
+test fCmd-16.10 {deleting multiple files} {notRoot} {
catch {file delete -force -- tfa1 tfa2}
createfile tfa1
createfile tfa2
@@ -1480,14 +1516,14 @@ test fCmd-16.10 {deleting multiple files } {
expr ![file exists tfa1] && ![file exists tfa2]
} {1}
-test fCmd-16.11 { TclFileDeleteCmd: removing a nonexistant file} {
+test fCmd-16.11 { TclFileDeleteCmd: removing a nonexistant file} {notRoot} {
catch {file delete -force -- tfa}
file delete tfa
set result 1
} {1}
# More coverage tests for mkpath()
- test fCmd-17.1 {mkdir stat failing on target but not ENOENT } {unixOnly} {
+ test fCmd-17.1 {mkdir stat failing on target but not ENOENT} {unixOnly notRoot} {
catch {file delete -force -- tfa1}
file mkdir tfa1
exec chmod 555 tfa1
@@ -1497,7 +1533,7 @@ test fCmd-16.11 { TclFileDeleteCmd: removing a nonexistant file} {
set result
} {1}
-test fCmd-17.2 {mkdir several levels deep - relative } {
+test fCmd-17.2 {mkdir several levels deep - relative } {notRoot} {
catch {file delete -force -- tfa}
file mkdir tfa/a/b
set result [file isdir tfa/a/b ]
@@ -1505,7 +1541,7 @@ test fCmd-17.2 {mkdir several levels deep - relative } {
set result
} {1}
-test fCmd-17.3 {mkdir several levels deep - absolute } {
+test fCmd-17.3 {mkdir several levels deep - absolute } {notRoot} {
catch {file delete -force -- tfa}
set f [file join [pwd] tfa a ]
file mkdir $f
@@ -1518,7 +1554,8 @@ test fCmd-17.3 {mkdir several levels deep - absolute } {
# Functionality tests for TclFileRenameCmd()
#
-test fCmd-18.1 {TclFileRenameCmd: rename (first form) in the same directory} {
+test fCmd-18.1 {TclFileRenameCmd: rename (first form) in the same directory} \
+ {notRoot} {
catch {file delete -force -- tfad}
file mkdir tfad/dir
cd tfad/dir
@@ -1538,7 +1575,7 @@ test fCmd-18.1 {TclFileRenameCmd: rename (first form) in the same directory} {
set result
} {1}
-test fCmd-18.2 {TclFileRenameCmd: single dir to nonexistant } {
+test fCmd-18.2 {TclFileRenameCmd: single dir to nonexistant} {notRoot} {
catch {file delete -force -- tfa1 tfa2}
file mkdir tfa1
file rename tfa1 tfa2
@@ -1547,7 +1584,7 @@ test fCmd-18.2 {TclFileRenameCmd: single dir to nonexistant } {
set result
} {1}
-test fCmd-18.3 {TclFileRenameCmd: mixed dirs and files into directory } {
+test fCmd-18.3 {TclFileRenameCmd: mixed dirs and files into directory} {notRoot} {
catch {file delete -force -- tfa1 tfad1 tfad2}
set s [createfile tfa1 ]
file mkdir tfad1 tfad2
@@ -1560,7 +1597,7 @@ test fCmd-18.3 {TclFileRenameCmd: mixed dirs and files into directory } {
set result
} {1}
-test fCmd-18.4 {TclFileRenameCmd: attempt to replace non-dir with dir } {
+test fCmd-18.4 {TclFileRenameCmd: attempt to replace non-dir with dir} {notRoot} {
catch {file delete -force -- tfa tfad}
set s [createfile tfa ]
file mkdir tfad
@@ -1572,7 +1609,7 @@ test fCmd-18.4 {TclFileRenameCmd: attempt to replace non-dir with dir } {
set result
} {1}
-test fCmd-18.5 {TclFileRenameCmd: attempt to replace dir with non-dir } {
+test fCmd-18.5 {TclFileRenameCmd: attempt to replace dir with non-dir} {notRoot} {
catch {file delete -force -- tfa tfad}
set s [createfile tfa ]
file mkdir tfad/tfa
@@ -1587,7 +1624,7 @@ test fCmd-18.5 {TclFileRenameCmd: attempt to replace dir with non-dir } {
#
# On Windows there is no easy way to determine if two files are the same
#
-test fCmd-18.6 {TclFileRenameCmd: rename a file to itself} {macOrUnix} {
+test fCmd-18.6 {TclFileRenameCmd: rename a file to itself} {macOrUnix notRoot} {
catch {file delete -force -- tfa}
set s [createfile tfa]
set r1 [catch {file rename tfa tfa}]
@@ -1596,7 +1633,8 @@ test fCmd-18.6 {TclFileRenameCmd: rename a file to itself} {macOrUnix} {
set result
} {1}
-test fCmd-18.7 {TclFileRenameCmd: rename dir on top of another empty dir w/o -force} {
+test fCmd-18.7 {TclFileRenameCmd: rename dir on top of another empty dir w/o -force} \
+ {notRoot} {
catch {file delete -force -- tfa tfad}
file mkdir tfa tfad/tfa
set r1 [catch {file rename tfa tfad}]
@@ -1605,7 +1643,8 @@ test fCmd-18.7 {TclFileRenameCmd: rename dir on top of another empty dir w/o -fo
set result
} {1}
-test fCmd-18.8 {TclFileRenameCmd: rename dir on top of another empty dir w/ -force} {
+test fCmd-18.8 {TclFileRenameCmd: rename dir on top of another empty dir w/ -force} \
+ {notRoot} {
catch {file delete -force -- tfa tfad}
file mkdir tfa tfad/tfa
file rename -force tfa tfad
@@ -1614,7 +1653,8 @@ test fCmd-18.8 {TclFileRenameCmd: rename dir on top of another empty dir w/ -for
set result
} {1}
-test fCmd-18.9 {TclFileRenameCmd: rename dir on top of a non-empty dir w/o -force} {
+test fCmd-18.9 {TclFileRenameCmd: rename dir on top of a non-empty dir w/o -force} \
+ {notRoot} {
catch {file delete -force -- tfa tfad}
file mkdir tfa tfad/tfa/file
set r1 [catch {file rename tfa tfad}]
@@ -1623,7 +1663,8 @@ test fCmd-18.9 {TclFileRenameCmd: rename dir on top of a non-empty dir w/o -forc
set result
} {1}
-test fCmd-18.10 {TclFileRenameCmd: rename dir on top of a non-empty dir w/ -force} {
+test fCmd-18.10 {TclFileRenameCmd: rename dir on top of a non-empty dir w/ -force} \
+ {notRoot} {
catch {file delete -force -- tfa tfad}
file mkdir tfa tfad/tfa/file
set r1 [catch {file rename -force tfa tfad}]
@@ -1632,13 +1673,14 @@ test fCmd-18.10 {TclFileRenameCmd: rename dir on top of a non-empty dir w/ -forc
set result
} {1}
-test fCmd-18.11 {TclFileRenameCmd: rename a non-existant file} {
+test fCmd-18.11 {TclFileRenameCmd: rename a non-existant file} {notRoot} {
catch {file delete -force -- tfa1}
set r1 [catch {file rename tfa1 tfa2}]
set result [expr $r1 && ![file exists tfa1] && ![file exists tfa2]]
} {1}
-test fCmd-18.12 {TclFileRenameCmd : rename a symbolic link to file} {unixOnly} {
+test fCmd-18.12 {TclFileRenameCmd : rename a symbolic link to file} \
+ {unixOnly notRoot} {
catch {file delete -force -- tfa1 tfa2 tfa3}
set s [createfile tfa1]
@@ -1650,7 +1692,8 @@ test fCmd-18.12 {TclFileRenameCmd : rename a symbolic link to file} {unixOnly} {
set result
} {1}
-test fCmd-18.13 {TclFileRenameCmd : rename a symbolic link to dir} {unixOnly} {
+test fCmd-18.13 {TclFileRenameCmd : rename a symbolic link to dir} \
+ {unixOnly notRoot} {
catch {file delete -force -- tfa1 tfa2 tfa3}
file mkdir tfa1
@@ -1662,7 +1705,8 @@ test fCmd-18.13 {TclFileRenameCmd : rename a symbolic link to dir} {unixOnly} {
set result
} {1}
-test fCmd-18.14 {TclFileRenameCmd : rename a path with sym link} {unixOnly} {
+test fCmd-18.14 {TclFileRenameCmd : rename a path with sym link} \
+ {unixOnly notRoot} {
catch {file delete -force -- tfa1 tfa2 tfa3}
file mkdir tfa1/a/b/c/d
@@ -1678,7 +1722,8 @@ test fCmd-18.14 {TclFileRenameCmd : rename a path with sym link} {unixOnly} {
set result
} {1}
-test fCmd-18.15 {TclFileRenameCmd : rename a file to a symlink dir} {unixOnly} {
+test fCmd-18.15 {TclFileRenameCmd : rename a file to a symlink dir} \
+ {unixOnly notRoot} {
catch {file delete -force -- tfa1 tfa2 tfalink}
file mkdir tfa1
@@ -1691,7 +1736,7 @@ test fCmd-18.15 {TclFileRenameCmd : rename a file to a symlink dir} {unixOnly} {
set result
} {1}
-test fCmd-18.16 {TclFileRenameCmd : rename a dangling symlink} {unixOnly} {
+test fCmd-18.16 {TclFileRenameCmd: rename a dangling symlink} {unixOnly notRoot} {
catch {file delete -force -- tfa1 tfalink}
file mkdir tfa1
@@ -1707,14 +1752,14 @@ test fCmd-18.16 {TclFileRenameCmd : rename a dangling symlink} {unixOnly} {
#
# Coverage tests for TclUnixRmdir
#
-test fCmd-19.1 { remove empty directory } {
+test fCmd-19.1 { remove empty directory } {notRoot} {
catch {file delete -force -- tfa}
file mkdir tfa
file delete tfa
file exists tfa
} {0}
-test fCmd-19.2 { rmdir error besides EEXIST} {unixOnly} {
+test fCmd-19.2 { rmdir error besides EEXIST} {unixOnly notRoot} {
catch {file delete -force -- tfa}
file mkdir tfa
file mkdir tfa/a
@@ -1725,7 +1770,7 @@ test fCmd-19.2 { rmdir error besides EEXIST} {unixOnly} {
set result
} {1}
-test fCmd-19.3 { recursive remove } {
+test fCmd-19.3 { recursive remove } {notRoot} {
catch {file delete -force -- tfa}
file mkdir tfa
file mkdir tfa/a
@@ -1743,7 +1788,8 @@ test fCmd-19.3 { recursive remove } {
# Coverage tests for TraverseUnixTree(), called from TclDeleteFilesCmd
#
-test fCmd-20.1 {TraverseUnixTree : failure opening a subdirectory directory } {unixOnly} {
+test fCmd-20.1 {TraverseUnixTree : failure opening a subdirectory directory } \
+ {unixOnly notRoot} {
catch {file delete -force -- tfa}
file mkdir tfa
file mkdir tfa/a
@@ -1758,7 +1804,7 @@ test fCmd-20.1 {TraverseUnixTree : failure opening a subdirectory directory } {u
#
# Feature testing for TclCopyFilesCmd
#
-test fCmd-21.1 {copy : single file to nonexistant } {
+test fCmd-21.1 {copy : single file to nonexistant } {notRoot} {
catch {file delete -force -- tfa1 tfa2}
set s [createfile tfa1]
file copy tfa1 tfa2
@@ -1767,7 +1813,7 @@ test fCmd-21.1 {copy : single file to nonexistant } {
set result
} {1}
-test fCmd-21.2 {copy : single dir to nonexistant } {
+test fCmd-21.2 {copy : single dir to nonexistant } {notRoot} {
catch {file delete -force -- tfa1 tfa2}
file mkdir tfa1
file copy tfa1 tfa2
@@ -1776,7 +1822,7 @@ test fCmd-21.2 {copy : single dir to nonexistant } {
set result
} {1}
-test fCmd-21.3 {copy : single file into directory } {
+test fCmd-21.3 {copy : single file into directory } {notRoot} {
catch {file delete -force -- tfa1 tfad}
set s [createfile tfa1]
file mkdir tfad
@@ -1786,7 +1832,8 @@ test fCmd-21.3 {copy : single file into directory } {
set result
} {1}
-test fCmd-21.4 {copy : more than one source and target is not a directory} {
+test fCmd-21.4 {copy : more than one source and target is not a directory} \
+ {notRoot} {
catch {file delete -force -- tfa1 tfa2 tfa3}
createfile tfa1
createfile tfa2
@@ -1796,7 +1843,7 @@ test fCmd-21.4 {copy : more than one source and target is not a directory} {
set result
} {1}
-test fCmd-21.5 {copy : multiple files into directory } {
+test fCmd-21.5 {copy : multiple files into directory } {notRoot} {
catch {file delete -force -- tfa1 tfa2 tfad}
set s1 [createfile tfa1 ]
set s2 [createfile tfa2 ]
@@ -1811,7 +1858,8 @@ test fCmd-21.5 {copy : multiple files into directory } {
set result
} {1}
-test fCmd-21.6 {copy : mixed dirs and files into directory } {notFileSharing} {
+test fCmd-21.6 {copy: mixed dirs and files into directory} \
+ {notRoot notFileSharing} {
catch {file delete -force -- tfa1 tfad1 tfad2}
set s [createfile tfa1 ]
file mkdir tfad1 tfad2
@@ -1824,7 +1872,7 @@ test fCmd-21.6 {copy : mixed dirs and files into directory } {notFileSharing} {
set result
} {1}
-test fCmd-21.7 {TclCopyFilesCmd : copy a dangling link } {unixOnly} {
+test fCmd-21.7 {TclCopyFilesCmd: copy a dangling link} {unixOnly notRoot} {
file mkdir tfad1
exec ln -s tfad1 tfalink
file delete tfad1
@@ -1834,7 +1882,7 @@ test fCmd-21.7 {TclCopyFilesCmd : copy a dangling link } {unixOnly} {
set result
} {1}
-test fCmd-21.8 {TclCopyFilesCmd : copy a link } {unixOnly} {
+test fCmd-21.8 {TclCopyFilesCmd : copy a link } {unixOnly notRoot} {
file mkdir tfad1
exec ln -s tfad1 tfalink
file copy tfalink tfalink2
@@ -1846,7 +1894,7 @@ test fCmd-21.8 {TclCopyFilesCmd : copy a link } {unixOnly} {
set result
} {1}
-test fCmd-21.9 {TclCopyFilesCmd : copy dir with a link in it } {unixOnly} {
+test fCmd-21.9 {TclCopyFilesCmd: copy dir with a link in it} {unixOnly notRoot} {
file mkdir tfad1
exec ln -s "[pwd]/tfad1" tfad1/tfalink
file copy tfad1 tfad2
@@ -1855,7 +1903,8 @@ test fCmd-21.9 {TclCopyFilesCmd : copy dir with a link in it } {unixOnly} {
set result
} {1}
-test fCmd-21.10 {TclFileCopyCmd: copy dir on top of another empty dir w/o -force} {
+test fCmd-21.10 {TclFileCopyCmd: copy dir on top of another empty dir w/o -force} \
+ {notRoot} {
catch {file delete -force -- tfa tfad}
file mkdir tfa [file join tfad tfa]
set r1 [catch {file copy tfa tfad}]
@@ -1864,7 +1913,7 @@ test fCmd-21.10 {TclFileCopyCmd: copy dir on top of another empty dir w/o -force
set result
} {1}
-test fCmd-21.11 {TclFileCopyCmd: copy dir on top of a dir w/o -force} {
+test fCmd-21.11 {TclFileCopyCmd: copy dir on top of a dir w/o -force} {notRoot} {
catch {file delete -force -- tfa tfad}
file mkdir tfa [file join tfad tfa file]
set r1 [catch {file copy tfa tfad}]
@@ -1873,7 +1922,8 @@ test fCmd-21.11 {TclFileCopyCmd: copy dir on top of a dir w/o -force} {
set result
} {1}
-test fCmd-21.12 {TclFileCopyCmd: copy dir on top of a non-empty dir w/ -force} {
+test fCmd-21.12 {TclFileCopyCmd: copy dir on top of a non-empty dir w/ -force} \
+ {notRoot} {
catch {file delete -force -- tfa tfad}
file mkdir tfa [file join tfad tfa file]
set r1 [catch {file copy -force tfa tfad}]
@@ -1885,7 +1935,7 @@ test fCmd-21.12 {TclFileCopyCmd: copy dir on top of a non-empty dir w/ -force} {
#
# Coverage testing for TclpRenameFile
#
-test fCmd-22.1 { TclpRenameFile : rename and overwrite in a single dir } {
+test fCmd-22.1 {TclpRenameFile: rename and overwrite in a single dir} {notRoot} {
catch {file delete -force -- tfa1 tfa2}
set s [createfile tfa1]
set s2 [createfile tfa2 q]
@@ -1897,7 +1947,7 @@ test fCmd-22.1 { TclpRenameFile : rename and overwrite in a single dir } {
set result
} {1}
-test fCmd-22.2 { TclpRenameFile : attempt to overwrite itself } {macOrUnix} {
+test fCmd-22.2 {TclpRenameFile: attempt to overwrite itself} {macOrUnix notRoot} {
catch {file delete -force -- tfa1}
set s [createfile tfa1]
file rename -force tfa1 tfa1
@@ -1906,7 +1956,7 @@ test fCmd-22.2 { TclpRenameFile : attempt to overwrite itself } {macOrUnix} {
set result
} {1}
-test fCmd-22.3 { TclpRenameFile : rename dir to existing dir } {
+test fCmd-22.3 { TclpRenameFile : rename dir to existing dir } {notRoot} {
catch {file delete -force -- d1 tfad}
file mkdir d1 [file join tfad d1]
set r1 [catch {file rename d1 tfad}]
@@ -1915,7 +1965,7 @@ test fCmd-22.3 { TclpRenameFile : rename dir to existing dir } {
set result
} {1}
-test fCmd-22.4 { TclpRenameFile : rename dir to dir several levels deep } {
+test fCmd-22.4 {TclpRenameFile: rename dir to dir several levels deep} {notRoot} {
catch {file delete -force -- d1 tfad}
file mkdir d1 [file join tfad a b c]
file rename d1 [file join tfad a b c d1]
@@ -1928,7 +1978,7 @@ test fCmd-22.4 { TclpRenameFile : rename dir to dir several levels deep } {
#
# TclMacCopyFile needs to be redone.
#
-test fCmd-22.5 { TclMacCopyFile : copy and overwrite in a single dir } {
+test fCmd-22.5 {TclMacCopyFile: copy and overwrite in a single dir} {notRoot} {
catch {file delete -force -- tfa1 tfa2}
set s [createfile tfa1]
set s2 [createfile tfa2 q]
@@ -1950,7 +2000,7 @@ test fCmd-22.5 { TclMacCopyFile : copy and overwrite in a single dir } {
# Error cases are not covered.
#
-test fCmd-23.1 { TclMacRmdir : trying to remove a nonempty directory } {
+test fCmd-23.1 {TclMacRmdir: trying to remove a nonempty directory} {notRoot} {
catch {file delete -force -- tfad}
file mkdir [file join tfad dir]
@@ -1964,7 +2014,7 @@ test fCmd-23.1 { TclMacRmdir : trying to remove a nonempty directory } {
# TclMacDeleteFile
# Error cases are not covered.
#
-test fCmd-24.1 { TclMacDeleteFile : deleting a normal file } {
+test fCmd-24.1 {TclMacDeleteFile: deleting a normal file} {notRoot} {
catch {file delete -force -- tfa1}
createfile tfa1
@@ -1976,7 +2026,8 @@ test fCmd-24.1 { TclMacDeleteFile : deleting a normal file } {
# TclMacCopyDirectory
# Error cases are not covered.
#
-test fCmd-25.1 { TclMacCopyDirectory : copying a normal directory} {notFileSharing} {
+test fCmd-25.1 { TclMacCopyDirectory : copying a normal directory} \
+ {notRoot notFileSharing} {
catch {file delete -force -- tfad1 tfad2}
file mkdir [file join tfad1 a b c]
@@ -1986,7 +2037,8 @@ test fCmd-25.1 { TclMacCopyDirectory : copying a normal directory} {notFileShari
set result
} {1}
-test fCmd-25.2 { TclMacCopyDirectory : copying a short path normal directory} {notFileSharing} {
+test fCmd-25.2 { TclMacCopyDirectory : copying a short path normal directory} \
+ {notRoot notFileSharing} {
catch {file delete -force -- tfad1 tfad2}
file mkdir tfad1
@@ -1996,7 +2048,8 @@ test fCmd-25.2 { TclMacCopyDirectory : copying a short path normal directory} {n
set result
} {1}
-test fCmd-25.3 { TclMacCopyDirectory : copying dirs between different dirs} {notFileSharing} {
+test fCmd-25.3 { TclMacCopyDirectory : copying dirs between different dirs} \
+ {notRoot notFileSharing} {
catch {file delete -force -- tfad1 tfad2}
file mkdir [file join tfad1 x y z]
@@ -2011,7 +2064,7 @@ test fCmd-25.3 { TclMacCopyDirectory : copying dirs between different dirs} {not
# Functionality tests for TclDeleteFilesCmd
#
-test fCmd-26.1 { TclDeleteFilesCmd : delete symlink} {unixOnly} {
+test fCmd-26.1 { TclDeleteFilesCmd : delete symlink} {unixOnly notRoot} {
catch {file delete -force -- tfad1 tfad2}
file mkdir tfad1
@@ -2026,7 +2079,7 @@ test fCmd-26.1 { TclDeleteFilesCmd : delete symlink} {unixOnly} {
set result
} {1}
-test fCmd-26.2 { TclDeleteFilesCmd : delete dir with symlink} {unixOnly} {
+test fCmd-26.2 { TclDeleteFilesCmd : delete dir with symlink} {unixOnly notRoot} {
catch {file delete -force -- tfad1 tfad2}
file mkdir tfad1
@@ -2042,7 +2095,7 @@ test fCmd-26.2 { TclDeleteFilesCmd : delete dir with symlink} {unixOnly} {
set result
} {1}
-test fCmd-26.3 { TclDeleteFilesCmd : delete dangling symlink} {unixOnly} {
+test fCmd-26.3 { TclDeleteFilesCmd : delete dangling symlink} {unixOnly notRoot} {
catch {file delete -force -- tfad1 tfad2}
file mkdir tfad1
@@ -2057,13 +2110,10 @@ test fCmd-26.3 { TclDeleteFilesCmd : delete dangling symlink} {unixOnly} {
set result
} {1}
-test fCmd-27.1 {TclFileAttrsCmd - wrong # args} {
- list [catch {file attributes a b c d} msg] $msg
-} {1 {wrong # args: must be "file attributes name ?option? ?value? ?option value? ..."}}
test fCmd-27.2 {TclFileAttrsCmd - Tcl_TranslateFileName fails} {
testsetplatform unix
- list [catch {file attributes ~_bad_user} msg] $msg [testsetplatform $platform]
-} {1 {user "_bad_user" doesn't exist} {}}
+ list [catch {file attributes ~_totally_bogus_user} msg] $msg [testsetplatform $platform]
+} {1 {user "_totally_bogus_user" doesn't exist} {}}
test fCmd-27.3 {TclFileAttrsCmd - all attributes} {
catch {file delete -force -- foo.tmp}
createfile foo.tmp
@@ -2076,27 +2126,46 @@ test fCmd-27.4 {TclFileAttrsCmd - getting one option} {
list [catch {eval file attributes foo.tmp [lindex $attrs 0]}] [file delete -force -- foo.tmp]
} {0 {}}
-set testConfig(tclGroup) 0
-if {($tcl_platform(platform) == "macintosh") \
- || ($tcl_platform(platform) == "windows")} {
- set testConfig(tclGroup) 1
-} elseif {[catch {exec {groups}} groupList] == 0} {
- if {[lsearch $groupList tcl] != -1} {
- set testConfig(tclGroup) 1
+# Find a group that exists on this Unix system, or else skip tests that
+# require Unix groups.
+if {$tcl_platform(platform) == "unix"} {
+ set ::tcltest::testConstraints(foundGroup) 0
+ catch {
+ set groupList [exec groups]
+ set group [lindex $groupList 0]
+ set ::tcltest::testConstraints(foundGroup) 1
}
+} else {
+ set ::tcltest::testConstraints(foundGroup) 1
}
-test fCmd-27.5 {TclFileAttrsCmd - setting one option} {tclGroup} {
+test fCmd-27.5 {TclFileAttrsCmd - setting one option} {foundGroup} {
catch {file delete -force -- foo.tmp}
createfile foo.tmp
set attrs [file attributes foo.tmp]
list [catch {eval file attributes foo.tmp [lrange $attrs 0 1]} msg] $msg [file delete -force -- foo.tmp]
} {0 {} {}}
-test fCmd-27.6 {TclFileAttrsCmd - setting more than one option} {tclGroup} {
+test fCmd-27.6 {TclFileAttrsCmd - setting more than one option} {foundGroup} {
catch {file delete -force -- foo.tmp}
createfile foo.tmp
set attrs [file attributes foo.tmp]
list [catch {eval file attributes foo.tmp [lrange $attrs 0 3]} msg] $msg [file delete -force -- foo.tmp]
} {0 {} {}}
+# cleanup
cleanup
+::tcltest::cleanupTests
+return
+
+
+
+
+
+
+
+
+
+
+
+
+