[llvm] r268402 - [ProfileData] Assert NoError in InstrProfTest
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Tue May 3 10:07:06 PDT 2016
Author: vedantk
Date: Tue May 3 12:07:06 2016
New Revision: 268402
URL: http://llvm.org/viewvc/llvm-project?rev=268402&view=rev
Log:
[ProfileData] Assert NoError in InstrProfTest
Check for success values in the InstrProfTest unit test file.
This is part of a series of patches to transition ProfileData over to
the stricter Error/Expected interface.
Modified:
llvm/trunk/unittests/ProfileData/InstrProfTest.cpp
Modified: llvm/trunk/unittests/ProfileData/InstrProfTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ProfileData/InstrProfTest.cpp?rev=268402&r1=268401&r2=268402&view=diff
==============================================================================
--- llvm/trunk/unittests/ProfileData/InstrProfTest.cpp (original)
+++ llvm/trunk/unittests/ProfileData/InstrProfTest.cpp Tue May 3 12:07:06 2016
@@ -66,7 +66,7 @@ TEST_P(MaybeSparseInstrProfTest, write_a
TEST_P(MaybeSparseInstrProfTest, write_and_read_one_function) {
InstrProfRecord Record("foo", 0x1234, {1, 2, 3, 4});
- Writer.addRecord(std::move(Record));
+ NoError(Writer.addRecord(std::move(Record)));
auto Profile = Writer.writeBuffer();
readProfile(std::move(Profile));
@@ -85,8 +85,8 @@ TEST_P(MaybeSparseInstrProfTest, write_a
TEST_P(MaybeSparseInstrProfTest, get_instr_prof_record) {
InstrProfRecord Record1("foo", 0x1234, {1, 2});
InstrProfRecord Record2("foo", 0x1235, {3, 4});
- Writer.addRecord(std::move(Record1));
- Writer.addRecord(std::move(Record2));
+ NoError(Writer.addRecord(std::move(Record1)));
+ NoError(Writer.addRecord(std::move(Record2)));
auto Profile = Writer.writeBuffer();
readProfile(std::move(Profile));
@@ -112,8 +112,8 @@ TEST_P(MaybeSparseInstrProfTest, get_ins
TEST_P(MaybeSparseInstrProfTest, get_function_counts) {
InstrProfRecord Record1("foo", 0x1234, {1, 2});
InstrProfRecord Record2("foo", 0x1235, {3, 4});
- Writer.addRecord(std::move(Record1));
- Writer.addRecord(std::move(Record2));
+ NoError(Writer.addRecord(std::move(Record1)));
+ NoError(Writer.addRecord(std::move(Record2)));
auto Profile = Writer.writeBuffer();
readProfile(std::move(Profile));
@@ -145,10 +145,10 @@ TEST_F(InstrProfTest, get_profile_summar
576460752303423488, 288230376151711744,
144115188075855872, 72057594037927936});
InstrProfRecord Record4("func4", 0x1234, {0});
- Writer.addRecord(std::move(Record1));
- Writer.addRecord(std::move(Record2));
- Writer.addRecord(std::move(Record3));
- Writer.addRecord(std::move(Record4));
+ NoError(Writer.addRecord(std::move(Record1)));
+ NoError(Writer.addRecord(std::move(Record2)));
+ NoError(Writer.addRecord(std::move(Record3)));
+ NoError(Writer.addRecord(std::move(Record4)));
auto Profile = Writer.writeBuffer();
readProfile(std::move(Profile));
@@ -228,10 +228,10 @@ TEST_P(MaybeSparseInstrProfTest, get_ica
InstrProfValueData VD3[] = {{(uint64_t)callee1, 1}};
Record1.addValueData(IPVK_IndirectCallTarget, 3, VD3, 1, nullptr);
- Writer.addRecord(std::move(Record1));
- Writer.addRecord(std::move(Record2));
- Writer.addRecord(std::move(Record3));
- Writer.addRecord(std::move(Record4));
+ NoError(Writer.addRecord(std::move(Record1)));
+ NoError(Writer.addRecord(std::move(Record2)));
+ NoError(Writer.addRecord(std::move(Record3)));
+ NoError(Writer.addRecord(std::move(Record4)));
auto Profile = Writer.writeBuffer();
readProfile(std::move(Profile));
@@ -263,7 +263,7 @@ TEST_P(MaybeSparseInstrProfTest, annotat
InstrProfValueData VD0[] = {{1000, 1}, {2000, 2}, {3000, 3}, {5000, 5},
{4000, 4}, {6000, 6}};
Record.addValueData(IPVK_IndirectCallTarget, 0, VD0, 6, nullptr);
- Writer.addRecord(std::move(Record));
+ NoError(Writer.addRecord(std::move(Record)));
auto Profile = Writer.writeBuffer();
readProfile(std::move(Profile));
ErrorOr<InstrProfRecord> R = Reader->getInstrProfRecord("caller", 0x1234);
@@ -371,10 +371,10 @@ TEST_P(MaybeSparseInstrProfTest, get_ica
InstrProfValueData VD3[] = {{(uint64_t)callee1, 1}};
Record1.addValueData(IPVK_IndirectCallTarget, 3, VD3, 1, nullptr);
- Writer.addRecord(std::move(Record1), 10);
- Writer.addRecord(std::move(Record2));
- Writer.addRecord(std::move(Record3));
- Writer.addRecord(std::move(Record4));
+ NoError(Writer.addRecord(std::move(Record1), 10));
+ NoError(Writer.addRecord(std::move(Record2)));
+ NoError(Writer.addRecord(std::move(Record3)));
+ NoError(Writer.addRecord(std::move(Record4)));
auto Profile = Writer.writeBuffer();
readProfile(std::move(Profile));
@@ -417,10 +417,10 @@ TEST_P(MaybeSparseInstrProfTest, get_ica
InstrProfValueData VD3[] = {{(uint64_t)callee1, 1}};
Record1.addValueData(IPVK_IndirectCallTarget, 3, VD3, 1, nullptr);
- Writer.addRecord(std::move(Record1));
- Writer.addRecord(std::move(Record2));
- Writer.addRecord(std::move(Record3));
- Writer.addRecord(std::move(Record4));
+ NoError(Writer.addRecord(std::move(Record1)));
+ NoError(Writer.addRecord(std::move(Record2)));
+ NoError(Writer.addRecord(std::move(Record3)));
+ NoError(Writer.addRecord(std::move(Record4)));
// Set big endian output.
Writer.setValueProfDataEndianness(support::big);
@@ -501,15 +501,15 @@ TEST_P(MaybeSparseInstrProfTest, get_ica
{uint64_t(callee3), 3}};
Record12.addValueData(IPVK_IndirectCallTarget, 4, VD42, 3, nullptr);
- Writer.addRecord(std::move(Record11));
+ NoError(Writer.addRecord(std::move(Record11)));
// Merge profile data.
- Writer.addRecord(std::move(Record12));
+ NoError(Writer.addRecord(std::move(Record12)));
- Writer.addRecord(std::move(Record2));
- Writer.addRecord(std::move(Record3));
- Writer.addRecord(std::move(Record4));
- Writer.addRecord(std::move(Record5));
- Writer.addRecord(std::move(Record6));
+ NoError(Writer.addRecord(std::move(Record2)));
+ NoError(Writer.addRecord(std::move(Record3)));
+ NoError(Writer.addRecord(std::move(Record4)));
+ NoError(Writer.addRecord(std::move(Record5)));
+ NoError(Writer.addRecord(std::move(Record6)));
auto Profile = Writer.writeBuffer();
readProfile(std::move(Profile));
@@ -640,9 +640,9 @@ TEST_P(MaybeSparseInstrProfTest, get_ica
Record12.addValueData(IPVK_IndirectCallTarget, 0, VD1, 255, nullptr);
Record12.addValueData(IPVK_IndirectCallTarget, 1, nullptr, 0, nullptr);
- Writer.addRecord(std::move(Record11));
+ NoError(Writer.addRecord(std::move(Record11)));
// Merge profile data.
- Writer.addRecord(std::move(Record12));
+ NoError(Writer.addRecord(std::move(Record12)));
auto Profile = Writer.writeBuffer();
readProfile(std::move(Profile));
@@ -799,9 +799,9 @@ TEST_P(MaybeSparseInstrProfTest, get_max
InstrProfRecord Record1("foo", 0x1234, {1ULL << 31, 2});
InstrProfRecord Record2("bar", 0, {1ULL << 63});
InstrProfRecord Record3("baz", 0x5678, {0, 0, 0, 0});
- Writer.addRecord(std::move(Record1));
- Writer.addRecord(std::move(Record2));
- Writer.addRecord(std::move(Record3));
+ NoError(Writer.addRecord(std::move(Record1)));
+ NoError(Writer.addRecord(std::move(Record2)));
+ NoError(Writer.addRecord(std::move(Record3)));
auto Profile = Writer.writeBuffer();
readProfile(std::move(Profile));
@@ -811,8 +811,8 @@ TEST_P(MaybeSparseInstrProfTest, get_max
TEST_P(MaybeSparseInstrProfTest, get_weighted_function_counts) {
InstrProfRecord Record1("foo", 0x1234, {1, 2});
InstrProfRecord Record2("foo", 0x1235, {3, 4});
- Writer.addRecord(std::move(Record1), 3);
- Writer.addRecord(std::move(Record2), 5);
+ NoError(Writer.addRecord(std::move(Record1), 3));
+ NoError(Writer.addRecord(std::move(Record2), 5));
auto Profile = Writer.writeBuffer();
readProfile(std::move(Profile));
@@ -946,13 +946,13 @@ TEST_P(MaybeSparseInstrProfTest, instr_p
for (bool DoCompression : {false, true}) {
// Compressing:
std::string FuncNameStrings1;
- collectPGOFuncNameStrings(
- FuncNames1, (DoCompression && zlib::isAvailable()), FuncNameStrings1);
+ NoError(collectPGOFuncNameStrings(
+ FuncNames1, (DoCompression && zlib::isAvailable()), FuncNameStrings1));
// Compressing:
std::string FuncNameStrings2;
- collectPGOFuncNameStrings(
- FuncNames2, (DoCompression && zlib::isAvailable()), FuncNameStrings2);
+ NoError(collectPGOFuncNameStrings(
+ FuncNames2, (DoCompression && zlib::isAvailable()), FuncNameStrings2));
for (int Padding = 0; Padding < 2; Padding++) {
// Join with paddings :
@@ -964,7 +964,7 @@ TEST_P(MaybeSparseInstrProfTest, instr_p
// Now decompress:
InstrProfSymtab Symtab;
- Symtab.create(StringRef(FuncNameStrings));
+ NoError(Symtab.create(StringRef(FuncNameStrings)));
// Now do the checks:
// First sampling some data points:
@@ -992,9 +992,9 @@ TEST_F(SparseInstrProfTest, preserve_no_
InstrProfRecord Record2("bar", 0x4321, {0, 0});
InstrProfRecord Record3("bar", 0x4321, {0, 0, 0});
- Writer.addRecord(std::move(Record1));
- Writer.addRecord(std::move(Record2));
- Writer.addRecord(std::move(Record3));
+ NoError(Writer.addRecord(std::move(Record1)));
+ NoError(Writer.addRecord(std::move(Record2)));
+ NoError(Writer.addRecord(std::move(Record3)));
auto Profile = Writer.writeBuffer();
readProfile(std::move(Profile));
More information about the llvm-commits
mailing list