switch SVM tests to the new test registration framework (#2168)

Switches the SVM tests to the new test registration framework.

The first commit is the best to review and contains the actual changes.
The second commit purely has formatting changes.

Note that several of these changes were a bit more than mechanical
because many of the SVM tests create a new context vs. using the context
provided by the harness and passed to each test function. The previous
code named the context provided by the harness differently, and hence
could use the name "context" in each test function, but with the new
test registration framework this is no longer possible. Instead, I am
creating the new context using the name "contextWrapper" and then
assigning it to the "context" passed to the test function, which seems
like the best way to avoid using the wrong context unintentionally. I am
open to suggestions to do this differently.

I have verified that the same calls are made before and after these
changes, and specifically that there are no context leaks.
This commit is contained in:
Ben Ashbaugh
2024-12-03 14:51:23 -08:00
committed by GitHub
parent e361b387d9
commit d99b302f90
16 changed files with 1066 additions and 854 deletions

View File

@@ -260,26 +260,6 @@ cl_int create_cl_objects(cl_device_id device_from_harness, const char** ppCodeSt
return 0;
}
test_definition test_list[] = {
ADD_TEST(svm_byte_granularity),
ADD_TEST(svm_set_kernel_exec_info_svm_ptrs),
ADD_TEST(svm_fine_grain_memory_consistency),
ADD_TEST(svm_fine_grain_sync_buffers),
ADD_TEST(svm_shared_address_space_fine_grain),
ADD_TEST(svm_shared_sub_buffers),
ADD_TEST(svm_shared_address_space_fine_grain_buffers),
ADD_TEST(svm_allocate_shared_buffer),
ADD_TEST(svm_allocate_shared_buffer_negative),
ADD_TEST(svm_shared_address_space_coarse_grain_old_api),
ADD_TEST(svm_shared_address_space_coarse_grain_new_api),
ADD_TEST(svm_cross_buffer_pointers_coarse_grain),
ADD_TEST(svm_pointer_passing),
ADD_TEST(svm_enqueue_api),
ADD_TEST_VERSION(svm_migrate, Version(2, 1)),
};
const int test_num = ARRAY_SIZE( test_list );
test_status InitCL(cl_device_id device) {
auto version = get_device_cl_version(device);
auto expected_min_version = Version(2, 0);
@@ -310,6 +290,7 @@ test_status InitCL(cl_device_id device) {
int main(int argc, const char *argv[])
{
return runTestHarnessWithCheck(argc, argv, test_num, test_list, true, 0, InitCL);
return runTestHarnessWithCheck(
argc, argv, test_registry::getInstance().num_tests(),
test_registry::getInstance().definitions(), true, 0, InitCL);
}