# 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