summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--tests/winFCmd.test40
2 files changed, 40 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 16ec059..1a2f383 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,7 @@
2008-07-21 Pat Thoyts <patthoyts@users.sourceforge.net>
* generic/tclFCmd.c: Inodes on windows are unreliable [Bug 2015723]
+ * tests/winFCmd.test: test rename with inode collision
2008-07-21 Miguel Sofer <msofer@users.sf.net>
diff --git a/tests/winFCmd.test b/tests/winFCmd.test
index f434516..d9598b1 100644
--- a/tests/winFCmd.test
+++ b/tests/winFCmd.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: winFCmd.test,v 1.43 2008/04/10 00:21:02 dkf Exp $
+# RCS: @(#) $Id: winFCmd.test,v 1.44 2008/07/21 21:51:36 patthoyts Exp $
#
if {[lsearch [namespace children] ::tcltest] == -1} {
@@ -387,6 +387,44 @@ test winFCmd-1.37 {TclpRenameFile: need to restore temp file} {win emptyTest} {
# Need a file that can't be copied.
} {}
+# If the native filesystem produces 0 for inodes numbers there is no point
+# doing the following test.
+testConstraint winNonZeroInodes [eval {
+ file stat [info nameofexecutable] statExe
+ expr {$statExe(ino) != 0}
+}]
+
+proc MakeFiles {dirname} {
+ set inodes {}
+ set ndx -1
+ while {1} {
+ if {$ndx > 10000} {
+ return -code error "limit reached without finding a collistion."
+ }
+ set filename [file join $dirname Test[incr ndx]]
+ set f [open $filename w]
+ close $f
+ file stat $filename stat
+ if {[set n [lsearch -exact -integer $inodes $stat(ino)]] != -1} {
+ return [list [file join $dirname Test$n] $filename]
+ }
+ lappend inodes $stat(ino)
+ unset stat
+ }
+}
+
+test winFCmd-1.38 {TclpRenameFile: check rename of conflicting inodes} -setup {
+ cleanup
+} -constraints {win winNonZeroInodes} -body {
+ file mkdir td1
+ foreach {a b} [MakeFiles td1] break
+ file rename -force $a $b
+ file exists $a
+} -cleanup {
+ cleanup
+} -result {0}
+
+
test winFCmd-2.1 {TclpCopyFile: errno: EACCES} -setup {
cleanup
} -constraints {win cdrom testfile} -body {