mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Migrate multiple_device_context suite to the new test registration framework (#2325)
Contributes to #2181. Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// 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
|
||||
@@ -13,34 +13,10 @@
|
||||
// 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"
|
||||
#include "harness/mt19937.h"
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
test_definition test_list[] = {
|
||||
ADD_TEST( context_multiple_contexts_same_device ),
|
||||
ADD_TEST( context_two_contexts_same_device ),
|
||||
ADD_TEST( context_three_contexts_same_device ),
|
||||
ADD_TEST( context_four_contexts_same_device ),
|
||||
|
||||
ADD_TEST( two_devices ),
|
||||
ADD_TEST( max_devices ),
|
||||
|
||||
ADD_TEST( hundred_queues ),
|
||||
};
|
||||
|
||||
const int test_num = ARRAY_SIZE( test_list );
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
return runTestHarness(argc, argv, test_num, test_list, true, 0);
|
||||
return runTestHarness(argc, argv, test_registry::getInstance().num_tests(),
|
||||
test_registry::getInstance().definitions(), true, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,31 +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/mt19937.h"
|
||||
|
||||
extern int test_context_multiple_contexts_same_device(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_context_two_contexts_same_device(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_context_three_contexts_same_device(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_context_four_contexts_same_device(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
||||
|
||||
extern int test_two_devices(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
||||
extern int test_max_devices(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
|
||||
|
||||
extern int test_hundred_queues(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//
|
||||
// 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
|
||||
@@ -16,16 +16,8 @@
|
||||
#ifndef _testBase_h
|
||||
#define _testBase_h
|
||||
|
||||
#include "harness/compat.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "procs.h"
|
||||
#include "harness/conversions.h"
|
||||
#include "harness/testHarness.h"
|
||||
#include "harness/kernelHelpers.h"
|
||||
|
||||
#endif // _testBase_h
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -414,8 +414,9 @@ cl_int UseTestItem( const TestItem *item, cl_int *err )
|
||||
}
|
||||
|
||||
|
||||
|
||||
int test_context_multiple_contexts_same_device(cl_device_id deviceID, size_t maxCount, size_t minCount )
|
||||
static int test_context_multiple_contexts_same_device(cl_device_id deviceID,
|
||||
size_t maxCount,
|
||||
size_t minCount)
|
||||
{
|
||||
size_t i, j;
|
||||
cl_int err = CL_SUCCESS;
|
||||
@@ -525,23 +526,22 @@ exit:
|
||||
// sane limit, currently 200), attempting to use each along the way. We keep track of how many we could make before
|
||||
// a failure occurred. We then free everything and attempt to go do it again a few times. If you are able to make
|
||||
// that many contexts 5 times over, then you pass.
|
||||
int test_context_multiple_contexts_same_device(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
|
||||
REGISTER_TEST(context_multiple_contexts_same_device)
|
||||
{
|
||||
return test_context_multiple_contexts_same_device(deviceID, 200, 1);
|
||||
return test_context_multiple_contexts_same_device(device, 200, 1);
|
||||
}
|
||||
|
||||
int test_context_two_contexts_same_device(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
|
||||
REGISTER_TEST(context_two_contexts_same_device)
|
||||
{
|
||||
return test_context_multiple_contexts_same_device( deviceID, 2, 2 );
|
||||
return test_context_multiple_contexts_same_device(device, 2, 2);
|
||||
}
|
||||
|
||||
int test_context_three_contexts_same_device(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
|
||||
REGISTER_TEST(context_three_contexts_same_device)
|
||||
{
|
||||
return test_context_multiple_contexts_same_device( deviceID, 3, 3 );
|
||||
return test_context_multiple_contexts_same_device(device, 3, 3);
|
||||
}
|
||||
|
||||
int test_context_four_contexts_same_device(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
|
||||
REGISTER_TEST(context_four_contexts_same_device)
|
||||
{
|
||||
return test_context_multiple_contexts_same_device( deviceID, 4, 4 );
|
||||
return test_context_multiple_contexts_same_device(device, 4, 4);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ const char *test_kernels[] = { "__kernel void kernelA(__global uint *dst)\n"
|
||||
#define MAX_DEVICES 32
|
||||
#define MAX_QUEUES 1000
|
||||
|
||||
int test_device_set(size_t deviceCount, size_t queueCount, cl_device_id *devices, int num_elements)
|
||||
static int test_device_set(size_t deviceCount, size_t queueCount,
|
||||
cl_device_id *devices, int num_elements)
|
||||
{
|
||||
int error;
|
||||
clContextWrapper context;
|
||||
@@ -187,7 +188,7 @@ int test_device_set(size_t deviceCount, size_t queueCount, cl_device_id *devices
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_two_devices(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
|
||||
REGISTER_TEST(two_devices)
|
||||
{
|
||||
cl_platform_id platform;
|
||||
cl_device_id devices[2];
|
||||
@@ -215,7 +216,7 @@ int test_two_devices(cl_device_id deviceID, cl_context context, cl_command_queue
|
||||
return test_device_set( 2, 2, devices, num_elements );
|
||||
}
|
||||
|
||||
int test_max_devices(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
|
||||
REGISTER_TEST(max_devices)
|
||||
{
|
||||
cl_platform_id platform;
|
||||
cl_device_id devices[MAX_DEVICES];
|
||||
@@ -235,8 +236,7 @@ int test_max_devices(cl_device_id deviceID, cl_context context, cl_command_queue
|
||||
return test_device_set( deviceCount, deviceCount, devices, num_elements );
|
||||
}
|
||||
|
||||
int test_hundred_queues(cl_device_id device, cl_context contextIgnore, cl_command_queue queueIgnore, int num_elements)
|
||||
REGISTER_TEST(hundred_queues)
|
||||
{
|
||||
return test_device_set( 1, 100, &device, num_elements );
|
||||
return test_device_set(1, 100, &device, num_elements);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user