[clang] [clang][unittests] Skip DeviceOffloadHIPTest.* on AIX and z/OS (PR #235580)

via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 25 21:12:36 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Hubert Tong (hubert-reinterpretcast)

<details>
<summary>Changes</summary>

Convert `DeviceOffloadHIPTest.DeviceObjectIsGenerated` to a `TEST_F` backed by a new fixture class that inherits from `InterpreterTestBase`, consistent with `DeviceOffloadTest`.

Avoids
```
LLVM ERROR: Incompatible object format!
```

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


1 Files Affected:

- (modified) clang/unittests/Interpreter/DeviceOffloadTest.cpp (+21-9) 


``````````diff
diff --git a/clang/unittests/Interpreter/DeviceOffloadTest.cpp b/clang/unittests/Interpreter/DeviceOffloadTest.cpp
index 6cd052ac4701f9..fa624f23f435b7 100644
--- a/clang/unittests/Interpreter/DeviceOffloadTest.cpp
+++ b/clang/unittests/Interpreter/DeviceOffloadTest.cpp
@@ -61,6 +61,26 @@ class DeviceOffloadTest : public InterpreterTestBase {
   }
 };
 
+class DeviceOffloadHIPTest : public InterpreterTestBase {
+protected:
+  static void SetUpTestSuite() {
+    InterpreterTestBase::SetUpTestSuite();
+    llvm::InitializeAllTargets();
+    llvm::InitializeAllTargetMCs();
+    llvm::InitializeAllAsmPrinters();
+  }
+
+  void SetUp() override {
+    InterpreterTestBase::SetUp();
+    if (IsSkipped())
+      return;
+    std::string Err;
+    if (!llvm::TargetRegistry::lookupTarget(llvm::Triple("amdgcn-amd-amdhsa"),
+                                            Err))
+      GTEST_SKIP() << Err;
+  }
+};
+
 TEST_F(DeviceOffloadTest, FirstDeviceModuleVerifies) {
 #if GTEST_HAS_DEATH_TEST
   // Release builds leave the IR verifier off. A broken module ends in
@@ -123,15 +143,7 @@ TEST(DeviceOffloadBuilderTest, MultipleOffloadArchsAreRejected) {
                               "supported. Pass a single --offload-arch"));
 }
 
-TEST(DeviceOffloadHIPTest, DeviceObjectIsGenerated) {
-  llvm::InitializeAllTargets();
-  llvm::InitializeAllTargetMCs();
-  llvm::InitializeAllAsmPrinters();
-  std::string Err;
-  if (!llvm::TargetRegistry::lookupTarget(llvm::Triple("amdgcn-amd-amdhsa"),
-                                          Err))
-    GTEST_SKIP() << Err;
-
+TEST_F(DeviceOffloadHIPTest, DeviceObjectIsGenerated) {
   IncrementalCompilerBuilder CB;
   CB.SetCompilerArgs({"--offload-arch=gfx1100", "-nogpulib", "-nogpuinc"});
   auto DeviceCI = CB.CreateDevice(OffloadType::HIP);

``````````

</details>


https://github.com/llvm/llvm-project/pull/235580


More information about the cfe-commits mailing list