mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-18 22:09:01 +00:00
Migrate computeinfo suite to the new test registration framework (#2320)
Contributes to #2181. Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
This commit is contained in:
@@ -18,11 +18,10 @@
|
||||
#include "harness/testHarness.h"
|
||||
#include "harness/deviceInfo.h"
|
||||
|
||||
int test_conformance_version(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue ignoreQueue, int num_elements)
|
||||
REGISTER_TEST_VERSION(conformance_version, Version(3, 0))
|
||||
{
|
||||
std::string version_string{ get_device_info_string(
|
||||
deviceID, CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED) };
|
||||
device, CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED) };
|
||||
|
||||
// Latest conformance version passed should match vYYYY-MM-DD-XX, where XX
|
||||
// is a number
|
||||
|
||||
@@ -99,10 +99,9 @@ static bool get_uuid(const cl_device_id device, const cl_device_info info,
|
||||
return true;
|
||||
}
|
||||
|
||||
int test_device_uuid(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue ignoreQueue, int num_elements)
|
||||
REGISTER_TEST(device_uuid)
|
||||
{
|
||||
if (!is_extension_available(deviceID, "cl_khr_device_uuid"))
|
||||
if (!is_extension_available(device, "cl_khr_device_uuid"))
|
||||
{
|
||||
log_info("cl_khr_device_uuid not supported. Skipping test...\n");
|
||||
return TEST_SKIPPED_ITSELF;
|
||||
@@ -112,7 +111,7 @@ int test_device_uuid(cl_device_id deviceID, cl_context context,
|
||||
|
||||
/* CL_DEVICE_UUID_KHR */
|
||||
uuid device_uuid;
|
||||
bool success = get_uuid(deviceID, CL_DEVICE_UUID_KHR, device_uuid);
|
||||
bool success = get_uuid(device, CL_DEVICE_UUID_KHR, device_uuid);
|
||||
if (!success)
|
||||
{
|
||||
log_error("Error getting device UUID\n");
|
||||
@@ -127,7 +126,7 @@ int test_device_uuid(cl_device_id deviceID, cl_context context,
|
||||
|
||||
/* CL_DRIVER_UUID_KHR */
|
||||
uuid driver_uuid;
|
||||
success = get_uuid(deviceID, CL_DRIVER_UUID_KHR, driver_uuid);
|
||||
success = get_uuid(device, CL_DRIVER_UUID_KHR, driver_uuid);
|
||||
if (!success)
|
||||
{
|
||||
log_error("Error getting driver UUID\n");
|
||||
@@ -144,7 +143,7 @@ int test_device_uuid(cl_device_id deviceID, cl_context context,
|
||||
|
||||
/* CL_DEVICE_LUID_VALID_KHR */
|
||||
cl_bool device_luid_valid{};
|
||||
cl_int err = clGetDeviceInfo(deviceID, CL_DEVICE_LUID_VALID_KHR,
|
||||
cl_int err = clGetDeviceInfo(device, CL_DEVICE_LUID_VALID_KHR,
|
||||
sizeof(device_luid_valid), &device_luid_valid,
|
||||
&size_ret);
|
||||
if (!check_device_info_returns(err, size_ret, sizeof(device_luid_valid)))
|
||||
@@ -162,7 +161,7 @@ int test_device_uuid(cl_device_id deviceID, cl_context context,
|
||||
/* CL_DEVICE_LUID_KHR */
|
||||
luid device_luid;
|
||||
success =
|
||||
get_uuid(deviceID, CL_DEVICE_LUID_KHR, device_luid, device_luid_valid);
|
||||
get_uuid(device, CL_DEVICE_LUID_KHR, device_luid, device_luid_valid);
|
||||
if (!success)
|
||||
{
|
||||
log_error("Error getting device LUID\n");
|
||||
@@ -178,7 +177,7 @@ int test_device_uuid(cl_device_id deviceID, cl_context context,
|
||||
/* CL_DEVICE_NODE_MASK_KHR */
|
||||
cl_uint device_node_mask{};
|
||||
err =
|
||||
clGetDeviceInfo(deviceID, CL_DEVICE_NODE_MASK_KHR,
|
||||
clGetDeviceInfo(device, CL_DEVICE_NODE_MASK_KHR,
|
||||
sizeof(device_node_mask), &device_node_mask, &size_ret);
|
||||
if (!check_device_info_returns(err, size_ret, sizeof(device_node_mask)))
|
||||
{
|
||||
|
||||
@@ -724,11 +724,10 @@ static_assert(sizeof(cl_name_version) == sizeof(cl_name_version_khr),
|
||||
static_assert(CL_MAKE_VERSION(1, 2, 3) == CL_MAKE_VERSION_KHR(1, 2, 3),
|
||||
"CL_MAKE_VERSION mismatch");
|
||||
|
||||
int test_extended_versioning(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue ignoreQueue, int num_elements)
|
||||
REGISTER_TEST(extended_versioning)
|
||||
{
|
||||
bool ext = is_extension_available(deviceID, "cl_khr_extended_versioning");
|
||||
bool core = get_device_cl_version(deviceID) >= Version(3, 0);
|
||||
bool ext = is_extension_available(device, "cl_khr_extended_versioning");
|
||||
bool core = get_device_cl_version(device) >= Version(3, 0);
|
||||
|
||||
if (!ext && !core)
|
||||
{
|
||||
@@ -736,17 +735,17 @@ int test_extended_versioning(cl_device_id deviceID, cl_context context,
|
||||
}
|
||||
|
||||
cl_platform_id platform;
|
||||
cl_int err = clGetDeviceInfo(deviceID, CL_DEVICE_PLATFORM, sizeof(platform),
|
||||
cl_int err = clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(platform),
|
||||
&platform, nullptr);
|
||||
test_error(err, "clGetDeviceInfo failed\n");
|
||||
|
||||
int total_errors = 0;
|
||||
total_errors += test_extended_versioning_platform_version(platform);
|
||||
total_errors += test_extended_versioning_platform_extensions(platform);
|
||||
total_errors += test_extended_versioning_device_versions(ext, deviceID);
|
||||
total_errors += test_extended_versioning_device_extensions(deviceID);
|
||||
total_errors += test_extended_versioning_device_il(deviceID);
|
||||
total_errors += test_extended_versioning_device_built_in_kernels(deviceID);
|
||||
total_errors += test_extended_versioning_device_versions(ext, device);
|
||||
total_errors += test_extended_versioning_device_extensions(device);
|
||||
total_errors += test_extended_versioning_device_il(device);
|
||||
total_errors += test_extended_versioning_device_built_in_kernels(device);
|
||||
|
||||
return total_errors;
|
||||
}
|
||||
|
||||
@@ -1251,8 +1251,7 @@ int getPlatformCapabilities(cl_platform_id platform)
|
||||
return total_errors;
|
||||
}
|
||||
|
||||
int test_computeinfo(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue ignoreQueue, int num_elements)
|
||||
REGISTER_TEST(computeinfo)
|
||||
{
|
||||
int err;
|
||||
int total_errors = 0;
|
||||
@@ -1411,23 +1410,6 @@ int test_computeinfo(cl_device_id deviceID, cl_context context,
|
||||
return total_errors;
|
||||
}
|
||||
|
||||
extern int test_extended_versioning(cl_device_id, cl_context, cl_command_queue,
|
||||
int);
|
||||
extern int test_device_uuid(cl_device_id, cl_context, cl_command_queue, int);
|
||||
extern int test_conformance_version(cl_device_id, cl_context, cl_command_queue,
|
||||
int);
|
||||
extern int test_pci_bus_info(cl_device_id, cl_context, cl_command_queue, int);
|
||||
|
||||
test_definition test_list[] = {
|
||||
ADD_TEST(computeinfo),
|
||||
ADD_TEST(extended_versioning),
|
||||
ADD_TEST(device_uuid),
|
||||
ADD_TEST_VERSION(conformance_version, Version(3, 0)),
|
||||
ADD_TEST(pci_bus_info),
|
||||
};
|
||||
|
||||
const int test_num = ARRAY_SIZE(test_list);
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
const char** argList = (const char**)calloc(argc, sizeof(char*));
|
||||
@@ -1453,7 +1435,9 @@ int main(int argc, const char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
int error = runTestHarness(argCount, argList, test_num, test_list, true, 0);
|
||||
int error = runTestHarness(
|
||||
argCount, argList, test_registry::getInstance().num_tests(),
|
||||
test_registry::getInstance().definitions(), true, 0);
|
||||
|
||||
free(argList);
|
||||
|
||||
|
||||
@@ -21,10 +21,9 @@
|
||||
#include "harness/testHarness.h"
|
||||
#include "harness/deviceInfo.h"
|
||||
|
||||
int test_pci_bus_info(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue ignoreQueue, int num_elements)
|
||||
REGISTER_TEST(pci_bus_info)
|
||||
{
|
||||
if (!is_extension_available(deviceID, "cl_khr_pci_bus_info"))
|
||||
if (!is_extension_available(device, "cl_khr_pci_bus_info"))
|
||||
{
|
||||
log_info("cl_khr_pci_bus_info not supported. Skipping test...\n");
|
||||
return TEST_SKIPPED_ITSELF;
|
||||
@@ -35,14 +34,14 @@ int test_pci_bus_info(cl_device_id deviceID, cl_context context,
|
||||
cl_device_pci_bus_info_khr info;
|
||||
|
||||
size_t size_ret;
|
||||
error = clGetDeviceInfo(deviceID, CL_DEVICE_PCI_BUS_INFO_KHR, 0, NULL,
|
||||
&size_ret);
|
||||
error =
|
||||
clGetDeviceInfo(device, CL_DEVICE_PCI_BUS_INFO_KHR, 0, NULL, &size_ret);
|
||||
test_error(error, "Unable to query CL_DEVICE_PCI_BUS_INFO_KHR size");
|
||||
test_assert_error(
|
||||
size_ret == sizeof(info),
|
||||
"Query for CL_DEVICE_PCI_BUS_INFO_KHR returned an unexpected size");
|
||||
|
||||
error = clGetDeviceInfo(deviceID, CL_DEVICE_PCI_BUS_INFO_KHR, sizeof(info),
|
||||
error = clGetDeviceInfo(device, CL_DEVICE_PCI_BUS_INFO_KHR, sizeof(info),
|
||||
&info, NULL);
|
||||
test_error(error, "Unable to query CL_DEVICE_PCI_BUS_INFO_KHR");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user