Skip to content

Commit bb90e2e

Browse files
authored
[libfuzzer] Fix -runs=X flaky test (fuzzer-finalstats.test) (#96914)
Disables LSan in order to remove a 1% flake rate in this test. There's some logic in LeakSanitizer and its integration into libFuzzer that will disable LSan and re-run the input. This only happens when more malloc()s are detected than free()s. Under high system load, this appears to be possible as the "more mallocs than frees" is dependent on walltime. In these instances, the number of runs ends up being `n + 1`, which is undesirable.
1 parent a77d3ea commit bb90e2e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

compiler-rt/test/fuzzer/fuzzer-finalstats.test

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,22 @@
22
UNSUPPORTED: target={{.*}}
33

44
RUN: %cpp_compiler %S/SimpleTest.cpp -o %t-SimpleTest
5-
RUN: %run %t-SimpleTest -seed=1 -runs=77 -print_final_stats=1 2>&1 | FileCheck %s --check-prefix=FINAL_STATS
5+
6+
// Note: `-detect_leaks=0` is required to prevent flakiness in this test.
7+
// There's some logic in LeakSanitizer and its integration into libFuzzer that
8+
// will disable LSan and re-run the input. This only happens when more malloc()s
9+
// are detected than free()s. Under high system load, this appears to be
10+
// possible as the "more mallocs than frees" is dependent on walltime. In these
11+
// instances, the number of runs ends up being `n + 1`, which is undesirable.
12+
13+
RUN: %run %t-SimpleTest -seed=1 -runs=77 -print_final_stats=1 -detect_leaks=0 2>&1 | FileCheck %s --check-prefix=FINAL_STATS
614
FINAL_STATS: stat::number_of_executed_units: 77
715
FINAL_STATS: stat::average_exec_per_sec: 0
816
FINAL_STATS: stat::new_units_added:
917
FINAL_STATS: stat::slowest_unit_time_sec: 0
1018
FINAL_STATS: stat::peak_rss_mb:
1119

12-
RUN: %run %t-SimpleTest %S/dict1.txt -runs=33 -print_final_stats=1 2>&1 | FileCheck %s --check-prefix=FINAL_STATS1
20+
RUN: %run %t-SimpleTest %S/dict1.txt -runs=33 -print_final_stats=1 -detect_leaks=0 2>&1 | FileCheck %s --check-prefix=FINAL_STATS1
1321
FINAL_STATS1: stat::number_of_executed_units: 33
1422
FINAL_STATS1: stat::peak_rss_mb:
1523

0 commit comments

Comments
 (0)