Browse Source

tests: implicitly skip SYMLINKS tests using <prereq>

Change the tests that skipped due to unavailable SYMLINKS support to
use the three-arg prereq form of test_expect_success.

Now we get an indication of how many tests that need symlinks are
being skipped on platforms that don't support them.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Ævar Arnfjörð Bjarmason 15 years ago committed by Junio C Hamano
parent
commit
41be8ea223
  1. 14
      t/t2007-checkout-symlink.sh
  2. 18
      t/t4011-diff-symlink.sh
  3. 14
      t/t4023-diff-rename-typechange.sh
  4. 28
      t/t4114-apply-typechange.sh
  5. 12
      t/t4115-apply-symlink.sh
  6. 12
      t/t4122-apply-symlink-inside.sh
  7. 14
      t/t5522-pull-symlink.sh
  8. 20
      t/t6035-merge-dir-to-symlink.sh

14
t/t2007-checkout-symlink.sh

@ -6,13 +6,7 @@ test_description='git checkout to switch between branches with symlink<->dir' @@ -6,13 +6,7 @@ test_description='git checkout to switch between branches with symlink<->dir'

. ./test-lib.sh

if ! test_have_prereq SYMLINKS
then
skip_all="symbolic links not supported - skipping tests"
test_done
fi

test_expect_success setup '
test_expect_success SYMLINKS setup '

mkdir frotz &&
echo hello >frotz/filfre &&
@ -38,18 +32,18 @@ test_expect_success setup ' @@ -38,18 +32,18 @@ test_expect_success setup '

'

test_expect_success 'switch from symlink to dir' '
test_expect_success SYMLINKS 'switch from symlink to dir' '

git checkout master

'

test_expect_success 'Remove temporary directories & switch to master' '
test_expect_success SYMLINKS 'Remove temporary directories & switch to master' '
rm -fr frotz xyzzy nitfol &&
git checkout -f master
'

test_expect_success 'switch from dir to symlink' '
test_expect_success SYMLINKS 'switch from dir to symlink' '

git checkout side


18
t/t4011-diff-symlink.sh

@ -9,12 +9,6 @@ test_description='Test diff of symlinks. @@ -9,12 +9,6 @@ test_description='Test diff of symlinks.
. ./test-lib.sh
. "$TEST_DIRECTORY"/diff-lib.sh

if ! test_have_prereq SYMLINKS
then
skip_all='Symbolic links not supported, skipping tests.'
test_done
fi

cat > expected << EOF
diff --git a/frotz b/frotz
new file mode 120000
@ -26,7 +20,7 @@ index 0000000..7c465af @@ -26,7 +20,7 @@ index 0000000..7c465af
\ No newline at end of file
EOF

test_expect_success \
test_expect_success SYMLINKS \
'diff new symlink' \
'ln -s xyzzy frotz &&
git update-index &&
@ -35,7 +29,7 @@ test_expect_success \ @@ -35,7 +29,7 @@ test_expect_success \
GIT_DIFF_OPTS=--unified=0 git diff-index -M -p $tree > current &&
compare_diff_patch current expected'

test_expect_success \
test_expect_success SYMLINKS \
'diff unchanged symlink' \
'tree=$(git write-tree) &&
git update-index frotz &&
@ -52,7 +46,7 @@ index 7c465af..0000000 @@ -52,7 +46,7 @@ index 7c465af..0000000
\ No newline at end of file
EOF

test_expect_success \
test_expect_success SYMLINKS \
'diff removed symlink' \
'mv frotz frotz2 &&
git diff-index -M -p $tree > current &&
@ -62,7 +56,7 @@ cat > expected << EOF @@ -62,7 +56,7 @@ cat > expected << EOF
diff --git a/frotz b/frotz
EOF

test_expect_success \
test_expect_success SYMLINKS \
'diff identical, but newly created symlink' \
'ln -s xyzzy frotz &&
git diff-index -M -p $tree > current &&
@ -80,14 +74,14 @@ index 7c465af..df1db54 120000 @@ -80,14 +74,14 @@ index 7c465af..df1db54 120000
\ No newline at end of file
EOF

test_expect_success \
test_expect_success SYMLINKS \
'diff different symlink' \
'rm frotz &&
ln -s yxyyz frotz &&
git diff-index -M -p $tree > current &&
compare_diff_patch current expected'

test_expect_success \
test_expect_success SYMLINKS \
'diff symlinks with non-existing targets' \
'ln -s narf pinky &&
ln -s take\ over brain &&

14
t/t4023-diff-rename-typechange.sh

@ -4,13 +4,7 @@ test_description='typechange rename detection' @@ -4,13 +4,7 @@ test_description='typechange rename detection'

