os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/winFCmd.test
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/winFCmd.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1109 @@
1.4 +# This file tests the tclWinFCmd.c file.
1.5 +#
1.6 +# This file contains a collection of tests for one or more of the Tcl
1.7 +# built-in commands. Sourcing this file into Tcl runs the tests and
1.8 +# generates output for errors. No output means no errors were found.
1.9 +#
1.10 +# Copyright (c) 1996-1997 Sun Microsystems, Inc.
1.11 +# Copyright (c) 1998-1999 by Scriptics Corporation.
1.12 +#
1.13 +# See the file "license.terms" for information on usage and redistribution
1.14 +# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1.15 +#
1.16 +# RCS: @(#) $Id: winFCmd.test,v 1.20.2.9 2006/03/19 22:47:30 vincentdarley Exp $
1.17 +#
1.18 +
1.19 +if {[lsearch [namespace children] ::tcltest] == -1} {
1.20 + package require tcltest
1.21 + namespace import -force ::tcltest::*
1.22 +}
1.23 +
1.24 +proc createfile {file {string a}} {
1.25 + set f [open $file w]
1.26 + puts -nonewline $f $string
1.27 + close $f
1.28 + return $string
1.29 +}
1.30 +
1.31 +proc contents {file} {
1.32 + set f [open $file r]
1.33 + set r [read $f]
1.34 + close $f
1.35 + set r
1.36 +}
1.37 +
1.38 +proc cleanup {args} {
1.39 + foreach p ". $args" {
1.40 + set x ""
1.41 + catch {
1.42 + set x [glob -directory $p tf* td*]
1.43 + }
1.44 + if {$x != ""} {
1.45 + catch {eval file delete -force -- $x}
1.46 + }
1.47 + }
1.48 +}
1.49 +
1.50 +if {[string equal $tcl_platform(platform) "windows"]} {
1.51 + if {[string equal $tcl_platform(os) "Windows NT"] \
1.52 + && [string equal [string index $tcl_platform(osVersion) 0] "5"]} {
1.53 + tcltest::testConstraint win2000orXP 1
1.54 + tcltest::testConstraint winOlderThan2000 0
1.55 + } else {
1.56 + tcltest::testConstraint win2000orXP 0
1.57 + tcltest::testConstraint winOlderThan2000 1
1.58 + }
1.59 +} else {
1.60 + tcltest::testConstraint win2000orXP 0
1.61 + tcltest::testConstraint winOlderThan2000 0
1.62 +}
1.63 +
1.64 +set ::tcltest::testConstraints(cdrom) 0
1.65 +set ::tcltest::testConstraints(exdev) 0
1.66 +
1.67 +# find a CD-ROM so we can test read-only filesystems.
1.68 +
1.69 +set cdrom {}
1.70 +if { [info commands ::testvolumetype] ne {} } {
1.71 + 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} {
1.72 + if { ! [catch { testvolumetype ${p}: } result] && $result eq {CDFS} } {
1.73 + set cdrom ${p}:
1.74 + }
1.75 + }
1.76 +}
1.77 +
1.78 +proc findfile {dir} {
1.79 + foreach p [glob $dir/*] {
1.80 + if {[file type $p] == "file"} {
1.81 + return $p
1.82 + }
1.83 + }
1.84 + foreach p [glob $dir/*] {
1.85 + if {[file type $p] == "directory"} {
1.86 + set f [findfile $p]
1.87 + if {$f != ""} {
1.88 + return $f
1.89 + }
1.90 + }
1.91 + }
1.92 + return ""
1.93 +}
1.94 +
1.95 +if {$cdrom != ""} {
1.96 + set ::tcltest::testConstraints(cdrom) 1
1.97 + set cdfile [findfile $cdrom]
1.98 +}
1.99 +
1.100 +if {[file exists c:/] && [file exists d:/]} {
1.101 + catch {file delete d:/tf1}
1.102 + if {[catch {close [open d:/tf1 w]}] == 0} {
1.103 + file delete d:/tf1
1.104 + set ::tcltest::testConstraints(exdev) 1
1.105 + }
1.106 +}
1.107 +
1.108 +file delete -force -- td1
1.109 +set foo [catch {open td1 w} testfile]
1.110 +if {$foo} {
1.111 + set ::tcltest::testConstraints(longFileNames) 0
1.112 +} else {
1.113 + close $testfile
1.114 + set ::tcltest::testConstraints(longFileNames) 1
1.115 + file delete -force -- td1
1.116 +}
1.117 +
1.118 +# A really long file name
1.119 +# length of longname is 1216 chars, which should be greater than any static
1.120 +# buffer or allowable filename.
1.121 +
1.122 +set longname "abcdefghihjllmnopqrstuvwxyz01234567890"
1.123 +append longname $longname
1.124 +append longname $longname
1.125 +append longname $longname
1.126 +append longname $longname
1.127 +append longname $longname
1.128 +
1.129 +# Uses the "testfile" command instead of the "file" command. The "file"
1.130 +# command provides several layers of sanity checks on the arguments and
1.131 +# it can be difficult to actually forward "insane" arguments to the
1.132 +# low-level posix emulation layer.
1.133 +
1.134 +test winFCmd-1.1 {TclpRenameFile: errno: EACCES} {pcOnly cdrom} {
1.135 + list [catch {testfile mv $cdfile $cdrom/dummy~~.fil} msg] $msg
1.136 +} {1 EACCES}
1.137 +test winFCmd-1.2 {TclpRenameFile: errno: EEXIST} {pcOnly} {
1.138 + cleanup
1.139 + file mkdir td1/td2/td3
1.140 + file mkdir td2
1.141 + list [catch {testfile mv td2 td1/td2} msg] $msg
1.142 +} {1 EEXIST}
1.143 +test winFCmd-1.3 {TclpRenameFile: errno: EINVAL} {pcOnly} {
1.144 + cleanup
1.145 + list [catch {testfile mv / td1} msg] $msg
1.146 +} {1 EINVAL}
1.147 +test winFCmd-1.4 {TclpRenameFile: errno: EINVAL} {pcOnly} {
1.148 + cleanup
1.149 + file mkdir td1
1.150 + list [catch {testfile mv td1 td1/td2} msg] $msg
1.151 +} {1 EINVAL}
1.152 +test winFCmd-1.5 {TclpRenameFile: errno: EISDIR} {pcOnly} {
1.153 + cleanup
1.154 + file mkdir td1
1.155 + createfile tf1
1.156 + list [catch {testfile mv tf1 td1} msg] $msg
1.157 +} {1 EISDIR}
1.158 +test winFCmd-1.6 {TclpRenameFile: errno: ENOENT} {pcOnly} {
1.159 + cleanup
1.160 + list [catch {testfile mv tf1 tf2} msg] $msg
1.161 +} {1 ENOENT}
1.162 +test winFCmd-1.7 {TclpRenameFile: errno: ENOENT} {pcOnly} {
1.163 + cleanup
1.164 + list [catch {testfile mv "" tf2} msg] $msg
1.165 +} {1 ENOENT}
1.166 +test winFCmd-1.8 {TclpRenameFile: errno: ENOENT} {pcOnly} {
1.167 + cleanup
1.168 + createfile tf1
1.169 + list [catch {testfile mv tf1 ""} msg] $msg
1.170 +} {1 ENOENT}
1.171 +test winFCmd-1.9 {TclpRenameFile: errno: ENOTDIR} {pcOnly} {
1.172 + cleanup
1.173 + file mkdir td1
1.174 + createfile tf1
1.175 + list [catch {testfile mv td1 tf1} msg] $msg
1.176 +} {1 ENOTDIR}
1.177 +test winFCmd-1.10 {TclpRenameFile: errno: EXDEV} {pcOnly exdev} {
1.178 + file delete -force d:/tf1
1.179 + file mkdir c:/tf1
1.180 + set msg [list [catch {testfile mv c:/tf1 d:/tf1} msg] $msg]
1.181 + file delete -force c:/tf1
1.182 + set msg
1.183 +} {1 EXDEV}
1.184 +test winFCmd-1.11 {TclpRenameFile: errno: EACCES} {pcOnly} {
1.185 + cleanup
1.186 + set fd [open tf1 w]
1.187 + set msg [list [catch {testfile mv tf1 tf2} msg] $msg]
1.188 + close $fd
1.189 + set msg
1.190 +} {1 EACCES}
1.191 +test winFCmd-1.12 {TclpRenameFile: errno: EACCES} {pcOnly} {
1.192 + cleanup
1.193 + createfile tf1
1.194 + set fd [open tf2 w]
1.195 + set msg [list [catch {testfile mv tf1 tf2} msg] $msg]
1.196 + close $fd
1.197 + set msg
1.198 +} {1 EACCES}
1.199 +test winFCmd-1.13 {TclpRenameFile: errno: EACCES} {pcOnly win2000orXP} {
1.200 + cleanup
1.201 + list [catch {testfile mv nul tf1} msg] $msg
1.202 +} {1 EINVAL}
1.203 +test winFCmd-1.13.1 {TclpRenameFile: errno: EACCES} {pcOnly winOlderThan2000} {
1.204 + cleanup
1.205 + list [catch {testfile mv nul tf1} msg] $msg
1.206 +} {1 EACCES}
1.207 +test winFCmd-1.14 {TclpRenameFile: errno: EACCES} {pcOnly 95} {
1.208 + cleanup
1.209 + createfile tf1
1.210 + list [catch {testfile mv tf1 nul} msg] $msg
1.211 +} {1 EACCES}
1.212 +test winFCmd-1.15 {TclpRenameFile: errno: EEXIST} {pcOnly nt} {
1.213 + cleanup
1.214 + createfile tf1
1.215 + list [catch {testfile mv tf1 nul} msg] $msg
1.216 +} {1 EEXIST}
1.217 +test winFCmd-1.16 {TclpRenameFile: MoveFile() != FALSE} {pcOnly} {
1.218 + cleanup
1.219 + createfile tf1 tf1
1.220 + testfile mv tf1 tf2
1.221 + list [file exists tf1] [contents tf2]
1.222 +} {0 tf1}
1.223 +test winFCmd-1.17 {TclpRenameFile: MoveFile() == FALSE} {pcOnly} {
1.224 + cleanup
1.225 + list [catch {testfile mv tf1 tf2} msg] $msg
1.226 +} {1 ENOENT}
1.227 +test winFCmd-1.18 {TclpRenameFile: srcAttr == -1} {pcOnly} {
1.228 + cleanup
1.229 + list [catch {testfile mv tf1 tf2} msg] $msg
1.230 +} {1 ENOENT}
1.231 +test winFCmd-1.19 {TclpRenameFile: errno == EACCES} {pcOnly win2000orXP} {
1.232 + cleanup
1.233 + list [catch {testfile mv nul tf1} msg] $msg
1.234 +} {1 EINVAL}
1.235 +test winFCmd-1.19.1 {TclpRenameFile: errno == EACCES} {pcOnly winOlderThan2000} {
1.236 + cleanup
1.237 + list [catch {testfile mv nul tf1} msg] $msg
1.238 +} {1 EACCES}
1.239 +test winFCmd-1.20 {TclpRenameFile: src is dir} {pcOnly nt} {
1.240 + # under 95, this would actually succeed and move the current dir out from
1.241 + # under the current process!
1.242 + cleanup
1.243 + file delete /tf1
1.244 + list [catch {testfile mv [pwd] /tf1} msg] $msg
1.245 +} {1 EACCES}
1.246 +test winFCmd-1.21 {TclpRenameFile: long src} {pcOnly} {
1.247 + cleanup
1.248 + list [catch {testfile mv $longname tf1} msg] $msg
1.249 +} {1 ENAMETOOLONG}
1.250 +test winFCmd-1.22 {TclpRenameFile: long dst} {pcOnly} {
1.251 + cleanup
1.252 + createfile tf1
1.253 + list [catch {testfile mv tf1 $longname} msg] $msg
1.254 +} {1 ENAMETOOLONG}
1.255 +test winFCmd-1.23 {TclpRenameFile: move dir into self} {pcOnly} {
1.256 + cleanup
1.257 + file mkdir td1
1.258 + list [catch {testfile mv [pwd]/td1 td1/td2} msg] $msg
1.259 +} {1 EINVAL}
1.260 +test winFCmd-1.24 {TclpRenameFile: move a root dir} {pcOnly} {
1.261 + cleanup
1.262 + list [catch {testfile mv / c:/} msg] $msg
1.263 +} {1 EINVAL}
1.264 +test winFCmd-1.25 {TclpRenameFile: cross file systems} {pcOnly cdrom} {
1.265 + cleanup
1.266 + file mkdir td1
1.267 + list [catch {testfile mv td1 $cdrom/td1} msg] $msg
1.268 +} {1 EXDEV}
1.269 +test winFCmd-1.26 {TclpRenameFile: readonly fs} {pcOnly cdrom} {
1.270 + cleanup
1.271 + list [catch {testfile mv $cdfile $cdrom/dummy~~.fil} msg] $msg
1.272 +} {1 EACCES}
1.273 +test winFCmd-1.27 {TclpRenameFile: open file} {pcOnly} {
1.274 + cleanup
1.275 + set fd [open tf1 w]
1.276 + set msg [list [catch {testfile mv tf1 tf2} msg] $msg]
1.277 + close $fd
1.278 + set msg
1.279 +} {1 EACCES}
1.280 +test winFCmd-1.28 {TclpRenameFile: errno == EEXIST} {pcOnly} {
1.281 + cleanup
1.282 + createfile tf1
1.283 + createfile tf2
1.284 + testfile mv tf1 tf2
1.285 + list [file exists tf1] [file exists tf2]
1.286 +} {0 1}
1.287 +test winFCmd-1.29 {TclpRenameFile: src is dir} {pcOnly} {
1.288 + cleanup
1.289 + file mkdir td1
1.290 + createfile tf1
1.291 + list [catch {testfile mv td1 tf1} msg] $msg
1.292 +} {1 ENOTDIR}
1.293 +test winFCmd-1.30 {TclpRenameFile: dst is dir} {pcOnly} {
1.294 + cleanup
1.295 + file mkdir td1
1.296 + file mkdir td2/td2
1.297 + list [catch {testfile mv td1 td2} msg] $msg
1.298 +} {1 EEXIST}
1.299 +test winFCmd-1.31 {TclpRenameFile: TclpRemoveDirectory fails} {pcOnly} {
1.300 + cleanup
1.301 + file mkdir td1
1.302 + file mkdir td2/td2
1.303 + list [catch {testfile mv td1 td2} msg] $msg
1.304 +} {1 EEXIST}
1.305 +test winFCmd-1.32 {TclpRenameFile: TclpRemoveDirectory succeeds} {pcOnly} {
1.306 + cleanup
1.307 + file mkdir td1/td2
1.308 + file mkdir td2
1.309 + testfile mv td1 td2
1.310 + list [file exists td1] [file exists td2] [file exists td2/td2]
1.311 +} {0 1 1}
1.312 +test winFCmd-1.33 {TclpRenameFile: After removing dst dir, MoveFile fails} \
1.313 + {pcOnly exdev} {
1.314 + file mkdir d:/td1
1.315 + testchmod 000 d:/td1
1.316 + file mkdir c:/tf1
1.317 + set msg [list [catch {testfile mv c:/tf1 d:/td1} msg] $msg]
1.318 + set msg "$msg [file writable d:/td1]"
1.319 + file delete d:/td1
1.320 + file delete -force c:/tf1
1.321 + set msg
1.322 +} {1 EXDEV 0}
1.323 +test winFCmd-1.34 {TclpRenameFile: src is dir, dst is not} {pcOnly} {
1.324 + file mkdir td1
1.325 + createfile tf1
1.326 + list [catch {testfile mv td1 tf1} msg] $msg
1.327 +} {1 ENOTDIR}
1.328 +test winFCmd-1.35 {TclpRenameFile: src is not dir, dst is} {pcOnly} {
1.329 + file mkdir td1
1.330 + createfile tf1
1.331 + list [catch {testfile mv tf1 td1} msg] $msg
1.332 +} {1 EISDIR}
1.333 +test winFCmd-1.36 {TclpRenameFile: src and dst not dir} {pcOnly} {
1.334 + createfile tf1 tf1
1.335 + createfile tf2 tf2
1.336 + testfile mv tf1 tf2
1.337 + contents tf2
1.338 +} {tf1}
1.339 +test winFCmd-1.37 {TclpRenameFile: need to restore temp file} {pcOnly} {
1.340 + # Can't figure out how to cause this.
1.341 + # Need a file that can't be copied.
1.342 +} {}
1.343 +
1.344 +test winFCmd-2.1 {TclpCopyFile: errno: EACCES} {pcOnly cdrom} {
1.345 + cleanup
1.346 + list [catch {testfile cp $cdfile $cdrom/dummy~~.fil} msg] $msg
1.347 +} {1 EACCES}
1.348 +test winFCmd-2.2 {TclpCopyFile: errno: EISDIR} {pcOnly} {
1.349 + cleanup
1.350 + file mkdir td1
1.351 + list [catch {testfile cp td1 tf1} msg] $msg
1.352 +} {1 EISDIR}
1.353 +test winFCmd-2.3 {TclpCopyFile: errno: EISDIR} {pcOnly} {
1.354 + cleanup
1.355 + createfile tf1
1.356 + file mkdir td1
1.357 + list [catch {testfile cp tf1 td1} msg] $msg
1.358 +} {1 EISDIR}
1.359 +test winFCmd-2.4 {TclpCopyFile: errno: ENOENT} {pcOnly} {
1.360 + cleanup
1.361 + list [catch {testfile cp tf1 tf2} msg] $msg
1.362 +} {1 ENOENT}
1.363 +test winFCmd-2.5 {TclpCopyFile: errno: ENOENT} {pcOnly} {
1.364 + cleanup
1.365 + list [catch {testfile cp "" tf2} msg] $msg
1.366 +} {1 ENOENT}
1.367 +test winFCmd-2.6 {TclpCopyFile: errno: ENOENT} {pcOnly} {
1.368 + cleanup
1.369 + createfile tf1
1.370 + list [catch {testfile cp tf1 ""} msg] $msg
1.371 +} {1 ENOENT}
1.372 +test winFCmd-2.7 {TclpCopyFile: errno: EACCES} {pcOnly 95} {
1.373 + cleanup
1.374 + createfile tf1
1.375 + set fd [open tf2 w]
1.376 + set msg [list [catch {testfile cp tf1 tf2} msg] $msg]
1.377 + close $fd
1.378 + set msg
1.379 +} {1 EACCES}
1.380 +test winFCmd-2.8 {TclpCopyFile: errno: EACCES} {pcOnly win2000orXP} {
1.381 + cleanup
1.382 + list [catch {testfile cp nul tf1} msg] $msg
1.383 +} {1 EINVAL}
1.384 +test winFCmd-2.8.1 {TclpCopyFile: errno: EACCES} {pcOnly nt winOlderThan2000} {
1.385 + cleanup
1.386 + list [catch {testfile cp nul tf1} msg] $msg
1.387 +} {1 EACCES}
1.388 +test winFCmd-2.9 {TclpCopyFile: errno: ENOENT} {pcOnly 95} {
1.389 + cleanup
1.390 + list [catch {testfile cp nul tf1} msg] $msg
1.391 +} {1 ENOENT}
1.392 +test winFCmd-2.10 {TclpCopyFile: CopyFile succeeds} {pcOnly} {
1.393 + cleanup
1.394 + createfile tf1 tf1
1.395 + testfile cp tf1 tf2
1.396 + list [contents tf1] [contents tf2]
1.397 +} {tf1 tf1}
1.398 +test winFCmd-2.11 {TclpCopyFile: CopyFile succeeds} {pcOnly} {
1.399 + cleanup
1.400 + createfile tf1 tf1
1.401 + createfile tf2 tf2
1.402 + testfile cp tf1 tf2
1.403 + list [contents tf1] [contents tf2]
1.404 +} {tf1 tf1}
1.405 +test winFCmd-2.12 {TclpCopyFile: CopyFile succeeds} {pcOnly} {
1.406 + cleanup
1.407 + createfile tf1 tf1
1.408 + testchmod 000 tf1
1.409 + testfile cp tf1 tf2
1.410 + list [contents tf2] [file writable tf2]
1.411 +} {tf1 0}
1.412 +test winFCmd-2.13 {TclpCopyFile: CopyFile fails} {pcOnly} {
1.413 + cleanup
1.414 + createfile tf1
1.415 + file mkdir td1
1.416 + list [catch {testfile cp tf1 td1} msg] $msg
1.417 +} {1 EISDIR}
1.418 +test winFCmd-2.14 {TclpCopyFile: errno == EACCES} {pcOnly} {
1.419 + cleanup
1.420 + file mkdir td1
1.421 + list [catch {testfile cp td1 tf1} msg] $msg
1.422 +} {1 EISDIR}
1.423 +test winFCmd-2.15 {TclpCopyFile: src is directory} {pcOnly} {
1.424 + cleanup
1.425 + file mkdir td1
1.426 + list [catch {testfile cp td1 tf1} msg] $msg
1.427 +} {1 EISDIR}
1.428 +test winFCmd-2.16 {TclpCopyFile: dst is directory} {pcOnly} {
1.429 + cleanup
1.430 + createfile tf1
1.431 + file mkdir td1
1.432 + list [catch {testfile cp tf1 td1} msg] $msg
1.433 +} {1 EISDIR}
1.434 +test winFCmd-2.17 {TclpCopyFile: dst is readonly} {pcOnly} {
1.435 + cleanup
1.436 + createfile tf1 tf1
1.437 + createfile tf2 tf2
1.438 + testchmod 000 tf2
1.439 + testfile cp tf1 tf2
1.440 + list [file writable tf2] [contents tf2]
1.441 +} {1 tf1}
1.442 +test winFCmd-2.18 {TclpCopyFile: still can't copy onto dst} {pcOnly 95} {
1.443 + cleanup
1.444 + createfile tf1
1.445 + createfile tf2
1.446 + testchmod 000 tf2
1.447 + set fd [open tf2]
1.448 + set msg [list [catch {testfile cp tf1 tf2} msg] $msg]
1.449 + close $fd
1.450 + set msg "$msg [file writable tf2]"
1.451 +} {1 EACCES 0}
1.452 +
1.453 +test winFCmd-3.1 {TclpDeleteFile: errno: EACCES} {pcOnly cdrom} {
1.454 + list [catch {testfile rm $cdfile $cdrom/dummy~~.fil} msg] $msg
1.455 +} {1 EACCES}
1.456 +test winFCmd-3.2 {TclpDeleteFile: errno: EISDIR} {pcOnly} {
1.457 + cleanup
1.458 + file mkdir td1
1.459 + list [catch {testfile rm td1} msg] $msg
1.460 +} {1 EISDIR}
1.461 +test winFCmd-3.3 {TclpDeleteFile: errno: ENOENT} {pcOnly} {
1.462 + cleanup
1.463 + list [catch {testfile rm tf1} msg] $msg
1.464 +} {1 ENOENT}
1.465 +test winFCmd-3.4 {TclpDeleteFile: errno: ENOENT} {pcOnly} {
1.466 + cleanup
1.467 + list [catch {testfile rm ""} msg] $msg
1.468 +} {1 ENOENT}
1.469 +test winFCmd-3.5 {TclpDeleteFile: errno: EACCES} {pcOnly} {
1.470 + cleanup
1.471 + set fd [open tf1 w]
1.472 + set msg [list [catch {testfile rm tf1} msg] $msg]
1.473 + close $fd
1.474 + set msg
1.475 +} {1 EACCES}
1.476 +test winFCmd-3.6 {TclpDeleteFile: errno: EACCES} {pcOnly} {
1.477 + cleanup
1.478 + list [catch {testfile rm nul} msg] $msg
1.479 +} {1 EACCES}
1.480 +test winFCmd-3.7 {TclpDeleteFile: DeleteFile succeeds} {pcOnly} {
1.481 + cleanup
1.482 + createfile tf1
1.483 + testfile rm tf1
1.484 + file exists tf1
1.485 +} {0}
1.486 +test winFCmd-3.8 {TclpDeleteFile: DeleteFile fails} {pcOnly} {
1.487 + cleanup
1.488 + file mkdir td1
1.489 + list [catch {testfile rm td1} msg] $msg
1.490 +} {1 EISDIR}
1.491 +test winFCmd-3.9 {TclpDeleteFile: errno == EACCES} {pcOnly} {
1.492 + cleanup
1.493 + set fd [open tf1 w]
1.494 + set msg [list [catch {testfile rm tf1} msg] $msg]
1.495 + close $fd
1.496 + set msg
1.497 +} {1 EACCES}
1.498 +test winFCmd-3.10 {TclpDeleteFile: path is readonly} {pcOnly} {
1.499 + cleanup
1.500 + createfile tf1
1.501 + testchmod 000 tf1
1.502 + testfile rm tf1
1.503 + file exists tf1
1.504 +} {0}
1.505 +test winFCmd-3.11 {TclpDeleteFile: still can't remove path} {pcOnly} {
1.506 + cleanup
1.507 + set fd [open tf1 w]
1.508 + testchmod 000 tf1
1.509 + set msg [list [catch {testfile rm tf1} msg] $msg]
1.510 + close $fd
1.511 + set msg
1.512 +} {1 EACCES}
1.513 +
1.514 +test winFCmd-4.1 {TclpCreateDirectory: errno: EACCES} {pcOnly nt cdrom} {
1.515 + list [catch {testfile mkdir $cdrom/dummy~~.dir} msg] $msg
1.516 +} {1 EACCES}
1.517 +test winFCmd-4.2 {TclpCreateDirectory: errno: EACCES} {pcOnly 95 cdrom} {
1.518 + list [catch {testfile mkdir $cdrom/dummy~~.dir} msg] $msg
1.519 +} {1 ENOSPC}
1.520 +test winFCmd-4.3 {TclpCreateDirectory: errno: EEXIST} {pcOnly} {
1.521 + cleanup
1.522 + file mkdir td1
1.523 + list [catch {testfile mkdir td1} msg] $msg
1.524 +} {1 EEXIST}
1.525 +test winFCmd-4.4 {TclpCreateDirectory: errno: ENOENT} {pcOnly} {
1.526 + cleanup
1.527 + list [catch {testfile mkdir td1/td2} msg] $msg
1.528 +} {1 ENOENT}
1.529 +test winFCmd-4.5 {TclpCreateDirectory: CreateDirectory succeeds} {pcOnly} {
1.530 + cleanup
1.531 + testfile mkdir td1
1.532 + file type td1
1.533 +} {directory}
1.534 +
1.535 +test winFCmd-5.1 {TclpCopyDirectory: calls TraverseWinTree} {pcOnly} {
1.536 + cleanup
1.537 + file mkdir td1
1.538 + testfile cpdir td1 td2
1.539 + list [file type td1] [file type td2]
1.540 +} {directory directory}
1.541 +
1.542 +test winFCmd-6.1 {TclpRemoveDirectory: errno: EACCES} {pcOnly} {
1.543 + cleanup
1.544 + file mkdir td1
1.545 + testchmod 000 td1
1.546 + testfile rmdir td1
1.547 + file exists td1
1.548 +} {0}
1.549 +test winFCmd-6.2 {TclpRemoveDirectory: errno: EEXIST} {pcOnly} {
1.550 + cleanup
1.551 + file mkdir td1/td2
1.552 + list [catch {testfile rmdir td1} msg] [file tail $msg]
1.553 +} {1 {td1 EEXIST}}
1.554 +test winFCmd-6.3 {TclpRemoveDirectory: errno: EACCES} {pcOnly} {
1.555 + # can't test this w/o removing everything on your hard disk first!
1.556 + # testfile rmdir /
1.557 +} {}
1.558 +test winFCmd-6.4 {TclpRemoveDirectory: errno: ENOENT} {pcOnly} {
1.559 + cleanup
1.560 + list [catch {testfile rmdir td1} msg] [file tail $msg]
1.561 +} {1 {td1 ENOENT}}
1.562 +test winFCmd-6.5 {TclpRemoveDirectory: errno: ENOENT} {pcOnly} {
1.563 + cleanup
1.564 + list [catch {testfile rmdir ""} msg] $msg
1.565 +} {1 ENOENT}
1.566 +test winFCmd-6.6 {TclpRemoveDirectory: errno: ENOTDIR} {pcOnly} {
1.567 + cleanup
1.568 + createfile tf1
1.569 + list [catch {testfile rmdir tf1} msg] [file tail $msg]
1.570 +} {1 {tf1 ENOTDIR}}
1.571 +test winFCmd-6.7 {TclpRemoveDirectory: RemoveDirectory succeeds} {pcOnly} {
1.572 + cleanup
1.573 + file mkdir td1
1.574 + testfile rmdir td1
1.575 + file exists td1
1.576 +} {0}
1.577 +test winFCmd-6.8 {TclpRemoveDirectory: RemoveDirectory fails} {pcOnly} {
1.578 + cleanup
1.579 + createfile tf1
1.580 + list [catch {testfile rmdir tf1} msg] [file tail $msg]
1.581 +} {1 {tf1 ENOTDIR}}
1.582 +test winFCmd-6.9 {TclpRemoveDirectory: errno == EACCES} {pcOnly} {
1.583 + cleanup
1.584 + file mkdir td1
1.585 + testchmod 000 td1
1.586 + testfile rmdir td1
1.587 + file exists td1
1.588 +} {0}
1.589 +test winFCmd-6.10 {TclpRemoveDirectory: attr == -1} {pcOnly 95} {
1.590 + cleanup
1.591 + list [catch {testfile rmdir nul} msg] $msg
1.592 +} {1 {nul EACCES}}
1.593 +test winFCmd-6.11 {TclpRemoveDirectory: attr == -1} {pcOnly nt} {
1.594 + cleanup
1.595 + set res [list [catch {testfile rmdir /} msg] $msg]
1.596 + # WinXP returns EEXIST, WinNT seems to return EACCES. No policy
1.597 + # decision has been made as to which is correct.
1.598 + regsub {E(ACCES|EXIST)} $res "EACCES or EEXIST" res
1.599 + # Don't mind which drive we're on
1.600 + regsub {[A-Z]:} $res ""
1.601 +} {1 {/ EACCES or EEXIST}}
1.602 +test winFCmd-6.12 {TclpRemoveDirectory: errno == EACCES} {pcOnly 95} {
1.603 + cleanup
1.604 + createfile tf1
1.605 + list [catch {testfile rmdir tf1} msg] $msg
1.606 +} {1 {tf1 ENOTDIR}}
1.607 +test winFCmd-6.13 {TclpRemoveDirectory: write-protected} {pcOnly} {
1.608 + cleanup
1.609 + file mkdir td1
1.610 + testchmod 000 td1
1.611 + testfile rmdir td1
1.612 + file exists td1
1.613 +} {0}
1.614 +test winFCmd-6.14 {TclpRemoveDirectory: check if empty dir} {pcOnly 95} {
1.615 + cleanup
1.616 + file mkdir td1/td2
1.617 + list [catch {testfile rmdir td1} msg] $msg
1.618 +} {1 {td1 EEXIST}}
1.619 +test winFCmd-6.15 {TclpRemoveDirectory: !recursive} {pcOnly} {
1.620 + cleanup
1.621 + file mkdir td1/td2
1.622 + list [catch {testfile rmdir td1} msg] [file tail $msg]
1.623 +} {1 {td1 EEXIST}}
1.624 +test winFCmd-6.16 {TclpRemoveDirectory: recursive, but errno != EEXIST} {pcOnly} {
1.625 + cleanup
1.626 + createfile tf1
1.627 + list [catch {testfile rmdir -force tf1} msg] $msg
1.628 +} {1 {tf1 ENOTDIR}}
1.629 +test winFCmd-6.17 {TclpRemoveDirectory: calls TraverseWinTree} {pcOnly} {
1.630 + cleanup
1.631 + file mkdir td1/td2
1.632 + testfile rmdir -force td1
1.633 + file exists td1
1.634 +} {0}
1.635 +
1.636 +test winFCmd-7.1 {TraverseWinTree: targetPtr == NULL} {pcOnly} {
1.637 + cleanup
1.638 + file mkdir td1/td2/td3
1.639 + testfile rmdir -force td1
1.640 + file exists td1
1.641 +} {0}
1.642 +test winFCmd-7.2 {TraverseWinTree: targetPtr != NULL} {pcOnly} {
1.643 + cleanup
1.644 + file mkdir td1/td2/td3
1.645 + testfile cpdir td1 td2
1.646 + list [file exists td1] [file exists td2]
1.647 +} {1 1}
1.648 +test winFCmd-7.3 {TraverseWinTree: sourceAttr == -1} {pcOnly} {
1.649 + cleanup
1.650 + list [catch {testfile cpdir td1 td2} msg] $msg
1.651 +} {1 {td1 ENOENT}}
1.652 +test winFCmd-7.4 {TraverseWinTree: source isn't directory} {pcOnly} {
1.653 + cleanup
1.654 + file mkdir td1
1.655 + createfile td1/tf1 tf1
1.656 + testfile cpdir td1 td2
1.657 + contents td2/tf1
1.658 +} {tf1}
1.659 +test winFCmd-7.5 {TraverseWinTree: call TraversalCopy: DOTREE_F} {pcOnly} {
1.660 + cleanup
1.661 + file mkdir td1
1.662 + createfile td1/tf1 tf1
1.663 + testfile cpdir td1 td2
1.664 + contents td2/tf1
1.665 +} {tf1}
1.666 +test winFCmd-7.6 {TraverseWinTree: call TraversalDelete: DOTREE_F} {pcOnly} {
1.667 + cleanup
1.668 + file mkdir td1
1.669 + createfile td1/tf1 tf1
1.670 + testfile rmdir -force td1
1.671 + file exists td1
1.672 +} {0}
1.673 +test winFCmd-7.7 {TraverseWinTree: append \ to source if necessary} {pcOnly} {
1.674 + cleanup
1.675 + file mkdir td1
1.676 + createfile td1/tf1 tf1
1.677 + testfile cpdir td1 td2
1.678 + contents td2/tf1
1.679 +} {tf1}
1.680 +test winFCmd-7.8 {TraverseWinTree: append \ to source if necessary} {pcOnly 95 cdrom} {
1.681 + # cdrom can return either d:\ or D:/, but we only care about the errcode
1.682 + list [catch {testfile rmdir $cdrom/} msg] [lindex $msg 1]
1.683 +} {1 EEXIST}
1.684 +test winFCmd-7.9 {TraverseWinTree: append \ to source if necessary} {pcOnly nt cdrom} {
1.685 + list [catch {testfile rmdir $cdrom/} msg] [lindex $msg 1]
1.686 +} {1 EACCES}
1.687 +test winFCmd-7.10 {TraverseWinTree: can't read directory: handle == INVALID} \
1.688 + {pcOnly} {
1.689 + # can't make it happen
1.690 +} {}
1.691 +test winFCmd-7.11 {TraverseWinTree: call TraversalCopy: DOTREE_PRED} {pcOnly} {
1.692 + cleanup
1.693 + file mkdir td1
1.694 + createfile td1/tf1 tf1
1.695 + testchmod 000 td1
1.696 + testfile cpdir td1 td2
1.697 + list [file exists td2] [file writable td2]
1.698 +} {1 1}
1.699 +test winFCmd-7.12 {TraverseWinTree: call TraversalDelete: DOTREE_PRED} {pcOnly} {
1.700 + cleanup
1.701 + file mkdir td1
1.702 + createfile td1/tf1 tf1
1.703 + testfile rmdir -force td1
1.704 + file exists td1
1.705 +} {0}
1.706 +test winFCmd-7.13 {TraverseWinTree: append \ to target if necessary} {pcOnly} {
1.707 + cleanup
1.708 + file mkdir td1
1.709 + createfile td1/tf1 tf1
1.710 + testfile cpdir td1 td2
1.711 + contents td2/tf1
1.712 +} {tf1}
1.713 +test winFCmd-7.14 {TraverseWinTree: append \ to target if necessary} {pcOnly 95} {
1.714 + cleanup
1.715 + file mkdir td1
1.716 + list [catch {testfile cpdir td1 /} msg] $msg
1.717 +} {1 {/ EEXIST}}
1.718 +test winFCmd-7.15 {TraverseWinTree: append \ to target if necessary} {pcOnly nt} {
1.719 + cleanup
1.720 + file mkdir td1
1.721 + list [catch {testfile cpdir td1 /} msg] $msg
1.722 +} {1 {/ EACCES}}
1.723 +test winFCmd-7.16 {TraverseWinTree: recurse on files: no files} {pcOnly} {
1.724 + cleanup
1.725 + file mkdir td1
1.726 + testfile cpdir td1 td2
1.727 +} {}
1.728 +test winFCmd-7.17 {TraverseWinTree: recurse on files: one file} {pcOnly} {
1.729 + cleanup
1.730 + file mkdir td1
1.731 + createfile td1/td2
1.732 + testfile cpdir td1 td2
1.733 + glob td2/*
1.734 +} {td2/td2}
1.735 +test winFCmd-7.18 {TraverseWinTree: recurse on files: several files and dir} \
1.736 + {pcOnly} {
1.737 + cleanup
1.738 + file mkdir td1
1.739 + createfile td1/tf1
1.740 + createfile td1/tf2
1.741 + file mkdir td1/td2/td3
1.742 + createfile td1/tf3
1.743 + createfile td1/tf4
1.744 + testfile cpdir td1 td2
1.745 + lsort [glob td2/*]
1.746 +} {td2/td2 td2/tf1 td2/tf2 td2/tf3 td2/tf4}
1.747 +test winFCmd-7.19 {TraverseWinTree: call TraversalCopy: DOTREE_POSTD} {pcOnly} {
1.748 + cleanup
1.749 + file mkdir td1
1.750 + createfile td1/tf1 tf1
1.751 + testchmod 000 td1
1.752 + testfile cpdir td1 td2
1.753 + list [file exists td2] [file writable td2]
1.754 +} {1 1}
1.755 +test winFCmd-7.20 {TraverseWinTree: call TraversalDelete: DOTREE_POSTD} \
1.756 + {pcOnly} {
1.757 + cleanup
1.758 + file mkdir td1
1.759 + createfile td1/tf1 tf1
1.760 + testfile rmdir -force td1
1.761 + file exists td1
1.762 +} {0}
1.763 +test winFCmd-7.21 {TraverseWinTree: fill errorPtr} {pcOnly} {
1.764 + cleanup
1.765 + list [catch {testfile cpdir td1 td2} msg] $msg
1.766 +} {1 {td1 ENOENT}}
1.767 +
1.768 +test winFCmd-8.1 {TraversalCopy: DOTREE_F} {pcOnly} {
1.769 + cleanup
1.770 + file mkdir td1
1.771 + list [catch {testfile cpdir td1 td1} msg] $msg
1.772 +} {1 {td1 EEXIST}}
1.773 +test winFCmd-8.2 {TraversalCopy: DOTREE_PRED} {pcOnly} {
1.774 + cleanup
1.775 + file mkdir td1/td2
1.776 + testchmod 000 td1
1.777 + testfile cpdir td1 td2
1.778 + list [file writable td1] [file writable td1/td2]
1.779 +} {0 1}
1.780 +test winFCmd-8.3 {TraversalCopy: DOTREE_POSTD} {pcOnly} {
1.781 + cleanup
1.782 + file mkdir td1
1.783 + testfile cpdir td1 td2
1.784 +} {}
1.785 +
1.786 +test winFCmd-9.1 {TraversalDelete: DOTREE_F} {pcOnly} {
1.787 + cleanup
1.788 + file mkdir td1
1.789 + createfile td1/tf1
1.790 + testfile rmdir -force td1
1.791 +} {}
1.792 +test winFCmd-9.2 {TraversalDelete: DOTREE_F} {pcOnly 95} {
1.793 + cleanup
1.794 + file mkdir td1
1.795 + set fd [open td1/tf1 w]
1.796 + set msg [list [catch {testfile rmdir -force td1} msg] $msg]
1.797 + close $fd
1.798 + set msg
1.799 +} {1 {td1\tf1 EACCES}}
1.800 +test winFCmd-9.3 {TraversalDelete: DOTREE_PRED} {pcOnly} {
1.801 + cleanup
1.802 + file mkdir td1/td2
1.803 + testchmod 000 td1
1.804 + testfile rmdir -force td1
1.805 + file exists td1
1.806 +} {0}
1.807 +test winFCmd-9.4 {TraversalDelete: DOTREE_POSTD} {pcOnly} {
1.808 + cleanup
1.809 + file mkdir td1/td1/td3/td4/td5
1.810 + testfile rmdir -force td1
1.811 +} {}
1.812 +
1.813 +test winFCmd-10.1 {AttributesPosixError - get} {pcOnly} {
1.814 + cleanup
1.815 + list [catch {file attributes td1 -archive} msg] $msg
1.816 +} {1 {could not read "td1": no such file or directory}}
1.817 +test winFCmd-10.2 {AttributesPosixError - set} {pcOnly} {
1.818 + cleanup
1.819 + list [catch {file attributes td1 -archive 0} msg] $msg
1.820 +} {1 {could not read "td1": no such file or directory}}
1.821 +
1.822 +test winFCmd-11.1 {GetWinFileAttributes} {pcOnly} {
1.823 + cleanup
1.824 + close [open td1 w]
1.825 + list [catch {file attributes td1 -archive} msg] $msg [cleanup]
1.826 +} {0 1 {}}
1.827 +test winFCmd-11.2 {GetWinFileAttributes} {pcOnly} {
1.828 + cleanup
1.829 + close [open td1 w]
1.830 + list [catch {file attributes td1 -readonly} msg] $msg [cleanup]
1.831 +} {0 0 {}}
1.832 +test winFCmd-11.3 {GetWinFileAttributes} {pcOnly} {
1.833 + cleanup
1.834 + close [open td1 w]
1.835 + list [catch {file attributes td1 -hidden} msg] $msg [cleanup]
1.836 +} {0 0 {}}
1.837 +test winFCmd-11.4 {GetWinFileAttributes} {pcOnly} {
1.838 + cleanup
1.839 + close [open td1 w]
1.840 + list [catch {file attributes td1 -system} msg] $msg [cleanup]
1.841 +} {0 0 {}}
1.842 +test winFCmd-11.5 {GetWinFileAttributes} {pcOnly} {
1.843 + # attr of relative paths that resolve to root was failing
1.844 + # don't care about answer, just that test runs.
1.845 +
1.846 + set old [pwd]
1.847 + cd c:/
1.848 + file attr c:
1.849 + file attr c:.
1.850 + file attr .
1.851 + cd $old
1.852 +} {}
1.853 +test winFCmd-11.6 {GetWinFileAttributes} {pcOnly} {
1.854 + file attr c:/ -hidden
1.855 +} {0}
1.856 +
1.857 +test winFCmd-12.1 {ConvertFileNameFormat} {pcOnly} {
1.858 + cleanup
1.859 + close [open td1 w]
1.860 + list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]
1.861 +} {0 td1 {}}
1.862 +test winFCmd-12.2 {ConvertFileNameFormat} {pcOnly} {
1.863 + cleanup
1.864 + file mkdir td1
1.865 + close [open td1/td1 w]
1.866 + list [catch {string tolower [file attributes td1/td1 -longname]} msg] $msg [cleanup]
1.867 +} {0 td1/td1 {}}
1.868 +test winFCmd-12.3 {ConvertFileNameFormat} {pcOnly} {
1.869 + cleanup
1.870 + file mkdir td1
1.871 + file mkdir td1/td2
1.872 + close [open td1/td3 w]
1.873 + list [catch {string tolower [file attributes td1/td2/../td3 -longname]} msg] $msg [cleanup]
1.874 +} {0 td1/td2/../td3 {}}
1.875 +test winFCmd-12.4 {ConvertFileNameFormat} {pcOnly} {
1.876 + cleanup
1.877 + close [open td1 w]
1.878 + list [catch {string tolower [file attributes ./td1 -longname]} msg] $msg [cleanup]
1.879 +} {0 ./td1 {}}
1.880 +test winFCmd-12.5 {ConvertFileNameFormat: absolute path} {pcOnly} {
1.881 + list [file attributes / -longname] [file attributes \\ -longname]
1.882 +} {/ /}
1.883 +test winFCmd-12.6 {ConvertFileNameFormat: absolute path with drive} {pcOnly} {
1.884 + catch {file delete -force -- c:/td1}
1.885 + close [open c:/td1 w]
1.886 + list [catch {string tolower [file attributes c:/td1 -longname]} msg] $msg [file delete -force -- c:/td1]
1.887 +} {0 c:/td1 {}}
1.888 +test winFCmd-12.7 {ConvertFileNameFormat} {nonPortable pcOnly} {
1.889 + string tolower [file attributes //bisque/tcl/ws -longname]
1.890 +} {//bisque/tcl/ws}
1.891 +test winFCmd-12.8 {ConvertFileNameFormat} {pcOnly longFileNames} {
1.892 + cleanup
1.893 + close [open td1 w]
1.894 + list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]
1.895 +} {0 td1 {}}
1.896 +test winFCmd-12.10 {ConvertFileNameFormat} {longFileNames pcOnly} {
1.897 + cleanup
1.898 + close [open td1td1td1 w]
1.899 + list [catch {file attributes td1td1td1 -shortname}] [cleanup]
1.900 +} {0 {}}
1.901 +test winFCmd-12.11 {ConvertFileNameFormat} {longFileNames pcOnly} {
1.902 + cleanup
1.903 + close [open td1 w]
1.904 + list [catch {string tolower [file attributes td1 -shortname]} msg] $msg [cleanup]
1.905 +} {0 td1 {}}
1.906 +
1.907 +test winFCmd-13.1 {GetWinFileLongName} {pcOnly} {
1.908 + cleanup
1.909 + close [open td1 w]
1.910 + list [catch {string tolower [file attributes td1 -longname]} msg] $msg [cleanup]
1.911 +} {0 td1 {}}
1.912 +
1.913 +test winFCmd-14.1 {GetWinFileShortName} {pcOnly} {
1.914 + cleanup
1.915 + close [open td1 w]
1.916 + list [catch {string tolower [file attributes td1 -shortname]} msg] $msg [cleanup]
1.917 +} {0 td1 {}}
1.918 +
1.919 +test winFCmd-15.1 {SetWinFileAttributes} {pcOnly} {
1.920 + cleanup
1.921 + list [catch {file attributes td1 -archive 0} msg] $msg
1.922 +} {1 {could not read "td1": no such file or directory}}
1.923 +test winFCmd-15.2 {SetWinFileAttributes - archive} {pcOnly} {
1.924 + cleanup
1.925 + close [open td1 w]
1.926 + list [catch {file attributes td1 -archive 1} msg] $msg [file attributes td1 -archive] [cleanup]
1.927 +} {0 {} 1 {}}
1.928 +test winFCmd-15.3 {SetWinFileAttributes - archive} {pcOnly} {
1.929 + cleanup
1.930 + close [open td1 w]
1.931 + list [catch {file attributes td1 -archive 0} msg] $msg [file attributes td1 -archive] [cleanup]
1.932 +} {0 {} 0 {}}
1.933 +test winFCmd-15.4 {SetWinFileAttributes - hidden} {pcOnly} {
1.934 + cleanup
1.935 + close [open td1 w]
1.936 + list [catch {file attributes td1 -hidden 1} msg] $msg [file attributes td1 -hidden] [file attributes td1 -hidden 0] [cleanup]
1.937 +} {0 {} 1 {} {}}
1.938 +test winFCmd-15.5 {SetWinFileAttributes - hidden} {pcOnly} {
1.939 + cleanup
1.940 + close [open td1 w]
1.941 + list [catch {file attributes td1 -hidden 0} msg] $msg [file attributes td1 -hidden] [cleanup]
1.942 +} {0 {} 0 {}}
1.943 +test winFCmd-15.6 {SetWinFileAttributes - readonly} {pcOnly} {
1.944 + cleanup
1.945 + close [open td1 w]
1.946 + list [catch {file attributes td1 -readonly 1} msg] $msg [file attributes td1 -readonly] [cleanup]
1.947 +} {0 {} 1 {}}
1.948 +test winFCmd-15.7 {SetWinFileAttributes - readonly} {pcOnly} {
1.949 + cleanup
1.950 + close [open td1 w]
1.951 + list [catch {file attributes td1 -readonly 0} msg] $msg [file attributes td1 -readonly] [cleanup]
1.952 +} {0 {} 0 {}}
1.953 +test winFCmd-15.8 {SetWinFileAttributes - system} {pcOnly} {
1.954 + cleanup
1.955 + close [open td1 w]
1.956 + list [catch {file attributes td1 -system 1} msg] $msg [file attributes td1 -system] [cleanup]
1.957 +} {0 {} 1 {}}
1.958 +test winFCmd-15.9 {SetWinFileAttributes - system} {pcOnly} {
1.959 + cleanup
1.960 + close [open td1 w]
1.961 + list [catch {file attributes td1 -system 0} msg] $msg [file attributes td1 -system] [cleanup]
1.962 +} {0 {} 0 {}}
1.963 +test winFCmd-15.10 {SetWinFileAttributes - failing} {pcOnly cdrom} {
1.964 + cleanup
1.965 + catch {file attributes $cdfile -archive 1}
1.966 +} {1}
1.967 +test winFCmd-16.1 {Windows file normalization} {pcOnly} {
1.968 + list [file normalize c:/] [file normalize C:/]
1.969 +} {C:/ C:/}
1.970 +test winFCmd-16.2 {Windows file normalization} {pcOnly} {
1.971 + close [open td1... w]
1.972 + set res [file tail [file normalize td1]]
1.973 + file delete td1...
1.974 + set res
1.975 +} {td1}
1.976 +
1.977 +set pwd [pwd]
1.978 +set d [string index $pwd 0]
1.979 +
1.980 +test winFCmd-16.3 {Windows file normalization} {pcOnly} {
1.981 + file norm ${d}:foo
1.982 +} [file join $pwd foo]
1.983 +test winFCmd-16.4 {Windows file normalization} {pcOnly} {
1.984 + file norm [string tolower ${d}]:foo
1.985 +} [file join $pwd foo]
1.986 +test winFCmd-16.5 {Windows file normalization} {pcOnly} {
1.987 + file norm ${d}:foo/bar
1.988 +} [file join $pwd foo/bar]
1.989 +test winFCmd-16.6 {Windows file normalization} {pcOnly} {
1.990 + file norm ${d}:foo\\bar
1.991 +} [file join $pwd foo/bar]
1.992 +test winFCmd-16.7 {Windows file normalization} {pcOnly} {
1.993 + file norm /bar
1.994 +} "${d}:/bar"
1.995 +test winFCmd-16.8 {Windows file normalization} {pcOnly} {
1.996 + file norm ///bar
1.997 +} "${d}:/bar"
1.998 +test winFCmd-16.9 {Windows file normalization} {pcOnly} {
1.999 + file norm /bar/foo
1.1000 +} "${d}:/bar/foo"
1.1001 +if {$d eq "C"} { set dd "D" } else { set dd "C" }
1.1002 +test winFCmd-16.10 {Windows file normalization} {pcOnly} {
1.1003 + file norm ${dd}:foo
1.1004 +} "${dd}:/foo"
1.1005 +test winFCmd-16.11 {Windows file normalization} {pcOnly cdrom} {
1.1006 + cd ${d}:
1.1007 + cd $cdrom
1.1008 + cd ${d}:
1.1009 + cd $cdrom
1.1010 + # Must not crash
1.1011 + set result "no crash"
1.1012 +} {no crash}
1.1013 +test winFCmd-16.12 {Windows file normalization} {pcOnly} {
1.1014 + set oldhome ""
1.1015 + catch {set oldhome $::env(HOME)}
1.1016 + set ::env(HOME) ${d}:
1.1017 + cd
1.1018 + set result [pwd]; # <- Must not crash
1.1019 + set ::env(HOME) $oldhome
1.1020 + set result
1.1021 +} ${d}:/
1.1022 +
1.1023 +cd $pwd
1.1024 +unset d dd pwd
1.1025 +
1.1026 +test winFCmd-18.1 {Windows reserved path names} -constraints win -body {
1.1027 + file pathtype com1
1.1028 +} -result "absolute"
1.1029 +
1.1030 +test winFCmd-18.1.2 {Windows reserved path names} -constraints win -body {
1.1031 + file pathtype com4
1.1032 +} -result "absolute"
1.1033 +
1.1034 +test winFCmd-18.1.3 {Windows reserved path names} -constraints win -body {
1.1035 + file pathtype com5
1.1036 +} -result "relative"
1.1037 +
1.1038 +test winFCmd-18.1.4 {Windows reserved path names} -constraints win -body {
1.1039 + file pathtype lpt3
1.1040 +} -result "absolute"
1.1041 +
1.1042 +test winFCmd-18.1.5 {Windows reserved path names} -constraints win -body {
1.1043 + file pathtype lpt4
1.1044 +} -result "relative"
1.1045 +
1.1046 +test winFCmd-18.1.6 {Windows reserved path names} -constraints win -body {
1.1047 + file pathtype nul
1.1048 +} -result "absolute"
1.1049 +
1.1050 +test winFCmd-18.1.7 {Windows reserved path names} -constraints win -body {
1.1051 + file pathtype null
1.1052 +} -result "relative"
1.1053 +
1.1054 +test winFCmd-18.2 {Windows reserved path names} -constraints win -body {
1.1055 + file pathtype com1:
1.1056 +} -result "absolute"
1.1057 +
1.1058 +test winFCmd-18.3 {Windows reserved path names} -constraints win -body {
1.1059 + file pathtype COM1
1.1060 +} -result "absolute"
1.1061 +
1.1062 +test winFCmd-18.4 {Windows reserved path names} -constraints win -body {
1.1063 + file pathtype CoM1:
1.1064 +} -result "absolute"
1.1065 +
1.1066 +test winFCmd-18.5 {Windows reserved path names} -constraints win -body {
1.1067 + file normalize com1:
1.1068 +} -result COM1
1.1069 +
1.1070 +test winFCmd-18.6 {Windows reserved path names} -constraints win -body {
1.1071 + file normalize COM1:
1.1072 +} -result COM1
1.1073 +
1.1074 +test winFCmd-18.7 {Windows reserved path names} -constraints win -body {
1.1075 + file normalize cOm1
1.1076 +} -result COM1
1.1077 +
1.1078 +test winFCmd-18.8 {Windows reserved path names} -constraints win -body {
1.1079 + file normalize cOm1:
1.1080 +} -result COM1
1.1081 +
1.1082 +# This block of code used to occur after the "return" call, so I'm
1.1083 +# commenting it out and assuming that this code is still under construction.
1.1084 +#foreach source {tef ted tnf tnd "" nul com1} {
1.1085 +# foreach chmodsrc {000 755} {
1.1086 +# foreach dest "tfn tfe tdn tdempty tdfull td1/td2 $p $p/td1 {} nul" {
1.1087 +# foreach chmoddst {000 755} {
1.1088 +# puts hi
1.1089 +# cleanup
1.1090 +# file delete -force ted tef
1.1091 +# file mkdir ted
1.1092 +# createfile tef
1.1093 +# createfile tfe
1.1094 +# file mkdir tdempty
1.1095 +# file mkdir tdfull/td1/td2
1.1096 +#
1.1097 +# catch {testchmod $chmodsrc $source}
1.1098 +# catch {testchmod $chmoddst $dest}
1.1099 +#
1.1100 +# if [catch {file rename $source $dest} msg] {
1.1101 +# puts "file rename $source ($chmodsrc) $dest ($chmoddst)"
1.1102 +# puts $msg
1.1103 +# }
1.1104 +# }
1.1105 +# }
1.1106 +# }
1.1107 +#}
1.1108 +
1.1109 +# cleanup
1.1110 +cleanup
1.1111 +::tcltest::cleanupTests
1.1112 +return