diff --git a/qemu/tests/ui-drive.sh b/qemu/tests/ui-drive.sh index d38e1b2..f91c7f2 100755 --- a/qemu/tests/ui-drive.sh +++ b/qemu/tests/ui-drive.sh @@ -73,6 +73,21 @@ command -v qemu-system-arm >/dev/null || { mkdir -p "$OUTDIR" # Short-named scratch: AF_UNIX socket paths are capped at ~108 chars. WORK="$(mktemp -d /tmp/wqd.XXXXXX)" +# Every run gets its own image and initramfs: mkinitramfs.sh, mkimage.sh and +# run.sh all read $OUT, and with the shared default (qemu/out) two concurrent +# runs built and booted the SAME disk.img, so a seeded VM could read back +# another run's state (SDK #20). The image is sparse but is written by the +# guest, and /tmp is a tmpfs on the dev box, so this lives under $TMPDIR on +# real disk; the pinned busybox stays shared and read-only through BUSYBOX. +avail_kb="$(df --output=avail -k "${TMPDIR:-/tmp}" | tail -1 | tr -d ' ')" +if [ "${avail_kb:-0}" -lt 1048576 ]; then + echo "FATAL: ${TMPDIR:-/tmp} has under 1 GB free; point TMPDIR at real disk (see flows README)" >&2 + exit 1 +fi +mkdir -p "$QDIR/out" +RUN_OUT="$(mktemp -d "${TMPDIR:-/tmp}/wqd-out.XXXXXX")" +export OUT="$RUN_OUT" +export BUSYBOX="${BUSYBOX:-$QDIR/out/busybox-armv7l}" QEMU_PID="" cleanup() { if [ -n "$QEMU_PID" ]; then @@ -81,7 +96,7 @@ cleanup() { kill "$QEMU_PID" 2>/dev/null || true fi cp "$WORK/console.log" "$OUTDIR/console.log" 2>/dev/null || true - rm -rf "$WORK" + rm -rf "$WORK" "$RUN_OUT" } trap cleanup EXIT