brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 92ca58f Raw
41 lines · cpp
1// RUN: %clangxx -fsanitize=realtime %s -o %t2// RUN: %env_rtsan_opts="halt_on_error=false,print_stats_on_exit=true" %run %t 2>&1 | FileCheck %s3// RUN: %env_rtsan_opts="halt_on_error=true,print_stats_on_exit=true" not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-HALT4// RUN: %env_rtsan_opts="suppressions=%s.supp,print_stats_on_exit=true" not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-SUPPRESSIONS5 6// UNSUPPORTED: ios7 8// Intent: Ensure exits stats are printed on exit.9 10#include <unistd.h>11 12void violation() [[clang::nonblocking]] {13  const int kNumViolations = 10;14  for (int i = 0; i < kNumViolations; i++) {15    usleep(1);16  }17}18 19int main() {20  violation();21  return 0;22}23 24// CHECK: RealtimeSanitizer exit stats:25// CHECK-NEXT: Total error count: 1026// CHECK-NEXT: Unique error count: 127// CHECK-NOT: Suppression count28 29// CHECK-HALT: RealtimeSanitizer exit stats:30// CHECK-HALT-NEXT: Total error count: 131// CHECK-HALT-NEXT: Unique error count: 132// CHECK-HALT-NOT: Suppression count33 34// We pass in intentionally_non_existant_function in the suppressions file35// This is just to ensure we only get the "Suppression count" metric if this36// file is passed at runtime, otherwise that statistic is omitted37// CHECK-SUPPRESSIONS: RealtimeSanitizer exit stats:38// CHECK-SUPPRESSIONS-NEXT: Total error count: 139// CHECK-SUPPRESSIONS-NEXT: Unique error count: 140// CHECK-SUPPRESSIONS-NEXT: Suppression count: 041