forked from arti/vt1200
Isolated-netns test setup (a private tap-mess-0-0 so a second MAME can run without holding the owner's tap), the one-file/one-index TFTP servers, the trace/probe run wrappers, and the two server logs quoted in FONT_STORAGE_REPORT.md.
48 lines
1.8 KiB
Bash
Executable File
48 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Serve ONE chosen file for every TFTP name inside the isolated netns and boot
|
|
# the terminal, capturing the wire. Usage:
|
|
# run_custom.sh <file> [seconds]
|
|
set -euo pipefail
|
|
NS=vt1test
|
|
ROOT=/home/arti/code/k-space/vt1200
|
|
WORK=$ROOT/harness/mame/fontwork
|
|
FILE="$1"
|
|
SECS="${2:-30}"
|
|
TAG="$(basename "$FILE")"
|
|
|
|
sudo -n ip netns exec "$NS" pkill -f 'custom_serve.py' 2>/dev/null || true
|
|
sudo -n ip netns exec "$NS" pkill -f 'harness/serve.py' 2>/dev/null || true
|
|
sudo -n ip netns exec "$NS" pkill -x vt1200 2>/dev/null || true
|
|
sleep 0.3
|
|
|
|
# fresh NVR copy per test (the OS rewrites settings during boot)
|
|
rm -rf "$WORK/nvram-$TAG"
|
|
mkdir -p "$WORK/nvram-$TAG/vt1200"
|
|
cp "$WORK/nvram_pristine.bin" "$WORK/nvram-$TAG/vt1200/nvram"
|
|
|
|
sudo -n ip netns exec "$NS" python3 -u "$WORK/custom_serve.py" "$FILE" 192.168.99.1 \
|
|
>"$WORK/custom_serve.log" 2>&1 &
|
|
SRV=$!
|
|
sleep 1.2
|
|
|
|
sudo -n ip netns exec "$NS" timeout $((SECS+6)) tcpdump -i tap-mess-0-0 -n -s0 \
|
|
'udp port 69' -w "$WORK/custom_$TAG.pcap" 2>/dev/null &
|
|
sleep 0.3
|
|
|
|
timeout $((SECS+8)) sudo -n ip netns exec "$NS" env -u DISPLAY \
|
|
SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy \
|
|
XDG_RUNTIME_DIR="$WORK" VT1200_SKIP_LEVEL1=1 \
|
|
/home/arti/code/k-space/mame0289/vt1200 vt1200 \
|
|
-rompath "$ROOT/harness/mame/roms" -video none -sound none -nothrottle \
|
|
-skip_gameinfo -cfg_directory "$ROOT/harness/mame/cfg-net" \
|
|
-nvram_directory "$WORK/nvram-$TAG" -networkprovider taptun \
|
|
-seconds_to_run "$SECS" >"$WORK/mame_$TAG.log" 2>&1 || true
|
|
|
|
sudo -n ip netns exec "$NS" pkill -f 'custom_serve.py' 2>/dev/null || true
|
|
wait $SRV 2>/dev/null || true
|
|
sleep 2; sudo -n pkill -x tcpdump 2>/dev/null || true
|
|
echo "=== $TAG server log ==="
|
|
cat "$WORK/custom_serve.log"
|
|
echo "=== $TAG pcap ==="
|
|
sudo -n tcpdump -r "$WORK/custom_$TAG.pcap" -n 2>/dev/null | tail -25
|