From c235cb62beefd03087e7cfc7f7f55f0c7c6601c9 Mon Sep 17 00:00:00 2001 From: Lena Date: Sat, 1 Aug 2026 00:00:00 +0000 Subject: Enter vmm A QEMU/KVM virtual machine manager in one POSIX shell script. Each VM is a directory of plain files under $VMMDIR, configured by a hand-edited KEY=VALUE file that is parsed rather than sourced, so nothing in it can inject a raw QEMU argument. Control is a QMP FIFO pair inside that directory, guarded by its permissions alone; nothing binds a TCP port. The tests are TAP without a framework and boot real guests where the host allows. --- tests/usage | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/usage (limited to 'tests/usage') diff --git a/tests/usage b/tests/usage new file mode 100644 index 0000000..25ec6e4 --- /dev/null +++ b/tests/usage @@ -0,0 +1,27 @@ +# Dispatch and name validation, before anything touches the filesystem. + +exits 1 "bare vmm prints usage" +exits 1 "unknown command prints usage" nosuchcommand +exits 2 "unknown VM exits 2" status nosuchvm + +# Every verb refuses a wrong argument count. The guards are one line +# each, and an inverted one is invisible until someone types the wrong +# thing: these run before any VM is named, so no VM has to exist. +for v in edit start stop restart kill status console viewer logs dryrun; do + exits 1 "$v refuses two names" "$v" a b +done +exits 1 "list refuses an argument" list a +exits 1 "clone refuses one name" clone a +exits 1 "create refuses three arguments" create a 10G x +exits 1 "monitor refuses no name at all" monitor + +exits 1 "rejects a traversing name" kill ../outside +exits 1 "rejects an empty name" start '' +exits 1 "rejects a leading dash" start -rf +exits 1 "rejects a leading dot" start .hidden +exits 1 "rejects a name with a slash" start a/b +exits 1 "rejects a 33 character name" create aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + +mkdir -p "$WORK/outside" +"$VMM" create ../outside/pwned >/dev/null 2>&1 || : +holds "traversal creates nothing outside VMMDIR" test ! -e "$WORK/outside/pwned" -- cgit v1.2.3