diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f34f47..a730d94 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,9 @@ jobs: if: ${{ contains(matrix.compiler, 'intel') }} uses: rscohn2/setup-oneapi@v0 with: - components: ifx + # Note: intel 2024.1 and 2024.2 fail to build Fortuno properly due to a compiler bug, + # see https://community.intel.com/t5/Intel-Fortran-Compiler/Compiler-bug-Procedure-pointer-association-status-gets-lost/m-p/1612121#M172850 + components: ifx@2024.0.0 - name: Setup Intel environment if: ${{ contains(matrix.compiler, 'intel') }} diff --git a/include/fortuno_serial.fypp b/include/fortuno_serial.fypp index f1b672c..17fdc03 100644 --- a/include/fortuno_serial.fypp +++ b/include/fortuno_serial.fypp @@ -46,7 +46,10 @@ #! constructor: Name of the constructor to use (default: "test") #! #:def TEST_ITEMS(label="", suffix="", constructor="serial_case_item ") - #:set items = _fortuno_registered_tests[label] + #:set items = _fortuno_registered_tests.get(label) + #:if items is None + #:stop "Undefined label ('{}') used in TEST_ITEMS()".format(label) + #:endif $:_fortuno_constructed_tests.update(set([(label, item['name']) for item in items])) #:set calls = [f"{constructor}('{item['name']}', {item['proc']})" for item in items] #:set lines = " " + ",&\n ".join(calls) + suffix + "&\n" diff --git a/test/export/app/testapp.f90 b/test/export/app/testapp.f90 index fd5dc74..206abb0 100644 --- a/test/export/app/testapp.f90 +++ b/test/export/app/testapp.f90 @@ -2,22 +2,40 @@ ! Licensed under the BSD-2-Clause Plus Patent license. ! SPDX-License-Identifier: BSD-2-Clause-Patent -!> Test app driving Fortuno unit tests -program testapp - use fortuno_serial, only : execute_serial_cmd_app, is_equal, test => serial_case_item,& - check => serial_check +!> Unit tests +module testapp_tests + use fortuno_serial, only : is_equal, test => serial_case_item, check => serial_check, test_item implicit none - call execute_serial_cmd_app(& - testitems=[& - test("success", test_success)& - ]& - ) + private + public :: test_items contains + subroutine test_success() call check(is_equal(1, 1)) end subroutine test_success + + function test_items() result(testitems) + type(test_item), allocatable :: testitems(:) + + testitems = [& + test("success", test_success)& + ] + + end function test_items + +end module testapp_tests + + +!> Test app driving Fortuno unit tests +program testapp + use testapp_tests, only : test_items + use fortuno_serial, only : execute_serial_cmd_app + implicit none + + call execute_serial_cmd_app(testitems=test_items()) + end program testapp diff --git a/test/export/app/testapp_fypp.fypp b/test/export/app/testapp_fypp.fypp index 894e944..ec8b42d 100644 --- a/test/export/app/testapp_fypp.fypp +++ b/test/export/app/testapp_fypp.fypp @@ -4,21 +4,17 @@ #:include "fortuno_serial.fypp" -!> Test app driving Fortuno unit tests -program testapp_fypp - use fortuno_serial, only : execute_serial_cmd_app, is_equal, test_item +!> Unit tests +module testapp_fypp_tests + use fortuno_serial, only : is_equal, test_item $:FORTUNO_SERIAL_IMPORTS() implicit none - call execute_serial_cmd_app(& - testitems=[& - test_items()& - ]& - ) + private + public :: test_items contains - $:TEST("success") @:CHECK(is_equal(1, 1)) $:END_TEST() @@ -33,4 +29,15 @@ contains end function test_items +end module testapp_fypp_tests + + +!> Test app driving Fortuno unit tests +program testapp_fypp + use testapp_fypp_tests, only : test_items + use fortuno_serial, only : execute_serial_cmd_app + implicit none + + call execute_serial_cmd_app(testitems=test_items()) + end program testapp_fypp