gitlab-ci centos7 exclude tests causing rhel8 issues

The centos7 on rhel8 was not running the install tests
as the path to cmake/ctest wasn't valid. This causes
the causes the following issues:

1. NOT_RUN tests with REPEAT don't show up in CMake failed
output fixed by:
  https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4801

2. failed tests cause ctest_test to return an error code,
   which propagates to the script, which propagates to
   having ctest running the script return an error.
This commit is contained in:
Robert Maynard 2020-05-19 10:07:58 -04:00
parent 963c871b76
commit f2b8cac0c9
3 changed files with 6 additions and 31 deletions

@ -1,7 +1,6 @@
# Docker Images:
#
# - CentOS 7
# * .gitlab/ci/docker/centos7/cuda10.2/
# - cuda
# - gcc 4.8.5

@ -46,6 +46,8 @@ test:rhel8_test_centos7:
- .rhel8
- .cmake_test_linux
- .only-default
variables:
CTEST_EXCLUSIONS: "built_against_test_install"
dependencies:
- build:centos7_gcc48
needs:

@ -19,7 +19,8 @@ ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}")
ctest_start(APPEND)
set(test_exclusions
# placeholder for tests to exclude
# placeholder for tests to exclude provided by the env
$ENV{CTEST_EXCLUSIONS}
)
string(REPLACE ";" "|" test_exclusions "${test_exclusions}")
@ -33,6 +34,7 @@ ctest_test(APPEND
EXCLUDE "${test_exclusions}"
REPEAT "UNTIL_PASS:3"
)
message(STATUS "ctest_test RETURN_VALUE: ${test_result}")
if(NOT DEFINED ENV{GITLAB_CI_EMULATION})
ctest_submit(PARTS Test BUILD_ID build_id)
@ -40,33 +42,5 @@ if(NOT DEFINED ENV{GITLAB_CI_EMULATION})
endif()
if (test_result)
#Current ctest return value only tracks if tests failed on the initial run.
#So when we use repeat unit pass, and all tests now succede ctest will still
#report a failure, making our gitlab-ci pipeline look red when it isn't
#
#To work around this issue we check if `Testing/Temporary/LastTestsFailed_*.log`
#has a listing of tests that failed.
set(testing_log_dir "$ENV{CI_PROJECT_DIR}/build/Testing/Temporary")
file(GLOB tests_that_failed_log "${testing_log_dir}/LastTestsFailed_*.log")
if(tests_that_failed_log)
#Make sure the file has tests listed
set(has_failing_tests true)
file(STRINGS "${tests_that_failed_log}" failed_tests)
list(LENGTH failed_tests length)
if(length LESS_EQUAL 1)
# each line looks like NUM:TEST_NAME
string(FIND "${failed_tests}" ":" location)
if(location EQUAL -1)
#no ":" so no tests actually failed after all the re-runs
set(has_failing_tests false)
endif()
endif()
if(has_failing_tests)
message(STATUS "Failing test from LastTestsFailed.log: \n ${failed_tests}")
message(FATAL_ERROR "Failed to test")
endif()
endif()
message(FATAL_ERROR "Failed to test")
endif ()