Skip to content

Commit

Permalink
Merge pull request #874 from aarongreig/aaron/miscCTSFixes
Browse files Browse the repository at this point in the history
Fix a few minor CTS issues
  • Loading branch information
aarongreig committed Sep 20, 2023
2 parents 1dc6a52 + db42003 commit fe4402d
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 32 deletions.
2 changes: 1 addition & 1 deletion test/conformance/enqueue/urEnqueueMemImageCopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct urEnqueueMemImageCopyTest

void TearDown() override {
if (srcImage) {
EXPECT_SUCCESS(urMemRelease(dstImage));
EXPECT_SUCCESS(urMemRelease(srcImage));
}
if (dstImage) {
EXPECT_SUCCESS(urMemRelease(dstImage));
Expand Down
12 changes: 0 additions & 12 deletions test/conformance/enqueue/urEnqueueWriteHostPipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,6 @@ TEST_P(urEnqueueWriteHostPipeTest, InvalidNullPointerBuffer) {
&phEventWaitList, phEvent));
}

TEST_P(urEnqueueWriteHostPipeTest, InvalidNullPointerEvent) {
uint32_t numEventsInWaitList = 0;
ur_event_handle_t phEventWaitList;
ur_event_handle_t *phEvent = nullptr;

ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_POINTER,
urEnqueueWriteHostPipe(queue, program, pipe_symbol,
/*blocking*/ true, &buffer, size,
numEventsInWaitList,
&phEventWaitList, phEvent));
}

TEST_P(urEnqueueWriteHostPipeTest, InvalidEventWaitList) {
ur_event_handle_t phEventWaitList;
ur_event_handle_t *phEvent = nullptr;
Expand Down
9 changes: 1 addition & 8 deletions test/conformance/kernel/urKernelCreateWithNativeHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,8 @@ TEST_P(urKernelCreateWithNativeHandleTest, InvalidNullHandleProgram) {
&properties, &native_kernel));
}

TEST_P(urKernelCreateWithNativeHandleTest, InvalidNullPointerProperties) {
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE,
urKernelCreateWithNativeHandle(native_kernel_handle,
context, program, nullptr,
&native_kernel));
}

TEST_P(urKernelCreateWithNativeHandleTest, InvalidNullPointerNativeKernel) {
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE,
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_POINTER,
urKernelCreateWithNativeHandle(native_kernel_handle,
context, program,
&properties, nullptr));
Expand Down
2 changes: 1 addition & 1 deletion test/conformance/kernel/urKernelSetArgPointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ struct urKernelSetArgPointerNegativeTest : urKernelSetArgPointerTest {
}

void SetUp() {
UUR_RETURN_ON_FATAL_FAILURE(urKernelSetArgPointerTest::SetUp());
SetUpAllocation();
ASSERT_NE(allocation, nullptr);
UUR_RETURN_ON_FATAL_FAILURE(urKernelSetArgPointerTest::SetUp());
}
};
UUR_INSTANTIATE_KERNEL_TEST_SUITE_P(urKernelSetArgPointerNegativeTest);
Expand Down
4 changes: 2 additions & 2 deletions test/conformance/program/urProgramCreateWithNativeHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ TEST_P(urProgramCreateWithNativeHandleTest, Success) {
TEST_P(urProgramCreateWithNativeHandleTest, InvalidNullHandleContext) {
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE,
urProgramCreateWithNativeHandle(native_program_handle,
context, nullptr,
nullptr, nullptr,
&native_program));
}

TEST_P(urProgramCreateWithNativeHandleTest, InvalidNullPointerProgram) {
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE,
ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_POINTER,
urProgramCreateWithNativeHandle(
native_program_handle, context, nullptr, nullptr));
}
9 changes: 8 additions & 1 deletion test/conformance/program/urProgramGetInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@

#include <uur/fixtures.h>

