aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-07-06 17:29:08 +1000
committerStefano Brivio <sbrivio@redhat.com>2022-07-14 01:36:02 +0200
commitd2802ec874fd70b4c4dda6158f63612d6f1bffc0 (patch)
tree3eaebdcf202eeb7643ef9a5c4987e4a531af8529
parent32c5e054795e811420db84eb913e00ac3af8fc2b (diff)
downloadpasst-d2802ec874fd70b4c4dda6158f63612d6f1bffc0.tar
passt-d2802ec874fd70b4c4dda6158f63612d6f1bffc0.tar.gz
passt-d2802ec874fd70b4c4dda6158f63612d6f1bffc0.tar.bz2
passt-d2802ec874fd70b4c4dda6158f63612d6f1bffc0.tar.lz
passt-d2802ec874fd70b4c4dda6158f63612d6f1bffc0.tar.xz
passt-d2802ec874fd70b4c4dda6158f63612d6f1bffc0.tar.zst
passt-d2802ec874fd70b4c4dda6158f63612d6f1bffc0.zip
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 <david@gibson.dropbear.id.au>
-rw-r--r--test/.gitignore1
-rw-r--r--test/Makefile20
-rw-r--r--test/distro/debian125
-rw-r--r--test/distro/fedora205
-rw-r--r--test/distro/ubuntu25
-rwxr-xr-xtest/prepare-distro-img.sh18
6 files changed, 69 insertions, 325 deletions
diff --git a/test/.gitignore b/test/.gitignore
index 225ecd9..f81126e 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -4,4 +4,5 @@ mbuto/
*.img
QEMU_EFI.fd
*.qcow2
+*.raw
*.raw.xz
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)
diff --git a/test/distro/debian b/test/distro/debian
index a7a0f98..ad0ec30 100644
--- a/test/distro/debian
+++ b/test/distro/debian
@@ -12,7 +12,7 @@
# Author: Stefano Brivio <sbrivio@redhat.com>
temp PIDFILE
-htools qemu-img virt-edit guestfish head sed cat kill qemu-system-x86_64 qemu-system-aarch64 qemu-system-ppc64
+htools head sed cat kill qemu-system-x86_64 qemu-system-aarch64 qemu-system-ppc64
# Quick pasta test: send message from init to ns, and from ns to init
def distro_quick_pasta_test
@@ -39,22 +39,11 @@ endef
hostb ./passt -P __PIDFILE__ &
sleep 1
host echo
-hout GUEST_FILES ls -1 *.c *.h *.sh passt.1 qrap.1 Makefile | tr '\n' ' '; echo
test Debian GNU/Linux 8 (jessie), amd64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/debian-8.11.0-openstack-amd64.qcow2 __IMG__
-host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
-host guestfish --rw -a __IMG__ -i rm /lib/systemd/system/serial-getty@.service
-host guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-config
-host guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-final
-host guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-init
-host guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-init-local
-host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none -drive file=__IMG__,if=virtio -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none -drive file=__BASEPATH__/prepared-debian-8.11.0-openstack-amd64.qcow2,if=virtio -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host apt-get update
@@ -75,13 +64,7 @@ hout PID cat __PIDFILE__
test Debian GNU/Linux 9 (stretch, oldoldstable), amd64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/debian-9-nocloud-amd64-daily-20200210-166.qcow2 __IMG__
-host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
-host guestfish --rw -a __IMG__ -i rm /lib/systemd/system/serial-getty@.service
-host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-9-nocloud-amd64-daily-20200210-166.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host apt-get update
@@ -99,13 +82,7 @@ sleep 1
test Debian GNU/Linux 10 (buster, oldstable), amd64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/debian-10-nocloud-amd64.qcow2 __IMG__
-host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
-host guestfish --rw -a __IMG__ -i rm /lib/systemd/system/serial-getty@.service
-host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-10-nocloud-amd64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host apt-get update
@@ -123,20 +100,7 @@ sleep 1
test Debian GNU/Linux 10 (buster, oldstable), aarch64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/debian-10-generic-arm64.qcow2 __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/init.d/cloud-config
-host guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-final
-host guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-init
-host guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-init-local
-host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-10-generic-arm64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host apt-get update
@@ -154,22 +118,7 @@ sleep 1
test Debian GNU/Linux 10 (buster, oldstable), ppc64le
-temp IMG
-
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/debian-10-generic-ppc64el.qcow2 __IMG__
-host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
-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/init.d/cloud-config
-host guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-final
-host guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-init
-host guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-init-local
-host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-10-generic-ppc64el.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host apt-get update
@@ -188,13 +137,7 @@ hostb reset
test Debian GNU/Linux 11 (bullseye, stable), amd64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/debian-11-nocloud-amd64.qcow2 __IMG__
-host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
-host guestfish --rw -a __IMG__ -i rm /lib/systemd/system/serial-getty@.service
-host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-11-nocloud-amd64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
sleep 2
host apt-get update
host apt-get -y install make gcc netcat-openbsd
@@ -210,20 +153,7 @@ sleep 1
test Debian GNU/Linux 11 (bullseye, stable), aarch64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/debian-11-generic-arm64.qcow2 __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/init.d/cloud-config
-host guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-final
-host guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-init
-host guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-init-local
-host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-11-generic-arm64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
sleep 2
host apt-get update
host apt-get -y install make gcc netcat-openbsd
@@ -239,21 +169,7 @@ sleep 1
test Debian GNU/Linux 11 (bullseye, stable), ppc64le
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/debian-11-generic-ppc64el.qcow2 __IMG__
-host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
-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/init.d/cloud-config
-host guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-final
-host guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-init
-host guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-init-local
-host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-11-generic-ppc64el.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
sleep 2
host apt-get update
host apt-get -y install make gcc netcat-openbsd
@@ -270,13 +186,7 @@ hostb reset
test Debian GNU/Linux sid (experimental), amd64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/debian-sid-nocloud-amd64-daily.qcow2 __IMG__
-host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
-host guestfish --rw -a __IMG__ -i rm /lib/systemd/system/serial-getty@.service
-host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-sid-nocloud-amd64-daily.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
sleep 2
host apt-get update
host apt-get -y install make gcc netcat-openbsd
@@ -292,12 +202,7 @@ sleep 1
test Debian GNU/Linux sid (experimental), aarch64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/debian-sid-nocloud-arm64-daily.qcow2 __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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-sid-nocloud-arm64-daily.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
sleep 2
host apt-get update
host apt-get -y install make gcc netcat-openbsd
@@ -313,13 +218,7 @@ sleep 1
test Debian GNU/Linux sid (experimental), ppc64le
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/debian-sid-nocloud-ppc64el-daily.qcow2 __IMG__
-host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
-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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-sid-nocloud-ppc64el-daily.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
sleep 2
host apt-get update
host apt-get -y install make gcc netcat-openbsd
diff --git a/test/distro/fedora b/test/distro/fedora
index 783d0ea..f225a8e 100644
--- a/test/distro/fedora
+++ b/test/distro/fedora
@@ -12,7 +12,7 @@
# Author: Stefano Brivio <sbrivio@redhat.com>
temp PIDFILE
-htools qemu-img virt-edit guestfish head sed cat kill qemu-system-x86_64
+htools head sed cat kill qemu-system-x86_64
# Quick pasta test: send message from init to ns, and from ns to init
def distro_quick_pasta_test
@@ -60,22 +60,10 @@ hostb ./passt -P __PIDFILE__ &
sleep 1
host echo
hout DNS6 sed -n 's/^nameserver \([^:]*:\)\([^%]*\).*/\1\2/p' /etc/resolv.conf | head -1
-hout GUEST_FILES ls -1 *.c *.h *.sh passt.1 qrap.1 Makefile | tr '\n' ' '; echo
-
test Fedora 26, x86_64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/Fedora-Cloud-Base-26-1.5.x86_64.qcow2 __IMG__
-host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
-host guestfish --rw -a __IMG__ -i rm /lib/systemd/system/serial-getty@.service
-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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-26-1.5.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc nmap-ncat
@@ -95,17 +83,7 @@ hout PID cat __PIDFILE__
test Fedora 27, x86_64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/Fedora-Cloud-Base-27-1.6.x86_64.qcow2 __IMG__
-host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
-host guestfish --rw -a __IMG__ -i rm /lib/systemd/system/serial-getty@.service
-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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-27-1.6.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc nmap-ncat
@@ -122,17 +100,7 @@ sleep 1
test Fedora 28, x86_64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/Fedora-Cloud-Base-28-1.1.x86_64.qcow2 __IMG__
-host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
-host guestfish --rw -a __IMG__ -i rm /lib/systemd/system/serial-getty@.service
-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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-28-1.1.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc nmap-ncat
@@ -149,16 +117,7 @@ sleep 1
test Fedora 28, aarch64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/Fedora-Cloud-Base-28-1.1.aarch64.qcow2 __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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __IMG__ -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci
+host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-28-1.1.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc nmap-ncat
@@ -178,16 +137,7 @@ host echo
test Fedora 29, x86_64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/Fedora-Cloud-Base-29-1.2.x86_64.qcow2 __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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-29-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc nmap-ncat
@@ -204,16 +154,7 @@ sleep 1
test Fedora 29, aarch64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/Fedora-Cloud-Base-29-1.2.aarch64.qcow2 __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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __IMG__ -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci
+host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-29-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc nmap-ncat
@@ -233,16 +174,7 @@ host echo
test Fedora 30, x86_64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/Fedora-Cloud-Base-30-1.2.x86_64.qcow2 __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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-30-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc nmap-ncat
@@ -259,16 +191,7 @@ sleep 1
test Fedora 30, aarch64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/Fedora-Cloud-Base-30-1.2.aarch64.qcow2 __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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __IMG__ -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci
+host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-30-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc nmap-ncat
@@ -288,16 +211,7 @@ host echo
test Fedora 31, x86_64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/Fedora-Cloud-Base-31-1.9.x86_64.qcow2 __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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-31-1.9.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc nmap-ncat
@@ -314,16 +228,7 @@ sleep 1
test Fedora 31, aarch64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/Fedora-Cloud-Base-31-1.9.aarch64.qcow2 __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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __IMG__ -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci
+host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-31-1.9.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc nmap-ncat
@@ -343,16 +248,7 @@ host echo
test Fedora 32, x86_64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/Fedora-Cloud-Base-32-1.6.x86_64.qcow2 __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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-32-1.6.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc nmap-ncat
@@ -369,16 +265,7 @@ sleep 1
test Fedora 32, aarch64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/Fedora-Cloud-Base-32-1.6.aarch64.qcow2 __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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __IMG__ -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci
+host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-32-1.6.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc nmap-ncat
@@ -398,16 +285,7 @@ host echo
test Fedora 33, x86_64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/Fedora-Cloud-Base-33-1.2.x86_64.qcow2 __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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-33-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc nmap-ncat
@@ -424,16 +302,7 @@ sleep 1
test Fedora 33, aarch64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/Fedora-Cloud-Base-33-1.2.aarch64.qcow2 __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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __IMG__ -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci
+host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-33-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc nmap-ncat
@@ -453,16 +322,7 @@ host echo
test Fedora 34, x86_64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/Fedora-Cloud-Base-34-1.2.x86_64.qcow2 __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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-34-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc nmap-ncat
@@ -479,16 +339,7 @@ sleep 1
test Fedora 34, aarch64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/Fedora-Cloud-Base-34-1.2.aarch64.qcow2 __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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __IMG__ -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci
+host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-34-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc nmap-ncat
@@ -508,16 +359,7 @@ host echo
test Fedora 35, x86_64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/Fedora-Cloud-Base-35-1.2.x86_64.qcow2 __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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
+host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-35-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc nmap-ncat
@@ -534,16 +376,7 @@ sleep 1
test Fedora 35, aarch64
-temp IMG
-host qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/Fedora-Cloud-Base-35-1.2.aarch64.qcow2 __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 copy-in __GUEST_FILES__ /root/
-
-host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __IMG__ -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci
+host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-35-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc nmap-ncat
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
diff --git a/test/prepare-distro-img.sh b/test/prepare-distro-img.sh
new file mode 100755
index 0000000..aeb97a0
--- /dev/null
+++ b/test/prepare-distro-img.sh
@@ -0,0 +1,18 @@
+#! /bin/sh -e
+
+IMG="$1"
+PASST_FILES="$(echo ../*.c ../*.h ../*.sh ../*.1 ../Makefile)"
+
+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'
+
+guestfish --rw -a $IMG -i <<EOF
+rm-f /usr/lib/systemd/system/cloud-config.service
+rm-f /usr/lib/systemd/system/cloud-init.service
+rm-f /usr/lib/systemd/system/cloud-init-local.service
+rm-f /usr/lib/systemd/system/cloud-final.service
+rm-f /etc/init.d/cloud-config
+rm-f /etc/init.d/cloud-final
+rm-f /etc/init.d/cloud-init
+rm-f /etc/init.d/cloud-init-local
+copy-in $PASST_FILES /root/
+EOF