• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Tests trace pc guard coverage collection.
2 //
3 // REQUIRES: x86_64-linux
4 // XFAIL: tsan
5 //
6 // RUN: DIR=%t_workdir
7 // RUN: rm -rf $DIR
8 // RUN: mkdir -p $DIR
9 // RUN: cd $DIR
10 // RUN: %clangxx -O0 -fsanitize-coverage=trace-pc-guard %s -o %t
11 // RUN: %env_tool_opts=coverage=1 %t 2>&1 | FileCheck %s
12 // RUN: rm -rf $DIR
13 
14 #include <stdio.h>
15 
foo()16 int foo() {
17   fprintf(stderr, "foo\n");
18   return 1;
19 }
20 
main()21 int main() {
22   fprintf(stderr, "main\n");
23   foo();
24   foo();
25 }
26 
27 // CHECK: main
28 // CHECK: SanitizerCoverage: ./sanitizer_coverage_symbolize.{{.*}}.sancov: 2 PCs written
29