Skip to content

Commit b6d775d

Browse files
avargitster
authored andcommitted
notes tests: don't ignore "git" exit code
Change a fragile test pattern that's been with us ever since these tests were introduced in [1], [2] and [3] to properly return the exit code of the failing command on failure. Because of this I'd marked this test as passing under SANITIZE=leak in [4] and [5]. We need to remove those annotations as these tests will no longer pass. 1. 9081a42 (checkout: fix "branch info" memory leaks, 2021-11-16) 2. 0057c09 (Add selftests verifying that we can parse notes trees with various fanouts, 2009-10-09) 3. 048cdd4 (t3305: Verify that adding many notes with git-notes triggers increased fanout, 2010-02-13) 4. ca08972 (leak tests: mark some notes tests as passing with SANITIZE=leak, 2021-10-31) 5. 9081a42 (checkout: fix "branch info" memory leaks, 2021-11-16) Signed-off-by: Junio C Hamano <[email protected]>
1 parent 53ce7cc commit b6d775d

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

t/t3302-notes-index-expensive.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ test_description='Test commit notes index (expensive!)'
88
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
99
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
1010

11-
TEST_PASSES_SANITIZE_LEAK=true
1211
. ./test-lib.sh
1312

1413
create_repo () {
@@ -65,7 +64,8 @@ create_repo () {
6564
test_notes () {
6665
count=$1 &&
6766
git config core.notesRef refs/notes/commits &&
68-
git log | grep "^ " >output &&
67+
git log >tmp &&
68+
grep "^ " tmp >output &&
6969
i=$count &&
7070
while test $i -gt 0
7171
do
@@ -90,7 +90,7 @@ write_script time_notes <<\EOF
9090
unset GIT_NOTES_REF
9191
;;
9292
esac
93-
git log
93+
git log || exit $?
9494
i=$(($i+1))
9595
done >/dev/null
9696
EOF

t/t3303-notes-subtrees.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ test_description='Test commit notes organized in subtrees'
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
number_of_commits=100
@@ -79,7 +78,7 @@ test_sha1_based () {
7978
(
8079
start_note_commit &&
8180
nr=$number_of_commits &&
82-
git rev-list refs/heads/main |
81+
git rev-list refs/heads/main >out &&
8382
while read sha1; do
8483
note_path=$(echo "$sha1" | sed "$1")
8584
cat <<INPUT_END &&
@@ -91,9 +90,9 @@ EOF
9190
INPUT_END
9291

9392
nr=$(($nr-1))
94-
done
95-
) |
96-
git fast-import --quiet
93+
done <out
94+
) >gfi &&
95+
git fast-import --quiet <gfi
9796
}
9897

9998
test_expect_success 'test notes in 2/38-fanout' 'test_sha1_based "s|^..|&/|"'

t/t3305-notes-fanout.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
test_description='Test that adding/removing many notes triggers automatic fanout restructuring'
44

5-
TEST_PASSES_SANITIZE_LEAK=true
65
. ./test-lib.sh
76

87
path_has_fanout() {
@@ -24,7 +23,7 @@ touched_one_note_with_fanout() {
2423
all_notes_have_fanout() {
2524
notes_commit=$1 &&
2625
fanout=$2 &&
27-
git ls-tree -r --name-only $notes_commit 2>/dev/null |
26+
git ls-tree -r --name-only $notes_commit |
2827
while read path
2928
do
3029
path_has_fanout $path $fanout || return 1
@@ -51,8 +50,9 @@ test_expect_success 'creating many notes with git-notes' '
5150
done
5251
'
5352

54-
test_expect_success 'many notes created correctly with git-notes' '
55-
git log | grep "^ " > output &&
53+
test_expect_success !SANITIZE_LEAK 'many notes created correctly with git-notes' '
54+
git log >output.raw &&
55+
grep "^ " output.raw >output &&
5656
i=$num_notes &&
5757
while test $i -gt 0
5858
do
@@ -91,13 +91,13 @@ test_expect_success 'stable fanout 0 is followed by stable fanout 1' '
9191
test_expect_success 'deleting most notes with git-notes' '
9292
remove_notes=285 &&
9393
i=0 &&
94-
git rev-list HEAD |
94+
git rev-list HEAD >revs &&
9595
while test $i -lt $remove_notes && read sha1
9696
do
9797
i=$(($i + 1)) &&
9898
test_tick &&
99-
git notes remove "$sha1" 2>/dev/null || return 1
100-
done
99+
git notes remove "$sha1" || return 1
100+
done <revs
101101
'
102102

103103
test_expect_success 'most notes deleted correctly with git-notes' '

0 commit comments

Comments
 (0)