[llvm] r284135 - [unittests] Remove a redundant test fixture (NFC)

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 13 10:22:44 PDT 2016


Author: vedantk
Date: Thu Oct 13 12:22:44 2016
New Revision: 284135

URL: http://llvm.org/viewvc/llvm-project?rev=284135&view=rev
Log:
[unittests] Remove a redundant test fixture (NFC)

Modified:
    llvm/trunk/unittests/ProfileData/CoverageMappingTest.cpp

Modified: llvm/trunk/unittests/ProfileData/CoverageMappingTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ProfileData/CoverageMappingTest.cpp?rev=284135&r1=284134&r2=284135&view=diff
==============================================================================
--- llvm/trunk/unittests/ProfileData/CoverageMappingTest.cpp (original)
+++ llvm/trunk/unittests/ProfileData/CoverageMappingTest.cpp Thu Oct 13 12:22:44 2016
@@ -118,7 +118,7 @@ struct InputFunctionCoverageData {
   InputFunctionCoverageData &operator=(InputFunctionCoverageData &&) = delete;
 };
 
-struct CoverageMappingTest : ::testing::Test {
+struct CoverageMappingTest : ::testing::TestWithParam<bool> {
   StringMap<unsigned> Files;
   std::vector<InputFunctionCoverageData> InputFunctions;
   std::vector<OutputFunctionCoverageData> OutputFunctions;
@@ -129,7 +129,7 @@ struct CoverageMappingTest : ::testing::
   std::unique_ptr<CoverageMapping> LoadedCoverage;
 
   void SetUp() override {
-    ProfileWriter.setOutputSparse(false);
+    ProfileWriter.setOutputSparse(GetParam());
   }
 
   unsigned getGlobalFileIndex(StringRef Name) {
@@ -226,16 +226,7 @@ struct CoverageMappingTest : ::testing::
   }
 };
 
-struct MaybeSparseCoverageMappingTest
-    : public CoverageMappingTest,
-      public ::testing::WithParamInterface<bool> {
-  void SetUp() {
-    CoverageMappingTest::SetUp();
-    ProfileWriter.setOutputSparse(GetParam());
-  }
-};
-
-TEST_P(MaybeSparseCoverageMappingTest, basic_write_read) {
+TEST_P(CoverageMappingTest, basic_write_read) {
   startFunction("func", 0x1234);
   addCMR(Counter::getCounter(0), "foo", 1, 1, 1, 1);
   addCMR(Counter::getCounter(1), "foo", 2, 1, 2, 2);
@@ -260,8 +251,7 @@ TEST_P(MaybeSparseCoverageMappingTest, b
   }
 }
 
-TEST_P(MaybeSparseCoverageMappingTest,
-       correct_deserialize_for_more_than_two_files) {
+TEST_P(CoverageMappingTest, correct_deserialize_for_more_than_two_files) {
   const char *FileNames[] = {"bar", "baz", "foo"};
   static const unsigned N = array_lengthof(FileNames);
 
@@ -286,7 +276,7 @@ TEST_P(MaybeSparseCoverageMappingTest,
   }
 }
 
-TEST_P(MaybeSparseCoverageMappingTest, load_coverage_for_more_than_two_files) {
+TEST_P(CoverageMappingTest, load_coverage_for_more_than_two_files) {
   InstrProfRecord Record("func", 0x1234, {0});
   NoError(ProfileWriter.addRecord(std::move(Record)));
 
@@ -308,7 +298,7 @@ TEST_P(MaybeSparseCoverageMappingTest, l
   }
 }
 
-TEST_P(MaybeSparseCoverageMappingTest, load_coverage_for_several_functions) {
+TEST_P(CoverageMappingTest, load_coverage_for_several_functions) {
   InstrProfRecord RecordFunc1("func1", 0x1234, {10});
   NoError(ProfileWriter.addRecord(std::move(RecordFunc1)));
   InstrProfRecord RecordFunc2("func2", 0x2345, {20});
@@ -339,7 +329,7 @@ TEST_P(MaybeSparseCoverageMappingTest, l
   }
 }
 
-TEST_P(MaybeSparseCoverageMappingTest, expansion_gets_first_counter) {
+TEST_P(CoverageMappingTest, expansion_gets_first_counter) {
   startFunction("func", 0x1234);
   addCMR(Counter::getCounter(1), "foo", 10, 1, 10, 2);
   // This starts earlier in "foo", so the expansion should get its counter.
@@ -355,7 +345,7 @@ TEST_P(MaybeSparseCoverageMappingTest, e
   ASSERT_EQ(3U, Output.Regions[2].LineStart);
 }
 
-TEST_P(MaybeSparseCoverageMappingTest, basic_coverage_iteration) {
+TEST_P(CoverageMappingTest, basic_coverage_iteration) {
   InstrProfRecord Record("func", 0x1234, {30, 20, 10, 0});
   NoError(ProfileWriter.addRecord(std::move(Record)));
 
@@ -378,7 +368,7 @@ TEST_P(MaybeSparseCoverageMappingTest, b
   ASSERT_EQ(CoverageSegment(11, 11, false),   Segments[6]);
 }
 
-TEST_P(MaybeSparseCoverageMappingTest, uncovered_function) {
+TEST_P(CoverageMappingTest, uncovered_function) {
   startFunction("func", 0x1234);
   addCMR(Counter::getZero(), "file1", 1, 2, 3, 4);
   loadCoverageMapping();
@@ -390,7 +380,7 @@ TEST_P(MaybeSparseCoverageMappingTest, u
   ASSERT_EQ(CoverageSegment(3, 4, false),   Segments[1]);
 }
 
-TEST_P(MaybeSparseCoverageMappingTest, uncovered_function_with_mapping) {
+TEST_P(CoverageMappingTest, uncovered_function_with_mapping) {
   startFunction("func", 0x1234);
   addCMR(Counter::getCounter(0), "file1", 1, 1, 9, 9);
   addCMR(Counter::getCounter(1), "file1", 1, 1, 4, 7);
@@ -404,7 +394,7 @@ TEST_P(MaybeSparseCoverageMappingTest, u
   ASSERT_EQ(CoverageSegment(9, 9, false),    Segments[2]);
 }
 
-TEST_P(MaybeSparseCoverageMappingTest, combine_regions) {
+TEST_P(CoverageMappingTest, combine_regions) {
   InstrProfRecord Record("func", 0x1234, {10, 20, 30});
   NoError(ProfileWriter.addRecord(std::move(Record)));
 
@@ -423,8 +413,7 @@ TEST_P(MaybeSparseCoverageMappingTest, c
   ASSERT_EQ(CoverageSegment(9, 9, false), Segments[3]);
 }
 
-TEST_P(MaybeSparseCoverageMappingTest,
-       restore_combined_counter_after_nested_region) {
+TEST_P(CoverageMappingTest, restore_combined_counter_after_nested_region) {
   InstrProfRecord Record("func", 0x1234, {10, 20, 40});
   NoError(ProfileWriter.addRecord(std::move(Record)));
 
@@ -445,7 +434,7 @@ TEST_P(MaybeSparseCoverageMappingTest,
 
 // If CodeRegions and ExpansionRegions cover the same area,
 // only counts of CodeRegions should be used.
-TEST_P(MaybeSparseCoverageMappingTest, dont_combine_expansions) {
+TEST_P(CoverageMappingTest, dont_combine_expansions) {
   InstrProfRecord Record1("func", 0x1234, {10, 20});
   InstrProfRecord Record2("func", 0x1234, {0, 0});
   NoError(ProfileWriter.addRecord(std::move(Record1)));
@@ -468,7 +457,7 @@ TEST_P(MaybeSparseCoverageMappingTest, d
 }
 
 // If an area is covered only by ExpansionRegions, they should be combinated.
-TEST_P(MaybeSparseCoverageMappingTest, combine_expansions) {
+TEST_P(CoverageMappingTest, combine_expansions) {
   InstrProfRecord Record("func", 0x1234, {2, 3, 7});
   NoError(ProfileWriter.addRecord(std::move(Record)));
 
@@ -490,7 +479,7 @@ TEST_P(MaybeSparseCoverageMappingTest, c
   EXPECT_EQ(CoverageSegment(5, 5, false), Segments[3]);
 }
 
-TEST_P(MaybeSparseCoverageMappingTest, strip_filename_prefix) {
+TEST_P(CoverageMappingTest, strip_filename_prefix) {
   InstrProfRecord Record("file1:func", 0x1234, {0});
   NoError(ProfileWriter.addRecord(std::move(Record)));
 
@@ -505,7 +494,7 @@ TEST_P(MaybeSparseCoverageMappingTest, s
   ASSERT_EQ("func", Names[0]);
 }
 
-TEST_P(MaybeSparseCoverageMappingTest, strip_unknown_filename_prefix) {
+TEST_P(CoverageMappingTest, strip_unknown_filename_prefix) {
   InstrProfRecord Record("<unknown>:func", 0x1234, {0});
   NoError(ProfileWriter.addRecord(std::move(Record)));
 
@@ -520,7 +509,7 @@ TEST_P(MaybeSparseCoverageMappingTest, s
   ASSERT_EQ("func", Names[0]);
 }
 
-TEST_P(MaybeSparseCoverageMappingTest, dont_detect_false_instantiations) {
+TEST_P(CoverageMappingTest, dont_detect_false_instantiations) {
   InstrProfRecord Record1("foo", 0x1234, {10});
   InstrProfRecord Record2("bar", 0x2345, {20});
   NoError(ProfileWriter.addRecord(std::move(Record1)));
@@ -541,7 +530,7 @@ TEST_P(MaybeSparseCoverageMappingTest, d
   ASSERT_TRUE(Instantiations.empty());
 }
 
-TEST_P(MaybeSparseCoverageMappingTest, load_coverage_for_expanded_file) {
+TEST_P(CoverageMappingTest, load_coverage_for_expanded_file) {
   InstrProfRecord Record("func", 0x1234, {10});
   NoError(ProfileWriter.addRecord(std::move(Record)));
 
@@ -558,7 +547,7 @@ TEST_P(MaybeSparseCoverageMappingTest, l
   EXPECT_EQ(CoverageSegment(1, 10, false), Segments[1]);
 }
 
-INSTANTIATE_TEST_CASE_P(MaybeSparse, MaybeSparseCoverageMappingTest,
+INSTANTIATE_TEST_CASE_P(ParameterizedCovMapTest, CoverageMappingTest,
                         ::testing::Bool());
 
 } // end anonymous namespace




More information about the llvm-commits mailing list