From 6e501d83b4a712d615fde1ca49c7e87a6926c61d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1lint=20Aradi?= Date: Wed, 13 Nov 2024 17:35:12 +0100 Subject: [PATCH] Add tests --- recipes/fortuno/build.sh | 11 ++++------- recipes/fortuno/meta.yaml | 4 ++++ recipes/fortuno/run_test.sh | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 recipes/fortuno/run_test.sh diff --git a/recipes/fortuno/build.sh b/recipes/fortuno/build.sh index 8686cc107d8b7..6b86508d287cb 100644 --- a/recipes/fortuno/build.sh +++ b/recipes/fortuno/build.sh @@ -13,10 +13,7 @@ cmake_options=( "-DFORTUNO_WITH_MPI=${MPI}" ) -mkdir -p _build -pushd _build - -FFLAGS="-fno-backtrace" cmake "${cmake_options[@]}" -GNinja .. -ninja all install - -popd +BUILD_DIR="_build" +FFLAGS="-fno-backtrace" cmake "${cmake_options[@]}" -GNinja -B ${BUILD_DIR} +cmake --build ${BUILD_DIR} +cmake --install ${BUILD_DIR} diff --git a/recipes/fortuno/meta.yaml b/recipes/fortuno/meta.yaml index 909a81b2bb80c..fb62c58041ead 100644 --- a/recipes/fortuno/meta.yaml +++ b/recipes/fortuno/meta.yaml @@ -44,6 +44,10 @@ requirements: test: requires: + - {{ compiler('fortran') }} + - {{ stdlib('c') }} + - cmake + - ninja - pkg-config commands: - pkg-config fortuno --exact-version={{ version }} diff --git a/recipes/fortuno/run_test.sh b/recipes/fortuno/run_test.sh new file mode 100644 index 0000000000000..aaae4b7478bcd --- /dev/null +++ b/recipes/fortuno/run_test.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -ex + +INTERFACES=( "serial" ) +if [ "${mpi}" != "nompi" ]; then + INTERFACES+=( "mpi" ) +fi + +cmake_options=( ${CMAKE_ARGS} ) +for interface in ${INTERFACES[@]}; do + RUNNER="" + if [[ "${interface}" == "mpi" ]]; then + RUNNER="mpirun -np 2" + fi + BUILD_DIR="_build_${interface}" + cmake "${cmake_options[@]}" -GNinja -B ${BUILD_DIR} + cmake --build ${BUILD_DIR} + ${RUNNER} ${BUILD_DIR}/app/testapp +done