mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-19 10:53:55 +00:00
[sancov] using normalized filenames for blacklist checks.
Differential Revision: http://reviews.llvm.org/D19395 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267078 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
259641db60
commit
aa724817e4
3
test/tools/sancov/Inputs/src_blacklist.txt
Normal file
3
test/tools/sancov/Inputs/src_blacklist.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# this path looks like sancov/Inputs/../Inputs/ in the binary.
|
||||||
|
# Make sure it is filtered out correctly.
|
||||||
|
src:*/sancov/Inputs/foo.cpp
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
// compile & generate coverage data using:
|
// compile & generate coverage data using:
|
||||||
// clang++ -g -o test-linux_x86_64 -fsanitize=address -fsanitize-coverage=bb test.cpp foo.cpp
|
// clang++ -g -o test-linux_x86_64 -fsanitize=address -fsanitize-coverage=bb test.cpp ../Inputs/foo.cpp
|
||||||
// ASAN_OPTIONS="coverage=1" ./test-linux_x86_64 && mv test-linux_x86_64.*.sancov test-linux_x86_64.sancov
|
// ASAN_OPTIONS="coverage=1" ./test-linux_x86_64 && mv test-linux_x86_64.??*.sancov test-linux_x86_64.0.sancov
|
||||||
// ASAN_OPTIONS="coverage=1" ./test-linux_x86_64 1 && mv test-linux_x86_64.*.sancov test-linux_x86_64-1.sancov
|
// ASAN_OPTIONS="coverage=1" ./test-linux_x86_64 1 && mv test-linux_x86_64.??*.sancov test-linux_x86_64.1.sancov
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
REQUIRES: x86_64-linux
|
REQUIRES: x86_64-linux
|
||||||
RUN: sancov -covered-functions -blacklist %p/Inputs/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/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
|
||||||
|
|
||||||
CHECK-NOT: Inputs{{[/\\]}}test.cpp:12 bar(std::string)
|
CHECK-NOT: Inputs{{[/\\]}}test.cpp:12 bar(std::string)
|
||||||
CHECK: Inputs{{[/\\]}}test.cpp:14 main
|
CHECK: Inputs{{[/\\]}}test.cpp:14 main
|
||||||
|
|
||||||
|
CHECK1-NOT: foo
|
||||||
|
CHECK1: Inputs{{[/\\]}}test.cpp:12 bar(std::string)
|
||||||
|
CHECK1: Inputs{{[/\\]}}test.cpp:14 main
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
REQUIRES: x86_64-linux
|
REQUIRES: x86_64-linux
|
||||||
RUN: sancov -print %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s
|
RUN: sancov -print %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s
|
||||||
|
|
||||||
CHECK: 0x4dbe2b
|
CHECK: 0x4e132b
|
||||||
CHECK: 0x4dbf72
|
CHECK: 0x4e1472
|
||||||
CHECK: 0x4dbfec
|
CHECK: 0x4e1520
|
||||||
CHECK: 0x4dc033
|
CHECK: 0x4e1553
|
||||||
CHECK: 0x4dc06a
|
CHECK: 0x4e1586
|
||||||
CHECK: 0x4dc09d
|
|
||||||
CHECK: 0x4dc0d0
|
|
||||||
|
|
||||||
|
@ -1,20 +1,13 @@
|
|||||||
REQUIRES: x86_64-linux
|
REQUIRES: x86_64-linux
|
||||||
RUN: sancov -print-coverage-pcs %p/Inputs/test-linux_x86_64 | FileCheck %s
|
RUN: sancov -print-coverage-pcs %p/Inputs/test-linux_x86_64 | FileCheck %s
|
||||||
|
|
||||||
CHECK: 0x4cced1
|
CHECK: 0x4e132b
|
||||||
CHECK: 0x4ccf01
|
CHECK: 0x4e1472
|
||||||
CHECK: 0x4dbe2b
|
CHECK: 0x4e14c2
|
||||||
CHECK: 0x4dbf72
|
CHECK: 0x4e1520
|
||||||
CHECK: 0x4dbfc2
|
CHECK: 0x4e1553
|
||||||
CHECK: 0x4dbfec
|
CHECK: 0x4e1586
|
||||||
CHECK: 0x4dc033
|
CHECK: 0x4e1635
|
||||||
CHECK: 0x4dc06a
|
CHECK: 0x4e1690
|
||||||
CHECK: 0x4dc09d
|
CHECK: 0x4e178c
|
||||||
CHECK: 0x4dc0d0
|
|
||||||
CHECK: 0x4dc17f
|
|
||||||
CHECK: 0x4dc1c6
|
|
||||||
CHECK: 0x4dc20d
|
|
||||||
CHECK: 0x4dc237
|
|
||||||
CHECK: 0x4dc265
|
|
||||||
CHECK: 0x4dc34c
|
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
REQUIRES: x86_64-linux
|
REQUIRES: x86_64-linux
|
||||||
RUN: sancov -print-coverage-stats %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s
|
RUN: sancov -print-coverage-stats %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s
|
||||||
|
|
||||||
CHECK: all-edges: 16
|
CHECK: all-edges: 9
|
||||||
CHECK: cov-edges: 7
|
CHECK: cov-edges: 5
|
||||||
CHECK: all-functions: 3
|
CHECK: all-functions: 3
|
||||||
CHECK: cov-functions: 2
|
CHECK: cov-functions: 2
|
||||||
|
|
||||||
|
@ -241,14 +241,16 @@ public:
|
|||||||
: DefaultBlacklist(createDefaultBlacklist()),
|
: DefaultBlacklist(createDefaultBlacklist()),
|
||||||
UserBlacklist(createUserBlacklist()) {}
|
UserBlacklist(createUserBlacklist()) {}
|
||||||
|
|
||||||
bool isBlacklisted(const DILineInfo &DI) {
|
// AddrInfo contains normalized filename. It is important to check it rather
|
||||||
if (DefaultBlacklist && DefaultBlacklist->inSection("fun", DI.FunctionName))
|
// than DILineInfo.
|
||||||
|
bool isBlacklisted(const AddrInfo &AI) {
|
||||||
|
if (DefaultBlacklist && DefaultBlacklist->inSection("fun", AI.FunctionName))
|
||||||
return true;
|
return true;
|
||||||
if (DefaultBlacklist && DefaultBlacklist->inSection("src", DI.FileName))
|
if (DefaultBlacklist && DefaultBlacklist->inSection("src", AI.FileName))
|
||||||
return true;
|
return true;
|
||||||
if (UserBlacklist && UserBlacklist->inSection("fun", DI.FunctionName))
|
if (UserBlacklist && UserBlacklist->inSection("fun", AI.FunctionName))
|
||||||
return true;
|
return true;
|
||||||
if (UserBlacklist && UserBlacklist->inSection("src", DI.FileName))
|
if (UserBlacklist && UserBlacklist->inSection("src", AI.FileName))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -286,17 +288,19 @@ static std::vector<AddrInfo> getAddrInfo(std::string ObjectFile,
|
|||||||
for (auto Addr : Addrs) {
|
for (auto Addr : Addrs) {
|
||||||
auto LineInfo = Symbolizer->symbolizeCode(ObjectFile, Addr);
|
auto LineInfo = Symbolizer->symbolizeCode(ObjectFile, Addr);
|
||||||
FailIfError(LineInfo);
|
FailIfError(LineInfo);
|
||||||
if (B.isBlacklisted(*LineInfo))
|
auto LineAddrInfo = AddrInfo(*LineInfo, Addr);
|
||||||
|
if (B.isBlacklisted(LineAddrInfo))
|
||||||
continue;
|
continue;
|
||||||
Result.push_back(AddrInfo(*LineInfo, Addr));
|
Result.push_back(LineAddrInfo);
|
||||||
if (InlinedCode) {
|
if (InlinedCode) {
|
||||||
auto InliningInfo = Symbolizer->symbolizeInlinedCode(ObjectFile, Addr);
|
auto InliningInfo = Symbolizer->symbolizeInlinedCode(ObjectFile, Addr);
|
||||||
FailIfError(InliningInfo);
|
FailIfError(InliningInfo);
|
||||||
for (uint32_t I = 0; I < InliningInfo->getNumberOfFrames(); ++I) {
|
for (uint32_t I = 0; I < InliningInfo->getNumberOfFrames(); ++I) {
|
||||||
auto FrameInfo = InliningInfo->getFrame(I);
|
auto FrameInfo = InliningInfo->getFrame(I);
|
||||||
if (B.isBlacklisted(FrameInfo))
|
auto FrameAddrInfo = AddrInfo(FrameInfo, Addr);
|
||||||
|
if (B.isBlacklisted(FrameAddrInfo))
|
||||||
continue;
|
continue;
|
||||||
Result.push_back(AddrInfo(FrameInfo, Addr));
|
Result.push_back(FrameAddrInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user