From dac1936869420f035077f81a1c79ed16dc4c1fee Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 16 Dec 2010 16:58:06 +0000 Subject: [PATCH] * If $DISPLAY is set (i.e. in interactive mode), show QEMU's graphical output. svn path=/nixos/trunk/; revision=25157 --- lib/test-driver/Machine.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/test-driver/Machine.pm b/lib/test-driver/Machine.pm index b9dae819b496..abf08c7fcf24 100644 --- a/lib/test-driver/Machine.pm +++ b/lib/test-driver/Machine.pm @@ -19,6 +19,8 @@ for (my $n = 0; $n < 256; $n++) { $ENV{"QEMU_MCAST_ADDR_$n"} = "$mcastPrefix.$n.$mcastSuffix"; } +my $showGraphics = defined $ENV{'DISPLAY'}; + sub new { my ($class, $args) = @_; @@ -54,7 +56,7 @@ sub new { pid => 0, connected => 0, socket => undef, - stateDir => "$tmpDir/$name", + stateDir => "$tmpDir/vm-state-$name", monitor => undef, }; @@ -124,7 +126,9 @@ sub start { dup2(fileno($serialC), fileno(STDERR)); $ENV{TMPDIR} = $self->{stateDir}; $ENV{USE_TMPDIR} = 1; - $ENV{QEMU_OPTS} = "-nographic -no-reboot -monitor unix:./monitor -chardev socket,id=shell,path=./shell"; + $ENV{QEMU_OPTS} = + "-no-reboot -monitor unix:./monitor -chardev socket,id=shell,path=./shell " . + ($showGraphics ? "-serial stdio" : "-nographic"); $ENV{QEMU_NET_OPTS} = "guestfwd=tcp:10.0.2.6:23-chardev:shell"; $ENV{QEMU_KERNEL_PARAMS} = "hostTmpDir=$ENV{TMPDIR}"; chdir $self->{stateDir} or die;