Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions install/test/run-nfsmount.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,18 @@ PEERNAME="${PEERHOST#*@}"
PEERADDR=$(getent ahostsv4 "$PEERNAME" 2>/dev/null | awk 'NR==1{print $1}')
[ -n "$PEERADDR" ] || PEERADDR="$PEERNAME"

# ONE BRIDGED GUEST PER HOST, claimed before this run wipes and restages its
# drive: a second run of the same tag would otherwise delete the drive of the
# guest running under the lock. Held until this script exits; the codes and
# the why are at rig_claim_bridge in tools/emu-rig-lock.sh.
# THIS TAG'S DRIVE, THEN ONE BRIDGED GUEST PER HOST, both claimed before this
# run wipes and restages its drive: a second run of the same tag would
# otherwise delete the drive of the guest that is running. Drive before
# bridge, always. Held until this script exits; the codes and the why are at
# rig_claim_drive and rig_claim_bridge in tools/emu-rig-lock.sh.
OUT="$ROOT/build/nfsmount-$TAG"
HD="$ROOT/build/nfshd-$TAG"
# shellcheck source=../../tools/emu-rig-lock.sh
. "$ROOT/tools/emu-rig-lock.sh"
rig_claim_drive "$HD" "run-nfsmount $TAG in $ROOT" "$BACKEND" || exit $?
rig_claim_bridge "$BACKEND" "run-nfsmount $TAG in $ROOT" || exit $?

OUT="$ROOT/build/nfsmount-$TAG"
HD="$ROOT/build/nfshd-$TAG"
rm -rf "$OUT"; mkdir -p "$OUT"

echo "==> $MODEL, OS 3.1, $(basename "$KICKSTART")"
Expand Down
10 changes: 6 additions & 4 deletions install/test/run-smbmount.sh
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,14 @@ else
echo "==> share $URL (host $SMBHOST), client smb2-handler.$CPUSFX (SMB2/3)"
fi

# ONE BRIDGED GUEST PER HOST, claimed before this run wipes and restages its
# drive: a second run of the same tag would otherwise delete the drive of the
# guest running under the lock. Held until this script exits; the codes and
# the why are at rig_claim_bridge in tools/emu-rig-lock.sh.
# THIS TAG'S DRIVE, THEN ONE BRIDGED GUEST PER HOST, both claimed before this
# run wipes and restages its drive: a second run of the same tag would
# otherwise delete the drive of the guest that is running. Drive before
# bridge, always. Held until this script exits; the codes and the why are at
# rig_claim_drive and rig_claim_bridge in tools/emu-rig-lock.sh.
# shellcheck source=../../tools/emu-rig-lock.sh
. "$ROOT/tools/emu-rig-lock.sh"
rig_claim_drive "$HD" "run-smbmount $TAG in $ROOT" "$BACKEND" || exit $?
rig_claim_bridge "$BACKEND" "run-smbmount $TAG in $ROOT" || exit $?

# --------------------------------------------------------------- the SYS: --
Expand Down
103 changes: 91 additions & 12 deletions install/test/run-workbench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ if [ "$EXPERT_CUSTOM" = "1" ] && [ "$LEVEL" != "EXPERT" ]; then
echo "-E needs -l EXPERT: unit and interface name are Expert-only pages" >&2
exit 2
fi
if [ "$NO_BOOT" = "1" ] && [ "$DRAWER" = "1" ]; then
echo "-B and -D conflict: the drawer arm installs twice and marks the" >&2
echo "S:Network-Startup that a boot-disabled install does not write." >&2
exit 2
fi
if [ "$NO_BOOT" = "1" ] && [ "$TERMINAL" = "1" ]; then
echo "-B and -H conflict: httpd-at-boot is not asked when boot networking" >&2
echo "is disabled." >&2
Expand Down Expand Up @@ -410,15 +415,20 @@ fi
# file this installer writes names is the driver that came with the card, so
# that is what this run boots. The device check below is about the file
# landing; everything after the power cycle is about the vendor driver working.
# AMINETXDUO_SANA2_VENDOR is set here for the same reason and can still be
# unset by a caller that wants the other one.
AMINETXDUO_SANA2_VENDOR="${AMINETXDUO_SANA2_VENDOR:-1}"
# AMINETXDUO_SANA2_VENDOR defaults to 1 for the same reason. Unset means 1;
# a caller that wants anxnet.device sets it EMPTY (AMINETXDUO_SANA2_VENDOR=),
# which is kept empty, and sana2_select then picks anxnet.device for every
# board tools/sana2-stage.sh maps onto it.
AMINETXDUO_SANA2_VENDOR="${AMINETXDUO_SANA2_VENDOR-1}"
export AMINETXDUO_SANA2_VENDOR

