blob: 83c11037a11d1a525b67026889a57ee34ad8d227 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#!/usr/bin/env bash
# apply-routing unit regression. Compiles
# lib/streaming_control.f90 + lib/jt9_params_init.f90 + lib/streaming_apply.f90
# and the driver test/apply_routing_test.f90 into an ISOLATED module dir and runs
# it. Guards the APPLY side: each configure_fields member -> its CORRECT
# params_block slot, plus the order-sensitive logic (rxfreq/tx_audio_offset
# decouple, emedelay-before-per-mode-policy, nfa/nfb baseline restore, ntol
# per-mode cap/restore).
#
# WHY a Fortran unit driver: the cfg->params apply routing used to live in a
# nested INTERNAL subroutine (streaming_io.f90 apply_configure_), unreachable from
# a unit driver, AND most Phase 4/5 fields are inert on the FT8/JT9 fixtures, so a
# mis-route (e.g. his_call -> hisgrid) passed every fixture gate byte-identical.
# The mapping was extracted to the module-public
# streaming_apply::apply_configure_fields so this driver can assert it directly.
# This is the structural close of the apply-routing gap.
#
# Usage:
# test/run-apply-routing-unit.sh (no build dir; compiles from source)
# FC=gfortran-13 test/run-apply-routing-unit.sh (override the compiler)
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
FC="${FC:-gfortran}"
SRC_CTRL="$REPO_ROOT/lib/streaming_control.f90"
SRC_INIT="$REPO_ROOT/lib/jt9_params_init.f90"
SRC_APPLY="$REPO_ROOT/lib/streaming_apply.f90"
DRV="$REPO_ROOT/test/apply_routing_test.f90"
if ! command -v "$FC" >/dev/null 2>&1; then
echo "ERROR: Fortran compiler '$FC' not found (set \$FC to override)" >&2
exit 2
fi
for f in "$SRC_CTRL" "$SRC_INIT" "$SRC_APPLY" "$DRV" \
"$REPO_ROOT/lib/jt9com.f90" "$REPO_ROOT/lib/constants.f90"; do
if [[ ! -f "$f" ]]; then
echo "ERROR: missing source: $f" >&2
exit 2
fi
done
# Compile into a throwaway dir so a stray repo-root *.mod cannot shadow the fresh
# compile, and so we leave no artifacts behind.
WORK="$(mktemp -d)"
trap 'rm -rf "$WORK"' EXIT
echo "apply-routing unit regression"
echo " FC: $FC"
echo " driver: $DRV"
echo ""
# Copy the textual includes (jt9com.f90 -> constants.f90) into the work dir so the
# INCLUDE chain resolves with cwd=$WORK and lib/ never lands on the search path.
cp "$REPO_ROOT/lib/jt9com.f90" "$REPO_ROOT/lib/constants.f90" "$WORK/"
# Compile FROM the work dir as cwd: gfortran searches the current directory for
# .mod files (and INCLUDE files) first, so a stray repo-root *.mod / jt9com.f90
# would otherwise shadow the fresh compile. -J/-I alone
# do NOT remove cwd from the search order; the cd does.
cd "$WORK"
"$FC" -c "$SRC_CTRL" -J"$WORK" -I"$WORK" -o "$WORK/streaming_control.o"
"$FC" -c "$SRC_INIT" -J"$WORK" -I"$WORK" -o "$WORK/jt9_params_init.o"
"$FC" -c "$SRC_APPLY" -J"$WORK" -I"$WORK" -o "$WORK/streaming_apply.o"
"$FC" "$DRV" "$WORK/streaming_control.o" "$WORK/jt9_params_init.o" \
"$WORK/streaming_apply.o" -I"$WORK" -o "$WORK/apply_drv"
"$WORK/apply_drv"
|