Skip to content

Commit

Permalink
Adapt to interface chane in Fortuno
Browse files Browse the repository at this point in the history
Note: currently uses a personal fork, not the official Fortuno repo.
  • Loading branch information
aradi committed Sep 22, 2024
1 parent 2387be0 commit c0dbee5
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 17 deletions.
34 changes: 23 additions & 11 deletions templates/testapp-serial.f90
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
program testapp
module test_{{cookiecutter.project_slug}}
use {{cookiecutter.project_slug}}, only : factorial
use fortuno_serial, only : execute_serial_cmd_app, is_equal, test => serial_case_item,&
& check => serial_check
use fortuno_serial, only : is_equal, test => serial_case_item, check => serial_check, test_list
implicit none

call execute_serial_cmd_app(&
testitems=[&
test("factorial_0", test_factorial_0),&
test("factorial_1", test_factorial_1),&
test("factorial_2", test_factorial_2)&
]&
)

contains

function tests()
type(test_list) :: tests

tests = test_list([&
test("factorial_0", test_factorial_0),&
test("factorial_1", test_factorial_1),&
test("factorial_2", test_factorial_2)&
])

end function tests

! Test: 0! = 1
subroutine test_factorial_0()
call check(factorial(0) == 1)
Expand All @@ -30,4 +32,14 @@ subroutine test_factorial_2()
call check(is_equal(factorial(2), 2))
end subroutine test_factorial_2

end module test_{{cookiecutter.project_slug}}


program testapp
use test_{{cookiecutter.project_slug}}, only : tests
use fortuno_serial, only : execute_serial_cmd_app
implicit none

call execute_serial_cmd_app(tests())

end program testapp
8 changes: 7 additions & 1 deletion test/runners/test.cmake-serial.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
set -e -v -x

SCRIPT_DIR="$(readlink -f $(dirname ${BASH_SOURCE[0]}))"
DISTRO_ID=$(python3 -c "import platform; print(platform.freedesktop_os_release()['ID'])")
if [[ "${DISTRO_ID}" =~ ^(ubuntu|debian)$ ]]; then
LIB_DIR="lib"
else
LIB_DIR="lib64"
fi

source ${SCRIPT_DIR}/init.sh

Expand Down Expand Up @@ -29,7 +35,7 @@ CMAKE_PREFIX_PATH=$PWD/_install\
cmake --build _build_export_cmake
./_build_export_cmake/app/export_test

PKG_CONFIG_PATH=$PWD/_install/lib/pkgconfig\
PKG_CONFIG_PATH=$PWD/_install/${LIB_DIR}/pkgconfig\
cmake\
-B _build_export_pkgconf\
-GNinja\
Expand Down
3 changes: 2 additions & 1 deletion {{ cookiecutter.project_slug }}/fpm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ mpi = "*"

[dev-dependencies]
{% if cookiecutter.__serial_code == "True" -%}
fortuno = { git = "https://github.com/fortuno-repos/fortuno.git" }
# fortuno = { git = "https://github.com/fortuno-repos/fortuno.git" }
fortuno = { git = "https://github.com/aradi/fortuno.git", branch = "testlist" }
{%- elif cookiecutter.__mpi_code == "True" -%}
fortuno-mpi = { git = "https://github.com/fortuno-repos/fortuno-mpi.git" }
{%- elif cookiecutter.__coarray_code == "True" -%}
Expand Down
6 changes: 4 additions & 2 deletions {{ cookiecutter.project_slug }}/subprojects/Fortuno.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ option(
# Make subproject available
FetchContent_Declare(
Fortuno
GIT_REPOSITORY "https://github.com/fortuno-repos/fortuno.git"
GIT_TAG "main"
# GIT_REPOSITORY "https://github.com/fortuno-repos/fortuno.git"
# GIT_TAG "main"
GIT_REPOSITORY "https://github.com/aradi/fortuno.git"
GIT_TAG "testlist"
FIND_PACKAGE_ARGS
)
FetchContent_MakeAvailable(Fortuno)
Expand Down
6 changes: 4 additions & 2 deletions {{ cookiecutter.project_slug }}/subprojects/fortuno.wrap
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[wrap-git]
directory=fortuno
url=https://github.com/fortuno-repos/fortuno
revision=main
# url=https://github.com/fortuno-repos/fortuno
# revision=main
url=https://github.com/aradi/fortuno
revision=testlist

0 comments on commit c0dbee5

Please sign in to comment.