summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Aizatsky <aizatsky@chromium.org>2017-01-19 03:49:18 +0000
committerMike Aizatsky <aizatsky@chromium.org>2017-01-19 03:49:18 +0000
commit7da919b8b08a074405d64b00b3e135e65765dbe5 (patch)
treef54599ee5cf70b4b077047789fa1453213b39a17
parentc8bcda2b56db0789acb9b557579b87c3035c833f (diff)
downloadbcm5719-llvm-7da919b8b08a074405d64b00b3e135e65765dbe5.tar.gz
bcm5719-llvm-7da919b8b08a074405d64b00b3e135e65765dbe5.zip
[sancov] applying blacklist to covered points too
Differential Revision: https://reviews.llvm.org/D28872 llvm-svn: 292468
-rw-r--r--llvm/test/tools/sancov/Inputs/src_blacklist.txt2
-rw-r--r--llvm/test/tools/sancov/blacklist.test26
-rw-r--r--llvm/tools/sancov/sancov.cc8
3 files changed, 30 insertions, 6 deletions
diff --git a/llvm/test/tools/sancov/Inputs/src_blacklist.txt b/llvm/test/tools/sancov/Inputs/src_blacklist.txt
index 8f5cbc838f4..c215d9ac627 100644
--- a/llvm/test/tools/sancov/Inputs/src_blacklist.txt
+++ b/llvm/test/tools/sancov/Inputs/src_blacklist.txt
@@ -1,3 +1,3 @@
# this path looks like sancov/Inputs/../Inputs/ in the binary.
# Make sure it is filtered out correctly.
-src:*/sancov/Inputs/foo.cpp
+src:*/sancov/Inputs/test.cpp
diff --git a/llvm/test/tools/sancov/blacklist.test b/llvm/test/tools/sancov/blacklist.test
index 6af1799a481..53f48534dc9 100644
--- a/llvm/test/tools/sancov/blacklist.test
+++ b/llvm/test/tools/sancov/blacklist.test
@@ -1,10 +1,26 @@
REQUIRES: x86_64-linux
+RUN: sancov -covered-functions %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s --check-prefix=ALL
RUN: sancov -covered-functions -blacklist %p/Inputs/fun_blacklist.txt %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s
RUN: sancov -covered-functions -blacklist %p/Inputs/src_blacklist.txt %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.1.sancov | FileCheck --check-prefix=CHECK1 %s
+RUN: sancov -print-coverage-stats %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.1.sancov | FileCheck --check-prefix=STATS %s
+RUN: sancov -print-coverage-stats -blacklist %p/Inputs/fun_blacklist.txt %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.1.sancov | FileCheck --check-prefix=STATS-BLIST %s
-CHECK-NOT: Inputs{{[/\\]}}test.cpp:12 bar(std::string)
-CHECK: Inputs{{[/\\]}}test.cpp:14 main
+ALL: test.cpp:12 bar(std::string)
+ALL: test.cpp:14 main
+
+CHECK-NOT: test.cpp:12 bar(std::string)
+CHECK: test.cpp:14 main
+
+CHECK1-NOT: test.cpp:12 bar(std::string)
+CHECK1-NOT: test.cpp:14 main
+
+STATS: all-edges: 9
+STATS: cov-edges: 7
+STATS: all-functions: 3
+STATS: cov-functions: 3
+
+STATS-BLIST: all-edges: 8
+STATS-BLIST: cov-edges: 6
+STATS-BLIST: all-functions: 2
+STATS-BLIST: cov-functions: 2
-CHECK1-NOT: foo
-CHECK1: Inputs{{[/\\]}}test.cpp:12 bar(std::string)
-CHECK1: Inputs{{[/\\]}}test.cpp:14 main
diff --git a/llvm/tools/sancov/sancov.cc b/llvm/tools/sancov/sancov.cc
index ff2039de35e..c56ea67b12c 100644
--- a/llvm/tools/sancov/sancov.cc
+++ b/llvm/tools/sancov/sancov.cc
@@ -946,7 +946,15 @@ symbolize(const RawCoverage &Data, const std::string ObjectFile) {
Hasher.update((*BufOrErr)->getBuffer());
Coverage->BinaryHash = toHex(Hasher.final());
+ Blacklists B;
+ auto Symbolizer(createSymbolizer());
+
for (uint64_t Addr : *Data.Addrs) {
+ auto LineInfo = Symbolizer->symbolizeCode(ObjectFile, Addr);
+ failIfError(LineInfo);
+ if (B.isBlacklisted(*LineInfo))
+ continue;
+
Coverage->CoveredIds.insert(utohexstr(Addr, true));
}
OpenPOWER on IntegriCloud