mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
fix bugs in negative command_buffer tests (#1969)
- when calling command buffer APIs, test with `command_queue != NULL` should return `CL_INVALID_VALUE` only if the device doesn't support `cl_khr_command_buffer_multi_device` (added `Skip`) - some tests enqueued commands with multiple invalid arguments, e.g. `clCommandCopyImageToBufferKHR` with two images and invalid sync points. AFAIK the order of argument checking is not defined, so implementation can return any valid error value for such API calls, but the tests assumed only one particular error would be returned. Fix the API calls to be unambiguous.
This commit is contained in:
@@ -37,6 +37,13 @@ struct CommandBufferBarrierNotNullQueue : public BasicCommandBufferTest
|
|||||||
|
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Skip() override
|
||||||
|
{
|
||||||
|
if (BasicCommandBufferTest::Skip()) return true;
|
||||||
|
return is_extension_available(device,
|
||||||
|
"cl_khr_command_buffer_multi_device");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// CL_INVALID_COMMAND_BUFFER_KHR if command_buffer is not a valid
|
// CL_INVALID_COMMAND_BUFFER_KHR if command_buffer is not a valid
|
||||||
|
|||||||
@@ -28,15 +28,20 @@ struct CommandCopyBaseTest : BasicCommandBufferTest
|
|||||||
|
|
||||||
cl_int SetUp(int elements) override
|
cl_int SetUp(int elements) override
|
||||||
{
|
{
|
||||||
|
num_elements = elements;
|
||||||
|
origin[0] = origin[1] = origin[2] = 0;
|
||||||
|
region[0] = elements / 64;
|
||||||
|
region[1] = 64;
|
||||||
|
region[2] = 1;
|
||||||
cl_int error = BasicCommandBufferTest::SetUp(elements);
|
cl_int error = BasicCommandBufferTest::SetUp(elements);
|
||||||
test_error(error, "BasicCommandBufferTest::SetUp failed");
|
test_error(error, "BasicCommandBufferTest::SetUp failed");
|
||||||
|
|
||||||
src_image = create_image_2d(context, CL_MEM_READ_ONLY, &formats, 512,
|
src_image = create_image_2d(context, CL_MEM_READ_ONLY, &formats,
|
||||||
512, 0, NULL, &error);
|
elements / 64, 64, 0, NULL, &error);
|
||||||
test_error(error, "create_image_2d failed");
|
test_error(error, "create_image_2d failed");
|
||||||
|
|
||||||
dst_image = create_image_2d(context, CL_MEM_WRITE_ONLY, &formats, 512,
|
dst_image = create_image_2d(context, CL_MEM_WRITE_ONLY, &formats,
|
||||||
512, 0, NULL, &error);
|
elements / 64, 64, 0, NULL, &error);
|
||||||
test_error(error, "create_image_2d failed");
|
test_error(error, "create_image_2d failed");
|
||||||
|
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
@@ -58,8 +63,8 @@ protected:
|
|||||||
clMemWrapper src_image;
|
clMemWrapper src_image;
|
||||||
clMemWrapper dst_image;
|
clMemWrapper dst_image;
|
||||||
const cl_image_format formats = { CL_RGBA, CL_UNSIGNED_INT8 };
|
const cl_image_format formats = { CL_RGBA, CL_UNSIGNED_INT8 };
|
||||||
const size_t origin[3] = { 0, 0, 0 };
|
size_t origin[3];
|
||||||
const size_t region[3] = { 512, 512, 1 };
|
size_t region[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -81,7 +86,7 @@ struct CommandBufferCopyImageQueueNotNull : public CommandCopyBaseTest
|
|||||||
TEST_FAIL);
|
TEST_FAIL);
|
||||||
|
|
||||||
error = clCommandCopyImageToBufferKHR(command_buffer, queue, src_image,
|
error = clCommandCopyImageToBufferKHR(command_buffer, queue, src_image,
|
||||||
dst_image, origin, region, 0, 0,
|
out_mem, origin, region, 0, 0,
|
||||||
nullptr, nullptr, nullptr);
|
nullptr, nullptr, nullptr);
|
||||||
|
|
||||||
test_failure_error_ret(error, CL_INVALID_COMMAND_QUEUE,
|
test_failure_error_ret(error, CL_INVALID_COMMAND_QUEUE,
|
||||||
@@ -119,8 +124,8 @@ struct CommandBufferCopyImageContextNotSame : public CommandCopyBaseTest
|
|||||||
TEST_FAIL);
|
TEST_FAIL);
|
||||||
|
|
||||||
error = clCommandCopyImageToBufferKHR(
|
error = clCommandCopyImageToBufferKHR(
|
||||||
command_buffer, nullptr, src_image_ctx, dst_image, origin, region,
|
command_buffer, nullptr, src_image_ctx, out_mem, origin, region, 0,
|
||||||
0, 0, nullptr, nullptr, nullptr);
|
0, nullptr, nullptr, nullptr);
|
||||||
|
|
||||||
test_failure_error_ret(error, CL_INVALID_CONTEXT,
|
test_failure_error_ret(error, CL_INVALID_CONTEXT,
|
||||||
"clCommandCopyImageToBufferKHR should return "
|
"clCommandCopyImageToBufferKHR should return "
|
||||||
@@ -159,7 +164,7 @@ struct CommandBufferCopyImageContextNotSame : public CommandCopyBaseTest
|
|||||||
TEST_FAIL);
|
TEST_FAIL);
|
||||||
|
|
||||||
error = clCommandCopyImageToBufferKHR(
|
error = clCommandCopyImageToBufferKHR(
|
||||||
command_buffer, nullptr, src_image, dst_image, origin, region, 0, 0,
|
command_buffer, nullptr, src_image, out_mem, origin, region, 0, 0,
|
||||||
nullptr, nullptr, nullptr);
|
nullptr, nullptr, nullptr);
|
||||||
|
|
||||||
test_failure_error_ret(error, CL_INVALID_CONTEXT,
|
test_failure_error_ret(error, CL_INVALID_CONTEXT,
|
||||||
@@ -179,11 +184,11 @@ struct CommandBufferCopyImageContextNotSame : public CommandCopyBaseTest
|
|||||||
test_error(error, "Failed to create context");
|
test_error(error, "Failed to create context");
|
||||||
|
|
||||||
src_image_ctx = create_image_2d(context1, CL_MEM_READ_ONLY, &formats,
|
src_image_ctx = create_image_2d(context1, CL_MEM_READ_ONLY, &formats,
|
||||||
512, 512, 0, NULL, &error);
|
elements / 64, 64, 0, NULL, &error);
|
||||||
test_error(error, "create_image_2d failed");
|
test_error(error, "create_image_2d failed");
|
||||||
|
|
||||||
dst_image_ctx = create_image_2d(context1, CL_MEM_WRITE_ONLY, &formats,
|
dst_image_ctx = create_image_2d(context1, CL_MEM_WRITE_ONLY, &formats,
|
||||||
512, 512, 0, NULL, &error);
|
elements / 64, 64, 0, NULL, &error);
|
||||||
test_error(error, "create_image_2d failed");
|
test_error(error, "create_image_2d failed");
|
||||||
|
|
||||||
queue1 = clCreateCommandQueue(context1, device, 0, &error);
|
queue1 = clCreateCommandQueue(context1, device, 0, &error);
|
||||||
@@ -220,7 +225,7 @@ struct CommandBufferCopySyncPointsNullOrNumZero : public CommandCopyBaseTest
|
|||||||
TEST_FAIL);
|
TEST_FAIL);
|
||||||
|
|
||||||
error = clCommandCopyImageToBufferKHR(
|
error = clCommandCopyImageToBufferKHR(
|
||||||
command_buffer, nullptr, src_image, dst_image, origin, region, 0, 1,
|
command_buffer, nullptr, src_image, out_mem, origin, region, 0, 1,
|
||||||
&invalid_point, nullptr, nullptr);
|
&invalid_point, nullptr, nullptr);
|
||||||
|
|
||||||
test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR,
|
test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR,
|
||||||
@@ -239,7 +244,7 @@ struct CommandBufferCopySyncPointsNullOrNumZero : public CommandCopyBaseTest
|
|||||||
TEST_FAIL);
|
TEST_FAIL);
|
||||||
|
|
||||||
error = clCommandCopyImageToBufferKHR(
|
error = clCommandCopyImageToBufferKHR(
|
||||||
command_buffer, nullptr, src_image, dst_image, origin, region, 0, 1,
|
command_buffer, nullptr, src_image, out_mem, origin, region, 0, 1,
|
||||||
nullptr, nullptr, nullptr);
|
nullptr, nullptr, nullptr);
|
||||||
|
|
||||||
test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR,
|
test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR,
|
||||||
@@ -263,7 +268,7 @@ struct CommandBufferCopySyncPointsNullOrNumZero : public CommandCopyBaseTest
|
|||||||
TEST_FAIL);
|
TEST_FAIL);
|
||||||
|
|
||||||
error = clCommandCopyImageToBufferKHR(
|
error = clCommandCopyImageToBufferKHR(
|
||||||
command_buffer, nullptr, src_image, dst_image, origin, region, 0, 0,
|
command_buffer, nullptr, src_image, out_mem, origin, region, 0, 0,
|
||||||
&point, nullptr, nullptr);
|
&point, nullptr, nullptr);
|
||||||
|
|
||||||
test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR,
|
test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR,
|
||||||
@@ -294,7 +299,7 @@ struct CommandBufferCopyImageInvalidCommandBuffer : public CommandCopyBaseTest
|
|||||||
TEST_FAIL);
|
TEST_FAIL);
|
||||||
|
|
||||||
error = clCommandCopyImageToBufferKHR(nullptr, nullptr, src_image,
|
error = clCommandCopyImageToBufferKHR(nullptr, nullptr, src_image,
|
||||||
dst_image, origin, region, 0, 0,
|
out_mem, origin, region, 0, 0,
|
||||||
nullptr, nullptr, nullptr);
|
nullptr, nullptr, nullptr);
|
||||||
|
|
||||||
test_failure_error_ret(error, CL_INVALID_COMMAND_BUFFER_KHR,
|
test_failure_error_ret(error, CL_INVALID_COMMAND_BUFFER_KHR,
|
||||||
@@ -327,7 +332,7 @@ struct CommandBufferCopyImageFinalizedCommandBuffer : public CommandCopyBaseTest
|
|||||||
TEST_FAIL);
|
TEST_FAIL);
|
||||||
|
|
||||||
error = clCommandCopyImageToBufferKHR(
|
error = clCommandCopyImageToBufferKHR(
|
||||||
command_buffer, nullptr, src_image, dst_image, origin, region, 0, 0,
|
command_buffer, nullptr, src_image, out_mem, origin, region, 0, 0,
|
||||||
nullptr, nullptr, nullptr);
|
nullptr, nullptr, nullptr);
|
||||||
|
|
||||||
test_failure_error_ret(error, CL_INVALID_OPERATION,
|
test_failure_error_ret(error, CL_INVALID_OPERATION,
|
||||||
@@ -358,7 +363,7 @@ struct CommandBufferCopyImageMutableHandleNotNull : public CommandCopyBaseTest
|
|||||||
TEST_FAIL);
|
TEST_FAIL);
|
||||||
|
|
||||||
error = clCommandCopyImageToBufferKHR(
|
error = clCommandCopyImageToBufferKHR(
|
||||||
command_buffer, nullptr, src_image, dst_image, origin, region, 0, 0,
|
command_buffer, nullptr, src_image, out_mem, origin, region, 0, 0,
|
||||||
nullptr, nullptr, &mutable_handle);
|
nullptr, nullptr, &mutable_handle);
|
||||||
|
|
||||||
test_failure_error_ret(error, CL_INVALID_VALUE,
|
test_failure_error_ret(error, CL_INVALID_VALUE,
|
||||||
|
|||||||
@@ -50,6 +50,13 @@ struct CommandBufferCommandSVMQueueNotNull : public BasicSVMCommandBufferTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cl_char pattern_1 = 0x14;
|
const cl_char pattern_1 = 0x14;
|
||||||
|
|
||||||
|
bool Skip() override
|
||||||
|
{
|
||||||
|
if (BasicSVMCommandBufferTest::Skip()) return true;
|
||||||
|
return is_extension_available(device,
|
||||||
|
"cl_khr_command_buffer_multi_device");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// CL_INVALID_SYNC_POINT_WAIT_LIST_KHR if sync_point_wait_list is NULL and
|
// CL_INVALID_SYNC_POINT_WAIT_LIST_KHR if sync_point_wait_list is NULL and
|
||||||
|
|||||||
@@ -38,6 +38,13 @@ struct CommandNDRangeKernelQueueNotNull : public BasicCommandBufferTest
|
|||||||
|
|
||||||
return CL_SUCCESS;
|
return CL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Skip() override
|
||||||
|
{
|
||||||
|
if (BasicCommandBufferTest::Skip()) return true;
|
||||||
|
return is_extension_available(device,
|
||||||
|
"cl_khr_command_buffer_multi_device");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// CL_INVALID_CONTEXT if the context associated with command_queue,
|
// CL_INVALID_CONTEXT if the context associated with command_queue,
|
||||||
@@ -108,7 +115,7 @@ struct CommandNDRangeKerneSyncPointsNullOrNumZero
|
|||||||
cl_sync_point_khr invalid_point = 0;
|
cl_sync_point_khr invalid_point = 0;
|
||||||
cl_sync_point_khr* invalid_sync_points[] = { &invalid_point };
|
cl_sync_point_khr* invalid_sync_points[] = { &invalid_point };
|
||||||
cl_int error = clCommandNDRangeKernelKHR(
|
cl_int error = clCommandNDRangeKernelKHR(
|
||||||
command_buffer, nullptr, nullptr, kernel, 0, nullptr, &num_elements,
|
command_buffer, nullptr, nullptr, kernel, 1, nullptr, &num_elements,
|
||||||
nullptr, 1, invalid_sync_points[0], nullptr, nullptr);
|
nullptr, 1, invalid_sync_points[0], nullptr, nullptr);
|
||||||
|
|
||||||
test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR,
|
test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR,
|
||||||
@@ -134,7 +141,7 @@ struct CommandNDRangeKerneSyncPointsNullOrNumZero
|
|||||||
|
|
||||||
cl_sync_point_khr* sync_points[] = { &point };
|
cl_sync_point_khr* sync_points[] = { &point };
|
||||||
error = clCommandNDRangeKernelKHR(
|
error = clCommandNDRangeKernelKHR(
|
||||||
command_buffer, nullptr, nullptr, kernel, 0, nullptr, &num_elements,
|
command_buffer, nullptr, nullptr, kernel, 1, nullptr, &num_elements,
|
||||||
nullptr, 0, sync_points[0], nullptr, nullptr);
|
nullptr, 0, sync_points[0], nullptr, nullptr);
|
||||||
|
|
||||||
test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR,
|
test_failure_error_ret(error, CL_INVALID_SYNC_POINT_WAIT_LIST_KHR,
|
||||||
|
|||||||
Reference in New Issue
Block a user