diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bac1d41..cec3d3b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,3 +214,4 @@ if(MSVC) endif(MSVC) set_property(TARGET COPY_FILES${CONFORMANCE_SUFFIX} PROPERTY FOLDER "CONFORMANCE${CONFORMANCE_SUFFIX}") +add_subdirectory( "test_extensions" ) \ No newline at end of file diff --git a/test_extensions/CMakeLists.txt b/test_extensions/CMakeLists.txt new file mode 100644 index 00000000..61f0b23e --- /dev/null +++ b/test_extensions/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory( media_sharing ) diff --git a/test_extensions/media_sharing/CMakeLists.txt b/test_extensions/media_sharing/CMakeLists.txt index 957395a2..2cf3e677 100644 --- a/test_extensions/media_sharing/CMakeLists.txt +++ b/test_extensions/media_sharing/CMakeLists.txt @@ -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) diff --git a/test_extensions/media_sharing/main.cpp b/test_extensions/media_sharing/main.cpp index 75fa44b9..32097372 100644 --- a/test_extensions/media_sharing/main.cpp +++ b/test_extensions/media_sharing/main.cpp @@ -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); } diff --git a/test_extensions/media_sharing/procs.h b/test_extensions/media_sharing/procs.h new file mode 100644 index 00000000..6b577990 --- /dev/null +++ b/test_extensions/media_sharing/procs.h @@ -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__ \ No newline at end of file