Skip to content

Commit f88611c

Browse files
ttaylorrgitster
authored andcommitted
t/t4216-log-bloom.sh: harden test_bloom_filters_not_used()
The existing implementation of test_bloom_filters_not_used() asserts that the Bloom filter sub-system has not been initialized at all, by checking for the absence of any data from it from trace2. In the following commit, it will become possible to load Bloom filters without using them (e.g., because the `commitGraph.changedPathVersion` introduced later in this series is incompatible with the hash version with which the commit-graph's Bloom filters were written). When this is the case, it's possible to initialize the Bloom filter sub-system, while still not using any Bloom filters. When this is the case, check that the data dump from the Bloom sub-system is all zeros, indicating that no filters were used. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d4dbce1 commit f88611c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

t/t4216-log-bloom.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,19 @@ test_bloom_filters_used () {
8282
test_bloom_filters_not_used () {
8383
log_args=$1
8484
setup "$log_args" &&
85-
! grep -q "statistics:{\"filter_not_present\":" "$TRASH_DIRECTORY/trace.perf" &&
85+
86+
if grep -q "statistics:{\"filter_not_present\":" "$TRASH_DIRECTORY/trace.perf"
87+
then
88+
# if the Bloom filter system is initialized, ensure that no
89+
# filters were used
90+
data="statistics:{"
91+
data="$data\"filter_not_present\":0,"
92+
data="$data\"maybe\":0,"
93+
data="$data\"definitely_not\":0,"
94+
data="$data\"false_positive\":0}"
95+
96+
grep -q "$data" "$TRASH_DIRECTORY/trace.perf"
97+
fi &&
8698
test_cmp log_wo_bloom log_w_bloom
8799
}
88100

0 commit comments

Comments
 (0)