Skip to content

Commit

Permalink
Migrate vectors suite to the new test registration framework (#2190)
Browse files Browse the repository at this point in the history
Contributes to #2181
  • Loading branch information
ahesham-arm authored Dec 13, 2024
1 parent 2fe382e commit 7d9ecaa
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 108 deletions.
25 changes: 2 additions & 23 deletions test_conformance/vectors/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "harness/compat.h"

#include <stdio.h>
#include <string.h>
#include "procs.h"
#include "harness/testHarness.h"

#if !defined(_WIN32)
#include <unistd.h>
#endif

test_definition test_list[] = {
ADD_TEST(step_type),
ADD_TEST(step_var),
ADD_TEST(step_typedef_type),
ADD_TEST(step_typedef_var),
ADD_TEST(vec_align_array),
ADD_TEST(vec_align_struct),
ADD_TEST(vec_align_packed_struct),
ADD_TEST(vec_align_struct_arr),
ADD_TEST(vec_align_packed_struct_arr),
};

const int test_num = ARRAY_SIZE(test_list);

int main(int argc, const char *argv[])
{
return runTestHarness(argc, argv, test_num, test_list, false, 0);
return runTestHarness(argc, argv, test_registry::getInstance().num_tests(),
test_registry::getInstance().definitions(), false, 0);
}
54 changes: 0 additions & 54 deletions test_conformance/vectors/procs.h

This file was deleted.

2 changes: 0 additions & 2 deletions test_conformance/vectors/testBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,4 @@
#include <sys/types.h>
#include <sys/stat.h>

#include "procs.h"

#endif // _testBase_h
20 changes: 8 additions & 12 deletions test_conformance/vectors/test_step.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,30 +222,26 @@ static const char* patterns[] = {
test_step_typedef_var,
*/

int test_step_type(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(step_type)
{
return test_step_internal(deviceID, context, queue, patterns[0],
return test_step_internal(device, context, queue, patterns[0],
"test_step_type");
}

int test_step_var(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(step_var)
{
return test_step_internal(deviceID, context, queue, patterns[1],
return test_step_internal(device, context, queue, patterns[1],
"test_step_var");
}

int test_step_typedef_type(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(step_typedef_type)
{
return test_step_internal(deviceID, context, queue, patterns[2],
return test_step_internal(device, context, queue, patterns[2],
"test_step_typedef_type");
}

int test_step_typedef_var(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(step_typedef_var)
{
return test_step_internal(deviceID, context, queue, patterns[3],
return test_step_internal(device, context, queue, patterns[3],
"test_step_typedef_var");
}
29 changes: 12 additions & 17 deletions test_conformance/vectors/test_vec_align.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,23 +352,21 @@ size_t post_align_arr[] = { 0, sizeof(cl_char),
size_t type_multiple_post_align_arr[] = { 0, 0, 3, 5, 4, 12 };

// there hsould be a packed version of this?
int test_vec_align_array(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(vec_align_array)
{
char tmp[2048];
int result;

log_info("Testing global\n");
doReplace(tmp, (size_t)2048, patterns[0], ".SRC_SCOPE.", "__global",
".DST_SCOPE.", "__global"); //
result = test_vec_internal(deviceID, context, queue, tmp,
result = test_vec_internal(device, context, queue, tmp,
"test_vec_align_array", BUFFER_SIZE, 0, 0, 0, 0);
return result;
}


int test_vec_align_struct(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(vec_align_struct)
{
char tmp1[2048], tmp2[2048];
int result = 0;
Expand All @@ -387,7 +385,7 @@ int test_vec_align_struct(cl_device_id deviceID, cl_context context,
post_substitution_arr[postIdx]);

result =
test_vec_internal(deviceID, context, queue, tmp1,
test_vec_internal(device, context, queue, tmp1,
"test_vec_align_struct", 512, 0, 0, 0, 0);
if (result != 0)
{
Expand All @@ -409,7 +407,7 @@ int test_vec_align_struct(cl_device_id deviceID, cl_context context,
post_substitution_arr[postIdx]);

result =
test_vec_internal(deviceID, context, queue, tmp1,
test_vec_internal(device, context, queue, tmp1,
"test_vec_align_struct", 512, 0, 0, 0, 0);
if (result != 0)
{
Expand All @@ -420,8 +418,7 @@ int test_vec_align_struct(cl_device_id deviceID, cl_context context,
return 0;
}

int test_vec_align_packed_struct(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(vec_align_packed_struct)
{
char tmp1[2048], tmp2[2048];
int result = 0;
Expand All @@ -441,7 +438,7 @@ int test_vec_align_packed_struct(cl_device_id deviceID, cl_context context,
post_substitution_arr[postIdx]);

result = test_vec_internal(
deviceID, context, queue, tmp1, "test_vec_align_packed_struct",
device, context, queue, tmp1, "test_vec_align_packed_struct",
512, pre_align_arr[preIdx], type_multiple_pre_align_arr[preIdx],
post_align_arr[postIdx], type_multiple_post_align_arr[postIdx]);
if (result != 0)
Expand All @@ -464,7 +461,7 @@ int test_vec_align_packed_struct(cl_device_id deviceID, cl_context context,
post_substitution_arr[postIdx]);

result = test_vec_internal(
deviceID, context, queue, tmp1, "test_vec_align_packed_struct",
device, context, queue, tmp1, "test_vec_align_packed_struct",
512, pre_align_arr[preIdx], type_multiple_pre_align_arr[preIdx],
post_align_arr[postIdx], type_multiple_post_align_arr[postIdx]);
if (result != 0)
Expand All @@ -476,8 +473,7 @@ int test_vec_align_packed_struct(cl_device_id deviceID, cl_context context,
return 0;
}

int test_vec_align_struct_arr(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(vec_align_struct_arr)
{
char tmp1[2048], tmp2[2048];
int result = 0;
Expand All @@ -496,7 +492,7 @@ int test_vec_align_struct_arr(cl_device_id deviceID, cl_context context,
pre_substitution_arr[preIdx], ".POST.",
post_substitution_arr[postIdx]);

result = test_vec_internal(deviceID, context, queue, tmp1,
result = test_vec_internal(device, context, queue, tmp1,
"test_vec_align_struct_arr", BUFFER_SIZE,
0, 0, 0, 0);
if (result != 0)
Expand All @@ -508,8 +504,7 @@ int test_vec_align_struct_arr(cl_device_id deviceID, cl_context context,
return 0;
}

int test_vec_align_packed_struct_arr(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
REGISTER_TEST(vec_align_packed_struct_arr)
{
char tmp1[2048], tmp2[2048];
int result = 0;
Expand All @@ -529,7 +524,7 @@ int test_vec_align_packed_struct_arr(cl_device_id deviceID, cl_context context,
post_substitution_arr[postIdx]);

result = test_vec_internal(
deviceID, context, queue, tmp1,
device, context, queue, tmp1,
"test_vec_align_packed_struct_arr", BUFFER_SIZE,
pre_align_arr[preIdx], type_multiple_pre_align_arr[preIdx],
post_align_arr[postIdx], type_multiple_post_align_arr[postIdx]);
Expand Down

0 comments on commit 7d9ecaa

Please sign in to comment.