Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nfc][InstrProfTest]Un-parameterize test cases that doesn't use profile reader and writer #73026

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

minglotus-6
Copy link
Contributor

@minglotus-6 minglotus-6 commented Nov 21, 2023

Test fixture MaybeSparseInstrProfTest parameterize InstrProfWriter by whether output is sparse or not. This test fixture has 20 test cases, and 6 of them doesn't use profile reader and writer. Undo the parameterization for these test cases will reduce redundant tests. This is one clean-up PR. (A few more clean-ups to come soon, but they are not inter-dependent)

@llvmbot llvmbot added the PGO Profile Guided Optimizations label Nov 21, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Nov 21, 2023

@llvm/pr-subscribers-pgo

Author: Mingming Liu (minglotus-6)

Changes

Test fixture MaybeSparseInstrProfTest parameterize InstrProfWriter by whether output is sparse or not. This test fixture has 20 test cases, and 6 of them doesn't use profile reader and writer. Undo the parameterization for these test cases. This is one clean-up PR. (A few more clean-ups to come soon, but they are not inter-dependent)


Full diff: https://github.com/llvm/llvm-project/pull/73026.diff

1 Files Affected:

  • (modified) llvm/unittests/ProfileData/InstrProfTest.cpp (+6-7)
diff --git a/llvm/unittests/ProfileData/InstrProfTest.cpp b/llvm/unittests/ProfileData/InstrProfTest.cpp
index f26f244afc5378e..bb96d2d10de5be4 100644
--- a/llvm/unittests/ProfileData/InstrProfTest.cpp
+++ b/llvm/unittests/ProfileData/InstrProfTest.cpp
@@ -1106,7 +1106,7 @@ static void addValueProfData(InstrProfRecord &Record) {
   Record.addValueData(IPVK_IndirectCallTarget, 4, nullptr, 0, nullptr);
 }
 
-TEST_P(MaybeSparseInstrProfTest, value_prof_data_read_write) {
+TEST(ValueProfileReadWriteTest, value_prof_data_read_write) {
   InstrProfRecord SrcRecord({1ULL << 31, 2});
   addValueProfData(SrcRecord);
   std::unique_ptr<ValueProfData> VPData =
@@ -1171,8 +1171,7 @@ TEST_P(MaybeSparseInstrProfTest, value_prof_data_read_write) {
   ASSERT_EQ(1800U, VD_3[1].Count);
 }
 
-TEST_P(MaybeSparseInstrProfTest, value_prof_data_read_write_mapping) {
-
+TEST(ValueProfileReadWriteTest, symtab_mapping) {
   NamedInstrProfRecord SrcRecord("caller", 0x1234, {1ULL << 31, 2});
   addValueProfData(SrcRecord);
   std::unique_ptr<ValueProfData> VPData =
@@ -1240,7 +1239,7 @@ TEST_P(MaybeSparseInstrProfTest, get_weighted_function_counts) {
 }
 
 // Testing symtab creator interface used by indexed profile reader.
-TEST_P(MaybeSparseInstrProfTest, instr_prof_symtab_test) {
+TEST(SymtabTest, instr_prof_symtab_test) {
   std::vector<StringRef> FuncNames;
   FuncNames.push_back("func1");
   FuncNames.push_back("func2");
@@ -1296,13 +1295,13 @@ TEST_P(MaybeSparseInstrProfTest, instr_prof_symtab_test) {
 }
 
 // Test that we get an error when creating a bogus symtab.
-TEST_P(MaybeSparseInstrProfTest, instr_prof_bogus_symtab_empty_func_name) {
+TEST(SymtabTest, instr_prof_bogus_symtab_empty_func_name) {
   InstrProfSymtab Symtab;
   EXPECT_TRUE(ErrorEquals(instrprof_error::malformed, Symtab.addFuncName("")));
 }
 
 // Testing symtab creator interface used by value profile transformer.
-TEST_P(MaybeSparseInstrProfTest, instr_prof_symtab_module_test) {
+TEST(SymtabTest, instr_prof_symtab_module_test) {
   LLVMContext Ctx;
   std::unique_ptr<Module> M = std::make_unique<Module>("MyModule.cpp", Ctx);
   FunctionType *FTy = FunctionType::get(Type::getVoidTy(Ctx),
@@ -1346,7 +1345,7 @@ TEST_P(MaybeSparseInstrProfTest, instr_prof_symtab_module_test) {
 
 // Testing symtab serialization and creator/deserialization interface
 // used by coverage map reader, and raw profile reader.
-TEST_P(MaybeSparseInstrProfTest, instr_prof_symtab_compression_test) {
+TEST(SymtabTest, instr_prof_symtab_compression_test) {
   std::vector<std::string> FuncNames1;
   std::vector<std::string> FuncNames2;
   for (int I = 0; I < 3; I++) {

Copy link
Contributor

@snehasish snehasish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

Perhaps note in the commit that this reduces change reduces running redundant tests to be explicit.

@minglotus-6
Copy link
Contributor Author

lgtm.

Perhaps note in the commit that this reduces change reduces running redundant tests to be explicit.

done. I'll wait a little bit for the build-bot since other clean-ups don't depend on this. Both ninja make-llvm-unit and a non-sharded run ( /usr/bin/python3 ./bin/llvm-lit -vv --no-gtest-sharding -j128 ../llvm/test/Unit/ProfileData/) passed.

@minglotus-6 minglotus-6 merged commit 03ac08d into llvm:main Nov 21, 2023
4 checks passed
@minglotus-6 minglotus-6 deleted the unittest branch November 21, 2023 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PGO Profile Guided Optimizations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants