diff options
Diffstat (limited to 'tests/viewer')
| -rw-r--r-- | tests/viewer | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/viewer b/tests/viewer new file mode 100644 index 0000000..f0357f0 --- /dev/null +++ b/tests/viewer @@ -0,0 +1,44 @@ +# The URI is the whole of what viewer decides, and VIEWER=echo reports +# it without a client anywhere. The guests here are emulated. + +"$VMM" create vw1 64M >/dev/null 2>&1 + +exits 2 "viewer of an unknown VM exits 2" viewer nosuchvm +exits 3 "viewer of a stopped VM exits 3" viewer vw1 + +cfg vw1 <<EOF +MEM=256 +CPUS=1 +HWACCEL=no +EOF +if "$VMM" start vw1 >/dev/null 2>&1; then + refuses 'has no display' "GRAPHICS=no leaves nothing to view" viewer vw1 + "$VMM" kill vw1 >/dev/null 2>&1 || : +else + skip 1 "vw1 did not start" +fi + +# The URI names the socket that is really there, not what the config +# says, so a display that failed to appear is an error rather than a +# client left dialling nothing. +for g in vnc spice; do + cfg vw1 <<EOF +MEM=256 +CPUS=1 +HWACCEL=no +GRAPHICS=$g +EOF + if ! "$VMM" start vw1 >/dev/null 2>&1; then + skip 2 "this qemu cannot do GRAPHICS=$g" + continue + fi + out=$(env VIEWER=echo "$VMM" viewer vw1 2>&1) && got=0 || got=$? + if [ "$got" = 0 ] && [ "$out" = "$g+unix://$VMMDIR/vw1/$g.sock" ]; then + ok "$g is handed to the client as $g+unix" + else + notok "$g is handed to the client as $g+unix" \ + "exit $got, wanted $g+unix://$VMMDIR/vw1/$g.sock" "got: $out" + fi + "$VMM" kill vw1 >/dev/null 2>&1 || : + exits 3 "and the killed $g guest has nothing to view" viewer vw1 +done |