• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // REQUIRES: has_sancovcc, x86_64-linux, asan-dynamic-runtime
2 // RUN: %clangxx_asan_static -fsanitize-coverage=func %s -o %t
3 // RUN: rm -rf %T/coverage_html_report
4 // RUN: mkdir -p %T/coverage_html_report
5 // RUN: cd %T/coverage_html_report
6 // RUN: %env_asan_opts=coverage=1:verbosity=1:html_cov_report=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-main
7 // RUN: ls *.html | FileCheck %s --check-prefix=CHECK-ls
8 // RUN: rm -r %T/coverage_html_report
9 
10 #include <stdio.h>
11 #include <unistd.h>
12 
bar()13 void bar() { printf("bar\n"); }
14 
main(int argc,char ** argv)15 int main(int argc, char **argv) {
16   fprintf(stderr, "PID: %d\n", getpid());
17   bar();
18   return 0;
19 }
20 
21 // CHECK-main: PID: [[PID:[0-9]+]]
22 // CHECK-main: [[PID]].sancov: 2 PCs written
23 // CHECK-main: coverage report generated to ./coverage_html_report.cc.tmp.[[PID]].html
24 // CHECK-ls: coverage_html_report.cc.tmp.{{[0-9]+}}.html
25