Skip to content

Commit f5d6491

Browse files
committed
Check for unsupported on CreateWithNative as well as GetNative.
1 parent 0ba9457 commit f5d6491

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

test/conformance/memory/urMemBufferCreateWithNativeHandle.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ TEST_P(urMemBufferCreateWithNativeHandleTest, Success) {
1919
// We can however convert the native_handle back into a unified-runtime handle
2020
// and perform some query on it to verify that it works.
2121
ur_mem_handle_t mem = nullptr;
22-
ASSERT_SUCCESS(
22+
UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
2323
urMemBufferCreateWithNativeHandle(hNativeMem, context, nullptr, &mem));
2424
ASSERT_NE(mem, nullptr);
2525

@@ -44,7 +44,7 @@ TEST_P(urMemBufferCreateWithNativeHandleTest, SuccessWithProperties) {
4444
/*.pNext =*/nullptr,
4545
/*.isNativeHandleOwned =*/false,
4646
};
47-
ASSERT_SUCCESS(
47+
UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(
4848
urMemBufferCreateWithNativeHandle(hNativeMem, context, &props, &mem));
4949
ASSERT_NE(mem, nullptr);
5050

test/conformance/memory/urMemImageCreateWithNativeHandle.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ TEST_P(urMemImageCreateWithNativeHandleTest, Success) {
1414
urMemGetNativeHandle(image, device, &native_handle));
1515

1616
ur_mem_handle_t mem = nullptr;
17-
ASSERT_SUCCESS(urMemImageCreateWithNativeHandle(
17+
UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(urMemImageCreateWithNativeHandle(
1818
native_handle, context, &image_format, &image_desc, nullptr, &mem));
1919
ASSERT_NE(nullptr, mem);
2020

@@ -36,7 +36,7 @@ TEST_P(urMemImageCreateWithNativeHandleTest, SuccessWithProperties) {
3636
// We can't pass isNativeHandleOwned = true in the generic tests since
3737
// we always get the native handle from a UR object, and transferring
3838
// ownership from one UR object to another isn't allowed.
39-
ASSERT_SUCCESS(urMemImageCreateWithNativeHandle(
39+
UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(urMemImageCreateWithNativeHandle(
4040
native_handle, context, &image_format, &image_desc, &props, &mem));
4141
ASSERT_NE(nullptr, mem);
4242

test/conformance/testing/include/uur/fixtures.h

+7-5
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@
2323
(void)0
2424

2525
#define UUR_ASSERT_SUCCESS_OR_UNSUPPORTED(ret) \
26-
auto status = ret; \
27-
if (status == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) { \
28-
GTEST_SKIP(); \
29-
} else { \
30-
ASSERT_EQ(status, UR_RESULT_SUCCESS); \
26+
{ \
27+
auto status = ret; \
28+
if (status == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) { \
29+
GTEST_SKIP(); \
30+
} else { \
31+
ASSERT_EQ(status, UR_RESULT_SUCCESS); \
32+
} \
3133
}
3234

3335
namespace uur {

0 commit comments

Comments
 (0)