From d2802ec874fd70b4c4dda6158f63612d6f1bffc0 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 6 Jul 2022 17:29:08 +1000 Subject: tests: Prepare distro images during asset build phase Before booting the guest images, the distro test cases need to modify the guest images, using virt-edit and guestfish, to boot in the way we need. At present this gets repeated on every test run, even though it's not really doing anything we want to test for. In addition many of the images have the same preparation steps leading to a lot of duplicated stages in the tests. A number of additional images can be prepared using common steps, even if the ones used now have small differences. Therefore move the preparation of most of the guest images to the asset build phase, where they can be done a single time for multiple test runs, using a common preparation script. We can even avoid making a copy of the disk image for booting, by using qemu's -snapshot option. A few of the distros (openSUSE and older Ubuntu) do need different steps. For now we don't chage how they are run, they could possibly be handled more like this in future. Signed-off-by: David Gibson --- test/Makefile | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'test/Makefile') diff --git a/test/Makefile b/test/Makefile index b858e0e..f11c4b5 100644 --- a/test/Makefile +++ b/test/Makefile @@ -45,15 +45,18 @@ OPENSUSE_IMGS = openSUSE-Leap-15.1-JeOS.x86_64-kvm-and-xen.qcow2 \ openSUSE-Tumbleweed-ARM-JeOS-efi.armv7l.raw.xz \ openSUSE-Tumbleweed-JeOS.x86_64-kvm-and-xen.qcow2 -UBUNTU_IMGS = trusty-server-cloudimg-amd64-disk1.img \ +UBUNTU_OLD_IMGS = trusty-server-cloudimg-amd64-disk1.img \ trusty-server-cloudimg-i386-disk1.img \ - trusty-server-cloudimg-ppc64el-disk1.img \ - xenial-server-cloudimg-powerpc-disk1.img \ + trusty-server-cloudimg-ppc64el-disk1.img +UBUNTU_NEW_IMGS = xenial-server-cloudimg-powerpc-disk1.img \ jammy-server-cloudimg-s390x.img +UBUNTU_IMGS = $(UBUNTU_OLD_IMGS) $(UBUNTU_NEW_IMGS) DOWNLOAD_ASSETS = mbuto \ $(DEBIAN_IMGS) $(FEDORA_IMGS) $(OPENSUSE_IMGS) $(UBUNTU_IMGS) -LOCAL_ASSETS = mbuto.img QEMU_EFI.fd +LOCAL_ASSETS = mbuto.img QEMU_EFI.fd \ + $(DEBIAN_IMGS:%=prepared-%) $(FEDORA_IMGS:%=prepared-%) \ + $(UBUNTU_NEW_IMGS:%=prepared-%) ASSETS = $(DOWNLOAD_ASSETS) $(LOCAL_ASSETS) @@ -68,6 +71,14 @@ mbuto.img: passt.mbuto mbuto QEMU_EFI.fd: ./find-arm64-firmware.sh $@ +prepared-%.qcow2: %.qcow2 ./prepare-distro-img.sh + qemu-img create -f qcow2 -F qcow2 -b $< $@ + ./prepare-distro-img.sh $@ + +prepared-%.img: %.img ./prepare-distro-img.sh + qemu-img create -f qcow2 -F qcow2 -b $< $@ + ./prepare-distro-img.sh $(IMGTYPE) $@ + check: assets ./run @@ -78,6 +89,7 @@ clean: rm -f perf.js *~ rm -f $(LOCAL_ASSETS) rm -rf test_logs + rm -f prepared-*.qcow2 prepared-*.img realclean: clean rm -rf $(DOWNLOAD_ASSETS) -- cgit v1.2.3