Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aradi committed Nov 13, 2024
1 parent 11e0e35 commit 93a7968
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 9 deletions.
11 changes: 4 additions & 7 deletions recipes/fortuno/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
14 changes: 12 additions & 2 deletions recipes/fortuno/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ package:
version: {{ version }}

source:
url: https://github.com/fortuno-repos/fortuno/archive/refs/heads/main.zip
url: https://github.com/aradi/fortuno/archive/refs/heads/testing-fixes.zip
sha256: a2002f054c385d2344369faa4a35b044eaf0572e81bc55dc53aa6d369c978358
# url: https://github.com/fortuno-repos/fortuno/archive/refs/heads/main.zip
# sha256: 2ad45984038b5ca663e0d7baa1c77811d3662c573795d342c94aaf24e5bedeae
# url: https://github.com/fortuno-repos/fortuno/releases/download/{{ version }}/fortuno-{{ version }}.tar.gz
sha256: 2ad45984038b5ca663e0d7baa1c77811d3662c573795d342c94aaf24e5bedeae

build:
number: {{ build }}
Expand Down Expand Up @@ -43,7 +45,15 @@ requirements:
- {{ mpi }} # [mpi != "nompi"]

test:
source_files:
- test/export/**
requires:
- {{ compiler('fortran') }}
- {{ stdlib('c') }}
- cmake
- meson
- ninja
- fypp
- pkg-config
commands:
- pkg-config fortuno --exact-version={{ version }}
Expand Down
33 changes: 33 additions & 0 deletions recipes/fortuno/run_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -ex

INTERFACES=( "serial" )
if [ "${mpi}" != "nompi" ]; then
INTERFACES+=( "mpi" )
fi

cmake_options=( ${CMAKE_ARGS} )
meson_options=( ${MESON_ARGS} )
meson_fflags="-ffree-line-length-none"
)
for interface in ${INTERFACES[@]}; do
RUN_PREFIX=""
if [[ "${interface}" == "mpi" ]]; then
RUN_PREFIX="mpirun -np 2"
fi
# Invoking installed library via CMake
BUILD_DIR="_build_cmake_${interface}"
cmake "${cmake_options[@]}" -GNinja -B ${BUILD_DIR} -S test/export/${interface}
cmake --build ${BUILD_DIR}
${RUN_PREFIX} ${BUILD_DIR}/app/testapp
${RUN_PREFIX} ${BUILD_DIR}/app/testapp_fpp
${RUN_PREFIX} ${BUILD_DIR}/app/testapp_fypp

# Invoking installed library via Meson
BUILD_DIR="_build_meson_${interface}"
FFLAGS="${meson_fflags}"\
meson setup "${meson_options[@]}" --wrap-mode nofallback ${BUILD_DIR} test/export/${interface}
ninja -j1 -v -C ${BUILD_DIR}
${RUN_PREFIX} ${BUILD_DIR}/testapp
${RUN_PREFIX} ${BUILD_DIR}/testapp_fpp
done

0 comments on commit 93a7968

Please sign in to comment.