Skip to content

Commit

Permalink
Merge pull request #421 from Goddard-Fortran-Ecosystem/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
tclune authored Apr 17, 2023
2 parents 545e0ae + 5ab7078 commit 74e6f4a
Show file tree
Hide file tree
Showing 23 changed files with 230 additions and 158 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/changelog-enforcer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Enforce Changelog"
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]

jobs:
# Enforces the update of a changelog file on every pull request
changelog:
runs-on: ubuntu-latest
steps:
- uses: dangoslen/changelog-enforcer@v3
with:
changeLogPath: 'ChangeLog.md'
skipLabels: 'skip changelog'
missingUpdateErrorMessage: >
No update to ChangeLog.md found! Please add a changelog
entry to it describing your change. Please note that the
keepachangelog (https://keepachangelog.com) format is
used. If your change is very trivial not applicable for a
changelog entry, add a 'skip changelog' label to the pull
request to skip the changelog enforcer.
46 changes: 12 additions & 34 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ jobs:
if: matrix.os == 'ubuntu-22.04' && matrix.compiler == 'gfortran-12'
run: |
sudo apt-get install gfortran-12 -y
# There is a bug between pFUnit and CMake 3.25.0 which is in ubuntu-latest.
# For now, we grab CMake 3.24.3
- name: Get specific version CMake, v3.24.3
uses: lukka/[email protected]
- name: Compiler Versions
run: |
${FC} --version
Expand Down Expand Up @@ -91,22 +87,14 @@ jobs:
${FC} --version
mpirun --version
mpifort --show
- name: Build pFUnit
run: |
mkdir -p build
cd build
cmake ..
make
#make -j$(nproc)
- name: Configure pFUnit
run: cmake -Bbuild
- name: Build pfUnit
run: cmake --build build --parallel
- name: Build Tests
run: |
cd build
make build-tests
#make -j$(nproc) build-tests
run: cmake --build build --parallel -t build-tests
- name: Run Tests
run: |
cd build
ctest -j1 --output-on-failure --repeat until-pass:4
run: ctest --test-dir build --parallel 1 --output-on-failure --repeat until-pass:4 --schedule-random
- name: Archive log files on failure
uses: actions/upload-artifact@v3
if: failure()
Expand All @@ -127,10 +115,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
# There is a bug between pFUnit and CMake 3.25.0 which is in ubuntu-latest.
# For now, we grab CMake 3.24.3
- name: Get specific version CMake, v3.24.3
uses: lukka/[email protected]
- name: Install Intel compilers
run: |
cd /tmp
Expand All @@ -148,20 +132,14 @@ jobs:
${CC} --version
mpirun --version
cmake --version
- name: Build pFUnit
run: |
mkdir -p build
cd build
cmake ..
make -j$(nproc)
- name: Configure pFUnit
run: cmake -Bbuild
- name: Build pfUnit
run: cmake --build build --parallel
- name: Build Tests
run: |
cd build
make -j$(nproc) build-tests
run: cmake --build build --parallel -t build-tests
- name: Run Tests
run: |
cd build
ctest -j1 --output-on-failure --repeat until-pass:4
run: ctest --test-dir build --parallel 1 --output-on-failure --repeat until-pass:4 --schedule-random
- name: Archive log files on failure
uses: actions/upload-artifact@v3
if: failure()
Expand Down
4 changes: 2 additions & 2 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.6.3
VERSION 4.7.0
LANGUAGES Fortran C)

cmake_policy(SET CMP0077 NEW)
Expand Down Expand Up @@ -108,7 +108,7 @@ if (NOT SKIP_OPENMP)
message (STATUS "OpenMP not found - skipping openmp support.")
endif()
# Kludge to workaround cmake+NAG+openmp linkage problem
if (CMAKE_Fortran_COMPILER_ID MATCHES NAG)
if (CMAKE_Fortran_COMPILER_ID STREQUAL "NAG")
set_property(TARGET OpenMP::OpenMP_Fortran PROPERTY
INTERFACE_LINK_LIBRARIES "")
set_property(TARGET OpenMP::OpenMP_Fortran PROPERTY INTERFACE_LINK_OPTIONS "-openmp")
Expand Down
19 changes: 19 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [4.7.0] - 2023-04-17

### Changed

- Update fArgParse submodule to v1.5.0

### Added

