Skip to content

Commit

Permalink
improve test logic
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Oct 26, 2021
1 parent b77a64c commit 5898870
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
35 changes: 20 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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(
"$<$<Fortran_COMPILER_ID:GNU>:-std=legacy;-Wall;-Wextra;-fimplicit-none>"
"$<$<Fortran_COMPILER_ID:Intel,IntelLLVM>:-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 "$<TARGET_FILE:snpcal> 2018 7 | diff --text -a - ${PROJECT_SOURCE_DIR}/ref/test.log"
)
set_tests_properties(Calendar PROPERTIES
DISABLED $<NOT:$<BOOL:${UNIX}>>
TIMEOUT 10
)

configure_file(snpcal.dat ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)

Expand All @@ -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()

0 comments on commit 5898870

Please # to comment.