Skip to content

Commit cf10c5b

Browse files
avargitster
authored andcommitted
rev-list tests: don't hide abort() in "test_expect_failure"
Change a couple of uses of "test_expect_failure" to use a "test_expect_success" to positively assert the current behavior, and replace the intent of "test_expect_failure" with a "TODO" comment int the description. As noted in [1] the "test_expect_failure" feature is overly eager to accept any failure as OK, and thus by design hides segfaults, abort() etc. Because of that I didn't notice in dd9cede (leak tests: mark some rev-list tests as passing with SANITIZE=leak, 2021-10-31) that this test leaks memory under SANITIZE=leak. I have some larger local changes to add a better "test_expect_failure", which would work just like "test_expect_success", but would allow us say "test_todo" here (and "success" would emit a "not ok [...] # TODO", not "ok [...]". So even though using "test_expect_success" here comes with its own problems[2], let's use it as a narrow change to fix the problem at hand here and stop conflating the current "success" with actual SANITIZE=leak failures. 1. https://lore.kernel.org/git/[email protected]/ 2. https://lore.kernel.org/git/[email protected]/ Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5b911a2 commit cf10c5b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

t/t6102-rev-list-unexpected-objects.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@ test_expect_success 'setup unexpected non-blob entry' '
1717
broken_tree="$(git hash-object -w --literally -t tree broken-tree)"
1818
'
1919

20-
test_expect_failure 'traverse unexpected non-blob entry (lone)' '
21-
test_must_fail git rev-list --objects $broken_tree
20+
test_expect_success !SANITIZE_LEAK 'TODO (should fail!): traverse unexpected non-blob entry (lone)' '
21+
sed "s/Z$//" >expect <<-EOF &&
22+
$broken_tree Z
23+
$tree foo
24+
EOF
25+
git rev-list --objects $broken_tree >actual &&
26+
test_cmp expect actual
2227
'
2328

2429
test_expect_success 'traverse unexpected non-blob entry (seen)' '
@@ -116,8 +121,8 @@ test_expect_success 'setup unexpected non-blob tag' '
116121
tag=$(git hash-object -w --literally -t tag broken-tag)
117122
'
118123

119-
test_expect_failure 'traverse unexpected non-blob tag (lone)' '
120-
test_must_fail git rev-list --objects $tag
124+
test_expect_success !SANITIZE_LEAK 'TODO (should fail!): traverse unexpected non-blob tag (lone)' '
125+
git rev-list --objects $tag
121126
'
122127

123128
test_expect_success 'traverse unexpected non-blob tag (seen)' '

0 commit comments

Comments
 (0)