1 // Tests trace pc guard coverage collection.
3 // REQUIRES: has_sancovcc
4 // UNSUPPORTED: ubsan,i386-darwin,target={{(powerpc64|s390x|thumb).*}}
6 // XFAIL: android && asan
12 // RUN: %clangxx -O0 -fsanitize-coverage=trace-pc-guard %s -o %t
13 // RUN: %env_tool_opts=coverage=1 %t 2>&1 | FileCheck %s
14 // RUN: %sancovcc -covered-functions -strip_path_prefix=TestCases/ *.sancov %t 2>&1 | \
15 // RUN: FileCheck --check-prefix=CHECK-SANCOV %s
16 // RUN: %env_tool_opts=coverage=0 %t 2>&1 | FileCheck --check-prefix=CHECK-NOCOV %s
18 // 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.cpp:[[@LINE-16]] foo
39 // CHECK-SANCOV-NEXT: sanitizer_coverage_trace_pc_guard.cpp:[[@LINE-12]] main
41 // CHECK-NOCOV-NOT: SanitizerCoverage