Skip to content

Commit 6b2edaa

Browse files
committed
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 <[email protected]>
1 parent 69a9c10 commit 6b2edaa

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

t/t4204-patch-id.sh

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ test_description='git patch-id'
55
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
66
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
77

8-
TEST_PASSES_SANITIZE_LEAK=true
98
. ./test-lib.sh
109

1110
test_expect_success 'setup' '
@@ -28,16 +27,17 @@ test_expect_success 'setup' '
2827
'
2928

3029
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 &&
3232
grep "^$OID_REGEX $(git rev-parse HEAD)$" output
3333
'
3434

3535
#calculate patch id. Make sure output is not empty.
3636
calc_patch_id () {
3737
patch_name="$1"
3838
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" &&
4141
test_line_count -gt 0 patch-id_"$patch_name"
4242
}
4343

@@ -46,7 +46,8 @@ get_top_diff () {
4646
}
4747

4848
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 "$@"
5051
}
5152

5253
test_expect_success 'patch-id detects equality' '
@@ -64,16 +65,18 @@ test_expect_success 'patch-id detects inequality' '
6465
test_expect_success 'patch-id supports git-format-patch output' '
6566
get_patch_id main &&
6667
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 &&
6870
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) &&
7072
test "$2" = $(git rev-parse HEAD)
7173
'
7274

7375
test_expect_success 'whitespace is irrelevant in footer' '
7476
get_patch_id main &&
7577
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 &&
7780
test_cmp patch-id_main patch-id_same
7881
'
7982

@@ -92,10 +95,11 @@ test_patch_id_file_order () {
9295
shift
9396
name="order-${1}-$relevant"
9497
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" "$@" &&
96100
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" "$@" &&
99103
cmp_patch_id $relevant "$name" "ordered-$name"
100104

101105
}
@@ -143,7 +147,8 @@ test_expect_success '--stable overrides patchid.stable = false' '
143147
test_expect_success 'patch-id supports git-format-patch MIME output' '
144148
get_patch_id main &&
145149
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 &&
147152
test_cmp patch-id_main patch-id_same
148153
'
149154

0 commit comments

Comments
 (0)