summaryrefslogtreecommitdiffstats
path: root/llvm/unittests
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2015-02-16 23:31:07 +0000
committerJustin Bogner <mail@justinbogner.com>2015-02-16 23:31:07 +0000
commitfcb2de694ae9d8c90f4f2b989d44a621e1c35a83 (patch)
tree0d6fa3b116ca4e8661d145e93edc1dd360e7f714 /llvm/unittests
parentf83e895fa79af04035916597204209112c8178c6 (diff)
downloadbcm5719-llvm-fcb2de694ae9d8c90f4f2b989d44a621e1c35a83.tar.gz
bcm5719-llvm-fcb2de694ae9d8c90f4f2b989d44a621e1c35a83.zip
Revert "InstrProf: Add unit tests for the profile reader and writer"
Looks like the bots don't like my initializer lists. This reverts r229455 llvm-svn: 229456
Diffstat (limited to 'llvm/unittests')
-rw-r--r--llvm/unittests/ProfileData/CMakeLists.txt1
-rw-r--r--llvm/unittests/ProfileData/InstrProfTest.cpp88
2 files changed, 0 insertions, 89 deletions
diff --git a/llvm/unittests/ProfileData/CMakeLists.txt b/llvm/unittests/ProfileData/CMakeLists.txt
index 79137c9510a..3251ff41502 100644
--- a/llvm/unittests/ProfileData/CMakeLists.txt
+++ b/llvm/unittests/ProfileData/CMakeLists.txt
@@ -6,5 +6,4 @@ set(LLVM_LINK_COMPONENTS
add_llvm_unittest(ProfileDataTests
CoverageMappingTest.cpp
- InstrProfTest.cpp
)
diff --git a/llvm/unittests/ProfileData/InstrProfTest.cpp b/llvm/unittests/ProfileData/InstrProfTest.cpp
deleted file mode 100644
index f6fd790dccb..00000000000
--- a/llvm/unittests/ProfileData/InstrProfTest.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-//===- unittest/ProfileData/InstrProfTest.cpp -------------------------------=//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/ProfileData/InstrProfReader.h"
-#include "llvm/ProfileData/InstrProfWriter.h"
-#include "gtest/gtest.h"
-
-using namespace llvm;
-
-namespace {
-
-TEST(InstrProfTest, write_and_read_empty_profile) {
- InstrProfWriter Writer;
- std::string Profile = Writer.writeString();
- auto ReaderOrErr =
- IndexedInstrProfReader::create(MemoryBuffer::getMemBuffer(Profile));
- ASSERT_EQ(std::error_code(), ReaderOrErr.getError());
- auto Reader = std::move(ReaderOrErr.get());
- ASSERT_TRUE(Reader->begin() == Reader->end());
-}
-
-TEST(InstrProfTest, write_and_read_one_function) {
- InstrProfWriter Writer;
- Writer.addFunctionCounts("foo", 0x1234, {1, 2, 3, 4});
- std::string Profile = Writer.writeString();
- auto ReaderOrErr =
- IndexedInstrProfReader::create(MemoryBuffer::getMemBuffer(Profile));
- ASSERT_EQ(std::error_code(), ReaderOrErr.getError());
- auto Reader = std::move(ReaderOrErr.get());
-
- auto I = Reader->begin(), E = Reader->end();
- ASSERT_TRUE(I != E);
- ASSERT_EQ(StringRef("foo"), I->Name);
- ASSERT_EQ(0x1234U, I->Hash);
- ASSERT_EQ(4U, I->Counts.size());
- ASSERT_EQ(1U, I->Counts[0]);
- ASSERT_EQ(2U, I->Counts[1]);
- ASSERT_EQ(3U, I->Counts[2]);
- ASSERT_EQ(4U, I->Counts[3]);
- ASSERT_TRUE(++I == E);
-}
-
-TEST(InstrProfTest, get_function_counts) {
- InstrProfWriter Writer;
- Writer.addFunctionCounts("foo", 0x1234, {1, 2});
- std::string Profile = Writer.writeString();
- auto ReaderOrErr =
- IndexedInstrProfReader::create(MemoryBuffer::getMemBuffer(Profile));
- ASSERT_EQ(std::error_code(), ReaderOrErr.getError());
- auto Reader = std::move(ReaderOrErr.get());
-
- std::vector<uint64_t> Counts;
- std::error_code EC;
-
- EC = Reader->getFunctionCounts("foo", 0x1234, Counts);
- ASSERT_EQ(instrprof_error::success, EC);
- ASSERT_EQ(2U, Counts.size());
- ASSERT_EQ(1U, Counts[0]);
- ASSERT_EQ(2U, Counts[1]);
-
- EC = Reader->getFunctionCounts("foo", 0x5678, Counts);
- ASSERT_EQ(instrprof_error::hash_mismatch, EC);
-
- EC = Reader->getFunctionCounts("bar", 0x1234, Counts);
- ASSERT_EQ(instrprof_error::unknown_function, EC);
-}
-
-TEST(InstrProfTest, get_max_function_count) {
- InstrProfWriter Writer;
- Writer.addFunctionCounts("foo", 0x1234, {1ULL << 31, 2});
- Writer.addFunctionCounts("bar", 0, {1ULL << 63});
- Writer.addFunctionCounts("baz", 0x5678, {0, 0, 0, 0});
- std::string Profile = Writer.writeString();
- auto ReaderOrErr =
- IndexedInstrProfReader::create(MemoryBuffer::getMemBuffer(Profile));
- ASSERT_EQ(std::error_code(), ReaderOrErr.getError());
- auto Reader = std::move(ReaderOrErr.get());
-
- ASSERT_EQ(1ULL << 63, Reader->getMaximumFunctionCount());
-}
-
-} // end anonymous namespace
OpenPOWER on IntegriCloud