vtk-m/.gitlab/ci/ctest_test.cmake

80 lines
2.3 KiB
CMake
Raw Normal View History

2020-03-11 18:16:04 +00:00
##=============================================================================
##
## Copyright (c) Kitware, Inc.
## All rights reserved.
## See LICENSE.txt for details.
##
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
## PURPOSE. See the above copyright notice for more information.
##
##=============================================================================
# We need this CMake versions for tests
cmake_minimum_required(VERSION 3.12..3.15 FATAL_ERROR)
2020-03-11 18:16:04 +00:00
# Read the files from the build directory that contain
# host information ( name, parallel level, etc )
include("$ENV{CI_PROJECT_DIR}/build/CIState.cmake")
ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}")
# Pick up from where the configure left off.
ctest_start(APPEND)
set(test_exclusions
# placeholder for tests to exclude provided by the env
$ENV{CTEST_EXCLUSIONS}
2020-03-11 18:16:04 +00:00
)
string(REPLACE " " ";" test_exclusions "${test_exclusions}")
2020-03-11 18:16:04 +00:00
string(REPLACE ";" "|" test_exclusions "${test_exclusions}")
if (test_exclusions)
2022-07-05 23:42:16 +00:00
set(test_exclusions EXCLUDE "(${test_exclusions})")
2020-03-11 18:16:04 +00:00
endif ()
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.21)
2022-06-16 17:39:24 +00:00
set(junit_args OUTPUT_JUNIT "${CTEST_BINARY_DIRECTORY}/junit.xml")
endif()
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.17)
set(repeat_args REPEAT "UNTIL_PASS:${CTEST_REPEAT_UNTIL_PASS}")
endif()
set(PARALLEL_LEVEL "10")
if (DEFINED ENV{CTEST_MAX_PARALLELISM})
set(PARALLEL_LEVEL $ENV{CTEST_MAX_PARALLELISM})
endif()
2022-07-05 23:42:16 +00:00
if (DEFINED ENV{TEST_INCLUSIONS})
set(test_inclusions INCLUDE $ENV{TEST_INCLUSIONS})
unset(test_exclusions)
endif()
2020-03-11 18:16:04 +00:00
ctest_test(APPEND
PARALLEL_LEVEL ${PARALLEL_LEVEL}
2020-03-11 18:16:04 +00:00
RETURN_VALUE test_result
2022-07-05 23:42:16 +00:00
${test_exclusions}
${test_inclusions}
${repeat_args}
${junit_args}
2020-03-11 18:16:04 +00:00
)
message(STATUS "ctest_test RETURN_VALUE: ${test_result}")
2022-07-05 23:42:16 +00:00
if(VTKm_ENABLE_PERFORMANCE_TESTING)
file(GLOB note_files
"${CTEST_BINARY_DIRECTORY}/benchmark_*.stdout"
"${CTEST_BINARY_DIRECTORY}/compare_*.stdout"
"${CTEST_BINARY_DIRECTORY}/$ENV{CI_COMMIT_SHA}_*.json")
list(APPEND CTEST_NOTES_FILES ${note_files})
endif()
if(NOT DEFINED ENV{GITLAB_CI_EMULATION})
ctest_submit(PARTS Test Notes)
message(STATUS "Test submission done")
endif()
2020-03-11 18:16:04 +00:00
if (test_result)
message(FATAL_ERROR "Failed to test")
2020-03-11 18:16:04 +00:00
endif ()