Revert "[lldb][test] Remove compiler version check and use regex" (#124101)
[llvm-project.git] / compiler-rt / test / sanitizer_common / TestCases / sanitizer_coverage_trace_pc_guard.cpp
blob84c28e82f04ac1ad0e86ab87815319a640d656db
1 // Tests trace pc guard coverage collection.
3 // REQUIRES: has_sancovcc
4 // UNSUPPORTED: ubsan,i386-darwin,target={{(powerpc64|s390x|sparc|thumb).*}}
5 // This test is failing for lsan on darwin on x86_64h.
6 // UNSUPPORTED: x86_64h-darwin && lsan
7 // XFAIL: tsan
8 // XFAIL: android && asan
10 // RUN: rm -rf %t_workdir
11 // RUN: mkdir -p %t_workdir
12 // RUN: cd %t_workdir
13 // RUN: %clangxx -O0 -fsanitize-coverage=trace-pc-guard %s -o %t
14 // RUN: %env_tool_opts=coverage=1 %t 2>&1 | FileCheck %s
15 // RUN: %sancovcc -covered-functions -strip_path_prefix=TestCases/ *.sancov %t 2>&1 | \
16 // RUN: FileCheck --check-prefix=CHECK-SANCOV %s
17 // RUN: %env_tool_opts=coverage=0 %t 2>&1 | FileCheck --check-prefix=CHECK-NOCOV %s
18 // RUN: rm -rf %t_workdir
19 // Make some room to stabilize line numbers
21 #include <stdio.h>
23 int foo() {
24 fprintf(stderr, "foo\n");
25 return 1;
28 int main() {
29 fprintf(stderr, "main\n");
30 foo();
31 foo();
34 // CHECK: main
35 // CHECK-NEXT: foo
36 // CHECK-NEXT: foo
37 // CHECK-NEXT: SanitizerCoverage: ./sanitizer_coverage_trace_pc_guard.{{.*}}.sancov: 2 PCs written
39 // CHECK-SANCOV: sanitizer_coverage_trace_pc_guard.cpp:[[@LINE-16]] foo
40 // CHECK-SANCOV-NEXT: sanitizer_coverage_trace_pc_guard.cpp:[[@LINE-12]] main
42 // CHECK-NOCOV-NOT: SanitizerCoverage