aboutsummaryrefslogtreecommitdiff
path: root/tests/usage
diff options
context:
space:
mode:
Diffstat (limited to 'tests/usage')
-rw-r--r--tests/usage27
1 files changed, 27 insertions, 0 deletions
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"