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/distro/ubuntu | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) (limited to 'test/distro/ubuntu') diff --git a/test/distro/ubuntu b/test/distro/ubuntu index 6e094d7..3a80e37 100644 --- a/test/distro/ubuntu +++ b/test/distro/ubuntu @@ -139,16 +139,7 @@ host echo test Ubuntu 16.04 LTS (Xenial Xerus), ppc64 (be) -temp IMG -host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/xenial-server-cloudimg-powerpc-disk1.img __IMG__ -host virt-edit -a __IMG__ /lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' -host guestfish --rw -a __IMG__ -i rm /etc/systemd/system/cloud-init.target.wants/cloud-config.service -host guestfish --rw -a __IMG__ -i rm /etc/systemd/system/cloud-init.target.wants/cloud-final.service -host guestfish --rw -a __IMG__ -i rm /etc/systemd/system/cloud-init.target.wants/cloud-init-local.service -host guestfish --rw -a __IMG__ -i rm /etc/systemd/system/cloud-init.target.wants/cloud-init.service -host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/ - -host ./qrap 5 qemu-system-ppc64 -m 1024 -M pseries -nographic -nodefaults -serial stdio -no-reboot -nographic -vga none -hda __IMG__ -net socket,fd=5 -net nic,model=virtio +host ./qrap 5 qemu-system-ppc64 -m 1024 -M pseries -nographic -nodefaults -serial stdio -no-reboot -nographic -vga none -hda __BASEPATH__/prepared-xenial-server-cloudimg-powerpc-disk1.img -net socket,fd=5 -net nic,model=virtio -snapshot host PS1='$ ' host dhclient -4 # Skip apt-get update here: some updates to xenial-updates around 2022-01-30 @@ -169,18 +160,8 @@ host echo test Ubuntu 22.04 (Jammy Jellyfish), s390x -temp IMG -host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/jammy-server-cloudimg-s390x.img __IMG__ -host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' -host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service -host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service -host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.service -host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-final.service -host guestfish --rw -a __IMG__ -i rm /etc/systemd/system/multi-user.target.wants/snapd.service -host guestfish --rw -a __IMG__ -i rm /etc/systemd/system/snap.lxd.activate.service -host guestfish --rw -a __IMG__ -i rm /etc/systemd/system/snap.lxd.daemon.service -host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/ -host ./qrap 5 qemu-system-s390x -m 2048 -smp 2 -serial stdio -nodefaults -nographic __IMG__ -net socket,fd=5 -net nic,model=virtio -device virtio-rng-ccw + +host ./qrap 5 qemu-system-s390x -m 2048 -smp 2 -serial stdio -nodefaults -nographic __BASEPATH__/prepared-jammy-server-cloudimg-s390x.img -net socket,fd=5 -net nic,model=virtio -device virtio-rng-ccw -snapshot host service systemd-resolved stop host export DEBIAN_FRONTEND=noninteractive -- cgit v1.2.3