Files
MeanField_SERiF/tools/validate_matrix.sh

43 lines
1.9 KiB
Bash
Executable File

#!/bin/sh
# Build and run all six sandboxes with each Linux compiler/library/linker pair.
set -eu
project_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
meson_bin=${MESON_BIN:-meson}
profile=${MFEM_MATRIX_PROFILE:-minimal}
jobs=${MFEM_JOBS:-4}
mode=${SERIF_BUILDTYPE:-debug}
# GCC/libc++ requires a recent GCC and Linux headers at /usr/include/c++/v1.
# Set SERIF_TOOLCHAINS to a space-separated subset to test selected toolchains.
for toolchain in ${SERIF_TOOLCHAINS:-gcc gcc-libcxx clang-libstdcxx clang-libcxx}; do
case "$toolchain" in
gcc) compiler=gcc; library= ;;
gcc-libcxx) compiler=gcc; library=gcc-libcxx ;;
clang-libstdcxx) compiler=clang; library=libstdcxx ;;
clang-libcxx) compiler=clang; library=libcxx ;;
*) echo "Unknown toolchain: $toolchain" >&2; exit 2 ;;
esac
for linker in ${SERIF_LINKERS:-ld lld}; do
case "$linker" in ld|lld) ;; *) echo "Unknown linker: $linker" >&2; exit 2 ;; esac
build_dir="$project_root/build/matrix/$toolchain-$linker"
set -- "$build_dir" "$project_root" \
"--native-file=$project_root/native/$compiler.ini" \
"--native-file=$project_root/native/$linker.ini" \
"--buildtype=$mode" -Dallow_preinstalled=false \
"-Dfeature_profile=$profile" -Dbuild_tests=true "-Djobs=$jobs"
if test -n "$library"; then
set -- "$@" "--native-file=$project_root/native/$library.ini"
fi
if test -n "${SERIF_SANDBOX_EXPECTED_ERRORS:-}"; then
set -- "$@" "-Dsandbox_expected_errors=$SERIF_SANDBOX_EXPECTED_ERRORS"
fi
if test -f "$build_dir/meson-private/coredata.dat"; then
set -- --reconfigure "$@"
fi
"$meson_bin" setup "$@"
"$meson_bin" compile -C "$build_dir" -j "$jobs"
"$meson_bin" test -C "$build_dir" --print-errorlogs
done
done