# The A2065 keeps its own variable and its own search: it is Commodore's, it
# comes out of the OS sources rather than the asset store, and every existing
# caller of this script sets AMINETXDUO_A2065 and nothing else.
if [ "$BOARD" = a2065 ] && [ -z "${AMINETXDUO_SANA2_DRIVER:-}" ]; then
# caller of this script sets AMINETXDUO_A2065 and nothing else. Vendor runs
# only: on an anxnet run this path would win over SANA2_SEL_PATH below and
# stage Commodore's bytes for a run that selected anxnet.device.
if [ "$BOARD" = a2065 ] && [ -n "${AMINETXDUO_SANA2_VENDOR:-}" ] &&
[ -z "${AMINETXDUO_SANA2_DRIVER:-}" ]; then
A2065="${AMINETXDUO_A2065:-}"
if [ -z "$A2065" ]; then
for candidate in \
Expand Down Expand Up @@ -447,6 +457,19 @@ DRIVER_PATH="${AMINETXDUO_SANA2_DRIVER:-$SANA2_SEL_PATH}"
# at a time, after saying it had found the file two lines earlier.
AMINETXDUO_SANA2_DRIVER="$DRIVER_PATH"
export AMINETXDUO_SANA2_DRIVER

# anxnet.device needs its NAME handed back too, before _sana2_names, which
# otherwise names the staged file after the board (ariadne2 -> ariadne_ii.device)
# and stages our bytes under the vendor's name. Mirrors tools/classicwb.sh.
# Never on a vendor run: that would stage vendor bytes as anxnet.device.
if [ "$SANA2_SEL_SOURCE" = anxnet ]; then
AMINETXDUO_SANA2_DRIVER_NAME=anxnet.device
AMINETXDUO_SANA2_DIR=Networks
AMINETXDUO_SANA2_DEVICE=DEVS:Networks/anxnet.device
AMINETXDUO_SANA2_CARD="$SANA2_SEL_CARD"
export AMINETXDUO_SANA2_DRIVER_NAME AMINETXDUO_SANA2_DIR \
AMINETXDUO_SANA2_DEVICE AMINETXDUO_SANA2_CARD
fi
_sana2_names "$BOARD"

# A MISSING DRIVER IS AN INGREDIENT, NOT A FAILURE, except in the manual-card
Expand Down Expand Up @@ -579,6 +602,13 @@ slirp|slirp_inbound|none)
;;
esac

# THIS TAG'S DRIVE, as soon as the backend is known and before anything below can wipe or
# restage it: a second run of the tag would otherwise delete the live guest's
# DH0: and Work: and then wait for the bridge. One claim covers both
# directories (they are named by the same tag), and it is held until the
# script exits. Drive before bridge, always: tools/emu-rig-lock.sh.
rig_claim_drive "$HD" "run-workbench $TAG in $ROOT" "$BACKEND" || exit $?

