Skip to content

[llvm][unittests] Put human-readable names on some TargetParserTests. NFC #8125

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

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions llvm/unittests/TargetParser/TargetParserTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,17 @@ template <typename T> struct ARMCPUTestParams {
return os;
}

static std::function<std::string(const testing::TestParamInfo<ARMCPUTestParams<T>>& Info)>
PrintToStringParamName() {
return [](const testing::TestParamInfo<ARMCPUTestParams<T>>& Info) {
std::string Name = Info.param.CPUName.str();
for (char &C : Name)
if (!std::isalnum(C))
C = '_';
return Name;
};
}

StringRef CPUName;
StringRef ExpectedArch;
StringRef ExpectedFPU;
Expand Down Expand Up @@ -263,7 +274,8 @@ INSTANTIATE_TEST_SUITE_P(
ARM::AEK_SEC | ARM::AEK_VIRT | ARM::AEK_DSP,
"7-A"),
ARMCPUTestParams<uint64_t>("cortex-a8", "armv7-a", "neon",
ARM::AEK_SEC | ARM::AEK_DSP, "7-A")));
ARM::AEK_SEC | ARM::AEK_DSP, "7-A")),
ARMCPUTestParams<uint64_t>::PrintToStringParamName());

// gtest in llvm has a limit of 50 test cases when using ::Values so we split
// them into 2 blocks
Expand Down Expand Up @@ -483,7 +495,8 @@ INSTANTIATE_TEST_SUITE_P(
ARMCPUTestParams<uint64_t>("xscale", "xscale", "none", ARM::AEK_NONE, "xscale"),
ARMCPUTestParams<uint64_t>("swift", "armv7s", "neon-vfpv4",
ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB | ARM::AEK_DSP,
"7-S")));
"7-S")),
ARMCPUTestParams<uint64_t>::PrintToStringParamName());

static constexpr unsigned NumARMCPUArchs = 90;

Expand Down Expand Up @@ -1660,7 +1673,8 @@ INSTANTIATE_TEST_SUITE_P(
{AArch64::AEK_CRC, AArch64::AEK_AES, AArch64::AEK_SHA2,
AArch64::AEK_FP, AArch64::AEK_SIMD, AArch64::AEK_FP16,
AArch64::AEK_RAS, AArch64::AEK_LSE, AArch64::AEK_RDM})),
"8.2-A")));
"8.2-A")),
ARMCPUTestParams<AArch64::ExtensionBitset>::PrintToStringParamName());

// Note: number of CPUs includes aliases.
static constexpr unsigned NumAArch64CPUArchs = 68;
Expand Down