Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tests for all valid combinations of min and target version #252

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,26 @@ foreach(VERSION 120 200 210 220 300)
add_test(NAME ${TEST_EXE} COMMAND ${TEST_EXE})
endforeach(OPTION)
endforeach(VERSION)

if(NOT TARGET OpenCL::openCL)
find_package(OpenCLICDLoader)
endif()
if(TARGET OpenCL::OpenCL)
# TODO enable testing for OpenCL 1.0 and 1.1
foreach(MINVERSION 120 200 210 220 300)
foreach(TARGETVERSION 120 200 210 220 300)
if(NOT (${MINVERSION} GREATER ${TARGETVERSION}))
set(TEST_EXE test_openclhpp_version_min_${MINVERSION}_target_${TARGETVERSION})
add_executable(${TEST_EXE} test_versions.cpp)
target_compile_definitions(${TEST_EXE} PUBLIC
CL_HPP_MINIMUM_OPENCL_VERSION=${MINVERSION}
CL_HPP_TARGET_OPENCL_VERSION=${TARGETVERSION})
target_link_libraries(${TEST_EXE} PRIVATE
OpenCL::HeadersCpp
OpenCL::Headers
OpenCL::OpenCL)
add_test(NAME ${TEST_EXE} COMMAND ${TEST_EXE})
endif()
endforeach()
endforeach()
endif()
24 changes: 24 additions & 0 deletions tests/test_versions.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// Copyright (c) 2023 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 <CL/opencl.hpp>
#include <iostream>

int main(void)
{
std::cout << "opencl.hpp version permutation test PASSED.\n";
return 0;
}