using urProgramGetInfoTest = uur::urProgramTestWithParam<ur_program_info_t>;
struct urProgramGetInfoTest : uur::urProgramTestWithParam<ur_program_info_t> {
void SetUp() override {
UUR_RETURN_ON_FATAL_FAILURE(
urProgramTestWithParam<ur_program_info_t>::SetUp());
// Some queries need the program to be built.
ASSERT_SUCCESS(urProgramBuild(this->context, program, nullptr));
}
};

UUR_TEST_SUITE_P(
urProgramGetInfoTest,
Expand Down
14 changes: 10 additions & 4 deletions test/conformance/testing/include/uur/fixtures.h
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,9 @@ struct urVirtualMemMappedTest : urVirtualMemTest {
}

void TearDown() override {
EXPECT_SUCCESS(urVirtualMemUnmap(context, virtual_ptr, size));
if (virtual_ptr) {
EXPECT_SUCCESS(urVirtualMemUnmap(context, virtual_ptr, size));
}
UUR_RETURN_ON_FATAL_FAILURE(urVirtualMemTest::TearDown());
}
};
Expand All @@ -826,8 +828,10 @@ struct urVirtualMemMappedTestWithParam : urVirtualMemTestWithParam<T> {
}

void TearDown() override {
EXPECT_SUCCESS(
urVirtualMemUnmap(this->context, this->virtual_ptr, this->size));
if (this->virtual_ptr) {
EXPECT_SUCCESS(urVirtualMemUnmap(this->context, this->virtual_ptr,
this->size));
}
UUR_RETURN_ON_FATAL_FAILURE(urVirtualMemTestWithParam<T>::TearDown());
}
};
Expand Down Expand Up @@ -861,7 +865,9 @@ struct urUSMDeviceAllocTestWithParam : urQueueTestWithParam<T> {
}

void TearDown() override {
ASSERT_SUCCESS(urUSMFree(this->context, ptr));
if (ptr) {
ASSERT_SUCCESS(urUSMFree(this->context, ptr));
}
if (pool) {
ASSERT_TRUE(use_pool);
ASSERT_SUCCESS(urUSMPoolRelease(pool));
Expand Down
30 changes: 27 additions & 3 deletions test/conformance/virtual_memory/urVirtualMemGranularityGetInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include <uur/fixtures.h>

using urVirtualMemGranularityGetInfoTest =
uur::urContextTestWithParam<ur_virtual_mem_granularity_info_t>;
struct urVirtualMemGranularityGetInfoTest
: uur::urContextTestWithParam<ur_virtual_mem_granularity_info_t> {
void SetUp() override {
UUR_RETURN_ON_FATAL_FAILURE(
urContextTestWithParam<ur_virtual_mem_granularity_info_t>::SetUp());
ur_bool_t virtual_memory_support = false;
ASSERT_SUCCESS(urDeviceGetInfo(
this->device, UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT,
sizeof(ur_bool_t), &virtual_memory_support, nullptr));
if (!virtual_memory_support) {
GTEST_SKIP() << "Virtual memory is not supported.";
}
}
};

UUR_TEST_SUITE_P(
urVirtualMemGranularityGetInfoTest,
Expand Down Expand Up @@ -42,7 +54,19 @@ TEST_P(urVirtualMemGranularityGetInfoTest, Success) {
}
}

using urVirtualMemGranularityGetInfoNegativeTest = uur::urContextTest;
struct urVirtualMemGranularityGetInfoNegativeTest : uur::urContextTest {
void SetUp() override {
UUR_RETURN_ON_FATAL_FAILURE(urContextTest::SetUp());

ur_bool_t virtual_memory_support = false;
ASSERT_SUCCESS(urDeviceGetInfo(
device, UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT, sizeof(ur_bool_t),
&virtual_memory_support, nullptr));
if (!virtual_memory_support) {
GTEST_SKIP() << "Virtual memory is not supported.";
}
}
};
UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urVirtualMemGranularityGetInfoNegativeTest);

TEST_P(urVirtualMemGranularityGetInfoNegativeTest, InvalidNullHandleContext) {
Expand Down

0 comments on commit fe4402d

Please sign in to comment.