aboutsummaryrefslogtreecommitdiff
path: root/test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cc')
-rw-r--r--test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cc b/test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cc
new file mode 100644
index 000000000000..48f32a705c3a
--- /dev/null
+++ b/test/sanitizer_common/TestCases/sanitizer_coverage_symbolize.cc
@@ -0,0 +1,34 @@
+// Tests trace pc guard coverage collection.
+//
+// REQUIRES: x86_64-linux
+// XFAIL: tsan
+//
+// RUN: DIR=%t_workdir
+// RUN: rm -rf $DIR
+// RUN: mkdir -p $DIR
+// RUN: cd $DIR
+// RUN: %clangxx -O0 -fsanitize-coverage=trace-pc-guard %s -ldl -o %t
+// RUN: %env_tool_opts=coverage=1 %t 2>&1 | FileCheck %s
+// RUN: %env_tool_opts=coverage=1 SANCOV_OPTIONS=symbolize=0 %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOSYM
+// RUN: rm -rf $DIR
+
+#include <stdio.h>
+
+int foo() {
+ fprintf(stderr, "foo\n");
+ return 1;
+}
+
+int main() {
+ fprintf(stderr, "main\n");
+ foo();
+ foo();
+}
+
+// CHECK: main
+// CHECK: SanitizerCoverage: ./sanitizer_coverage_symbolize.{{.*}}.sancov 2 PCs written
+// CHECK: call sancov
+
+// CHECK-NOSYM: main
+// CHECK-NOSYM: SanitizerCoverage: ./sanitizer_coverage_symbolize.{{.*}}.sancov 2 PCs written
+// CHECK-NOSYM-NOT: call sancov