[llvm] [BOLT][test] Allow uninstantiated tests when no matching targets are enabled (PR #217604)

Rong Mantle Bao via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 05:40:55 PDT 2026


https://github.com/CSharperMantle updated https://github.com/llvm/llvm-project/pull/217604

>From 3f85b8c098b51b3f17092afdfd47e2162d723211 Mon Sep 17 00:00:00 2001
From: Rong Bao <rong.bao at csmantle.top>
Date: Mon, 11 May 2026 23:10:32 +0800
Subject: [PATCH] [BOLT][test] Allow uninstantiated tests when no matching
 targets are enabled

When neither X86 nor AArch64 is enabled, e.g. when only enabling the
RISCV target, check-bolt-unit triggers GTest's uninstantiated suite
errors on the following cases:

        BOLT-Unit :: Core/./CoreTests/GoogleTestVerification/UninstantiatedParameterizedTestSuite<BinaryContextTester>
        BOLT-Unit :: Core/./CoreTests/GoogleTestVerification/UninstantiatedParameterizedTestSuite<MCPlusBuilderTester>
        BOLT-Unit :: Core/./CoreTests/GoogleTestVerification/UninstantiatedParameterizedTestSuite<MemoryMapsTester>
        BOLT-Unit :: Profile/./ProfileTests/GoogleTestVerification/UninstantiatedParameterizedTestSuite<PerfScriptTestHelper>

Add gated GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST to suppress such
warnings until appropriate tests have been implemented.
---
 bolt/unittests/Core/BinaryContext.cpp  | 4 ++++
 bolt/unittests/Core/MCPlusBuilder.cpp  | 4 ++++
 bolt/unittests/Core/MemoryMaps.cpp     | 4 ++++
 bolt/unittests/Profile/PerfScripts.cpp | 4 ++++
 4 files changed, 16 insertions(+)

diff --git a/bolt/unittests/Core/BinaryContext.cpp b/bolt/unittests/Core/BinaryContext.cpp
index 1713b56938391..c7c23ba33dcf9 100644
--- a/bolt/unittests/Core/BinaryContext.cpp
+++ b/bolt/unittests/Core/BinaryContext.cpp
@@ -270,3 +270,7 @@ TEST_P(BinaryContextTester, BaseAddressSegmentsSmallerThanAlignment) {
   ASSERT_TRUE(BaseAddress.has_value());
   ASSERT_EQ(*BaseAddress, 0xaaaaaaaa0000ULL);
 }
+
+#if !defined(X86_AVAILABLE) && !defined(AARCH64_AVAILABLE)
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(BinaryContextTester);
+#endif // !defined(X86_AVAILABLE) && !defined(AARCH64_AVAILABLE)
diff --git a/bolt/unittests/Core/MCPlusBuilder.cpp b/bolt/unittests/Core/MCPlusBuilder.cpp
index a692f45f551eb..5a4690fdba66f 100644
--- a/bolt/unittests/Core/MCPlusBuilder.cpp
+++ b/bolt/unittests/Core/MCPlusBuilder.cpp
@@ -993,3 +993,7 @@ TEST_P(MCPlusBuilderTester, Annotation) {
   ASSERT_DEATH(BC->MIB->addEHInfo(Inst, MCPlus::MCLandingPad(LPSymbol, Value)),
                "annotation value out of range");
 }
+
+#if !defined(X86_AVAILABLE) && !defined(AARCH64_AVAILABLE)
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(MCPlusBuilderTester);
+#endif // !defined(X86_AVAILABLE) && !defined(AARCH64_AVAILABLE)
diff --git a/bolt/unittests/Core/MemoryMaps.cpp b/bolt/unittests/Core/MemoryMaps.cpp
index cf842b6324957..a53bb4c6240a8 100644
--- a/bolt/unittests/Core/MemoryMaps.cpp
+++ b/bolt/unittests/Core/MemoryMaps.cpp
@@ -176,3 +176,7 @@ TEST_P(MemoryMapsTester, MultipleSegmentsMismatchedBaseAddress) {
       "Base address on multiple segment mappings should match");
   sys::fs::remove(Path);
 }
+
+#if !defined(X86_AVAILABLE) && !defined(AARCH64_AVAILABLE)
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(MemoryMapsTester);
+#endif // !defined(X86_AVAILABLE) && !defined(AARCH64_AVAILABLE)
diff --git a/bolt/unittests/Profile/PerfScripts.cpp b/bolt/unittests/Profile/PerfScripts.cpp
index 813540abd0053..bf7560ad67434 100644
--- a/bolt/unittests/Profile/PerfScripts.cpp
+++ b/bolt/unittests/Profile/PerfScripts.cpp
@@ -240,3 +240,7 @@ TEST_P(PerfScriptTestHelper, ParseAndCheckFileHeader) {
   // should be 'size == 3' after the parsing this dummy MainEvents.
   parseAndCheckPerfScriptProfile(Buffer, Pid, 3);
 }
+
+#if !defined(X86_AVAILABLE) && !defined(AARCH64_AVAILABLE)
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(PerfScriptTestHelper);
+#endif // !defined(X86_AVAILABLE) && !defined(AARCH64_AVAILABLE)



More information about the llvm-commits mailing list