From 58988703cad893694bf8173620c9036ab4259744 Mon Sep 17 00:00:00 2001 From: Michael Hirsch Date: Tue, 26 Oct 2021 19:45:40 -0400 Subject: [PATCH] improve test logic --- .github/workflows/ci_cmake.yml | 5 +++-- CMakeLists.txt | 35 +++++++++++++++++++--------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci_cmake.yml b/.github/workflows/ci_cmake.yml index 08d3020..4437ff1 100644 --- a/.github/workflows/ci_cmake.yml +++ b/.github/workflows/ci_cmake.yml @@ -19,7 +19,8 @@ jobs: - run: cmake -B build -G "MinGW Makefiles" - run: cmake --build build --parallel - - run: ctest --test-dir build + - run: ctest --test-dir build -V + linux: runs-on: ubuntu-latest @@ -29,4 +30,4 @@ jobs: - run: cmake -B build - run: cmake --build build --parallel - - run: ctest --test-dir build + - run: ctest --test-dir build -V diff --git a/CMakeLists.txt b/CMakeLists.txt index 469db42..83e343e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,22 +1,24 @@ -cmake_minimum_required (VERSION 3.14...3.21) +cmake_minimum_required (VERSION 3.14...3.22) project(snpcal LANGUAGES Fortran) -include(CTest) +enable_testing() -if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) - add_compile_options(-std=legacy -Wall -Wextra -fimplicit-none) -elseif(CMAKE_Fortran_COMPILER_ID STREQUAL Intel) - add_compile_options(-warn) -endif() +add_compile_options( +"$<$:-std=legacy;-Wall;-Wextra;-fimplicit-none>" +"$<$:-warn>" +) add_executable(snpcal snpcal.f) -find_program(BASH NAMES bash) -if(BASH) - add_test(NAME Calendar - COMMAND ${BASH} -c "./snpcal 2018 7 | diff --text -a - ${PROJECT_SOURCE_DIR}/ref/test.log") -endif() + +add_test(NAME Calendar +COMMAND sh -c "$ 2018 7 | diff --text -a - ${PROJECT_SOURCE_DIR}/ref/test.log" +) +set_tests_properties(Calendar PROPERTIES +DISABLED $> +TIMEOUT 10 +) configure_file(snpcal.dat ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) @@ -25,9 +27,12 @@ configure_file(snpcal.dat ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) install(TARGETS snpcal TYPE RUNTIME) install(FILES ${snpcal_SOURCE_DIR}/snpcal.dat - DESTINATION bin - PERMISSIONS OWNER_READ) +TYPE BIN +PERMISSIONS OWNER_READ +) if(UNIX) - install(FILES ${snpcal_SOURCE_DIR}/snpcal.sh DESTINATION bin) + install(FILES ${snpcal_SOURCE_DIR}/snpcal.sh + TYPE BIN + ) endif()