[PATCH v2 3/3] tests/vm/freebsd: Get up-to-date package list from lcitool vars file

Philippe Mathieu-Daudé posted 3 patches 2 years, 5 months ago
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Thomas Huth <thuth@redhat.com>, Wainer dos Santos Moschetta <wainersm@redhat.com>, Beraldo Leal <bleal@redhat.com>, Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>, Ed Maste <emaste@freebsd.org>, Li-Wen Hsu <lwhsu@freebsd.org>
There is a newer version of this series
[PATCH v2 3/3] tests/vm/freebsd: Get up-to-date package list from lcitool vars file
Posted by Philippe Mathieu-Daudé 2 years, 5 months ago
Get an up-to-date package list from lcitool, that way we
don't need to manually keep this array in sync.

Inspired-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 tests/vm/Makefile.include |  2 ++
 tests/vm/freebsd          | 42 ++-------------------------------------
 2 files changed, 4 insertions(+), 40 deletions(-)

diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
index b021b344b5..84b8ad5222 100644
--- a/tests/vm/Makefile.include
+++ b/tests/vm/Makefile.include
@@ -110,6 +110,8 @@ $(SRC_PATH)/tests/vm/%.json:
 	$(call quiet-command, \
 		make lcitool-refresh)
 
+vm-build-freebsd: $(SRC_PATH)/tests/vm/freebsd.json
+
 # Build in VM $(IMAGE)
 vm-build-%: $(IMAGES_DIR)/%.img $(VM_VENV)
 	$(call quiet-command, \
diff --git a/tests/vm/freebsd b/tests/vm/freebsd
index 11de6473f4..ac51376c82 100755
--- a/tests/vm/freebsd
+++ b/tests/vm/freebsd
@@ -31,45 +31,6 @@ class FreeBSDVM(basevm.BaseVM):
     link = "https://download.freebsd.org/releases/CI-IMAGES/13.2-RELEASE/amd64/Latest/FreeBSD-13.2-RELEASE-amd64-BASIC-CI.raw.xz"
     csum = "a4fb3b6c7b75dd4d58fb0d75e4caf72844bffe0ca00e66459c028b198ffb3c0e"
     size = "20G"
-    pkgs = [
-        # build tools
-        "git",
-        "pkgconf",
-        "bzip2",
-        "python39",
-        "ninja",
-
-        # gnu tools
-        "bash",
-        "gmake",
-        "gsed",
-        "gettext",
-
-        # libs: crypto
-        "gnutls",
-
-        # libs: images
-        "jpeg-turbo",
-        "png",
-
-        # libs: ui
-        "sdl2",
-        "gtk3",
-        "libxkbcommon",
-
-        # libs: opengl
-        "libepoxy",
-        "mesa-libs",
-
-        # libs: migration
-        "zstd",
-
-        # libs: networking
-        "libslirp",
-
-        # libs: sndio
-        "sndio",
-    ]
 
     BUILD_SCRIPT = """
         set -e;
@@ -151,8 +112,9 @@ class FreeBSDVM(basevm.BaseVM):
         self.console_wait(prompt)
         self.console_send("echo 'chmod 666 /dev/vtbd1' >> /etc/rc.local\n")
 
+        pkgs = self.get_qemu_packages_from_lcitool_json()
         self.print_step("Installing packages")
-        self.ssh_root_check("pkg install -y %s\n" % " ".join(self.pkgs))
+        self.ssh_root_check("pkg install -y %s\n" % " ".join(pkgs))
 
         # shutdown
         self.ssh_root(self.poweroff)
-- 
2.38.1


Re: [PATCH v2 3/3] tests/vm/freebsd: Get up-to-date package list from lcitool vars file
Posted by Daniel P. Berrangé 2 years, 5 months ago
On Tue, Jul 11, 2023 at 04:01:43PM +0200, Philippe Mathieu-Daudé wrote:
> Get an up-to-date package list from lcitool, that way we
> don't need to manually keep this array in sync.
> 
> Inspired-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  tests/vm/Makefile.include |  2 ++
>  tests/vm/freebsd          | 42 ++-------------------------------------
>  2 files changed, 4 insertions(+), 40 deletions(-)
> 
> diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
> index b021b344b5..84b8ad5222 100644
> --- a/tests/vm/Makefile.include
> +++ b/tests/vm/Makefile.include
> @@ -110,6 +110,8 @@ $(SRC_PATH)/tests/vm/%.json:
>  	$(call quiet-command, \
>  		make lcitool-refresh)
>  
> +vm-build-freebsd: $(SRC_PATH)/tests/vm/freebsd.json

I don't think we need this, as we just commit the result of
lcitool as needed.

> +
>  # Build in VM $(IMAGE)
>  vm-build-%: $(IMAGES_DIR)/%.img $(VM_VENV)
>  	$(call quiet-command, \
> diff --git a/tests/vm/freebsd b/tests/vm/freebsd
> index 11de6473f4..ac51376c82 100755
> --- a/tests/vm/freebsd
> +++ b/tests/vm/freebsd
> @@ -31,45 +31,6 @@ class FreeBSDVM(basevm.BaseVM):
>      link = "https://download.freebsd.org/releases/CI-IMAGES/13.2-RELEASE/amd64/Latest/FreeBSD-13.2-RELEASE-amd64-BASIC-CI.raw.xz"
>      csum = "a4fb3b6c7b75dd4d58fb0d75e4caf72844bffe0ca00e66459c028b198ffb3c0e"
>      size = "20G"
> -    pkgs = [
> -        # build tools
> -        "git",
> -        "pkgconf",
> -        "bzip2",
> -        "python39",
> -        "ninja",
> -
> -        # gnu tools
> -        "bash",
> -        "gmake",
> -        "gsed",
> -        "gettext",
> -
> -        # libs: crypto
> -        "gnutls",
> -
> -        # libs: images
> -        "jpeg-turbo",
> -        "png",
> -
> -        # libs: ui
> -        "sdl2",
> -        "gtk3",
> -        "libxkbcommon",
> -
> -        # libs: opengl
> -        "libepoxy",
> -        "mesa-libs",
> -
> -        # libs: migration
> -        "zstd",
> -
> -        # libs: networking
> -        "libslirp",
> -
> -        # libs: sndio
> -        "sndio",
> -    ]
>  
>      BUILD_SCRIPT = """
>          set -e;
> @@ -151,8 +112,9 @@ class FreeBSDVM(basevm.BaseVM):
>          self.console_wait(prompt)
>          self.console_send("echo 'chmod 666 /dev/vtbd1' >> /etc/rc.local\n")
>  
> +        pkgs = self.get_qemu_packages_from_lcitool_json()
>          self.print_step("Installing packages")
> -        self.ssh_root_check("pkg install -y %s\n" % " ".join(self.pkgs))
> +        self.ssh_root_check("pkg install -y %s\n" % " ".join(pkgs))
>  
>          # shutdown
>          self.ssh_root(self.poweroff)
> -- 
> 2.38.1
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|