From: Alexander Lanin Date: Mon, 22 Jun 2020 20:14:23 +0000 (+0200) Subject: Do not report skipped tests as failures on CMake <3.9 (#609) X-Git-Tag: v4.0~381 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=eae6d5da266c58b08ccbcc13ea115eb5e801b055;p=thirdparty%2Fccache.git Do not report skipped tests as failures on CMake <3.9 (#609) --- diff --git a/dockerfiles/alpine-3.4/Dockerfile b/dockerfiles/alpine-3.4/Dockerfile index 8c5d0aba4..b178a08b4 100644 --- a/dockerfiles/alpine-3.4/Dockerfile +++ b/dockerfiles/alpine-3.4/Dockerfile @@ -1,8 +1,5 @@ # Released 2016, this is the first release to contain cmake >= 3.4.3 -# Note: While alpine 3.4 runs fine, cmake 3.8.1 reports skipped tests as failures while cmake 3.9.5 reports them as skipped. -# So alpine 3.7 is the first version to report exit code 0. Maybe install new cmake manually here? - FROM alpine:3.4 RUN apk add --no-cache \ diff --git a/dockerfiles/alpine/Dockerfile b/dockerfiles/alpine/Dockerfile deleted file mode 100644 index 66f8a4446..000000000 --- a/dockerfiles/alpine/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM alpine:latest - -RUN apk add --no-cache \ - gcc libc-dev \ - make \ - bash \ - build-essential \ - cmake \ - asciidoc \ - autoconf \ - zstd-dev \ - ## diff --git a/test-all-systems.sh b/test-all-systems.sh index 9798518e1..0683ec94f 100755 --- a/test-all-systems.sh +++ b/test-all-systems.sh @@ -11,7 +11,6 @@ # Next steps: # * run compilation, tests and/or docker instances in parallel to improve runtime. -# * improve detection of failures so this script can be executed as a whole (see Note in alpine 3.4 Dockerfile). echo "Warning: Docker support is rather experimental\n" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 17c62e9a8..8ddc2172c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,12 +4,23 @@ function(addtest name) COMMAND ${CMAKE_SOURCE_DIR}/test/run ${name} WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) - set(environment CCACHE=${CMAKE_BINARY_DIR}/ccache EXIT_IF_SKIPPED=true) - set_tests_properties( - "producttest.${name}" - PROPERTIES - ENVIRONMENT "${environment}" - SKIP_RETURN_CODE 125) + set_tests_properties("producttest.${name}" PROPERTIES + ENVIRONMENT "CCACHE=${CMAKE_BINARY_DIR}/ccache;EXIT_IF_SKIPPED=true") + + if(${CMAKE_VERSION} VERSION_LESS "3.9") + # Older cmake versions treat skipped tests as errors. + # Therefore resort to parsing output for those cases. + # Exit code is not considered. + # Skipped tests will appear as "Passed". + set_tests_properties("producttest.${name}" PROPERTIES + PASS_REGULAR_EXPRESSION "PASSED|Passed|Skipped" + FAIL_REGULAR_EXPRESSION "[Ww]arning|[Ff]ail|[Er]rror") + else() + set_tests_properties( + "producttest.${name}" PROPERTIES + SKIP_RETURN_CODE 125) + endif() + endfunction() addtest(base)