Skip to content

Commit 9e06e77

Browse files
authored
[rtsan] Add stats summary even when halt_on_error=true (#110165)
1 parent 10d4306 commit 9e06e77

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

compiler-rt/lib/rtsan/rtsan.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,11 @@ static auto OnViolationAction(DiagnosticsInfo info) {
7575
handle.inc_use_count_unsafe();
7676
}
7777

78-
if (flags().halt_on_error)
78+
if (flags().halt_on_error) {
79+
if (flags().print_stats_on_exit)
80+
PrintStatisticsSummary();
7981
Die();
82+
}
8083
};
8184
}
8285

compiler-rt/test/rtsan/exit_stats.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %clangxx -fsanitize=realtime %s -o %t
2-
// RUN: env RTSAN_OPTIONS="halt_on_error=false,print_stats_on_exit=true" %run %t 2>&1 | FileCheck %s
2+
// RUN: %env_rtsan_opts="halt_on_error=false,print_stats_on_exit=true" %run %t 2>&1 | FileCheck %s
3+
// RUN: %env_rtsan_opts="halt_on_error=true,print_stats_on_exit=true" not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-HALT
34

45
// UNSUPPORTED: ios
56

@@ -22,3 +23,7 @@ int main() {
2223
// CHECK: RealtimeSanitizer exit stats:
2324
// CHECK-NEXT: Total error count: 10
2425
// CHECK-NEXT: Unique error count: 1
26+
27+
// CHECK-HALT: RealtimeSanitizer exit stats:
28+
// CHECK-HALT-NEXT: Total error count: 1
29+
// CHECK-HALT-NEXT: Unique error count: 1

0 commit comments

Comments
 (0)