Files
mars-nwe/tests/networked_ctest_gate.sh.in
2026-06-19 07:32:57 +02:00

51 lines
1.2 KiB
Bash

#!/bin/sh
# CTest gate for server-dependent mars-nwe integration smokes.
#
# Offline developer builds should still list these tests, but they should not
# fail when no mars_nwe server, NCPFS mount, credentials, or transport is
# available. CTest treats exit code 77 as skipped via SKIP_RETURN_CODE.
set -u
SKIP_CODE=77
if [ "$#" -lt 3 ]; then
echo "SKIP/WARN: malformed networked CTest gate invocation" >&2
exit "$SKIP_CODE"
fi
TEST_NAME=$1
DESCRIPTION=$2
shift 2
RUN=${MARS_NWE_RUN_NETWORKED_TESTS:-0}
case "$RUN" in
1|yes|true|on|YES|TRUE|ON) ;;
*)
echo "SKIP/WARN: $TEST_NAME requires $DESCRIPTION." >&2
echo "SKIP/WARN: set MARS_NWE_RUN_NETWORKED_TESTS=1 and the required MARS_NWE_TEST_* environment before running networked CTest labels." >&2
exit "$SKIP_CODE"
;;
esac
while [ "$#" -gt 0 ]; do
case "$1" in
--)
shift
break
;;
esac
eval "VALUE=\${$1:-}"
if [ -z "$VALUE" ]; then
echo "SKIP/WARN: $TEST_NAME needs environment variable $1." >&2
exit "$SKIP_CODE"
fi
shift
done
if [ "$#" -eq 0 ]; then
echo "SKIP/WARN: $TEST_NAME has no command after networked CTest gate." >&2
exit "$SKIP_CODE"
fi
exec "$@"