# ONE MAC PER TAG, derived, not pinned. A fixed address here put every run of
# this harness on the bridge under 52:54:00:c0:ff:ee, beside the demo instance
# and beside other checkouts' guests: two machines at two addresses sharing one
Expand Down Expand Up @@ -1181,21 +1211,38 @@ startup_count() {
# anxnet.device there first and prove the installer replaces it and keeps
# the old one beside it as anxnet.device.old.
#
# An anxnet run (any card, the A2065 included) has already staged the real
# anxnet.device at that name, and the stale text would overwrite the driver
# under test. That file is left alone and is itself the existing driver:
# the backup assertions still hold, and only "the live file is no longer the
# old one" cannot, because its bytes are the archive's by construction.
#
# Written before the archive is unpacked, so nothing here can be confused with
# something the unpack left lying about.
DEVS_NETWORKS_BEFORE=absent
STALE_DEVICE=""
STALE_SUM=""
STALE_IS_STAGED=0
if [ -d "$HD/Devs/Networks" ]; then
DEVS_NETWORKS_BEFORE=present
STALE_DEVICE="$HD/Devs/Networks/anxnet.device"
printf 'not a driver: a stale anxnet.device left by an earlier install, %s\n' \
"$TAG" > "$STALE_DEVICE"
chmod 644 "$STALE_DEVICE"
if [ -n "$STAGED_AT" ] && [ "$STAGED_AT" = "$STALE_DEVICE" ] &&
[ -f "$STAGED_AT" ]; then
STALE_IS_STAGED=1
else
printf 'not a driver: a stale anxnet.device left by an earlier install, %s\n' \
"$TAG" > "$STALE_DEVICE"
chmod 644 "$STALE_DEVICE"
fi
STALE_SUM=$(shasum "$STALE_DEVICE" | cut -d' ' -f1)
fi
echo "==> DEVS:Networks before the install: $DEVS_NETWORKS_BEFORE" \
"${STALE_DEVICE:+(a stale anxnet.device staged in it)}"
if [ "$STALE_IS_STAGED" = 1 ]; then
echo "==> DEVS:Networks before the install: $DEVS_NETWORKS_BEFORE" \
"(the staged anxnet.device under test, no stale fixture)"
else
echo "==> DEVS:Networks before the install: $DEVS_NETWORKS_BEFORE" \
"${STALE_DEVICE:+(a stale anxnet.device staged in it)}"
fi

FOREIGN_STACK_BEFORE=""
if [ "$DRAWER" = "1" ]; then
Expand Down Expand Up @@ -1228,6 +1275,30 @@ SUPPLIED_DRIVERS="anxnet.device anxgenet.device anxwifipi.device"
cp "$INSTALLER" "$UNPACK/AmiNetXDuo/Installer"
chmod -R a+rx "$UNPACK"

# THE STAGED BYTES ARE THE ARCHIVE'S anxnet.device. Keyed on what sana2_select
# chose, not on AMINETXDUO_SANA2_DRIVER: that is the file that was copied, so
# comparing against it compares the staged file with itself. Fails closed: an
# anxnet run with nothing to compare against is not an anxnet run.
STAGED_SHA256=""
if [ "$SANA2_SEL_SOURCE" = anxnet ] && [ "$MANUAL_CARD" = 0 ] &&
[ "$NO_CARD" = 0 ]; then
_anx_ref="$UNPACK/AmiNetXDuo/Devs/Networks/anxnet.device"
[ -n "$STAGED_AT" ] && [ -f "$STAGED_AT" ] || {
echo "!! anxnet.device selected and nothing staged at ${STAGED_AT:-none}" >&2
exit 1; }
[ -f "$_anx_ref" ] || {
echo "!! anxnet.device selected and $ARCHIVE carries none to check" >&2
exit 1; }
STAGED_SHA256=$(shasum -a 256 "$STAGED_AT" | cut -d' ' -f1)
_anx_ref_sum=$(shasum -a 256 "$_anx_ref" | cut -d' ' -f1)
echo "staged_driver_sha256=$STAGED_SHA256 archive_anxnet_sha256=$_anx_ref_sum"
[ "$STAGED_SHA256" = "$_anx_ref_sum" ] || {
echo "!! the staged $SANA2_DRIVER is not the archive's anxnet.device" >&2
echo " staged $STAGED_AT" >&2
echo " source ${AMINETXDUO_SANA2_DRIVER:-none}" >&2
exit 1; }
fi

# A previous AmiNetXDuo install leaves both Pi drivers on every machine. They
# are payload, not proof of Pi hardware. Seed precisely that state while the
# explicit no-card fixture is active: Novice must still refuse without writing
Expand Down Expand Up @@ -1820,9 +1891,16 @@ fi
# Installer spinning on its "select at least one" page. Ordinary scenarios
# keep their old driver-file fallback, and the explicit no-card fixture still
# boots with no board.
#
# An anxnet run is the same case: the staged file is anxnet.device, which is
# not in the Installer's driver-file fallback, so with no board present the
# card page comes up with nothing ticked and installdrive's Proceed loops on
# "Select at least one network device."
INSTALL_CARD=""
if [ "$MANUAL_CARD" = 1 ]; then
INSTALL_CARD=net
elif [ "$SANA2_SEL_SOURCE" = anxnet ] && [ "$NO_CARD" = 0 ]; then
INSTALL_CARD=net
fi
boot install "$INSTALL_TIMEOUT" "$INSTALL_CARD"
INSTALL_STATUS=$BOOT_STATUS
Expand Down Expand Up @@ -2441,7 +2519,7 @@ else
# The upgrade half: a stale driver was there, and it must be gone from the
# live name and kept under .old. Its bytes are unique to this run, so
# "gone" is checked rather than assumed.
if [ -n "$ANXNET_INSTALLED" ] &&
if [ "$STALE_IS_STAGED" = 0 ] && [ -n "$ANXNET_INSTALLED" ] &&
[ "$(shasum "$ANXNET_INSTALLED" | cut -d' ' -f1)" = "$STALE_SUM" ]; then
echo "!! DEVS:Networks/anxnet.device is still the STALE file this"
echo " harness staged before the install. A reinstall that leaves"
Expand Down Expand Up @@ -2705,7 +2783,8 @@ elif [ -n "$EXPECTED_AUTO_DEVICE" ]; then
esac
else
case "$INSTALLER_DEVICE" in
"$SANA2_DRIVER"|"DEVS:Networks/$SANA2_DRIVER") CARD_SELECTED=yes ;;
"$SANA2_DRIVER"|"DEVS:Networks/$SANA2_DRIVER"|"AmiNetXDuo:Devs/Networks/$SANA2_DRIVER")
CARD_SELECTED=yes ;;
esac
fi

