From db570f70e5e275bd396e2b16afffdd750f701610 Mon Sep 17 00:00:00 2001 From: Grzegorz Wawiorko Date: Wed, 11 Mar 2020 19:14:16 +0100 Subject: [PATCH] Set minimum expected OpenCL version for the test. (#674) --- test_conformance/c11_atomics/main.cpp | 12 +++++++++++- test_conformance/compiler/main.cpp | 2 +- test_conformance/generic_address_space/main.cpp | 12 +++++++++++- test_conformance/non_uniform_work_group/main.cpp | 12 +++++++++++- test_conformance/workgroups/main.cpp | 8 +++++++- 5 files changed, 41 insertions(+), 5 deletions(-) diff --git a/test_conformance/c11_atomics/main.cpp b/test_conformance/c11_atomics/main.cpp index e15fe3fc..ac9c96e0 100644 --- a/test_conformance/c11_atomics/main.cpp +++ b/test_conformance/c11_atomics/main.cpp @@ -105,6 +105,16 @@ test_definition test_list[] = { const int test_num = ARRAY_SIZE( test_list ); +test_status InitCL(cl_device_id device) { + auto version = get_device_cl_version(device); + auto expected_min_version = Version(2, 0); + if (version < expected_min_version) + { + version_expected_info("Test", expected_min_version.to_string().c_str(), version.to_string().c_str()); + return TEST_SKIP; + } +} + int main(int argc, const char *argv[]) { bool noCert = false; @@ -186,5 +196,5 @@ int main(int argc, const char *argv[]) log_info("*** Use of this mode is not sufficient to verify correctness. ***\n"); log_info("*** ***\n"); } - return runTestHarness(argc, argv, test_num, test_list, false, false, 0); + return runTestHarnessWithCheck(argc, argv, test_num, test_list, false, false, InitCL); } diff --git a/test_conformance/compiler/main.cpp b/test_conformance/compiler/main.cpp index 4d34f769..dd97b084 100644 --- a/test_conformance/compiler/main.cpp +++ b/test_conformance/compiler/main.cpp @@ -87,7 +87,7 @@ test_definition test_list[] = { ADD_TEST( program_binary_type ), ADD_TEST( compile_and_link_status_options_log ), - ADD_TEST( pragma_unroll ), + ADD_TEST_VERSION( pragma_unroll, Version(2, 0) ), }; const int test_num = ARRAY_SIZE( test_list ); diff --git a/test_conformance/generic_address_space/main.cpp b/test_conformance/generic_address_space/main.cpp index b0efe84d..271933ef 100644 --- a/test_conformance/generic_address_space/main.cpp +++ b/test_conformance/generic_address_space/main.cpp @@ -67,6 +67,16 @@ test_definition test_list[] = { const int test_num = ARRAY_SIZE( test_list ); +test_status InitCL(cl_device_id device) { + auto version = get_device_cl_version(device); + auto expected_min_version = Version(2, 0); + if (version < expected_min_version) + { + version_expected_info("Test", expected_min_version.to_string().c_str(), version.to_string().c_str()); + return TEST_SKIP; + } +} + /* Generic Address Space Tests for unnamed generic address space. This feature allows developers to create single generic functions @@ -75,5 +85,5 @@ const int test_num = ARRAY_SIZE( test_list ); int main(int argc, const char *argv[]) { - return runTestHarness(argc, argv, test_num, test_list, false, false, 0); + return runTestHarnessWithCheck(argc, argv, test_num, test_list, false, false, InitCL); } diff --git a/test_conformance/non_uniform_work_group/main.cpp b/test_conformance/non_uniform_work_group/main.cpp index 7fb05fac..473f5c34 100644 --- a/test_conformance/non_uniform_work_group/main.cpp +++ b/test_conformance/non_uniform_work_group/main.cpp @@ -38,6 +38,16 @@ test_definition test_list[] = { const int test_num = ARRAY_SIZE( test_list ); +test_status InitCL(cl_device_id device) { + auto version = get_device_cl_version(device); + auto expected_min_version = Version(2, 0); + if (version < expected_min_version) + { + version_expected_info("Test", expected_min_version.to_string().c_str(), version.to_string().c_str()); + return TEST_SKIP; + } +} + int main(int argc, const char *argv[]) { typedef std::vector ArgsVector; @@ -56,6 +66,6 @@ int main(int argc, const char *argv[]) PrimeNumbers::generatePrimeNumbers(100000); - return runTestHarness(static_cast(programArgs.size()), &programArgs.front(), test_num, test_list, false, false, 0 ); + return runTestHarnessWithCheck(static_cast(programArgs.size()), &programArgs.front(), test_num, test_list, false, false, InitCL); } diff --git a/test_conformance/workgroups/main.cpp b/test_conformance/workgroups/main.cpp index df2cf7d3..ad406efb 100644 --- a/test_conformance/workgroups/main.cpp +++ b/test_conformance/workgroups/main.cpp @@ -43,8 +43,14 @@ test_definition test_list[] = { const int test_num = ARRAY_SIZE(test_list); test_status InitCL(cl_device_id device) { + auto version = get_device_cl_version(device); + auto expected_min_version = Version(2, 0); + if (version < expected_min_version) + { + version_expected_info("Test", expected_min_version.to_string().c_str(), version.to_string().c_str()); + return TEST_SKIP; + } #ifdef CL_EXPERIMENTAL - auto version = get_device_cl_version(device); if(version > Version(2,2)) { int error;