From edd2fdf34dbf9a1967367e52099a2ddef1b962c9 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Thu, 9 Jan 2025 15:49:08 +0000 Subject: [PATCH] Move urVirtualMemGetInfo success test from a switch to individual tests. --- .../virtual_memory/urVirtualMemGetInfo.cpp | 40 +++++-------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/test/conformance/virtual_memory/urVirtualMemGetInfo.cpp b/test/conformance/virtual_memory/urVirtualMemGetInfo.cpp index 041a749b5b..360c913118 100644 --- a/test/conformance/virtual_memory/urVirtualMemGetInfo.cpp +++ b/test/conformance/virtual_memory/urVirtualMemGetInfo.cpp @@ -4,42 +4,24 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -using urVirtualMemGetInfoTestWithParam = - uur::urVirtualMemMappedTestWithParam; -UUR_TEST_SUITE_P(urVirtualMemGetInfoTestWithParam, - ::testing::Values(UR_VIRTUAL_MEM_INFO_ACCESS_MODE), - uur::deviceTestWithParamPrinter); +using urVirtualMemGetInfoTest = uur::urVirtualMemMappedTest; +UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urVirtualMemGetInfoTest); -TEST_P(urVirtualMemGetInfoTestWithParam, Success) { +TEST_P(urVirtualMemGetInfoTest, SuccessAccessMode) { size_t info_size = 0; - ur_virtual_mem_info_t info = getParam(); - ASSERT_SUCCESS_OR_OPTIONAL_QUERY(urVirtualMemGetInfo(context, virtual_ptr, - size, info, 0, nullptr, - &info_size), - info); + auto info_type = UR_VIRTUAL_MEM_INFO_ACCESS_MODE; + ASSERT_SUCCESS(urVirtualMemGetInfo(context, virtual_ptr, size, info_type, 0, + nullptr, &info_size)); ASSERT_NE(info_size, 0); - std::vector data(info_size); - ASSERT_SUCCESS(urVirtualMemGetInfo(context, virtual_ptr, size, info, - data.size(), data.data(), nullptr)); - - switch (info) { - case UR_VIRTUAL_MEM_INFO_ACCESS_MODE: { - ASSERT_EQ(sizeof(ur_virtual_mem_access_flags_t), data.size()); - ur_virtual_mem_access_flags_t flags = - *reinterpret_cast(data.data()); - ASSERT_TRUE(flags & UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE); - } break; + ur_virtual_mem_access_flags_t returned_flags = + UR_VIRTUAL_MEM_ACCESS_FLAG_FORCE_UINT32; + ASSERT_SUCCESS(urVirtualMemGetInfo(context, virtual_ptr, size, info_type, + info_size, &returned_flags, nullptr)); - default: - FAIL() << "Unhandled ur_virtual_mem_info_t enumeration: " << info; - break; - } + ASSERT_TRUE(returned_flags & UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE); } -using urVirtualMemGetInfoTest = uur::urVirtualMemMappedTest; -UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urVirtualMemGetInfoTest); - TEST_P(urVirtualMemGetInfoTest, InvalidNullHandleContext) { ur_virtual_mem_access_flags_t flags = 0; ASSERT_EQ_RESULT(urVirtualMemGetInfo(nullptr, virtual_ptr, size,