mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Migrate vectors suite to the new test registration framework (#2190)
Contributes to #2181
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#include "harness/errorHelpers.h"
|
||||
#include "harness/kernelHelpers.h"
|
||||
#include "harness/typeWrappers.h"
|
||||
#include "harness/conversions.h"
|
||||
#include "harness/mt19937.h"
|
||||
|
||||
// The number of errors to print out for each test in the shuffle tests
|
||||
#define MAX_ERRORS_TO_PRINT 1
|
||||
|
||||
|
||||
extern int create_program_and_kernel(const char *source,
|
||||
const char *kernel_name,
|
||||
cl_program *program_ret,
|
||||
cl_kernel *kernel_ret);
|
||||
|
||||
extern int test_step_type(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
extern int test_step_var(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
extern int test_step_typedef_type(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
extern int test_step_typedef_var(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
|
||||
int test_vec_align_array(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
|
||||
int test_vec_align_struct(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
|
||||
int test_vec_align_packed_struct(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
|
||||
|
||||
int test_vec_align_struct_arr(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
|
||||
int test_vec_align_packed_struct_arr(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
@@ -23,6 +23,4 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "procs.h"
|
||||
|
||||
#endif // _testBase_h
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -352,8 +352,7 @@ 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;
|
||||
@@ -361,14 +360,13 @@ int test_vec_align_array(cl_device_id deviceID, cl_context context,
|
||||
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;
|
||||
@@ -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)
|
||||
{
|
||||
@@ -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)
|
||||
{
|
||||
@@ -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;
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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;
|
||||
@@ -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)
|
||||
@@ -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;
|
||||
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user