From e4233b6e3d378b57bfccda8e60f95cfc42f7856e Mon Sep 17 00:00:00 2001 From: David Tellenbach Date: Thu, 1 Apr 2021 00:08:37 +0000 Subject: Add CI infrastructure for pre-merge smoke tests. This patch adds pre-merge smoke tests for x86 Linux using gcc-10 and clang-10. Closes #2188. --- .gitlab-ci.yml | 3 ++ ci/smoketests.gitlab-ci.yml | 107 ++++++++++++++++++++++++++++++++++++++++++++ cmake/EigenTesting.cmake | 23 ++++------ 3 files changed, 118 insertions(+), 15 deletions(-) create mode 100644 ci/smoketests.gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 64d31a372..e5a3c00af 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,6 +8,8 @@ # with this file, You can obtain one at http://mozilla.org/MPL/2.0/. stages: + - buildsmoketests + - smoketests - build - test @@ -16,5 +18,6 @@ variables: EIGEN_CI_CMAKE_GENEATOR: "Ninja" include: + - "/ci/smoketests.gitlab-ci.yml" - "/ci/build.gitlab-ci.yml" - "/ci/test.gitlab-ci.yml" diff --git a/ci/smoketests.gitlab-ci.yml b/ci/smoketests.gitlab-ci.yml new file mode 100644 index 000000000..6384f1076 --- /dev/null +++ b/ci/smoketests.gitlab-ci.yml @@ -0,0 +1,107 @@ +.buildsmoketests:linux:base: + stage: buildsmoketests + image: ubuntu:18.04 + before_script: + - apt-get update -y + - apt-get install -y --no-install-recommends software-properties-common + - add-apt-repository -y ppa:ubuntu-toolchain-r/test + - apt-get update + - apt-get install --no-install-recommends -y ${EIGEN_CI_CXX_COMPILER} + ${EIGEN_CI_CC_COMPILER} cmake ninja-build + script: + - mkdir -p ${BUILDDIR} && cd ${BUILDDIR} + - CXX=${EIGEN_CI_CXX_COMPILER} CC=${EIGEN_CI_CC_COMPILER} cmake -G + ${EIGEN_CI_CMAKE_GENEATOR} -DEIGEN_TEST_CXX11=${EIGEN_TEST_CXX11} + ${EIGEN_CI_ADDITIONAL_ARGS} .. + - cmake --build . --target buildsmoketests + artifacts: + name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME" + paths: + - ${BUILDDIR}/ + expire_in: 5 days + only: + - merge_requests + +buildsmoketests:x86-64:linux:gcc-10:cxx11-off: + extends: .buildsmoketests:linux:base + variables: + EIGEN_CI_CXX_COMPILER: "g++-10" + EIGEN_CI_CC_COMPILER: "gcc-10" + EIGEN_TEST_CXX11: "off" + +buildsmoketests:x86-64:linux:gcc-10:cxx11-on: + extends: .buildsmoketests:linux:base + variables: + EIGEN_CI_CXX_COMPILER: "g++-10" + EIGEN_CI_CC_COMPILER: "gcc-10" + EIGEN_TEST_CXX11: "on" + +buildsmoketests:x86-64:linux:clang-10:cxx11-off: + extends: .buildsmoketests:linux:base + variables: + EIGEN_CI_CXX_COMPILER: "clang++-10" + EIGEN_CI_CC_COMPILER: "clang-10" + EIGEN_TEST_CXX11: "off" + +buildsmoketests:x86-64:linux:clang-10:cxx11-on: + extends: .buildsmoketests:linux:base + variables: + EIGEN_CI_CXX_COMPILER: "clang++-10" + EIGEN_CI_CC_COMPILER: "clang-10" + EIGEN_TEST_CXX11: "on" + +.smoketests:linux:base: + stage: smoketests + image: ubuntu:18.04 + before_script: + - apt-get update -y + - apt-get install -y --no-install-recommends software-properties-common + - add-apt-repository -y ppa:ubuntu-toolchain-r/test + - apt-get update + - apt-get install --no-install-recommends -y ${EIGEN_CI_CXX_COMPILER} + ${EIGEN_CI_CC_COMPILER} cmake ninja-build xsltproc + script: + - export CXX=${EIGEN_CI_CXX_COMPILER} + - export CC=${EIGEN_CI_CC_COMPILER} + - cd ${BUILDDIR} && ctest --output-on-failure --no-compress-output + --build-no-clean -T test -L smoketest + after_script: + - apt-get update -y + - apt-get install --no-install-recommends -y xsltproc + - cd ${BUILDDIR} + - xsltproc ../ci/CTest2JUnit.xsl Testing/`head -n 1 < Testing/TAG`/Test.xml > "JUnitTestResults_$CI_JOB_ID.xml" + artifacts: + reports: + junit: + - ${BUILDDIR}/JUnitTestResults_$CI_JOB_ID.xml + expire_in: 5 days + only: + - merge_requests + +smoketests:x86-64:linux:gcc-10:cxx11-off: + extends: .smoketests:linux:base + variables: + EIGEN_CI_CXX_COMPILER: g++-10 + EIGEN_CI_CC_COMPILER: gcc-10 + needs: [ "buildsmoketests:x86-64:linux:gcc-10:cxx11-off" ] + +smoketests:x86-64:linux:gcc-10:cxx11-on: + extends: .smoketests:linux:base + variables: + EIGEN_CI_CXX_COMPILER: g++-10 + EIGEN_CI_CC_COMPILER: gcc-10 + needs: [ "buildsmoketests:x86-64:linux:gcc-10:cxx11-on" ] + +smoketests:x86-64:linux:clang-10:cxx11-off: + extends: .smoketests:linux:base + variables: + EIGEN_CI_CXX_COMPILER: clang++-10 + EIGEN_CI_CC_COMPILER: clang-10 + needs: [ "buildsmoketests:x86-64:linux:clang-10:cxx11-off" ] + +smoketests:x86-64:linux:clang-10:cxx11-on: + extends: .smoketests:linux:base + variables: + EIGEN_CI_CXX_COMPILER: clang++-10 + EIGEN_CI_CC_COMPILER: clang-10 + needs: [ "buildsmoketests:x86-64:linux:clang-10:cxx11-on" ] diff --git a/cmake/EigenTesting.cmake b/cmake/EigenTesting.cmake index 5011340dc..0808446d6 100644 --- a/cmake/EigenTesting.cmake +++ b/cmake/EigenTesting.cmake @@ -716,13 +716,16 @@ macro(ei_split_testsuite num_splits) endforeach() endmacro(ei_split_testsuite num_splits) -# Defines two custom commands buildsmoketests and smoketests that build and run -# a number of tests specified in smoke_test_list. +# Defines the custom command buildsmoketests to build a number of tests +# specified in smoke_test_list. # # Test in smoke_test_list can be either test targets (e.g. packetmath) or # subtests targets (e.g. packetmath_2). If any of the test are not available # in the current configuration they are just skipped. # +# All tests added via this macro are labeled with the smoketest label. This +# allows running smoketests only using ctest. +# # Smoke tests are intended to be run before the whole test suite is invoked, # e.g., to smoke test patches. macro(ei_add_smoke_tests smoke_test_list) @@ -730,9 +733,6 @@ macro(ei_add_smoke_tests smoke_test_list) set(buildtarget "buildsmoketests") add_custom_target("${buildtarget}") - # We build a regex that matches our smoketests only and will pass it to ctest - set(ctest_regex "") - # Get list of all tests and translate it into a CMake list get_property(EIGEN_TESTS_LIST GLOBAL PROPERTY EIGEN_TESTS_LIST) string(REGEX REPLACE "\n" " " EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}") @@ -762,16 +762,9 @@ macro(ei_add_smoke_tests smoke_test_list) # is currently available, i.e., is in EIGEN_SUBTESTS_LIST if ("${test}" IN_LIST EIGEN_SUBTESTS_LIST) add_dependencies("${buildtarget}" "${test}") - # In the case of a subtest we match exactly - set(ctest_regex "${ctest_regex}^${test}$$|") + # Add label smoketest to be able to run smoketests using ctest + get_property(test_labels TEST ${test} PROPERTY LABELS) + set_property(TEST ${test} PROPERTY LABELS "${test_labels};smoketest") endif() endforeach() - - # Remove trailing '|' in ctest regex - string(REGEX REPLACE "\\|$" "" ctest_regex "${ctest_regex}") - message(STATUS "${ctest_regex}") - # Set the test target to run smoketests - set(testtarget "smoketests") - add_custom_target("${testtarget}" COMMAND ctest -R '${ctest_regex}' --random-shuffle) - add_dependencies("${testtarget}" "${buildtarget}") endmacro(ei_add_smoke_tests) \ No newline at end of file -- cgit v1.2.3