Expand Down
10 changes: 9 additions & 1 deletion tests/tools/console-instance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@ if [ "$(curl -s -m 4 -o /dev/null -w '%{http_code}' "http://$ADDRESS:$PORT/" ||
exit 2
fi

# The drive, before anything below assembles, wipes or restages it. Wait 0:
# a standing guest is up for hours (tools/emu-rig-lock.sh has the codes).
rig_claim_drive "$HD" "console-instance in $RUN" "$BACKEND" 0 || {
rc=$?
say RESULT INFRA
exit "$rc"
}

HTTPD="$BUILD/src/tools/httpd"
BSD="$BUILD/src/bsdsocket/bsdsocket.library"
for f in "$HTTPD" "$BSD"; do
Expand Down Expand Up @@ -279,7 +287,7 @@ EOF
( trap '' PIPE; exec "$AMIBERRY" -f "$CFG" ) >>"$EMULOG" 2>&1 &
printf '%s\n' "$!" > "$PIDFILE"
# The emulator holds the standing lock now; the reader below may not.
rig_drop_standing
rig_drop_standing; rig_drop_drive

# The reader, retried: /wait holds the emulator until this connects, and the
# emulator has to have opened the listener first. Appends, so a restart of the
Expand Down
10 changes: 8 additions & 2 deletions tests/tools/run-console.sh
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,14 @@ fi
# shellcheck source=tools/emu-rig-lock.sh
. "$ROOT/tools/emu-rig-lock.sh"

# The drive first, on every backend, then the bridge (tools/emu-rig-lock.sh):
# stage() below wipes $HD, which is one directory for every run in this tree.
HD="$ROOT/build/console-dh0"
rig_claim_drive "$HD" "console ($BACKEND) in $ROOT" "$BACKEND" || {
rc=$?
say RESULT INFRA
exit "$rc"
}
rig_claim_bridge "$BACKEND" "console ($BACKEND) in $ROOT" || {
rc=$?
say RESULT INFRA
Expand Down Expand Up @@ -449,8 +457,6 @@ with open(sys.argv[1], "wb") as fh:
EOF
}

HD="$ROOT/build/console-dh0"

stage() {
local depth="$1" mode_id="${2:-}"

Expand Down
9 changes: 7 additions & 2 deletions tests/tools/run-wbgrab.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ if [ -z "$AMIBERRY" ]; then
fi
[ -n "$AMIBERRY" ] || { say error "amiberry not found; set AMIBERRY=<path>"; exit 2; }

# The drive, before anything below assembles, wipes or restages it: one
# directory for every run in this tree. No network, so no bridge.
HD="$ROOT/build/wbgrab-dh0"
# shellcheck source=tools/emu-rig-lock.sh
. "$ROOT/tools/emu-rig-lock.sh"
rig_claim_drive "$HD" "wbgrab in $ROOT" none || exit $?

# ------------------------------------------------------ Workbench 3.1 SYS: --

# shellcheck source=tests/tools/wb31-sys.sh
Expand All @@ -99,8 +106,6 @@ WB="$WB31_SYS"

# ------------------------------------------------------------ the drive ----

HD="$ROOT/build/wbgrab-dh0"

stage() {
rm -rf "$HD"
mkdir -p "$HD"
Expand Down
27 changes: 19 additions & 8 deletions tools/amiberry-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
# cannot take anything away, and it covers every artefact a guest writes rather
# than the one that was noticed.
#
# EXCEPT THAT ON A BRIDGED RUN THE BRIDGE LOCK COMES FIRST. A second run of
# the same tag in the same checkout would otherwise delete the drive of the
# guest that is running under the lock and then wait for it. So -B is read
# here, in a quiet first pass, and a host-NIC run claims the bridge before the
# wipe. A run refused there exits 6 or 2 with the drive untouched, which is
# right: it is the holder's drive, and a nonzero exit is never a result.
# EXCEPT THAT THE DRIVE LOCK COMES FIRST, ON EVERY BACKEND, THEN THE BRIDGE.
# A second run of the same tag in the same checkout would otherwise delete the
# drive of the guest that is running and then wait for it. So -B is read
# here, in a quiet first pass, and the drive (then, on a host NIC, the bridge)
# is claimed before the wipe. A run refused there exits 6 or 2 with the drive
# untouched, which is right: it is the holder's drive, and a nonzero exit is
# never a result.
#
# ONE BRIDGED GUEST ON THIS HOST, taken here so that no harness can boot one
# without it. The emulator inherits the descriptor and holds it until it
Expand Down Expand Up @@ -92,7 +93,14 @@ if [ -n "$STANDING" ] && rig_backend_bridged "$_pre_backend"; then
rig_standing_exempt "$STANDING ${AMINETXDUO_RUN_TAG:-amiberry} in $ROOT" \
"$AMINETXDUO_AMIBERRY_MAC" "$_pre_backend" || exit $?
export AMINETXDUO_AMIBERRY_MAC
else
fi
# The drive, on every backend, and BEFORE the bridge (tools/emu-rig-lock.sh,
# rig_claim_drive): two SLIRP runs of one tag in this checkout are one drive.
# The standing check above never waits, so it may come first.
rig_claim_drive "$ROOT/build/amiberry-testhd-${AMINETXDUO_RUN_TAG:-amiberry}" \
"${AMINETXDUO_RUN_TAG:-amiberry} ($_pre_backend) in $ROOT" "$_pre_backend" ||
exit $?
if [ -z "$STANDING" ] || ! rig_backend_bridged "$_pre_backend"; then
rig_claim_bridge "$_pre_backend" \
"${AMINETXDUO_RUN_TAG:-amiberry} ($_pre_backend) in $ROOT" || exit $?
fi
Expand Down Expand Up @@ -661,6 +669,7 @@ cleanup() {
rig_release_port
rig_drop_bridge
rig_drop_standing
rig_drop_drive
return 0
}
trap cleanup EXIT INT TERM HUP
Expand Down Expand Up @@ -700,7 +709,8 @@ fi
LOGPIPE="$ROOT/build/amiberry-$TAG.logpipe"
rm -f "$LOGPIPE"
if [ -x "$ROOT/tools/logcap.sh" ] && mkfifo "$LOGPIPE" 2>/dev/null; then
( rig_drop_bridge; rig_drop_standing; exec "$ROOT/tools/logcap.sh" ) \
( rig_drop_bridge; rig_drop_standing; rig_drop_drive
exec "$ROOT/tools/logcap.sh" ) \
< "$LOGPIPE" > "$UAELOG" &
LOGCAP_PID=$!
else
Expand Down Expand Up @@ -754,6 +764,7 @@ fi
[ -z "${RIG_PORT_FD:-}" ] || eval "exec ${RIG_PORT_FD}>&-" 2>/dev/null || true
rig_drop_bridge
rig_drop_standing
rig_drop_drive
reader=""
trap '[ -z "$reader" ] || kill -TERM "$reader" 2>/dev/null; exit 0' TERM INT
for _ in $(seq 1 60); do
Expand Down
Loading
Loading