- Added IntelLLVM.cmake to support ifx
- Added interface for `@asertEquals` for arrays of strings. Previously only string scalars could be compared.
- Added check in pFUnit preprocessor that raises an exception if the module name and filename do not agree unless `@suite` is used to override default assumptions.
- Added option to set labels to ctests
- Added changelog enforcer GitHub Action

### Fixed

- `--verbose option` is now passed through by ctest runner
- Converted GitHub CI to use cmake abstract build commands

## [4.6.3] - 2023-02-07

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions bin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ add_subdirectory(tests)

install(PROGRAMS funitproc DESTINATION ${dest}/bin)

add_test(unit_test_processor
${Python_EXECUTABLE} -m unittest discover
add_test(NAME unit_test_processor
COMMAND ${Python_EXECUTABLE} -m unittest discover
--start-directory=${CMAKE_CURRENT_SOURCE_DIR})
15 changes: 8 additions & 7 deletions bin/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/outputs)
file(GLOB test_cases
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/inputs
${CMAKE_CURRENT_SOURCE_DIR}/inputs/*.pf)
foreach( case ${test_cases})
foreach(case IN LISTS test_cases)
get_filename_component(name ${case} NAME_WE)

set(input_file "${CMAKE_CURRENT_SOURCE_DIR}/inputs/${name}.pf")
Expand All @@ -12,11 +12,12 @@ foreach( case ${test_cases})

get_filename_component(executable_file
"${CMAKE_CURRENT_SOURCE_DIR}/../funitproc" REALPATH)
add_test(processor_test_${name} ${CMAKE_COMMAND}
-D Python_EXECUTABLE=${Python_EXECUTABLE}
-D executable_file=${executable_file}
-D input_file=${input_file}
-D output_file=${output_file}
-D expected_file=${expected_file}
add_test(NAME processor_test_${name}
COMMAND ${CMAKE_COMMAND}
-DPython_EXECUTABLE=${Python_EXECUTABLE}
-Dexecutable_file=${executable_file}
-Dinput_file=${input_file}
-Doutput_file=${output_file}
-Dexpected_file=${expected_file}
-P ${CMAKE_CURRENT_SOURCE_DIR}/run-test.cmake)
endforeach()
4 changes: 2 additions & 2 deletions cmake/CheckFortranSource.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function (CHECK_FORTRAN_SOURCE_RUN file var)
set(${var} ${${var}} CACHE STRING "" FORCE)

endif()
add_definitions(-D${var}=${${var}})
add_compile_definitions(${var}=${${var}})
endfunction (CHECK_FORTRAN_SOURCE_RUN)


Expand All @@ -50,5 +50,5 @@ function (CHECK_FORTRAN_SOURCE_COMPILE file var)

set(${var} ${${var}} CACHE STRING "" FORCE)
endif()
add_definitions(-D${var})
add_compile_definitions(${var})
endfunction (CHECK_FORTRAN_SOURCE_COMPILE)
2 changes: 1 addition & 1 deletion cmake/GNU.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ endif ()
set(CMAKE_Fortran_FLAGS_DEBUG "-g ${common_flags} ${traceback}")
set(CMAKE_Fortran_FLAGS_RELEASE "${common_flags}")

add_definitions(-D_GNU)
add_compile_definitions(_GNU)
6 changes: 3 additions & 3 deletions cmake/Intel.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ else()
set(no_optimize "-O0")
set(check_all "-check all")
endif()


set(disable_warning_for_long_names "-diag-disable 5462")
set(traceback "-traceback")
Expand All @@ -18,5 +18,5 @@ set(common_flags "${cpp} ${disable_warning_for_long_names}")
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g ${common_flags} ${traceback} ${no_optimize} ${check_all}")
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 ${common_flags}")

add_definitions(-D_INTEL)
add_definitions(-D__ifort_18)
add_compile_definitions(_INTEL)
add_compile_definitions(__ifort_18)
22 changes: 22 additions & 0 deletions cmake/IntelLLVM.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Compiler specific flags for Intel Fortran compiler

if(WIN32)
set(no_optimize "-Od")
set(check_all "-check:all")
else()
set(no_optimize "-O0")
set(check_all "-check all")
endif()


set(disable_warning_for_long_names "-diag-disable 5462")
set(traceback "-traceback")
set(cpp "-cpp")


set(common_flags "${cpp} ${disable_warning_for_long_names}")
set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g ${common_flags} ${traceback} ${no_optimize} ${check_all}")
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 ${common_flags}")

add_definitions(-D_INTEL)
add_definitions(-D__ifort_18)
2 changes: 1 addition & 1 deletion cmake/NAG.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ set(common_flags "${cpp} -w=x95")
set(CMAKE_Fortran_FLAGS_DEBUG "${common_flags} -O0 ${check_all} ${traceback}")
set(CMAKE_Fortran_FLAGS_RELEASE ${common_flags})

add_definitions(-D_NAG)
add_compile_definitions(_NAG)
3 changes: 1 addition & 2 deletions cmake/XL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ set(CMAKE_Fortran_FLAGS_DEBUG "-O0")
set(CMAKE_Fortran_FLAGS_RELEASE "-O3")
set(CMAKE_Fortran_FLAGS "-g ${cpp} ${check_all}")

add_definitions(-DIBM)

add_compile_definitions(IBM)
2 changes: 1 addition & 1 deletion extern/fArgParse
13 changes: 10 additions & 3 deletions include/add_pfunit_ctest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# EXTRA_USE ...
# EXTRA_INITIALIZE ...
# EXTRA_FINALIZE ...
# LABELS ...
# MAX_PES 5
# WORKING_DIRECTORY working_directory
# )
Expand Down Expand Up @@ -45,7 +46,7 @@ include (add_pfunit_sources)

function (add_pfunit_ctest test_package_name)
set (oneValueArgs REGISTRY MAX_PES EXTRA_USE EXTRA_INITIALIZE EXTRA_FINALIZE WORKING_DIRECTORY)
set (multiValueArgs TEST_SOURCES OTHER_SOURCES LINK_LIBRARIES)
set (multiValueArgs TEST_SOURCES OTHER_SOURCES LINK_LIBRARIES LABELS)
cmake_parse_arguments (PF_TEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

set (test_sources_f90)
Expand Down Expand Up @@ -144,18 +145,24 @@ function (add_pfunit_ctest test_package_name)
endif()
add_test (NAME ${test_package_name}
WORKING_DIRECTORY ${workdir}
COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${PF_TEST_MAX_PES} ${CMAKE_CURRENT_BINARY_DIR}/${test_package_name}
COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG} ${PF_TEST_MAX_PES} ${CMAKE_CURRENT_BINARY_DIR}/${test_package_name} --verbose
)
else()
target_link_libraries (${test_package_name} ${PFUNIT_SERIAL_LIBRARIES})
add_test (NAME ${test_package_name}
WORKING_DIRECTORY ${workdir}
COMMAND ${test_package_name}
COMMAND ${test_package_name} --verbose
)
endif()

set_property (TEST ${test_package_name}
PROPERTY FAIL_REGULAR_EXPRESSION "Encountered 1 or more failures/errors during testing"
)

if (PF_TEST_LABELS)
set_property (TEST ${test_package_name}
PROPERTY LABELS ${PF_TEST_LABELS}
)
endif()

endfunction()
14 changes: 6 additions & 8 deletions include/add_pfunit_sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
function( ADD_PFUNIT_SOURCES out_var )

set( out_files )
foreach( file ${ARGN} )
foreach( file IN LISTS ARGN )

get_filename_component (basename "${file}" NAME_WE)
get_filename_component( abs_file "${file}" ABSOLUTE )

# replace the extension with .F90 to determine the output file name

if (IS_ABSOLUTE ${file}) # it is in build tree, and out_file is sibling

get_filename_component (file_dir "${file}" DIRECTORY BASE_DIR ${CMAKE_CURRENT_BINARY_DIR})
Expand All @@ -56,19 +56,17 @@ function( ADD_PFUNIT_SOURCES out_var )

# append the output file to the list of outputs
list( APPEND out_files "${out_file}" )

# now add the custom command to generate the output file
add_custom_command( OUTPUT "${out_file}"
COMMAND ${PFUNIT_PARSER} "${abs_file}" "${out_file}"
DEPENDS "${abs_file}"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)

endforeach ( )

# set the output list in the calling scope
set( ${out_var} ${${out_var}} ${out_files} PARENT_SCOPE )

endfunction( ADD_PFUNIT_SOURCES )


2 changes: 1 addition & 1 deletion src/funit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ if (BUILD_SHARED_LIBS)
list(APPEND funit_targets funit_shared)
endif()

foreach(funit_target ${funit_targets})
foreach(funit_target IN LISTS funit_targets)
set_funit_target_properties(${funit_target})
funit_target_link_pfunit(${funit_target})

Expand Down
Loading

0 comments on commit 74e6f4a

Please sign in to comment.