diff options
| author | Lena <lena@omega> | 2026-08-01 00:00:00 +0000 |
|---|---|---|
| committer | Lena <lena@omega> | 2026-08-01 00:00:00 +0000 |
| commit | c235cb62beefd03087e7cfc7f7f55f0c7c6601c9 (patch) | |
| tree | 2776f86d9226d55c78e3d735764fcd9ecbe5e08e /tests/env | |
| download | vmm-master.tar.gz | |
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.
Diffstat (limited to 'tests/env')
| -rw-r--r-- | tests/env | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/env b/tests/env new file mode 100644 index 0000000..aa0ea9b --- /dev/null +++ b/tests/env @@ -0,0 +1,32 @@ +# Environment variables reach qemu and the timeout loops, so they are +# checked once for every verb rather than inside the one that uses them. + +"$VMM" create ev1 64M >/dev/null 2>&1 + +# A differently spelled VMMDIR must name the same VMs, or a live guest +# goes invisible and the next verb deletes its disk. +a=$("$VMM" list -q | sort | tr '\n' ' ') +b=$(VMMDIR="$VMMDIR/" "$VMM" list -q | sort | tr '\n' ' ') +if [ "$a" = "$b" ]; then + ok "a trailing slash on VMMDIR names the same VMs" +else + notok "a trailing slash on VMMDIR names the same VMs" "[$a] vs [$b]" +fi + +out=$(VMMDIR=relative/path "$VMM" list 2>&1) && got=0 || got=$? +if [ "$got" != 0 ] && printf '%s' "$out" | grep -q 'absolute path'; then + ok "a relative VMMDIR is refused" +else + notok "a relative VMMDIR is refused" "exit $got: $out" +fi + +for v in SHUTDOWN_TIMEOUT MONITOR_TIMEOUT; do + for bad in abc 0 00 99999999999999999999; do + out=$(env "$v=$bad" "$VMM" list 2>&1) && got=0 || got=$? + if [ "$got" = 1 ] && printf '%s' "$out" | grep -q "$v must be"; then + ok "$v refuses $bad" + else + notok "$v refuses $bad" "exit $got: $out" + fi + done +done |