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

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


Author: Hubert Tong
Date: 2026-10-26T00:59:05-04:00
New Revision: 8742b9f8fc184ce76e98999ebd3a72fad2781dde

URL: https://github.com/llvm/llvm-project/commit/8742b9f8fc184ce76e98999ebd3a72fad2781dde
DIFF: https://github.com/llvm/llvm-project/commit/8742b9f8fc184ce76e98999ebd3a72fad2781dde.diff

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

Convert `DeviceOffloadHIPTest.DeviceObjectIsGenerated` to a `TEST_F`
backed by a new fixture class that inherits from `InterpreterTestBase`,
consistent with `DeviceOffloadTest`. This pattern inherits the existing
mechanism to skip LLVM JIT tests on AIX and z/OS.

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

Co-authored-by: Hubert Tong <hstong at ca.ibm.com>

Added: 
    

Modified: 
    clang/unittests/Interpreter/DeviceOffloadTest.cpp

Removed: 
    


################################################################################
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);


        


More information about the cfe-commits mailing list