mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Merge topic 'backport-3128' into release-2.1
2aa04d7c2 ci: fix ctest_memcheck args 2d47ba22b cmake: Add makefile against install test 1b0ea8af8 cmake: update vtkm.pc and vtkm_config.mk file Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3134
This commit is contained in:
commit
4571db1249
@ -41,8 +41,10 @@ test:centos8_sanitizer:
|
||||
variables:
|
||||
OMP_NUM_THREADS: 4
|
||||
CTEST_MEMORYCHECK_TYPE: LeakSanitizer
|
||||
CTEST_EXCLUSIONS: smoke_test_built_against_test_install
|
||||
|
||||
CTEST_EXCLUSIONS: >-
|
||||
smoke_test_cmake_built_against_test_install
|
||||
smoke_test_make_built_against_test_install
|
||||
smoke_test_pkgconfig_make_built_against_test_install
|
||||
dependencies:
|
||||
- build:centos8_sanitizer
|
||||
needs:
|
||||
|
@ -37,20 +37,32 @@ set(test_exclusions
|
||||
$ENV{CTEST_EXCLUSIONS}
|
||||
)
|
||||
|
||||
string(REPLACE " " ";" test_exclusions "${test_exclusions}")
|
||||
string(REPLACE ";" "|" test_exclusions "${test_exclusions}")
|
||||
if (test_exclusions)
|
||||
set(test_exclusions "(${test_exclusions})")
|
||||
set(test_exclusions EXCLUDE "(${test_exclusions})")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{TEST_INCLUSIONS})
|
||||
set(test_inclusions INCLUDE $ENV{TEST_INCLUSIONS})
|
||||
unset(test_exclusions)
|
||||
endif()
|
||||
|
||||
set(PARALLEL_LEVEL "10")
|
||||
if (DEFINED ENV{CTEST_MAX_PARALLELISM})
|
||||
set(PARALLEL_LEVEL $ENV{CTEST_MAX_PARALLELISM})
|
||||
endif()
|
||||
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.21)
|
||||
set(junit_args OUTPUT_JUNIT "${CTEST_BINARY_DIRECTORY}/junit.xml")
|
||||
endif()
|
||||
|
||||
# reduced parallel level so we don't exhaust system resources
|
||||
ctest_memcheck(
|
||||
PARALLEL_LEVEL "4"
|
||||
PARALLEL_LEVEL ${PARALLEL_LEVEL}
|
||||
RETURN_VALUE test_result
|
||||
EXCLUDE "${test_exclusions}"
|
||||
${test_exclusions}
|
||||
${test_inclusions}
|
||||
DEFECT_COUNT defects
|
||||
${junit_args}
|
||||
)
|
||||
|
@ -90,6 +90,10 @@ test:macos_xcode14:
|
||||
- "ctest $CTEST_TIMEOUT -VV -S .gitlab/ci/ctest_test.cmake"
|
||||
extends:
|
||||
- .cmake_test_artifacts
|
||||
variables:
|
||||
CTEST_EXCLUSIONS: >-
|
||||
smoke_test_make_built_against_test_install
|
||||
smoke_test_pkgconfig_make_built_against_test_install
|
||||
|
||||
.macos_build_tags:
|
||||
tags:
|
||||
|
@ -122,3 +122,5 @@ test:ubuntu1604_clang5:
|
||||
- build:ubuntu1604_clang5
|
||||
needs:
|
||||
- build:ubuntu1604_clang5
|
||||
variables:
|
||||
CTEST_EXCLUSIONS: "make_built_against_test_install"
|
||||
|
@ -9,7 +9,7 @@
|
||||
##============================================================================
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
function(vtkm_test_install )
|
||||
function(vtkm_test_install)
|
||||
if(NOT VTKm_INSTALL_ONLY_LIBRARIES)
|
||||
# Find all modules that are not-compiled. Skip these directories.
|
||||
set(dir_exceptions)
|
||||
@ -89,11 +89,11 @@ set(CMAKE_HIP_COMPILER \"${CMAKE_HIP_COMPILER}\" CACHE FILEPATH \"\")
|
||||
endfunction()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
function(vtkm_test_against_install dir)
|
||||
function(vtkm_test_against_install_cmake dir)
|
||||
set(name ${dir})
|
||||
set(install_prefix "${VTKm_BINARY_DIR}/CMakeFiles/_tmp_install")
|
||||
set(src_dir "${CMAKE_CURRENT_SOURCE_DIR}/${name}/")
|
||||
set(build_dir "${VTKm_BINARY_DIR}/CMakeFiles/_tmp_build/test_${name}/")
|
||||
set(build_dir "${VTKm_BINARY_DIR}/CMakeFiles/_tmp_build/test_${name}_cmake/")
|
||||
|
||||
set(args )
|
||||
if(CMAKE_VERSION VERSION_LESS 3.13)
|
||||
@ -134,7 +134,7 @@ function(vtkm_test_against_install dir)
|
||||
#this information to built the test name to make it clear to the user
|
||||
#what a 'passing' test means
|
||||
set(retcode 0)
|
||||
set(build_name "${name}_built_against_test_install")
|
||||
set(build_name "${name}_cmake_built_against_test_install")
|
||||
set(test_label "TEST_INSTALL")
|
||||
|
||||
add_test(NAME ${build_name}
|
||||
@ -162,3 +162,72 @@ function(vtkm_test_against_install dir)
|
||||
set_tests_properties(${build_name} PROPERTIES FIXTURES_REQUIRED vtkm_installed)
|
||||
set_tests_properties(${build_name} PROPERTIES TIMEOUT 600)
|
||||
endfunction()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
function(_test_install_make dir name)
|
||||
set(build_name "${name}_make_built_against_test_install")
|
||||
set(build_example_dir "${VTKm_BINARY_DIR}/CMakeFiles/_tmp_build/test_${name}_make/")
|
||||
set(source_example_dir "${CMAKE_CURRENT_SOURCE_DIR}/${dir}/")
|
||||
|
||||
# Create build dir if it doesnt exists
|
||||
add_test(NAME ${build_name}_setup
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${build_example_dir})
|
||||
|
||||
# Build and invoke its test
|
||||
add_test(NAME ${build_name}
|
||||
WORKING_DIRECTORY ${build_example_dir}
|
||||
COMMAND make -f ${source_example_dir}/Makefile check V=1 VPATH=${source_example_dir})
|
||||
|
||||
set_tests_properties(${build_name}_setup PROPERTIES FIXTURES_SETUP "makefile_setup")
|
||||
set_tests_properties(${build_name} PROPERTIES ENVIRONMENT "${ARGN}")
|
||||
set_tests_properties(${build_name} PROPERTIES LABELS "TEST_INSTALL")
|
||||
set_tests_properties(${build_name} PROPERTIES FIXTURES_REQUIRED "vtkm_installed;makefile_setup")
|
||||
set_tests_properties(${build_name} PROPERTIES TIMEOUT 600)
|
||||
endfunction()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
function(vtkm_test_against_install_make dir)
|
||||
# Only add tests if and only if Make is found
|
||||
if (NOT ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
|
||||
# Only these compilers accept the -std=c++XX parameter
|
||||
if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU|Clang|Intel")
|
||||
return()
|
||||
endif()
|
||||
find_program(make_found make)
|
||||
if (NOT make_found)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(env_vars
|
||||
"CXX=${CMAKE_CXX_COMPILER}"
|
||||
"CXXFLAGS=$CACHE{CMAKE_CXX_FLAGS} -std=c++${CMAKE_CXX_STANDARD}"
|
||||
)
|
||||
|
||||
set(vtkm_install_dir "${VTKm_BINARY_DIR}/CMakeFiles/_tmp_install")
|
||||
if (WIN32)
|
||||
string(REPLACE ";" "\\;" escaped_path "$ENV{PATH}")
|
||||
list(APPEND env_vars "PATH=$<SHELL_PATH:${vtkm_install_dir}/bin>\\;${escaped_path}")
|
||||
elseif(APPLE)
|
||||
list(APPEND env_vars "DYLD_LIBRARY_PATH=${vtkm_install_dir}/lib:$ENV{DYLD_LIBRARY_PATH}")
|
||||
else()
|
||||
list(APPEND env_vars "LD_LIBRARY_PATH=${vtkm_install_dir}/lib:$ENV{LD_LIBRARY_PATH}")
|
||||
endif()
|
||||
|
||||
# The plain make test uses the given dir as its test name
|
||||
_test_install_make(${dir} ${dir}
|
||||
"VTKM_INSTALL_PREFIX=${vtkm_install_dir}"
|
||||
"VTKM_CONFIG_MK_PATH=${vtkm_install_dir}/share/vtkm-${VTKm_VERSION_MAJOR}.${VTKm_VERSION_MINOR}/vtkm_config.mk"
|
||||
${env_vars}
|
||||
)
|
||||
|
||||
# Create pkg-config test if pkg-config is found
|
||||
find_program(pkgconfig_found pkg-config)
|
||||
if (pkgconfig_found)
|
||||
_test_install_make(${dir} "${dir}_pkgconfig"
|
||||
"PKG_CONFIG_PATH=${vtkm_install_dir}/share/vtkm-${VTKm_VERSION_MAJOR}.${VTKm_VERSION_MINOR}/"
|
||||
"PKG_CONFIG_TEST_ARGS=--define-variable=prefix=${vtkm_install_dir}"
|
||||
${env_vars}
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
@ -17,5 +17,5 @@ libdir=${exec_prefix}/lib
|
||||
Name: VTKm
|
||||
Description: The VTKm library
|
||||
Version: @VTKm_VERSION@
|
||||
Cflags: -I${includedir}/vtkm-@CMAKE_INSTALL_PREFIX@
|
||||
Cflags: -I${includedir} -I${includedir}/vtkm/thirdparty/diy/vtkmdiy/include/ -I${includedir}/vtkm/thirdparty/lcl/vtkmlcl/
|
||||
Libs: -L${libdir}@lib_args@
|
||||
|
@ -24,5 +24,7 @@ VTKm_ENABLE_OSMESA_CONTEXT = @VTKm_ENABLE_OSMESA_CONTEXT@
|
||||
VTKm_ENABLE_EGL_CONTEXT = @VTKm_ENABLE_EGL_CONTEXT@
|
||||
VTKm_ENABLE_MPI = @VTKm_ENABLE_MPI@
|
||||
|
||||
VTKm_INCLUDE_FLAGS = -I $(VTKm_DIR)/include/vtkm-@VTKm_VERSION_MAJOR@.@VTKm_VERSION_MINOR@
|
||||
VTKm_INCLUDE_DIR = $(VTKm_DIR)/include/vtkm-@VTKm_VERSION_MAJOR@.@VTKm_VERSION_MINOR@
|
||||
VTKm_INCLUDE_FLAGS = -I$(VTKm_INCLUDE_DIR) -I$(VTKm_INCLUDE_DIR)/vtkm/thirdparty/diy/vtkmdiy/include/ -I$(VTKm_INCLUDE_DIR)/vtkm/thirdparty/lcl/vtkmlcl/
|
||||
|
||||
VTKm_LIB_FLAGS = -L $(VTKm_DIR)/lib@lib_args@
|
||||
|
13
docs/changelog/Added_Makefile_contract_tests.md
Normal file
13
docs/changelog/Added_Makefile_contract_tests.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Added Makefile contract tests
|
||||
|
||||
Added Makefile contract tests to ensure that the VTK-m smoke test example
|
||||
application can be built and run using a Makefile against a VTK-m install tree.
|
||||
This will help users who use bare Make as their build system. Additionally,
|
||||
fixed both the VTK-m pkg-config `vtkm.pc` and the `vtkm_config.mk` file to
|
||||
ensure that both files are correctly generated and added CI coverage to ensure
|
||||
that they are always up-to-date and correct. This improves support for users
|
||||
who use bare Make as their build system, and increases confidence in the
|
||||
correctness of both the VTK-m pkg-config file `vtkm.pc` and of the Makefile
|
||||
`vtkm_config.mk`.
|
||||
|
||||
You can run these tests with: `ctest -R smoke_test`
|
@ -57,7 +57,8 @@ endif()
|
||||
if (VTKm_ENABLE_TESTING)
|
||||
# These need to be fast to build as they will
|
||||
# be built each time we run the test
|
||||
vtkm_test_against_install(demo)
|
||||
vtkm_test_against_install(histogram)
|
||||
vtkm_test_against_install(smoke_test)
|
||||
vtkm_test_against_install_cmake(demo)
|
||||
vtkm_test_against_install_cmake(histogram)
|
||||
vtkm_test_against_install_cmake(smoke_test)
|
||||
vtkm_test_against_install_make(smoke_test)
|
||||
endif()
|
||||
|
24
examples/smoke_test/Makefile
Normal file
24
examples/smoke_test/Makefile
Normal file
@ -0,0 +1,24 @@
|
||||
ifdef PKG_CONFIG_TEST_ARGS
|
||||
CPPFLAGS = $(shell pkg-config $${PKG_CONFIG_TEST_ARGS} --cflags vtkm)
|
||||
LDLIBS = $(shell pkg-config $${PKG_CONFIG_TEST_ARGS} --libs vtkm)
|
||||
|
||||
else ifdef VTKM_CONFIG_MK_PATH
|
||||
include $(VTKM_CONFIG_MK_PATH)
|
||||
VTKm_DIR = $(VTKM_INSTALL_PREFIX)
|
||||
CPPFLAGS = $(VTKm_INCLUDE_FLAGS)
|
||||
LDLIBS = $(VTKm_LIB_FLAGS)
|
||||
|
||||
endif
|
||||
|
||||
all: smoke_test
|
||||
|
||||
check: smoke_test
|
||||
./smoke_test
|
||||
|
||||
%.o : %.cxx
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $^
|
||||
|
||||
smoke_test.o: smoke_test.cxx
|
||||
|
||||
smoke_test: CC=$(CXX)
|
||||
smoke_test: smoke_test.o
|
Loading…
Reference in New Issue
Block a user