changeset 6806:2134d6c09432

Add test for case folding issues
author Patrick Mezard <pmezard@gmail.com>
date Fri, 11 Jul 2008 14:40:44 +0200
parents 482581431dcd
children fdf5980bd010
files tests/hghave tests/test-casefolding tests/test-casefolding.out
diffstat 3 files changed, 73 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/hghave	Tue Jul 01 17:59:31 2008 +0100
+++ b/tests/hghave	Fri Jul 11 14:40:44 2008 +0200
@@ -57,6 +57,24 @@
     finally:
         os.remove(path)
 
+def has_icasefs():
+    # Stolen from mercurial.util
+    fd, path = tempfile.mkstemp(prefix=tempprefix)
+    os.close(fd)
+    try:
+        s1 = os.stat(path)
+        d, b = os.path.split(path)
+        p2 = os.path.join(d, b.upper())
+        if path == p2:
+            p2 = os.path.join(d, b.lower())
+        try:
+            s2 = os.stat(p2)
+            return s2 == s1
+        except:
+            return False
+    finally:
+        os.remove(path)  
+
 def has_fifo():
     return hasattr(os, "mkfifo")
 
@@ -129,6 +147,7 @@
     "fifo": (has_fifo, "named pipes"),
     "git": (has_git, "git command line client"),
     "hotshot": (has_hotshot, "python hotshot module"),
+    "icasefs": (has_icasefs, "case insensitive file system"),
     "lsprof": (has_lsprof, "python lsprof module"),
     "mtn": (has_mtn, "monotone client (> 0.31)"),
     "svn": (has_svn, "subversion client and admin tools"),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-casefolding	Fri Jul 11 14:40:44 2008 +0200
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+"$TESTDIR/hghave" icasefs || exit 80
+
+echo '% test file addition with bad case'
+hg init repo1
+cd repo1
+echo a > a
+hg add A
+hg st
+hg ci -m adda
+hg manifest
+cd ..
+
+echo '% test case collision on rename (issue 750)'
+hg init repo2
+cd repo2
+echo a > a
+hg --debug ci -Am adda
+hg mv a A
+# 'a' used to be removed under windows
+test -f a || echo 'a is missing'
+hg st
+cd ..
+
+echo '% test case collision between revisions (issue 912)'
+hg init repo3
+cd repo3
+echo a > a
+hg ci -Am adda
+hg rm a
+hg ci -Am removea
+echo A > A
+hg ci -Am addA
+# Used to fail under case insensitive fs
+hg up -C 0
+hg up -C
+cd ..
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-casefolding.out	Fri Jul 11 14:40:44 2008 +0200
@@ -0,0 +1,13 @@
+% test file addition with bad case
+adding a
+A a
+a
+% test case collision on rename (issue 750)
+adding a
+a
+A: not overwriting - file exists
+% test case collision between revisions (issue 912)
+adding a
+adding A
+1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+1 files updated, 0 files merged, 1 files removed, 0 files unresolved