t4204 is not sanitizer clean at all
Earlier we marked that this patch-id test is leak-sanitizer clean, but if we read the test script carefully, it is merely because we have too many invocations of commands in the "git log" family on the upstream side of the pipe, hiding breakages from them. Split the pipeline so that breakages from these commands can be caught (not limited to aborts due to leak-sanitizer) and unmark the script as not passing the test with leak-sanitizer in effect. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Dec 16, 2021 at 15:11 UTC
6b2edaa3788936e07662ddc9bfddcf47920371fa
1 file changed
+17
-12
t/t4204-patch-id.sh
+17
-12
@@ -5,7 +5,6 @@ test_description='git patch-id'
5
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8
-TEST_PASSES_SANITIZE_LEAK=true
8
. ./test-lib.sh
9
10
test_expect_success 'setup' '
@@ -28,7 +27,8 @@ test_expect_success 'setup' '
27
'
28
29
test_expect_success 'patch-id output is well-formed' '
31
- git log -p -1 | git patch-id >output &&
30
+ git log -p -1 >log.output &&
31
+ git patch-id <log.output >output &&
32
grep "^$OID_REGEX $(git rev-parse HEAD)$" output
33
'
34
@@ -36,8 +36,8 @@ test_expect_success 'patch-id output is well-formed' '
36
calc_patch_id () {
37
patch_name="$1"
38
shift
39
- git patch-id "$@" |
40
- sed "s/ .*//" >patch-id_"$patch_name" &&
39
+ git patch-id "$@" >patch-id.output &&
40
+ sed "s/ .*//" patch-id.output >patch-id_"$patch_name" &&
41
test_line_count -gt 0 patch-id_"$patch_name"
42
}
43
@@ -46,7 +46,8 @@ get_top_diff () {
46
}
47
48
get_patch_id () {
49
- get_top_diff "$1" | calc_patch_id "$@"
49
+ get_top_diff "$1" >top-diff.output &&
50
+ calc_patch_id <top-diff.output "$@"
51
}
52
53
test_expect_success 'patch-id detects equality' '
@@ -64,16 +65,18 @@ test_expect_success 'patch-id detects inequality' '
65
test_expect_success 'patch-id supports git-format-patch output' '
66
get_patch_id main &&
67
git checkout same &&
67
- git format-patch -1 --stdout | calc_patch_id same &&
68
+ git format-patch -1 --stdout >format-patch.output &&
69
+ calc_patch_id same <format-patch.output &&
70
test_cmp patch-id_main patch-id_same &&
69
- set $(git format-patch -1 --stdout | git patch-id) &&
71
+ set $(git patch-id <format-patch.output) &&
72
test "$2" = $(git rev-parse HEAD)
73
'
74
75
test_expect_success 'whitespace is irrelevant in footer' '
76
get_patch_id main &&
77
git checkout same &&
76
- git format-patch -1 --stdout | sed "s/ \$//" | calc_patch_id same &&
78
+ git format-patch -1 --stdout >format-patch.output &&
79
+ sed "s/ \$//" format-patch.output | calc_patch_id same &&
80
test_cmp patch-id_main patch-id_same
81
'
82
@@ -92,10 +95,11 @@ test_patch_id_file_order () {
95
shift
96
name="order-${1}-$relevant"
97
shift
95
- get_top_diff "main" | calc_patch_id "$name" "$@" &&
98
+ get_top_diff "main" >top-diff.output &&
99
+ calc_patch_id <top-diff.output "$name" "$@" &&
100
git checkout same &&
97
- git format-patch -1 --stdout -O foo-then-bar |
98
- calc_patch_id "ordered-$name" "$@" &&
101
+ git format-patch -1 --stdout -O foo-then-bar >format-patch.output &&
102
+ calc_patch_id <format-patch.output "ordered-$name" "$@" &&
103
cmp_patch_id $relevant "$name" "ordered-$name"
104
105
}
@@ -143,7 +147,8 @@ test_expect_success '--stable overrides patchid.stable = false' '
147
test_expect_success 'patch-id supports git-format-patch MIME output' '
148
get_patch_id main &&
149
git checkout same &&
146
- git format-patch -1 --attach --stdout | calc_patch_id same &&
150
+ git format-patch -1 --attach --stdout >format-patch.output &&
151
+ calc_patch_id <format-patch.output same &&
152
test_cmp patch-id_main patch-id_same
153
'
154