cl21: Fix building media sharing tests (#390)

* Add media_sharing to cmakes

* Adjust cases to ADD_TEST macro

* Review fixes
This commit is contained in:
Grzegorz Wawiorko
2019-07-29 17:08:17 +02:00
committed by Kévin Petit
parent ef84736c73
commit f24b072595
5 changed files with 51 additions and 34 deletions

View File

@@ -163,3 +163,4 @@ if(MSVC)
endif(MSVC)
set_property(TARGET COPY_FILES${CONFORMANCE_SUFFIX} PROPERTY FOLDER "CONFORMANCE${CONFORMANCE_SUFFIX}")
add_subdirectory( "test_extensions" )

View File

@@ -0,0 +1 @@
add_subdirectory( media_sharing )

View File

@@ -1,6 +1,5 @@
if(WIN32)
list(APPEND CLConform_LIBRARIES d3d9.lib dxva2.lib )
endif(WIN32)
set (MEDIA_SOURCES
main.cpp
@@ -21,6 +20,7 @@ set (MEDIA_SOURCES
../../test_common/harness/mt19937.c
../../test_common/harness/parseParameters.cpp
../../test_common/harness/crc32.c
../../test_common/harness/msvc9.c
)
add_executable(conformance_test_media_surface_sharing
@@ -32,3 +32,5 @@ set_source_files_properties(
TARGET_LINK_LIBRARIES(conformance_test_media_surface_sharing
${CLConform_LIBRARIES})
endif(WIN32)

View File

@@ -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
@@ -18,38 +18,20 @@
#include "../../test_common/harness/testHarness.h"
#include "utils.h"
#include "procs.h"
extern int test_context_create(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_get_device_ids(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_api(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_kernel(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_other_data_types(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_memory_access(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_interop_user_sync(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
basefn basefn_list[] = {
test_context_create,
test_get_device_ids,
test_api,
test_kernel,
test_other_data_types,
test_memory_access,
test_interop_user_sync,
test_definition test_list[] = {
ADD_TEST( context_create ),
ADD_TEST( get_device_ids ),
ADD_TEST( api ),
ADD_TEST( kernel ),
ADD_TEST( other_data_types ),
ADD_TEST( memory_access ),
ADD_TEST( interop_user_sync )
};
const char *basefn_names[] = {
"test_context_create",
"test_get_device_ids",
"test_api",
"test_kernel",
"test_other_data_types",
"test_memory_access",
"test_interop_user_sync",
};
ct_assert((sizeof(basefn_names) / sizeof(basefn_names[0])) == (sizeof(basefn_list) / sizeof(basefn_list[0])));
int num_fns = sizeof(basefn_names) / sizeof(char *);
const int test_num = ARRAY_SIZE(test_list);
clGetDeviceIDsFromDX9MediaAdapterKHR_fn clGetDeviceIDsFromDX9MediaAdapterKHR = NULL;
clCreateFromDX9MediaSurfaceKHR_fn clCreateFromDX9MediaSurfaceKHR = NULL;
@@ -207,16 +189,16 @@ bool CmdlineParse(int argc, const char *argv[])
int main(int argc, const char *argv[])
{
if (!CmdlineParse(argc, argv))
return 2;
return TEST_FAIL;
if (!DetectPlatformAndDevice())
{
log_info("Test was not run, because the media surface sharing extension is not supported\n");
return TEST_NOT_SUPPORTED;
return TEST_SKIP;
}
if (!MediaSurfaceSharingExtensionInit())
return 2;
return TEST_FAIL;
return runTestHarness( argc, argv, num_fns, basefn_list, basefn_names, false, true, 0 );
return runTestHarness(argc, argv, test_num, test_list, false, true, 0);
}

View File

@@ -0,0 +1,31 @@
//
// Copyright (c) 2019 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.
//
#ifndef __MEDIA_SHARING_PROCS_H__
#define __MEDIA_SHARING_PROCS_H__
extern int test_context_create(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_get_device_ids(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_api(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_kernel(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_other_data_types(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_memory_access(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
extern int test_interop_user_sync(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
#endif // #ifndef __MEDIA_SHARING_PROCS_H__