First version

This commit is contained in:
andy committed 2026-10-15 20:44:05 -03:00
commit 243e92a9dd
84 files changed
+4012

No files matched your search

Executable
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
# Plugs a USB stick (32 MB, label TEAMUSB, one file) into the test VM started
# with --usb: tests/usb.sh plug|unplug
cd "$(dirname "$0")/.."
W=tests/work
case "$1" in
plug)
mkdir -p "$W/usb/content"
echo "prepared code library" > "$W/usb/content/lib.cpp"
truncate -s 32M "$W/usb/usb.img"
mkfs.ext4 -q -F -L TEAMUSB -d "$W/usb/content" "$W/usb/usb.img"
n=$(date +%s)
python3 -I tests/monitor.py "$W/monitor.sock" "drive_add 0 if=none,id=ud$n,file=$PWD/$W/usb/usb.img,format=raw"
python3 -I tests/monitor.py "$W/monitor.sock" "device_add usb-storage,bus=xhci.0,drive=ud$n,id=usbstick"
;;
unplug)
python3 -I tests/monitor.py "$W/monitor.sock" "device_del usbstick"
;;
esac