Skip to content

Commit

Permalink
Merge pull request #473 from Goddard-Fortran-Ecosystem/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
tclune authored Jul 10, 2024
2 parents decc27e + 39990ca commit 26dadb1
Show file tree
Hide file tree
Showing 28 changed files with 166 additions and 119 deletions.
47 changes: 30 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-11, macos-12]
compiler: [gfortran-10, gfortran-11, gfortran-12, gfortran-13]
os: [ubuntu-22.04, ubuntu-24.04, macos-13, macos-14]
compiler: [gfortran-11, gfortran-12, gfortran-13]
# gfortran-10 is only on ubuntu-22.04
# gfortran-14 is available on ubuntu-24.04
include:
- os: ubuntu-22.04
compiler: gfortran-10
- os: ubuntu-24.04
compiler: gfortran-14
exclude:
- os: macos-11
- os: ubuntu-24.04
compiler: gfortran-11
- os: ubuntu-22.04
compiler: gfortran-13
- os: macos-12
compiler: gfortran-10

# fail-fast if set to 'true' here is good for production, but when
# debugging, set to 'false'. fail-fast means if *any* ci test in the matrix fails
Expand Down Expand Up @@ -69,7 +76,7 @@ jobs:
- name: Build MPI
if: steps.cache-mpi.outputs.cache-hit != 'true'
run: |
sh ${GITHUB_WORKSPACE}/tools/ci-install-mpi.sh openmpi 4.1.4
sh ${GITHUB_WORKSPACE}/tools/ci-install-mpi.sh openmpi 5.0.2
- name: Set MPI Environment
run: |
Expand All @@ -87,13 +94,15 @@ jobs:
run: cmake -B build

- name: Build pfUnit
run: cmake --build build --parallel
run: cmake --build build --parallel 4

- 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 All @@ -104,7 +113,7 @@ jobs:
build/**/*.log
Intel:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

env:
FC: ifx
Expand Down Expand Up @@ -157,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 @@ -204,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/
47 changes: 25 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
cmake_minimum_required(VERSION 3.12)

project (PFUNIT
VERSION 4.9.0
VERSION 4.10.0
LANGUAGES Fortran C)

cmake_policy(SET CMP0077 NEW)
Expand Down Expand Up @@ -138,9 +138,15 @@ 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)
build_submodule(extern/fArgParse PROJECT FARGPARSE TARGET FARGPARSE::fargparse VERSION 1.8.0)

add_subdirectory (src)
add_subdirectory (include)
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
17 changes: 17 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [4.10.0] - 2024-07-10

### Changed

- Updated pFUnit to use v2 template interfaces
- Added `-quiet` flag for NAG Fortran
- Remove `macos-11` from GitHub Actions, add `macos-12` and `gfortran-14` to Ubuntu 24.04
- Updated fArgParse to v1.8.0

### Added

- 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
7 changes: 7 additions & 0 deletions cmake/LLVMFlang.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Compiler specific flags for LLVM Flang

set(cpp "-cpp")

set(common_flags "${cpp}")
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g ${common_flags}")
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 ${common_flags}")
2 changes: 1 addition & 1 deletion cmake/NAG.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set(check_all "-C=pointer")
set(cpp "-fpp")
set(mismatch "-mismatch")

set(common_flags "${cpp} -w=x95")
set(common_flags "${cpp} -w=x95 -quiet")

set(CMAKE_Fortran_FLAGS_DEBUG "${common_flags} -O0 ${check_all} ${traceback}")
set(CMAKE_Fortran_FLAGS_RELEASE ${common_flags})
Expand Down
4 changes: 2 additions & 2 deletions cmake/build_submodule.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
macro (build_submodule submodule)

set(options)
set(oneValueArgs TARGET PROJECT)
set(oneValueArgs TARGET PROJECT VERSION)
set(multiValueArgs)
cmake_parse_arguments(build_submodule "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

find_package(${build_submodule_PROJECT} QUIET)
find_package(${build_submodule_PROJECT} ${build_submodule_VERSION} QUIET)

if (${build_submodule_PROJECT}_FOUND)
message(STATUS "Using package '${build_submodule_PROJECT}'")
Expand Down
6 changes: 3 additions & 3 deletions src/funit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ function(funit_target_link_pfunit funit_target)
target_link_libraries (${funit_target} PUBLIC OpenMP::OpenMP_Fortran)
endif ()

if (NOT TARGET GFTL::gftl)
if (NOT TARGET GFTL::gftl-v2)
message(FATAL_ERROR "Could not find gFTL. This should not happen.")
endif ()

if (NOT TARGET GFTL_SHARED::gftl-shared)
if (NOT TARGET GFTL_SHARED::gftl-shared-v2)
message(FATAL_ERROR "Could not find gFTL-shared. This should not happen.")
endif ()

target_link_libraries (${funit_target} PUBLIC GFTL::gftl GFTL_SHARED::gftl-shared FARGPARSE::fargparse)
target_link_libraries (${funit_target} PUBLIC GFTL::gftl-v2 GFTL_SHARED::gftl-shared-v2 GFTL_SHARED::gftl-shared-v2-as-default FARGPARSE::fargparse)
target_include_directories(${funit_target} PUBLIC
$<BUILD_INTERFACE:${PFUNIT_SOURCE_DIR}/include>
)
Expand Down
10 changes: 5 additions & 5 deletions src/funit/core/AbstractPattern.F90
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ end module PF_AbstractPattern

module PF_AbstractPatternVector
use PF_AbstractPattern
#define _type class (AbstractPattern)
#define _allocatable
#define _vector AbstractPatternVector
#define _iterator AbstractPatternVectorIterator
#define T AbstractPattern
#define T_polymorphic
#define Vector AbstractPatternVector
#define VectorIterator AbstractPatternVectorIterator

#include "templates/vector.inc"
#include "vector/template.inc"

end module PF_AbstractPatternVector
7 changes: 4 additions & 3 deletions src/funit/core/ExceptionList.F90
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ logical function catch_message(this, message, preserve) result(found)

iter = this%begin()
do while (iter /= this%end())
e => iter%get()
e => iter%of()
if (e%getMessage() == message) then
found = .true.
if (.not. preserveMessage(preserve)) call this%erase(iter)
if (.not. preserveMessage(preserve)) iter = this%erase(iter)
return
end if
call iter%next()
Expand All @@ -119,6 +119,7 @@ function catch_next(this, preserve) result(anException)
class (ExceptionList), intent(inOut) :: this
logical, optional, intent(in) :: preserve
type (Exception) :: anException
type (ExceptionVectorIterator) :: iter


if (.not. this%empty()) then
Expand All @@ -134,7 +135,7 @@ function catch_next(this, preserve) result(anException)
#endif
if (preserveMessage(preserve)) return

call this%erase(this%begin())
iter = this%erase(this%begin())
end if

end function catch_next
Expand Down
10 changes: 5 additions & 5 deletions src/funit/core/ExceptionVector.F90
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module PF_ExceptionVector
use PF_Exception

#define _type class(Exception)
#define _allocatable
#define _vector ExceptionVector
#define _iterator ExceptionVectorIterator
#include "templates/vector.inc"
#define T Exception
#define T_polymorphic
#define Vector ExceptionVector
#define VectorIterator ExceptionVectorIterator
#include "vector/template.inc"

end module PF_ExceptionVector
Loading

0 comments on commit 26dadb1

Please sign in to comment.