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
8 // XFAIL: android && asan
10 // RUN: rm -rf %t_workdir
11 // RUN: mkdir -p %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
24 fprintf(stderr
, "foo\n");
29 fprintf(stderr
, "main\n");
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