Skip to content

Commit

Permalink
InstrProf: Add a test for multiple copies of the same with different …
Browse files Browse the repository at this point in the history
…hashes

This functionality wasn't being tested.

Patch by Betul Buyukkurt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240359 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
bogner committed Jun 22, 2015
1 parent 46a3ee7 commit fe3176f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions unittests/ProfileData/InstrProfTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand All @@ -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));
Expand Down

0 comments on commit fe3176f

Please sign in to comment.