1 // Tests trace pc guard coverage collection.
3 // REQUIRES: has_sancovcc,stable-runtime
4 // XFAIL: tsan,darwin,powerpc64,s390x
10 // RUN: %clangxx -O0 -fsanitize-coverage=trace-pc-guard %s -ldl -o %t
11 // RUN: %env_tool_opts=coverage=1 %t 2>&1 | FileCheck %s
12 // RUN: %sancovcc -covered-functions -strip_path_prefix=TestCases/ *.sancov %t 2>&1 | \
13 // RUN: FileCheck --check-prefix=CHECK-SANCOV %s
14 // RUN: %env_tool_opts=coverage=0 %t 2>&1 | FileCheck --check-prefix=CHECK-NOCOV %s
16 // Make some room to stabilize line numbers
23 fprintf(stderr, "foo\n");
28 fprintf(stderr, "main\n");
36 // CHECK-NEXT: SanitizerCoverage: ./sanitizer_coverage_trace_pc_guard.{{.*}}.sancov 2 PCs written
38 // CHECK-SANCOV: sanitizer_coverage_trace_pc_guard.cc:22 foo
39 // CHECK-SANCOV-NEXT: sanitizer_coverage_trace_pc_guard.cc:27 main
41 // CHECK-NOCOV-NOT: SanitizerCoverage