aboutsummaryrefslogtreecommitdiff
path: root/tests/usage
blob: 25ec6e4358bed5b42cd99c32dbf5b6c4241c6b62 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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"