tests: detect that MSYS lacks symlinks
authorPeter Rosin <peda@lysator.liu.se>
Mon, 9 Jan 2012 11:43:30 +0000 (12:43 +0100)
committerPeter Rosin <peda@lysator.liu.se>
Mon, 9 Jan 2012 11:43:30 +0000 (12:43 +0100)
* tests/self-check-cleanup.tap: Also check if "ln -s" really created a
symlink to cater for MSYS falling back to an ordinary copy.  Also, don't
chmod the symlinks if they were never created.

tests/self-check-cleanup.tap

index d369c9f..e403dde 100755 (executable)
@@ -33,7 +33,7 @@ cp ../defs .
 
 AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
 
-if ln -s defs foo; then
+if ln -s defs foo && test -h foo; then
   have_symlinks=yes
 else
   have_symlinks=no
@@ -60,7 +60,8 @@ if test $have_symlinks = yes; then
   ln -s none brokenlink
 fi
 cd ..
-chmod 000 $dir/sub/* $dir/file $dir/symlink
+chmod 000 $dir/sub/* $dir/file
+test $have_symlinks = yes && chmod 000 $dir/symlink
 chmod 000 $dir/sub $dir
 command_ok_ "pre-cleanup can deal with null-perms testdir" \
             $SHELL -c  '. ./defs' dummy.test
@@ -84,7 +85,8 @@ command_ok_ "post-cleanup can deal with null-perms testdir" \
     ln -s none brokenlink
   fi
   cd ..
-  chmod 000 dir/sub/* dir/file dir/symlink
+  chmod 000 dir/sub/* dir/file
+  test $have_symlinks = yes && chmod 000 dir/symlink
   chmod 000 dir/sub dir
   :
 ' dummy.test