[llvm] [offload] add KNOWN_FAILURE_ON unittest macro (PR #196275)

Piotr Balcer via llvm-commits llvm-commits at lists.llvm.org
Thu May 7 05:58:56 PDT 2026


================
@@ -61,6 +61,23 @@
   } while (0)
 #endif
 
+inline bool
+isKnownFailureOnBackend(ol_platform_backend_t CurBackend,
+                        std::initializer_list<ol_platform_backend_t> Backends) {
+  for (ol_platform_backend_t B : Backends) {
+    if (CurBackend == B)
+      return true;
+  }
+  return false;
+}
+
+#define KNOWN_FAILURE_ON(...)                                                  \
+  GTEST_AMBIGUOUS_ELSE_BLOCKER_                                                \
+  if (!isKnownFailureOnBackend(this->getPlatformBackend(), {__VA_ARGS__}))     \
+    ;                                                                          \
+  else                                                                         \
+    GTEST_SKIP() << "Skipping known failure. "
----------------
pbalcer wrote:

Done. I changed the implementation to look more like the UR macro. I did initially consider just copy/pasting that implementation, but felt that we didn't need the entire machinery here yet.

But I agree that the initial implementation I proposed here may have been a bit too simple. So I've added the mechanism to provide a custom message per backend, but skipped everything else - we can always add it later.

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


More information about the llvm-commits mailing list