[llvm] [Offload] Make OffloadAPI error messages more readable (PR #140728)
Ross Brunton via llvm-commits
llvm-commits at lists.llvm.org
Tue May 20 06:17:12 PDT 2025
https://github.com/RossBrunton created https://github.com/llvm/llvm-project/pull/140728
None
>From 190fd1fba9548ac19deb9b41766987c93eeb6aaf Mon Sep 17 00:00:00 2001
From: Ross Brunton <ross at codeplay.com>
Date: Tue, 20 May 2025 14:16:01 +0100
Subject: [PATCH] [Offload] Make OffloadAPI error messages more readable
---
offload/unittests/OffloadAPI/common/Fixtures.hpp | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/offload/unittests/OffloadAPI/common/Fixtures.hpp b/offload/unittests/OffloadAPI/common/Fixtures.hpp
index 2303601feb933..ff3c1f4194807 100644
--- a/offload/unittests/OffloadAPI/common/Fixtures.hpp
+++ b/offload/unittests/OffloadAPI/common/Fixtures.hpp
@@ -15,7 +15,14 @@
#pragma once
#ifndef ASSERT_SUCCESS
-#define ASSERT_SUCCESS(ACTUAL) ASSERT_EQ(OL_SUCCESS, ACTUAL)
+#define ASSERT_SUCCESS(ACTUAL) \
+ do { \
+ ol_result_t Res = ACTUAL; \
+ if (Res && Res->Code != OL_ERRC_SUCCESS) { \
+ GTEST_FAIL() << #ACTUAL " returned " << Res->Code << ": " \
+ << Res->Details; \
+ } \
+ } while (0)
#endif
// TODO: rework this so the EXPECTED/ACTUAL results are readable
More information about the llvm-commits
mailing list