Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix up some ctest errors #470

Merged
merged 2 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ jobs:
run: cmake --build build --parallel 4

- name: Build Tests
run: cmake --build build --parallel 4 -t build-tests
run: |
cmake --build build --parallel 4 --target build-tests
cmake --build build --parallel 4 --target tests

- name: Run Tests
run: ctest --test-dir build --parallel 1 --output-on-failure --repeat until-pass:4 --schedule-random
- name: Run Ctest
run: ctest --test-dir build --parallel 1 --output-on-failure --repeat until-pass:4

- name: Archive log files on failure
uses: actions/upload-artifact@v4
Expand All @@ -111,7 +113,7 @@ jobs:
build/**/*.log

Intel:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

env:
FC: ifx
Expand Down Expand Up @@ -164,10 +166,12 @@ jobs:
run: cmake --build build --parallel

- name: Build Tests
run: cmake --build build --parallel -t build-tests
run: |
cmake --build build --parallel 4 --target build-tests
cmake --build build --parallel 4 --target tests

- name: Run Tests
run: ctest --test-dir build --parallel 1 --output-on-failure --repeat until-pass:4 --schedule-random
- name: Run Ctest
run: ctest --test-dir build --parallel 1 --output-on-failure --repeat until-pass:4

- name: Archive log files on failure
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -211,10 +215,12 @@ jobs:
run: cmake --build build --parallel

- name: Build Tests
run: cmake --build build --parallel -t build-tests
run: |
cmake --build build --parallel 4 --target build-tests
cmake --build build --parallel 4 --target tests

- name: Run Tests
run: ctest --test-dir build --parallel 1 --output-on-failure --repeat until-pass:4 --schedule-random
- name: Run Ctest
run: ctest --test-dir build --parallel 1 --output-on-failure --repeat until-pass:4

- name: Archive log files on failure
uses: actions/upload-artifact@v4
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
/mpi_pFUnit.x
/nag
*.zip
build/
build/
Testing/
43 changes: 23 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ if (APPLE)
SET(CMAKE_Fortran_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
endif ()

# Enable testing before adding subdirectories
# to catch any tests in the main project
if (ENABLE_TESTS)
enable_testing()
endif ()

include(build_submodule)
# Find fArgParse first so that gFTL and gFTL-shared are consistent
build_submodule(extern/fArgParse PROJECT FARGPARSE TARGET FARGPARSE::fargparse)
Expand All @@ -150,28 +156,25 @@ if (ENABLE_BUILD_DOXYGEN)
add_subdirectory(documentation)
endif()

if (ENABLE_TESTS)
enable_testing()
if (NOT TARGET build-tests)
add_custom_target(build-tests)
endif()

if (NOT TARGET tests)
add_custom_target(tests
COMMAND ${CMAKE_CTEST_COMMAND}
EXCLUDE_FROM_ALL)
endif ()
add_dependencies(tests build-tests)
add_subdirectory (tests EXCLUDE_FROM_ALL)

# The following forces tests to be built when using "make ctest" even if some targets
# are EXCLUDE_FROM_ALL
# From https://stackoverflow.com/questions/733475/cmake-ctest-make-test-doesnt-build-tests/56448477#56448477
build_command(CTEST_CUSTOM_PRE_TEST TARGET build-tests)
string(CONFIGURE \"@CTEST_CUSTOM_PRE_TEST@\" CTEST_CUSTOM_PRE_TEST_QUOTED ESCAPE_QUOTES)
file(WRITE "${CMAKE_BINARY_DIR}/CTestCustom.cmake" "set(CTEST_CUSTOM_PRE_TEST ${CTEST_CUSTOM_PRE_TEST_QUOTED})" "\n")
if (NOT TARGET build-tests)
add_custom_target(build-tests)
endif()

if (NOT TARGET tests)
add_custom_target(tests
COMMAND ${CMAKE_CTEST_COMMAND}
EXCLUDE_FROM_ALL)
endif ()
add_dependencies(tests build-tests)
add_subdirectory (tests EXCLUDE_FROM_ALL)

# The following forces tests to be built when using "make ctest" even if some targets
# are EXCLUDE_FROM_ALL
# From https://stackoverflow.com/questions/733475/cmake-ctest-make-test-doesnt-build-tests/56448477#56448477
build_command(CTEST_CUSTOM_PRE_TEST TARGET build-tests)
string(CONFIGURE \"@CTEST_CUSTOM_PRE_TEST@\" CTEST_CUSTOM_PRE_TEST_QUOTED ESCAPE_QUOTES)
file(WRITE "${CMAKE_BINARY_DIR}/CTestCustom.cmake" "set(CTEST_CUSTOM_PRE_TEST ${CTEST_CUSTOM_PRE_TEST_QUOTED})" "\n")

# The following is needed for external projects using *nix make when
# parent project builds pFUnit as a subproject.
set (top_dir PFUNIT-${PFUNIT_VERSION_MAJOR}.${PFUNIT_VERSION_MINOR})
Expand Down
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- LLVMFlang compiler support

### Fixed

- Fixes some ctest failures

## [4.9.0] - 2024-02-06

### Added
Expand Down
4 changes: 2 additions & 2 deletions bin/tests/inputs/MpiParameterizedTestCaseC.pf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module TestCaseC_mod
module MpiParameterizedTestCaseC
use pfunit_mod
implicit none

Expand Down Expand Up @@ -117,6 +117,6 @@ contains

end function toString

end module TestCaseC_mod
end module MpiParameterizedTestCaseC


4 changes: 2 additions & 2 deletions bin/tests/inputs/MpiTestCaseB.pf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module MpiTestCaseB_mod
module MpiTestCaseB
use pfunit_mod
implicit none

Expand Down Expand Up @@ -35,6 +35,6 @@ contains
class (MpiTestCaseB), intent(inout) :: this
end subroutine testB

end module MpiTestCaseB_mod
end module MpiTestCaseB


4 changes: 2 additions & 2 deletions bin/tests/inputs/ParameterizedTestCaseB.pf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module TestCaseB_mod
module ParameterizedTestCaseB
use pfunit_mod
implicit none

Expand Down Expand Up @@ -64,6 +64,6 @@ contains

end function toString

end module TestCaseB_mod
end module ParameterizedTestCaseB


4 changes: 2 additions & 2 deletions bin/tests/inputs/TestA.pf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module TestA_mod
module TestA
use pfunit_mod
implicit none

Expand All @@ -19,6 +19,6 @@ contains
class (MpiTestMethod), intent(inout) :: this
end subroutine testMethodC

end module TestA_mod
end module TestA


4 changes: 2 additions & 2 deletions bin/tests/inputs/TestCaseA.pf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module TestCaseA_mod
module TestCaseA
use pfunit_mod
implicit none

Expand Down Expand Up @@ -35,4 +35,4 @@ contains
class (TestCaseA), intent(inout) :: this
end subroutine testB

end module TestCaseA_mod
end module TestCaseA
Loading