summaryrefslogtreecommitdiff
path: root/test/asan
diff options
context:
space:
mode:
authorMike Aizatsky <aizatsky@chromium.org>2016-01-27 23:51:36 +0000
committerMike Aizatsky <aizatsky@chromium.org>2016-01-27 23:51:36 +0000
commit331b8d08ba07668ce06a15a8f310ba4fa9543296 (patch)
tree595a5532d236f23dd162ff355f8dc7287f0d3e94 /test/asan
parentcce3227b8684952f19f3fb184c819f721e4e19b3 (diff)
[sanitizers] generating html report on coverage dump
Subscribers: tberghammer, danalbert, srhines Differential Revision: http://reviews.llvm.org/D16374 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@258999 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/asan')
-rw-r--r--test/asan/TestCases/Posix/coverage_html_report.cc24
-rw-r--r--test/asan/lit.cfg2
2 files changed, 25 insertions, 1 deletions
diff --git a/test/asan/TestCases/Posix/coverage_html_report.cc b/test/asan/TestCases/Posix/coverage_html_report.cc
new file mode 100644
index 000000000..98d78b9be
--- /dev/null
+++ b/test/asan/TestCases/Posix/coverage_html_report.cc
@@ -0,0 +1,24 @@
+// REQUIRES: has_sancovcc
+// RUN: %clangxx_asan -fsanitize-coverage=func %s -o %t
+// RUN: rm -rf %T/coverage_html_report
+// RUN: mkdir -p %T/coverage_html_report
+// RUN: cd %T/coverage_html_report
+// RUN: %env_asan_opts=coverage=1:verbosity=1:html_cov_report=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-main
+// RUN: ls *.html | FileCheck %s --check-prefix=CHECK-ls
+// RUN: rm -r %T/coverage_html_report
+
+#include <stdio.h>
+#include <unistd.h>
+
+void bar() { printf("bar\n"); }
+
+int main(int argc, char **argv) {
+ fprintf(stderr, "PID: %d\n", getpid());
+ bar();
+ return 0;
+}
+
+// CHECK-main: PID: [[PID:[0-9]+]]
+// CHECK-main: [[PID]].sancov: 2 PCs written
+// CHECK-main: html report generated to ./coverage_html_report.cc.tmp.[[PID]].html
+// CHECK-ls: coverage_html_report.cc.tmp.{{[0-9]+}}.html
diff --git a/test/asan/lit.cfg b/test/asan/lit.cfg
index 835547090..c50559a51 100644
--- a/test/asan/lit.cfg
+++ b/test/asan/lit.cfg
@@ -138,7 +138,7 @@ sancov = os.path.join(sanitizer_common_source_dir, "scripts", "sancov.py")
if not os.path.exists(sancov):
lit_config.fatal("Can't find script on path %r" % sancov)
python_exec = get_required_attr(config, "python_executable")
-config.substitutions.append( ("%sancov", python_exec + " " + sancov + " ") )
+config.substitutions.append( ("%sancov ", python_exec + " " + sancov + " ") )
# Determine kernel bitness
if config.host_arch.find('64') != -1 and config.android != "1":