summaryrefslogtreecommitdiff
path: root/unittests/ProfileData/CoverageMappingTest.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-07-28 10:51:19 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-07-28 10:51:19 +0000
commiteb11fae6d08f479c0799db45860a98af528fa6e7 (patch)
tree44d492a50c8c1a7eb8e2d17ea3360ec4d066f042 /unittests/ProfileData/CoverageMappingTest.cpp
parentb8a2042aa938069e862750553db0e4d82d25822c (diff)
Notes
Diffstat (limited to 'unittests/ProfileData/CoverageMappingTest.cpp')
-rw-r--r--unittests/ProfileData/CoverageMappingTest.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/unittests/ProfileData/CoverageMappingTest.cpp b/unittests/ProfileData/CoverageMappingTest.cpp
index 4d0f852da982..987f67699585 100644
--- a/unittests/ProfileData/CoverageMappingTest.cpp
+++ b/unittests/ProfileData/CoverageMappingTest.cpp
@@ -859,17 +859,34 @@ TEST_P(CoverageMappingTest, load_coverage_for_expanded_file) {
TEST_P(CoverageMappingTest, skip_duplicate_function_record) {
ProfileWriter.addRecord({"func", 0x1234, {1}}, Err);
+ // This record should be loaded.
startFunction("func", 0x1234);
addCMR(Counter::getCounter(0), "file1", 1, 1, 9, 9);
+ // This record should be loaded.
startFunction("func", 0x1234);
addCMR(Counter::getCounter(0), "file1", 1, 1, 9, 9);
+ addCMR(Counter::getCounter(0), "file2", 1, 1, 9, 9);
+
+ // This record should be skipped.
+ startFunction("func", 0x1234);
+ addCMR(Counter::getCounter(0), "file1", 1, 1, 9, 9);
+
+ // This record should be loaded.
+ startFunction("func", 0x1234);
+ addCMR(Counter::getCounter(0), "file2", 1, 1, 9, 9);
+ addCMR(Counter::getCounter(0), "file1", 1, 1, 9, 9);
+
+ // This record should be skipped.
+ startFunction("func", 0x1234);
+ addCMR(Counter::getCounter(0), "file1", 1, 1, 9, 9);
+ addCMR(Counter::getCounter(0), "file2", 1, 1, 9, 9);
EXPECT_THAT_ERROR(loadCoverageMapping(), Succeeded());
auto Funcs = LoadedCoverage->getCoveredFunctions();
unsigned NumFuncs = std::distance(Funcs.begin(), Funcs.end());
- ASSERT_EQ(1U, NumFuncs);
+ ASSERT_EQ(3U, NumFuncs);
}
// FIXME: Use ::testing::Combine() when llvm updates its copy of googletest.