diff options
| author | Justin Bogner <mail@justinbogner.com> | 2015-06-22 23:56:53 +0000 |
|---|---|---|
| committer | Justin Bogner <mail@justinbogner.com> | 2015-06-22 23:56:53 +0000 |
| commit | 09829f440b4793b00df325c09fae30677e531f70 (patch) | |
| tree | 635f3d4626dfdf1eb0fd46cfa785ffe9ade27742 /llvm/unittests/ProfileData | |
| parent | 70a7f340d255bab523c1efaa90579ffdf628c858 (diff) | |
| download | bcm5719-llvm-09829f440b4793b00df325c09fae30677e531f70.tar.gz bcm5719-llvm-09829f440b4793b00df325c09fae30677e531f70.zip | |
InstrProf: Add a test for multiple copies of the same with different hashes
This functionality wasn't being tested.
Patch by Betul Buyukkurt.
llvm-svn: 240359
Diffstat (limited to 'llvm/unittests/ProfileData')
| -rw-r--r-- | llvm/unittests/ProfileData/InstrProfTest.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/unittests/ProfileData/InstrProfTest.cpp b/llvm/unittests/ProfileData/InstrProfTest.cpp index 26ea0e44ca4..2cedd593eb8 100644 --- a/llvm/unittests/ProfileData/InstrProfTest.cpp +++ b/llvm/unittests/ProfileData/InstrProfTest.cpp @@ -68,6 +68,7 @@ TEST_F(InstrProfTest, write_and_read_one_function) { TEST_F(InstrProfTest, get_function_counts) { Writer.addFunctionCounts("foo", 0x1234, {1, 2}); + Writer.addFunctionCounts("foo", 0x1235, {3, 4}); auto Profile = Writer.writeBuffer(); readProfile(std::move(Profile)); @@ -77,6 +78,11 @@ TEST_F(InstrProfTest, get_function_counts) { ASSERT_EQ(1U, Counts[0]); ASSERT_EQ(2U, Counts[1]); + ASSERT_TRUE(NoError(Reader->getFunctionCounts("foo", 0x1235, Counts))); + ASSERT_EQ(2U, Counts.size()); + ASSERT_EQ(3U, Counts[0]); + ASSERT_EQ(4U, Counts[1]); + std::error_code EC; EC = Reader->getFunctionCounts("foo", 0x5678, Counts); ASSERT_TRUE(ErrorEquals(instrprof_error::hash_mismatch, EC)); |

