try to fix test-inherit-mode on HFS+
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Fri, 15 Feb 2008 10:51:35 -0200
changeset 6113 8ca25589e960
parent 6112 5ffa962783c4
child 6114 ee83510fe567
try to fix test-inherit-mode on HFS+ HFS+ doesn't like setgid directories, so avoid them in most of the test and do a quick check that doesn't change the output when everything's OK.
tests/test-inherit-mode
tests/test-inherit-mode.out
--- a/tests/test-inherit-mode	Fri Feb 15 10:38:37 2008 -0200
+++ b/tests/test-inherit-mode	Fri Feb 15 10:51:35 2008 -0200
@@ -28,13 +28,18 @@
     print '%05o %s%s' % (os.lstat(name).st_mode & 07777, name, suffix)
 EOF
 
+cat >mode.py <<EOF
+import sys
+import os
+print '%05o' % os.lstat(sys.argv[1]).st_mode
+EOF
+
 umask 077
 
 hg init repo
 cd repo
 
 chmod 0770 .hg/store
-chmod g+s .hg/store
 
 echo '% before commit'
 echo '% store can be written by the group, other files cannot'
@@ -66,3 +71,20 @@
 echo '% after push'
 echo '% group can still write everything'
 python ../printmodes.py ../push
+
+# Test that we don't lose the setgid bit when we call chmod.
+# Not all systems support setgid directories (e.g. HFS+), so
+# just check that directories have the same mode.
+cd ..
+hg init setgid
+cd setgid
+chmod g+s .hg/store 2> /dev/null
+mkdir dir
+touch dir/file
+hg ci -qAm 'add dir/file'
+storemode=`python ../mode.py .hg/store`
+dirmode=`python ../mode.py .hg/store/data/dir`
+if [ "$storemode" != "$dirmode" ]; then
+    echo "$storemode != $dirmode"
+fi
+
--- a/tests/test-inherit-mode.out	Fri Feb 15 10:38:37 2008 -0200
+++ b/tests/test-inherit-mode.out	Fri Feb 15 10:51:35 2008 -0200
@@ -4,7 +4,7 @@
 00700 ./.hg/
 00600 ./.hg/00changelog.i
 00600 ./.hg/requires
-02770 ./.hg/store/
+00770 ./.hg/store/
 
 % after commit
 % working dir files can only be written by the owner
@@ -15,11 +15,11 @@
 00600 ./.hg/00changelog.i
 00660 ./.hg/dirstate
 00600 ./.hg/requires
-02770 ./.hg/store/
+00770 ./.hg/store/
 00660 ./.hg/store/00changelog.i
 00660 ./.hg/store/00manifest.i
-02770 ./.hg/store/data/
-02770 ./.hg/store/data/dir/
+00770 ./.hg/store/data/
+00770 ./.hg/store/data/dir/
 00660 ./.hg/store/data/dir/bar.i
 00660 ./.hg/store/data/foo.i
 00660 ./.hg/store/undo