[PATCH 2/4] tests/vm: move vga setup

Gerd Hoffmann posted 4 patches 5 years, 8 months ago
Maintainers: Fam Zheng <fam@euphon.net>, Kamil Rytarowski <kamil@netbsd.org>, "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@redhat.com>
[PATCH 2/4] tests/vm: move vga setup
Posted by Gerd Hoffmann 5 years, 8 months ago
Move '-device VGA' from basevm.py to the guests, so they have
the chance to opt out and run without display device.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 tests/vm/basevm.py   | 1 -
 tests/vm/fedora      | 1 +
 tests/vm/freebsd     | 1 +
 tests/vm/netbsd      | 1 +
 tests/vm/openbsd     | 1 +
 tests/vm/ubuntu.i386 | 5 ++++-
 6 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index c53fd354d955..cffe7c4600ed 100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -179,7 +179,6 @@ class BaseVM(object):
 
     def boot(self, img, extra_args=[]):
         args = self._args + [
-            "-device", "VGA",
             "-drive", "file=%s,if=none,id=drive0,cache=writeback" % img,
             "-device", "virtio-blk,drive=drive0,bootindex=0"]
         args += self._data_args + extra_args
diff --git a/tests/vm/fedora b/tests/vm/fedora
index 4843b4175e07..bd9c6cf295c1 100755
--- a/tests/vm/fedora
+++ b/tests/vm/fedora
@@ -82,6 +82,7 @@ class FedoraVM(basevm.BaseVM):
         self.boot(img_tmp, extra_args = [
             "-bios", "pc-bios/bios-256k.bin",
             "-machine", "graphics=off",
+            "-device", "VGA",
             "-cdrom", iso
         ])
         self.console_init(300)
diff --git a/tests/vm/freebsd b/tests/vm/freebsd
index 86770878b67b..58166766d915 100755
--- a/tests/vm/freebsd
+++ b/tests/vm/freebsd
@@ -92,6 +92,7 @@ class FreeBSDVM(basevm.BaseVM):
         self.boot(img_tmp, extra_args = [
             "-bios", "pc-bios/bios-256k.bin",
             "-machine", "graphics=off",
+            "-device", "VGA",
             "-cdrom", iso
         ])
         self.console_init()
diff --git a/tests/vm/netbsd b/tests/vm/netbsd
index 55590f460152..f3257bc245a3 100755
--- a/tests/vm/netbsd
+++ b/tests/vm/netbsd
@@ -86,6 +86,7 @@ class NetBSDVM(basevm.BaseVM):
         self.boot(img_tmp, extra_args = [
             "-bios", "pc-bios/bios-256k.bin",
             "-machine", "graphics=off",
+            "-device", "VGA",
             "-cdrom", iso
         ])
         self.console_init()
diff --git a/tests/vm/openbsd b/tests/vm/openbsd
index ab6abbedab57..0b705f494527 100755
--- a/tests/vm/openbsd
+++ b/tests/vm/openbsd
@@ -82,6 +82,7 @@ class OpenBSDVM(basevm.BaseVM):
         self.boot(img_tmp, extra_args = [
             "-bios", "pc-bios/bios-256k.bin",
             "-machine", "graphics=off",
+            "-device", "VGA",
             "-cdrom", iso
         ])
         self.console_init()
diff --git a/tests/vm/ubuntu.i386 b/tests/vm/ubuntu.i386
index 3266038fbde5..157077533532 100755
--- a/tests/vm/ubuntu.i386
+++ b/tests/vm/ubuntu.i386
@@ -36,7 +36,10 @@ class UbuntuX86VM(basevm.BaseVM):
         img_tmp = img + ".tmp"
         subprocess.check_call(["cp", "-f", cimg, img_tmp])
         self.exec_qemu_img("resize", img_tmp, "50G")
-        self.boot(img_tmp, extra_args = ["-cdrom", self.gen_cloud_init_iso()])
+        self.boot(img_tmp, extra_args = [
+            "-device", "VGA",
+            "-cdrom", self.gen_cloud_init_iso()
+        ])
         self.wait_ssh()
         self.ssh_root_check("touch /etc/cloud/cloud-init.disabled")
         self.ssh_root_check("apt-get update")
-- 
2.18.2