. ./test-lib.sh

if ! test_have_prereq SYMLINKS
then
skip_all='Symbolic links not supported, skipping tests.'
test_done
fi

test_expect_success setup '
test_expect_success SYMLINKS setup '

rm -f foo bar &&
cat "$TEST_DIRECTORY"/../COPYING >foo &&
@ -56,7 +50,7 @@ test_expect_success setup ' @@ -56,7 +50,7 @@ test_expect_success setup '

'

test_expect_success 'cross renames to be detected for regular files' '
test_expect_success SYMLINKS 'cross renames to be detected for regular files' '

git diff-tree five six -r --name-status -B -M | sort >actual &&
{
@ -67,7 +61,7 @@ test_expect_success 'cross renames to be detected for regular files' ' @@ -67,7 +61,7 @@ test_expect_success 'cross renames to be detected for regular files' '

'

test_expect_success 'cross renames to be detected for typechange' '
test_expect_success SYMLINKS 'cross renames to be detected for typechange' '

git diff-tree one two -r --name-status -B -M | sort >actual &&
{
@ -78,7 +72,7 @@ test_expect_success 'cross renames to be detected for typechange' ' @@ -78,7 +72,7 @@ test_expect_success 'cross renames to be detected for typechange' '

'

test_expect_success 'moves and renames' '
test_expect_success SYMLINKS 'moves and renames' '

git diff-tree three four -r --name-status -B -M | sort >actual &&
{

28
t/t4114-apply-typechange.sh

@ -9,13 +9,7 @@ test_description='git apply should not get confused with type changes. @@ -9,13 +9,7 @@ test_description='git apply should not get confused with type changes.

. ./test-lib.sh

if ! test_have_prereq SYMLINKS
then
skip_all='Symbolic links not supported, skipping tests.'
test_done
fi

test_expect_success 'setup repository and commits' '
test_expect_success SYMLINKS 'setup repository and commits' '
echo "hello world" > foo &&
echo "hi planet" > bar &&
git update-index --add foo bar &&
@ -48,7 +42,7 @@ test_expect_success 'setup repository and commits' ' @@ -48,7 +42,7 @@ test_expect_success 'setup repository and commits' '
git branch foo-baz-renamed-from-foo
'

test_expect_success 'file renamed from foo to foo/baz' '
test_expect_success SYMLINKS 'file renamed from foo to foo/baz' '
git checkout -f initial &&
git diff-tree -M -p HEAD foo-baz-renamed-from-foo > patch &&
git apply --index < patch
@ -56,7 +50,7 @@ test_expect_success 'file renamed from foo to foo/baz' ' @@ -56,7 +50,7 @@ test_expect_success 'file renamed from foo to foo/baz' '
test_debug 'cat patch'


test_expect_success 'file renamed from foo/baz to foo' '
test_expect_success SYMLINKS 'file renamed from foo/baz to foo' '
git checkout -f foo-baz-renamed-from-foo &&
git diff-tree -M -p HEAD initial > patch &&
git apply --index < patch
@ -64,7 +58,7 @@ test_expect_success 'file renamed from foo/baz to foo' ' @@ -64,7 +58,7 @@ test_expect_success 'file renamed from foo/baz to foo' '
test_debug 'cat patch'


test_expect_success 'directory becomes file' '
test_expect_success SYMLINKS 'directory becomes file' '
git checkout -f foo-becomes-a-directory &&
git diff-tree -p HEAD initial > patch &&
git apply --index < patch
@ -72,7 +66,7 @@ test_expect_success 'directory becomes file' ' @@ -72,7 +66,7 @@ test_expect_success 'directory becomes file' '
test_debug 'cat patch'


test_expect_success 'file becomes directory' '
test_expect_success SYMLINKS 'file becomes directory' '
git checkout -f initial &&
git diff-tree -p HEAD foo-becomes-a-directory > patch &&
git apply --index < patch
@ -80,7 +74,7 @@ test_expect_success 'file becomes directory' ' @@ -80,7 +74,7 @@ test_expect_success 'file becomes directory' '
test_debug 'cat patch'


test_expect_success 'file becomes symlink' '
test_expect_success SYMLINKS 'file becomes symlink' '
git checkout -f initial &&
git diff-tree -p HEAD foo-symlinked-to-bar > patch &&
git apply --index < patch
@ -88,21 +82,21 @@ test_expect_success 'file becomes symlink' ' @@ -88,21 +82,21 @@ test_expect_success 'file becomes symlink' '
test_debug 'cat patch'


test_expect_success 'symlink becomes file' '
test_expect_success SYMLINKS 'symlink becomes file' '
git checkout -f foo-symlinked-to-bar &&
git diff-tree -p HEAD foo-back-to-file > patch &&
git apply --index < patch
'
test_debug 'cat patch'

test_expect_success 'binary file becomes symlink' '
test_expect_success SYMLINKS 'binary file becomes symlink' '
git checkout -f foo-becomes-binary &&
git diff-tree -p --binary HEAD foo-symlinked-to-bar > patch &&
git apply --index < patch
'
test_debug 'cat patch'

test_expect_success 'symlink becomes binary file' '
test_expect_success SYMLINKS 'symlink becomes binary file' '
git checkout -f foo-symlinked-to-bar &&
git diff-tree -p --binary HEAD foo-becomes-binary > patch &&
git apply --index < patch
@ -110,7 +104,7 @@ test_expect_success 'symlink becomes binary file' ' @@ -110,7 +104,7 @@ test_expect_success 'symlink becomes binary file' '
test_debug 'cat patch'


test_expect_success 'symlink becomes directory' '
test_expect_success SYMLINKS 'symlink becomes directory' '
git checkout -f foo-symlinked-to-bar &&
git diff-tree -p HEAD foo-becomes-a-directory > patch &&
git apply --index < patch
@ -118,7 +112,7 @@ test_expect_success 'symlink becomes directory' ' @@ -118,7 +112,7 @@ test_expect_success 'symlink becomes directory' '
test_debug 'cat patch'


test_expect_success 'directory becomes symlink' '
test_expect_success SYMLINKS 'directory becomes symlink' '
git checkout -f foo-becomes-a-directory &&
git diff-tree -p HEAD foo-symlinked-to-bar > patch &&
git apply --index < patch

12
t/t4115-apply-symlink.sh

@ -9,13 +9,7 @@ test_description='git apply symlinks and partial files @@ -9,13 +9,7 @@ test_description='git apply symlinks and partial files

. ./test-lib.sh

if ! test_have_prereq SYMLINKS
then
skip_all='Symbolic links not supported, skipping tests.'
test_done
fi

test_expect_success setup '
test_expect_success SYMLINKS setup '

ln -s path1/path2/path3/path4/path5 link1 &&
git add link? &&
@ -34,7 +28,7 @@ test_expect_success setup ' @@ -34,7 +28,7 @@ test_expect_success setup '

'

test_expect_success 'apply symlink patch' '
test_expect_success SYMLINKS 'apply symlink patch' '

git checkout side &&
git apply patch &&
@ -43,7 +37,7 @@ test_expect_success 'apply symlink patch' ' @@ -43,7 +37,7 @@ test_expect_success 'apply symlink patch' '

'

test_expect_success 'apply --index symlink patch' '
test_expect_success SYMLINKS 'apply --index symlink patch' '

git checkout -f side &&
git apply --index patch &&

12
t/t4122-apply-symlink-inside.sh

@ -3,12 +3,6 @@ @@ -3,12 +3,6 @@
test_description='apply to deeper directory without getting fooled with symlink'
. ./test-lib.sh

if ! test_have_prereq SYMLINKS
then
skip_all='Symbolic links not supported, skipping tests.'
test_done
fi

lecho () {
for l_
do
@ -16,7 +10,7 @@ lecho () { @@ -16,7 +10,7 @@ lecho () {
done
}

test_expect_success setup '
test_expect_success SYMLINKS setup '

mkdir -p arch/i386/boot arch/x86_64 &&
lecho 1 2 3 4 5 >arch/i386/boot/Makefile &&
@ -37,7 +31,7 @@ test_expect_success setup ' @@ -37,7 +31,7 @@ test_expect_success setup '

'

test_expect_success apply '
test_expect_success SYMLINKS apply '

git checkout test &&
git diff --exit-code test &&
@ -46,7 +40,7 @@ test_expect_success apply ' @@ -46,7 +40,7 @@ test_expect_success apply '

'

test_expect_success 'check result' '
test_expect_success SYMLINKS 'check result' '

git diff --exit-code master &&
git diff --exit-code --cached master &&

14
t/t5522-pull-symlink.sh

@ -4,12 +4,6 @@ test_description='pulling from symlinked subdir' @@ -4,12 +4,6 @@ test_description='pulling from symlinked subdir'

. ./test-lib.sh

if ! test_have_prereq SYMLINKS
then
skip_all='Symbolic links not supported, skipping tests.'
test_done
fi

# The scenario we are building:
#
# trash\ directory/
@ -20,7 +14,7 @@ fi @@ -20,7 +14,7 @@ fi
#
# The working directory is subdir-link.

test_expect_success setup '
test_expect_success SYMLINKS setup '
mkdir subdir &&
echo file >subdir/file &&
git add subdir/file &&
@ -36,7 +30,7 @@ test_expect_success setup ' @@ -36,7 +30,7 @@ test_expect_success setup '

# Demonstrate that things work if we just avoid the symlink
#
test_expect_success 'pulling from real subdir' '
test_expect_success SYMLINKS 'pulling from real subdir' '
(
echo real >subdir/file &&
git commit -m real subdir/file &&
@ -64,7 +58,7 @@ test_expect_success 'pulling from real subdir' ' @@ -64,7 +58,7 @@ test_expect_success 'pulling from real subdir' '
# directory. A POSIX shell's "cd" works a little differently
# than chdir() in C; "cd -P" is much closer to chdir().
#
test_expect_success 'pulling from symlinked subdir' '
test_expect_success SYMLINKS 'pulling from symlinked subdir' '
(
echo link >subdir/file &&
git commit -m link subdir/file &&
@ -77,7 +71,7 @@ test_expect_success 'pulling from symlinked subdir' ' @@ -77,7 +71,7 @@ test_expect_success 'pulling from symlinked subdir' '
# Prove that the remote end really is a repo, and other commands
# work fine in this context. It's just that "git pull" breaks.
#
test_expect_success 'pushing from symlinked subdir' '
test_expect_success SYMLINKS 'pushing from symlinked subdir' '
(
cd subdir-link/ &&
echo push >file &&

20
t/t6035-merge-dir-to-symlink.sh

@ -3,13 +3,7 @@ @@ -3,13 +3,7 @@
test_description='merging when a directory was replaced with a symlink'
. ./test-lib.sh

if ! test_have_prereq SYMLINKS
then
skip_all='Symbolic links not supported, skipping tests.'
test_done
fi

test_expect_success 'create a commit where dir a/b changed to symlink' '
test_expect_success SYMLINKS 'create a commit where dir a/b changed to symlink' '
mkdir -p a/b/c a/b-2/c &&
> a/b/c/d &&
> a/b-2/c/d &&
@ -23,7 +17,7 @@ test_expect_success 'create a commit where dir a/b changed to symlink' ' @@ -23,7 +17,7 @@ test_expect_success 'create a commit where dir a/b changed to symlink' '
git commit -m "dir to symlink"
'

test_expect_success 'keep a/b-2/c/d across checkout' '
test_expect_success SYMLINKS 'keep a/b-2/c/d across checkout' '
git checkout HEAD^0 &&
git reset --hard master &&
git rm --cached a/b &&
@ -32,14 +26,14 @@ test_expect_success 'keep a/b-2/c/d across checkout' ' @@ -32,14 +26,14 @@ test_expect_success 'keep a/b-2/c/d across checkout' '
test -f a/b-2/c/d
'

test_expect_success 'checkout should not have deleted a/b-2/c/d' '
test_expect_success SYMLINKS 'checkout should not have deleted a/b-2/c/d' '
git checkout HEAD^0 &&
git reset --hard master &&
git checkout start^0 &&
test -f a/b-2/c/d
'

test_expect_success 'setup for merge test' '
test_expect_success SYMLINKS 'setup for merge test' '
git reset --hard &&
test -f a/b-2/c/d &&
echo x > a/x &&
@ -48,7 +42,7 @@ test_expect_success 'setup for merge test' ' @@ -48,7 +42,7 @@ test_expect_success 'setup for merge test' '
git tag baseline
'

test_expect_success 'do not lose a/b-2/c/d in merge (resolve)' '
test_expect_success SYMLINKS 'do not lose a/b-2/c/d in merge (resolve)' '
git reset --hard &&
git checkout baseline^0 &&
git merge -s resolve master &&
@ -64,7 +58,7 @@ test_expect_failure 'do not lose a/b-2/c/d in merge (recursive)' ' @@ -64,7 +58,7 @@ test_expect_failure 'do not lose a/b-2/c/d in merge (recursive)' '
test -f a/b-2/c/d
'

test_expect_success 'setup a merge where dir a/b-2 changed to symlink' '
test_expect_success SYMLINKS 'setup a merge where dir a/b-2 changed to symlink' '
git reset --hard &&
git checkout start^0 &&
rm -rf a/b-2 &&
@ -74,7 +68,7 @@ test_expect_success 'setup a merge where dir a/b-2 changed to symlink' ' @@ -74,7 +68,7 @@ test_expect_success 'setup a merge where dir a/b-2 changed to symlink' '
git tag test2
'

test_expect_success 'merge should not have conflicts (resolve)' '
test_expect_success SYMLINKS 'merge should not have conflicts (resolve)' '
git reset --hard &&
git checkout baseline^0 &&
git merge -s resolve test2 &&

Loading…
Cancel
Save