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>
Ævar Arnfjörð Bjarmason committed
Jul 28, 2010 at 10:34 UTC
41be8ea22371b82e2a8eb308386b704c6775ed03
8 files changed
+42
-90
t/t2007-checkout-symlink.sh
+4
-10
@@ -6,13 +6,7 @@ test_description='git checkout to switch between branches with symlink<->dir'
6
7
. ./test-lib.sh
8
9
-if ! test_have_prereq SYMLINKS
10
-then
11
- skip_all="symbolic links not supported - skipping tests"
12
- test_done
13
-fi
14
-
15
-test_expect_success setup '
9
+test_expect_success SYMLINKS setup '
10
11
mkdir frotz &&
12
echo hello >frotz/filfre &&
@@ -38,18 +32,18 @@ test_expect_success setup '
32
33
'
34
41
-test_expect_success 'switch from symlink to dir' '
35
+test_expect_success SYMLINKS 'switch from symlink to dir' '
36
37
git checkout master
38
39
'
40
47
-test_expect_success 'Remove temporary directories & switch to master' '
41
+test_expect_success SYMLINKS 'Remove temporary directories & switch to master' '
42
rm -fr frotz xyzzy nitfol &&
43
git checkout -f master
44
'
45
52
-test_expect_success 'switch from dir to symlink' '
46
+test_expect_success SYMLINKS 'switch from dir to symlink' '
47
48
git checkout side
49
t/t4011-diff-symlink.sh
+6
-12
@@ -9,12 +9,6 @@ test_description='Test diff of symlinks.
9
. ./test-lib.sh
10
. "$TEST_DIRECTORY"/diff-lib.sh
11
12
-if ! test_have_prereq SYMLINKS
13
-then
14
- skip_all='Symbolic links not supported, skipping tests.'
15
- test_done
16
-fi
17
-
12
cat > expected << EOF
13
diff --git a/frotz b/frotz
14
new file mode 120000
@@ -26,7 +20,7 @@ index 0000000..7c465af
20
\ No newline at end of file
21
EOF
22
29
-test_expect_success \
23
+test_expect_success SYMLINKS \
24
'diff new symlink' \
25
'ln -s xyzzy frotz &&
26
git update-index &&
@@ -35,7 +29,7 @@ test_expect_success \
29
GIT_DIFF_OPTS=--unified=0 git diff-index -M -p $tree > current &&
30
compare_diff_patch current expected'
31
38
-test_expect_success \
32
+test_expect_success SYMLINKS \
33
'diff unchanged symlink' \
34
'tree=$(git write-tree) &&
35
git update-index frotz &&
@@ -52,7 +46,7 @@ index 7c465af..0000000
46
\ No newline at end of file
47
EOF
48
55
-test_expect_success \
49
+test_expect_success SYMLINKS \
50
'diff removed symlink' \
51
'mv frotz frotz2 &&
52
git diff-index -M -p $tree > current &&
@@ -62,7 +56,7 @@ cat > expected << EOF
56
diff --git a/frotz b/frotz
57
EOF
58
65
-test_expect_success \
59
+test_expect_success SYMLINKS \
60
'diff identical, but newly created symlink' \
61
'ln -s xyzzy frotz &&
62
git diff-index -M -p $tree > current &&
@@ -80,14 +74,14 @@ index 7c465af..df1db54 120000
74
\ No newline at end of file
75
EOF
76
83
-test_expect_success \
77
+test_expect_success SYMLINKS \
78
'diff different symlink' \
79
'rm frotz &&
80
ln -s yxyyz frotz &&
81
git diff-index -M -p $tree > current &&
82
compare_diff_patch current expected'
83
90
-test_expect_success \
84
+test_expect_success SYMLINKS \
85
'diff symlinks with non-existing targets' \
86
'ln -s narf pinky &&
87
ln -s take\ over brain &&
t/t4023-diff-rename-typechange.sh
+4
-10
@@ -4,13 +4,7 @@ test_description='typechange rename detection'
4
5
. ./test-lib.sh
6
7
-if ! test_have_prereq SYMLINKS
8
-then
9
- skip_all='Symbolic links not supported, skipping tests.'
10
- test_done
11
-fi
12
-
13
-test_expect_success setup '
7
+test_expect_success SYMLINKS setup '
8
9
rm -f foo bar &&
10
cat "$TEST_DIRECTORY"/../COPYING >foo &&
@@ -56,7 +50,7 @@ test_expect_success setup '
50
51
'
52
59
-test_expect_success 'cross renames to be detected for regular files' '
53
+test_expect_success SYMLINKS 'cross renames to be detected for regular files' '
54
55
git diff-tree five six -r --name-status -B -M | sort >actual &&
56
{
@@ -67,7 +61,7 @@ test_expect_success 'cross renames to be detected for regular files' '
61
62
'
63
70
-test_expect_success 'cross renames to be detected for typechange' '
64
+test_expect_success SYMLINKS 'cross renames to be detected for typechange' '
65
66
git diff-tree one two -r --name-status -B -M | sort >actual &&
67
{
@@ -78,7 +72,7 @@ test_expect_success 'cross renames to be detected for typechange' '
72
73
'
74
81
-test_expect_success 'moves and renames' '
75
+test_expect_success SYMLINKS 'moves and renames' '
76
77
git diff-tree three four -r --name-status -B -M | sort >actual &&
78
{
t/t4114-apply-typechange.sh
+11
-17
@@ -9,13 +9,7 @@ test_description='git apply should not get confused with type changes.
9
10
. ./test-lib.sh
11
12
-if ! test_have_prereq SYMLINKS
13
-then
14
- skip_all='Symbolic links not supported, skipping tests.'
15
- test_done
16
-fi
17
-
18
-test_expect_success 'setup repository and commits' '
12
+test_expect_success SYMLINKS 'setup repository and commits' '
13
echo "hello world" > foo &&
14
echo "hi planet" > bar &&
15
git update-index --add foo bar &&
@@ -48,7 +42,7 @@ test_expect_success 'setup repository and commits' '
42
git branch foo-baz-renamed-from-foo
43
'
44
51
-test_expect_success 'file renamed from foo to foo/baz' '
45
+test_expect_success SYMLINKS 'file renamed from foo to foo/baz' '
46
git checkout -f initial &&
47
git diff-tree -M -p HEAD foo-baz-renamed-from-foo > patch &&
48
git apply --index < patch
@@ -56,7 +50,7 @@ test_expect_success 'file renamed from foo to foo/baz' '
50
test_debug 'cat patch'
51
52
59
-test_expect_success 'file renamed from foo/baz to foo' '
53
+test_expect_success SYMLINKS 'file renamed from foo/baz to foo' '
54
git checkout -f foo-baz-renamed-from-foo &&
55
git diff-tree -M -p HEAD initial > patch &&
56
git apply --index < patch
@@ -64,7 +58,7 @@ test_expect_success 'file renamed from foo/baz to foo' '
58
test_debug 'cat patch'
59
60
67
-test_expect_success 'directory becomes file' '
61
+test_expect_success SYMLINKS 'directory becomes file' '
62
git checkout -f foo-becomes-a-directory &&
63
git diff-tree -p HEAD initial > patch &&
64
git apply --index < patch
@@ -72,7 +66,7 @@ test_expect_success 'directory becomes file' '
66
test_debug 'cat patch'
67
68
75
-test_expect_success 'file becomes directory' '
69
+test_expect_success SYMLINKS 'file becomes directory' '
70
git checkout -f initial &&
71
git diff-tree -p HEAD foo-becomes-a-directory > patch &&
72
git apply --index < patch
@@ -80,7 +74,7 @@ test_expect_success 'file becomes directory' '
74
test_debug 'cat patch'
75
76
83
-test_expect_success 'file becomes symlink' '
77
+test_expect_success SYMLINKS 'file becomes symlink' '
78
git checkout -f initial &&
79
git diff-tree -p HEAD foo-symlinked-to-bar > patch &&
80
git apply --index < patch
@@ -88,21 +82,21 @@ test_expect_success 'file becomes symlink' '
82
test_debug 'cat patch'
83
84
91
-test_expect_success 'symlink becomes file' '
85
+test_expect_success SYMLINKS 'symlink becomes file' '
86
git checkout -f foo-symlinked-to-bar &&
87
git diff-tree -p HEAD foo-back-to-file > patch &&
88
git apply --index < patch
89
'
90
test_debug 'cat patch'
91
98
-test_expect_success 'binary file becomes symlink' '
92
+test_expect_success SYMLINKS 'binary file becomes symlink' '
93
git checkout -f foo-becomes-binary &&
94
git diff-tree -p --binary HEAD foo-symlinked-to-bar > patch &&
95
git apply --index < patch
96
'
97
test_debug 'cat patch'
98
105
-test_expect_success 'symlink becomes binary file' '
99
+test_expect_success SYMLINKS 'symlink becomes binary file' '
100
git checkout -f foo-symlinked-to-bar &&
101
git diff-tree -p --binary HEAD foo-becomes-binary > patch &&
102
git apply --index < patch
@@ -110,7 +104,7 @@ test_expect_success 'symlink becomes binary file' '
104
test_debug 'cat patch'
105
106
113
-test_expect_success 'symlink becomes directory' '
107
+test_expect_success SYMLINKS 'symlink becomes directory' '
108
git checkout -f foo-symlinked-to-bar &&
109
git diff-tree -p HEAD foo-becomes-a-directory > patch &&
110
git apply --index < patch
@@ -118,7 +112,7 @@ test_expect_success 'symlink becomes directory' '
112
test_debug 'cat patch'
113
114
121
-test_expect_success 'directory becomes symlink' '
115
+test_expect_success SYMLINKS 'directory becomes symlink' '
116
git checkout -f foo-becomes-a-directory &&
117
git diff-tree -p HEAD foo-symlinked-to-bar > patch &&
118
git apply --index < patch
t/t4115-apply-symlink.sh
+3
-9
@@ -9,13 +9,7 @@ test_description='git apply symlinks and partial files
9
10
. ./test-lib.sh
11
12
-if ! test_have_prereq SYMLINKS
13
-then
14
- skip_all='Symbolic links not supported, skipping tests.'
15
- test_done
16
-fi
17
-
18
-test_expect_success setup '
12
+test_expect_success SYMLINKS setup '
13
14
ln -s path1/path2/path3/path4/path5 link1 &&
15
git add link? &&
@@ -34,7 +28,7 @@ test_expect_success setup '
28
29
'
30
37
-test_expect_success 'apply symlink patch' '
31
+test_expect_success SYMLINKS 'apply symlink patch' '
32
33
git checkout side &&
34
git apply patch &&
@@ -43,7 +37,7 @@ test_expect_success 'apply symlink patch' '
37
38
'
39
46
-test_expect_success 'apply --index symlink patch' '
40
+test_expect_success SYMLINKS 'apply --index symlink patch' '
41
42
git checkout -f side &&
43
git apply --index patch &&
t/t4122-apply-symlink-inside.sh
+3
-9
@@ -3,12 +3,6 @@
3
test_description='apply to deeper directory without getting fooled with symlink'
4
. ./test-lib.sh
5
6
-if ! test_have_prereq SYMLINKS
7
-then
8
- skip_all='Symbolic links not supported, skipping tests.'
9
- test_done
10
-fi
11
-
6
lecho () {
7
for l_
8
do
@@ -16,7 +10,7 @@ lecho () {
10
done
11
}
12
19
-test_expect_success setup '
13
+test_expect_success SYMLINKS setup '
14
15
mkdir -p arch/i386/boot arch/x86_64 &&
16
lecho 1 2 3 4 5 >arch/i386/boot/Makefile &&
@@ -37,7 +31,7 @@ test_expect_success setup '
31
32
'
33
40
-test_expect_success apply '
34
+test_expect_success SYMLINKS apply '
35
36
git checkout test &&
37
git diff --exit-code test &&
@@ -46,7 +40,7 @@ test_expect_success apply '
40
41
'
42
49
-test_expect_success 'check result' '
43
+test_expect_success SYMLINKS 'check result' '
44
45
git diff --exit-code master &&
46
git diff --exit-code --cached master &&
t/t5522-pull-symlink.sh
+4
-10
@@ -4,12 +4,6 @@ test_description='pulling from symlinked subdir'
4
5
. ./test-lib.sh
6
7
-if ! test_have_prereq SYMLINKS
8
-then
9
- skip_all='Symbolic links not supported, skipping tests.'
10
- test_done
11
-fi
12
-
7
# The scenario we are building:
8
#
9
# trash\ directory/
@@ -20,7 +14,7 @@ fi
14
#
15
# The working directory is subdir-link.
16
23
-test_expect_success setup '
17
+test_expect_success SYMLINKS setup '
18
mkdir subdir &&
19
echo file >subdir/file &&
20
git add subdir/file &&
@@ -36,7 +30,7 @@ test_expect_success setup '
30
31
# Demonstrate that things work if we just avoid the symlink
32
#
39
-test_expect_success 'pulling from real subdir' '
33
+test_expect_success SYMLINKS 'pulling from real subdir' '
34
(
35
echo real >subdir/file &&
36
git commit -m real subdir/file &&
@@ -64,7 +58,7 @@ test_expect_success 'pulling from real subdir' '
58
# directory. A POSIX shell's "cd" works a little differently
59
# than chdir() in C; "cd -P" is much closer to chdir().
60
#
67
-test_expect_success 'pulling from symlinked subdir' '
61
+test_expect_success SYMLINKS 'pulling from symlinked subdir' '
62
(
63
echo link >subdir/file &&
64
git commit -m link subdir/file &&
@@ -77,7 +71,7 @@ test_expect_success 'pulling from symlinked subdir' '
71
# Prove that the remote end really is a repo, and other commands
72
# work fine in this context. It's just that "git pull" breaks.
73
#
80
-test_expect_success 'pushing from symlinked subdir' '
74
+test_expect_success SYMLINKS 'pushing from symlinked subdir' '
75
(
76
cd subdir-link/ &&
77
echo push >file &&
t/t6035-merge-dir-to-symlink.sh
+7
-13
@@ -3,13 +3,7 @@
3
test_description='merging when a directory was replaced with a symlink'
4
. ./test-lib.sh
5
6
-if ! test_have_prereq SYMLINKS
7
-then
8
- skip_all='Symbolic links not supported, skipping tests.'
9
- test_done
10
-fi
11
-
12
-test_expect_success 'create a commit where dir a/b changed to symlink' '
6
+test_expect_success SYMLINKS 'create a commit where dir a/b changed to symlink' '
7
mkdir -p a/b/c a/b-2/c &&
8
> a/b/c/d &&
9
> a/b-2/c/d &&
@@ -23,7 +17,7 @@ test_expect_success 'create a commit where dir a/b changed to symlink' '
17
git commit -m "dir to symlink"
18
'
19
26
-test_expect_success 'keep a/b-2/c/d across checkout' '
20
+test_expect_success SYMLINKS 'keep a/b-2/c/d across checkout' '
21
git checkout HEAD^0 &&
22
git reset --hard master &&
23
git rm --cached a/b &&
@@ -32,14 +26,14 @@ test_expect_success 'keep a/b-2/c/d across checkout' '
26
test -f a/b-2/c/d
27
'
28
35
-test_expect_success 'checkout should not have deleted a/b-2/c/d' '
29
+test_expect_success SYMLINKS 'checkout should not have deleted a/b-2/c/d' '
30
git checkout HEAD^0 &&
31
git reset --hard master &&
32
git checkout start^0 &&
33
test -f a/b-2/c/d
34
'
35
42
-test_expect_success 'setup for merge test' '
36
+test_expect_success SYMLINKS 'setup for merge test' '
37
git reset --hard &&
38
test -f a/b-2/c/d &&
39
echo x > a/x &&
@@ -48,7 +42,7 @@ test_expect_success 'setup for merge test' '
42
git tag baseline
43
'
44
51
-test_expect_success 'do not lose a/b-2/c/d in merge (resolve)' '
45
+test_expect_success SYMLINKS 'do not lose a/b-2/c/d in merge (resolve)' '
46
git reset --hard &&
47
git checkout baseline^0 &&
48
git merge -s resolve master &&
@@ -64,7 +58,7 @@ test_expect_failure 'do not lose a/b-2/c/d in merge (recursive)' '
58
test -f a/b-2/c/d
59
'
60
67
-test_expect_success 'setup a merge where dir a/b-2 changed to symlink' '
61
+test_expect_success SYMLINKS 'setup a merge where dir a/b-2 changed to symlink' '
62
git reset --hard &&
63
git checkout start^0 &&
64
rm -rf a/b-2 &&
@@ -74,7 +68,7 @@ test_expect_success 'setup a merge where dir a/b-2 changed to symlink' '
68
git tag test2
69
'
70
77
-test_expect_success 'merge should not have conflicts (resolve)' '
71
+test_expect_success SYMLINKS 'merge should not have conflicts (resolve)' '
72
git reset --hard &&
73
git checkout baseline^0 &&
74
git merge -s resolve test2 &&