Re: [PATCH 2/4] tests/vm: move vga setup
Posted by Philippe Mathieu-Daudé 5 years, 8 months ago
On 3/10/20 9:32 AM, Gerd Hoffmann wrote:
> Move '-device VGA' from basevm.py to the guests, so they have
> the chance to opt out and run without display device.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>   tests/vm/basevm.py   | 1 -
>   tests/vm/fedora      | 1 +
>   tests/vm/freebsd     | 1 +
>   tests/vm/netbsd      | 1 +
>   tests/vm/openbsd     | 1 +
>   tests/vm/ubuntu.i386 | 5 ++++-
>   6 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
> index c53fd354d955..cffe7c4600ed 100644
> --- a/tests/vm/basevm.py
> +++ b/tests/vm/basevm.py
> @@ -179,7 +179,6 @@ class BaseVM(object):
>   
>       def boot(self, img, extra_args=[]):
>           args = self._args + [
> -            "-device", "VGA",
>               "-drive", "file=%s,if=none,id=drive0,cache=writeback" % img,
>               "-device", "virtio-blk,drive=drive0,bootindex=0"]
>           args += self._data_args + extra_args
> diff --git a/tests/vm/fedora b/tests/vm/fedora
> index 4843b4175e07..bd9c6cf295c1 100755
> --- a/tests/vm/fedora
> +++ b/tests/vm/fedora
> @@ -82,6 +82,7 @@ class FedoraVM(basevm.BaseVM):
>           self.boot(img_tmp, extra_args = [
>               "-bios", "pc-bios/bios-256k.bin",
>               "-machine", "graphics=off",
> +            "-device", "VGA",
>               "-cdrom", iso
>           ])
>           self.console_init(300)
> diff --git a/tests/vm/freebsd b/tests/vm/freebsd
> index 86770878b67b..58166766d915 100755
> --- a/tests/vm/freebsd
> +++ b/tests/vm/freebsd
> @@ -92,6 +92,7 @@ class FreeBSDVM(basevm.BaseVM):
>           self.boot(img_tmp, extra_args = [
>               "-bios", "pc-bios/bios-256k.bin",
>               "-machine", "graphics=off",
> +            "-device", "VGA",
>               "-cdrom", iso
>           ])
>           self.console_init()
> diff --git a/tests/vm/netbsd b/tests/vm/netbsd
> index 55590f460152..f3257bc245a3 100755
> --- a/tests/vm/netbsd
> +++ b/tests/vm/netbsd
> @@ -86,6 +86,7 @@ class NetBSDVM(basevm.BaseVM):
>           self.boot(img_tmp, extra_args = [
>               "-bios", "pc-bios/bios-256k.bin",
>               "-machine", "graphics=off",
> +            "-device", "VGA",
>               "-cdrom", iso
>           ])
>           self.console_init()
> diff --git a/tests/vm/openbsd b/tests/vm/openbsd
> index ab6abbedab57..0b705f494527 100755
> --- a/tests/vm/openbsd
> +++ b/tests/vm/openbsd
> @@ -82,6 +82,7 @@ class OpenBSDVM(basevm.BaseVM):
>           self.boot(img_tmp, extra_args = [
>               "-bios", "pc-bios/bios-256k.bin",
>               "-machine", "graphics=off",
> +            "-device", "VGA",
>               "-cdrom", iso
>           ])
>           self.console_init()
> diff --git a/tests/vm/ubuntu.i386 b/tests/vm/ubuntu.i386
> index 3266038fbde5..157077533532 100755
> --- a/tests/vm/ubuntu.i386
> +++ b/tests/vm/ubuntu.i386
> @@ -36,7 +36,10 @@ class UbuntuX86VM(basevm.BaseVM):
>           img_tmp = img + ".tmp"
>           subprocess.check_call(["cp", "-f", cimg, img_tmp])
>           self.exec_qemu_img("resize", img_tmp, "50G")
> -        self.boot(img_tmp, extra_args = ["-cdrom", self.gen_cloud_init_iso()])
> +        self.boot(img_tmp, extra_args = [
> +            "-device", "VGA",
> +            "-cdrom", self.gen_cloud_init_iso()
> +        ])
>           self.wait_ssh()
>           self.ssh_root_check("touch /etc/cloud/cloud-init.disabled")
>           self.ssh_root_check("apt-get update")
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>