-
Notifications
You must be signed in to change notification settings - Fork 291
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 integration testing #1423
Add integration testing #1423
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,11 +70,6 @@ jobs: | |
- run: cmake --build build | ||
- run: ctest --output-on-failure --test-dir build/ | ||
- run: cmake --install build --prefix /tmp | ||
# NOTE: This check is NOT sufficient to ensure vulkan.pc is actually valid | ||
- name: Check vulkan.pc exists and validate it | ||
run: | | ||
cat /tmp/lib/pkgconfig/vulkan.pc | ||
pkg-config --validate /tmp/lib/pkgconfig/vulkan.pc | ||
Comment on lines
-73
to
-77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic is now tested by |
||
|
||
codegen: | ||
runs-on: ubuntu-latest | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,3 +85,32 @@ if(NOT CMAKE_CROSSCOMPILING) | |
else() | ||
gtest_add_tests(TARGET test_regression) | ||
endif() | ||
|
||
# When APPLE_STATIC_LOADER is ON installation is disabled | ||
if (APPLE_STATIC_LOADER) | ||
return() | ||
endif() | ||
|
||
# Test installation | ||
set(test_install_dir "${CMAKE_CURRENT_BINARY_DIR}/install") | ||
add_test(NAME integration.install | ||
COMMAND ${CMAKE_COMMAND} --install ${PROJECT_BINARY_DIR} --prefix ${test_install_dir} --config $<CONFIG> | ||
) | ||
Comment on lines
+94
to
+98
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NOTE: You can go 1 step further and test the BOM (build of materials). See https://cmake.org/cmake/help/latest/prop_test/PASS_REGULAR_EXPRESSION.html The CMake book covers this fairly well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also I have an example in VVL:
|
||
|
||
# find_package testing currently doesn't work well under cross-compilation scenarios. | ||
if (CMAKE_CROSSCOMPILING OR | ||
NOT CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This 1 line was added to make 32 bit builds work without issue. I'm not a fan and it could potentially be handled more elegantly. |
||
return() | ||
endif() | ||
|
||
# Test find_package suppport | ||
add_test(NAME integration.find_package | ||
COMMAND ${CMAKE_CTEST_COMMAND} | ||
--build-and-test ${CMAKE_CURRENT_LIST_DIR}/integration | ||
${CMAKE_CURRENT_BINARY_DIR}/find_package | ||
--build-generator ${CMAKE_GENERATOR} | ||
--build-options -DCMAKE_PREFIX_PATH=${test_install_dir} | ||
) | ||
|
||
# Installing comes before testing | ||
set_tests_properties(integration.find_package PROPERTIES DEPENDS integration.install) |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NOTE: The testing here is SUPER minimal. glslang would need more of course. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# ~~~ | ||
# Copyright (c) 2023 Valve Corporation | ||
# Copyright (c) 2023 LunarG, 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. | ||
# ~~~ | ||
cmake_minimum_required(VERSION 3.17.2) | ||
|
||
project(INTEGRATION LANGUAGES C) | ||
|
||
find_package(VulkanLoader REQUIRED CONFIG) | ||
|
||
# The intent is ensuring we don't accidentally change the names of these | ||
# targets. Since it would break downstream users. | ||
if (NOT TARGET Vulkan::Loader) | ||
message(FATAL_ERROR "Vulkan::Loader target not defined!") | ||
endif() | ||
|
||
if (NOT DEFINED VulkanLoader_VERSION) | ||
message(FATAL_ERROR "VulkanLoader_VERSION not defined!") | ||
endif() | ||
message(STATUS "VulkanLoader_VERSION = ${VulkanLoader_VERSION}") | ||
|
||
# NOTE: This check is NOT sufficient to ensure vulkan.pc is actually valid | ||
find_package(PkgConfig) | ||
if(PKG_CONFIG_FOUND) | ||
find_file(VULKAN_PC vulkan.pc PATH_SUFFIXES lib/pkgconfig REQUIRED) | ||
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --validate ${VULKAN_PC}) | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI @ncesario-lunarg who is looking to do similar work in glslang.
ctest
now handles the find_package integration testing. Making it require little to no CI effort.