59 lines
2 KiB
Bash
Executable file
59 lines
2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# verify-atarist-serial.sh - both-directions RS-232 gate for the Atari ST port.
|
|
#
|
|
# Runs SERTEST.PRG (examples/sertest: banner, then echo) under Hatari and
|
|
# EmuTOS with the Modem port on a pseudo-terminal whose other end is the host
|
|
# peer (scripts/lib/serialLoopPeer.py): it waits for the banner, sends a
|
|
# probe and expects it echoed. That exercises the chain: m68k-atari-mint-gcc
|
|
# -> the BIOS Aux channel -> JoeyLib serial HAL -> the MFP's USART -> host.
|
|
#
|
|
# Usage: scripts/verify-atarist-serial.sh
|
|
# Requires: hatari, EmuTOS (install.sh install emulator:atarist);
|
|
# build/atarist/bin/SERTEST.PRG (make atarist).
|
|
set -uo pipefail
|
|
|
|
repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
|
source "$repo/scripts/lib/joeyEnv.sh"
|
|
joeyNeed HATARI hatari
|
|
joeyNeed EMUTOS_IMG emutos
|
|
|
|
prg="$repo/build/atarist/bin/SERTEST.PRG"
|
|
wall=60
|
|
[ -f "$prg" ] || { echo "verify-atarist-serial: build SERTEST.PRG first (make atarist)" >&2; exit 2; }
|
|
|
|
work=$(mktemp -d -t joeylib-atarist-serial.XXXXXX)
|
|
cleanup() {
|
|
joeyStop "${hatariPid:-}"
|
|
joeyStop "${peerPid:-}"
|
|
rm -rf "$work"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
mkdir -p "$work/c"
|
|
cp "$prg" "$work/c/SERTEST.PRG"
|
|
|
|
python3 "$repo/scripts/lib/serialLoopPeer.py" pty "$work/pty" "$wall" > "$work/peer.log" 2>&1 &
|
|
peerPid=$!
|
|
for _ in $(seq 1 50); do
|
|
[ -f "$work/pty" ] && break
|
|
sleep 0.1
|
|
done
|
|
[ -f "$work/pty" ] || { echo "verify-atarist-serial: the peer made no pty" >&2; exit 1; }
|
|
pty=$(cat "$work/pty")
|
|
|
|
SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy "$HATARI" --tos "$EMUTOS_IMG" \
|
|
--harddrive "$work/c" --gemdos-drive C --drive-a off --drive-b off \
|
|
--sound off --fast-forward on --rs232-in "$pty" --rs232-out "$pty" \
|
|
--auto 'C:\SERTEST.PRG' > "$work/hatari.log" 2>&1 &
|
|
hatariPid=$!
|
|
|
|
wait "$peerPid"
|
|
rc=$?
|
|
peerPid=""
|
|
cat "$work/peer.log"
|
|
if [ "$rc" -eq 0 ]; then
|
|
echo "verify-atarist-serial: PASS (banner out, probe echoed through the Modem port)"
|
|
else
|
|
echo "verify-atarist-serial: FAIL" >&2
|
|
fi
|
|
exit "$rc"
|