public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH 00/15] Test fixes, batch 4
@ 2022-07-06  7:28 David Gibson
  2022-07-06  7:28 ` [PATCH 01/15] test: Add external mbuto profile, drop udhcpc, and switch to it David Gibson
                   ` (16 more replies)
  0 siblings, 17 replies; 24+ messages in thread
From: David Gibson @ 2022-07-06  7:28 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 2958 bytes --]

This set supersedes the previous "batch 3" which had some problems.
This fixes a number of problems I've encountered trying to run the
passt tests on a Fedora host.  It also makes a number of small
cleanups and improvements to the test running framework.

David Gibson (14):
  Handle the case of a DNS server on localhost
  tests: qemu-system-ppc64le isn't a thing
  Invoke specific qemu-system-* binaries
  tests: Introduce makefile for building test assets
  tests: Move mbuto download and execution to asset build
  tests: Search multiple places for aarch64 EDK2 bios image
  Clean up passt.pid file
  tests: Remove unused set_mode() function
  tests: Remove not-very-useful "req" directive
  tests: Don't automatically traverse directories of test files
  tests: Explicitly list test files in test/run, remove "onlyfor"
    support
  tests: Move distro image download to asset build makefile
  tests: Prepare distro images during asset build phase
  tests: Remove unused DNS6 calculation from fedora tests

Stefano Brivio (1):
  test: Add external mbuto profile, drop udhcpc, and switch to it

 .gitignore                  |   1 +
 Makefile                    |   3 +-
 conf.c                      |  16 +++
 passt.1                     |   6 +-
 test/.gitignore             |   6 ++
 test/Makefile               | 177 +++++++++++++++++++++++++++++++
 test/build/all              |  22 +++-
 test/build/install          |  34 ------
 test/demo/passt             |   5 +-
 test/demo/pasta             |   1 -
 test/demo/podman            |   2 -
 test/dhcp/passt             |   1 -
 test/dhcp/pasta             |   1 -
 test/distro/debian          | 124 +++-------------------
 test/distro/fedora          | 206 ++++--------------------------------
 test/distro/opensuse        |  24 ++---
 test/distro/ubuntu          |  39 ++-----
 test/find-arm64-firmware.sh |  13 +++
 test/icmp/passt_in_ns       |   1 -
 test/lib/setup              |  50 ++++-----
 test/lib/test               |  35 ++----
 test/lib/util               |  13 ---
 test/ndp/passt              |   1 -
 test/ndp/pasta              |   1 -
 test/passt.mbuto            |  34 ++++++
 test/perf/passt_tcp         |   1 -
 test/perf/passt_udp         |   1 -
 test/perf/pasta_tcp         |   1 -
 test/perf/pasta_udp         |   1 -
 test/prepare-distro-img.sh  |  18 ++++
 test/run                    |  58 +++++-----
 test/tcp/passt              |   1 -
 test/tcp/passt_in_ns        |   1 -
 test/tcp/pasta              |   1 -
 test/udp/passt              |   1 -
 test/udp/passt_in_ns        |   1 -
 test/udp/pasta              |   1 -
 test/valgrind/passt         |   1 -
 test/valgrind/passt_in_ns   |   1 -
 39 files changed, 405 insertions(+), 499 deletions(-)
 create mode 100644 test/Makefile
 delete mode 100644 test/build/install
 create mode 100755 test/find-arm64-firmware.sh
 create mode 100755 test/passt.mbuto
 create mode 100755 test/prepare-distro-img.sh

-- 
2.36.1


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 01/15] test: Add external mbuto profile, drop udhcpc, and switch to it
  2022-07-06  7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
@ 2022-07-06  7:28 ` David Gibson
  2022-07-06  7:28 ` [PATCH 02/15] Handle the case of a DNS server on localhost David Gibson
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 24+ messages in thread
From: David Gibson @ 2022-07-06  7:28 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 2614 bytes --]

From: Stefano Brivio <sbrivio(a)redhat.com>

This depends on a future change in mbuto to accept external profile
files. Add a file defining what we need for tests and demos, dropping
udhcpc, plus udhcpc and dhclient scripts as they're not needed
anymore, and switch to it.

Suggested-by: David Gibson <david(a)gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>
Message-Id: <20220623124635.2408173-1-sbrivio(a)redhat.com>
---
 test/demo/passt  |  2 +-
 test/lib/setup   |  2 +-
 test/passt.mbuto | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 2 deletions(-)
 create mode 100755 test/passt.mbuto

diff --git a/test/demo/passt b/test/demo/passt
index ee4e7c2..7c69e94 100644
--- a/test/demo/passt
+++ b/test/demo/passt
@@ -56,7 +56,7 @@ say	Let's create a small initramfs image for the guest.
 guest	cd __TEMPDIR__
 guest	git clone git://mbuto.sh/mbuto
 guest	cd mbuto
-guest	./mbuto -f passt.img -p passt -c lz4
+guest	./mbuto -f passt.img -p __TEMPDIR__/passt/test/passt.mbuto -c lz4
 sleep	2
 
 nl
diff --git a/test/lib/setup b/test/lib/setup
index e57d97c..afa5101 100755
--- a/test/lib/setup
+++ b/test/lib/setup
@@ -34,7 +34,7 @@ setup_passt() {
 	pane_run GUEST "git -C ${__mbuto_dir} clone git://mbuto.sh/mbuto"
 	pane_status GUEST
 
-	pane_run GUEST "${__mbuto_dir}/mbuto/mbuto -p passt -c lz4 -f mbuto.img"
+	pane_run GUEST "${__mbuto_dir}/mbuto/mbuto -p test/passt.mbuto -c lz4 -f mbuto.img"
 	pane_status GUEST
 
 	rm -rf "${__mbuto_dir}"
diff --git a/test/passt.mbuto b/test/passt.mbuto
new file mode 100755
index 0000000..5cafb30
--- /dev/null
+++ b/test/passt.mbuto
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# SPDX-License-Identifier: AGPL-3.0-or-later
+#
+# PASST - Plug A Simple Socket Transport
+#  for qemu/UNIX domain socket mode
+#
+# test/passt.mbuto - mbuto (https://mbuto.sh) profile for test images
+#
+# Copyright (c) 2022 Red Hat GmbH
+# Author: Stefano Brivio <sbrivio(a)redhat.com>
+
+PROGS="${PROGS:-ash,dash,bash ip mount ls insmod mkdir ln cat chmod lsmod
+       modprobe find grep mknod mv rm umount jq iperf3 dhclient busybox logger
+       sed tr chown sipcalc cut md5sum nc dd strace ping tail killall sleep
+       sysctl nproc tcp_rr tcp_crr udp_rr which tee seq bc}"
+
+KMODS="${KMODS:- virtio_net virtio_pci}"
+
+LINKS="${LINKS:-
+	 ash,dash,bash		/init
+	 ash,dash,bash		/bin/sh
+	 ash,dash,bash		/usr/bin/bash}"
+
+DIRS="${DIRS} /tmp"
+
+FIXUP="${FIXUP}
+	:> /etc/fstab
+	sh +m
+"
+
+OUTPUT="KERNEL=__KERNEL__
+INITRD=__INITRD__
+"
-- 
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# SPDX-License-Identifier: AGPL-3.0-or-later
+#
+# PASST - Plug A Simple Socket Transport
+#  for qemu/UNIX domain socket mode
+#
+# test/passt.mbuto - mbuto (https://mbuto.sh) profile for test images
+#
+# Copyright (c) 2022 Red Hat GmbH
+# Author: Stefano Brivio <sbrivio(a)redhat.com>
+
+PROGS="${PROGS:-ash,dash,bash ip mount ls insmod mkdir ln cat chmod lsmod
+       modprobe find grep mknod mv rm umount jq iperf3 dhclient busybox logger
+       sed tr chown sipcalc cut md5sum nc dd strace ping tail killall sleep
+       sysctl nproc tcp_rr tcp_crr udp_rr which tee seq bc}"
+
+KMODS="${KMODS:- virtio_net virtio_pci}"
+
+LINKS="${LINKS:-
+	 ash,dash,bash		/init
+	 ash,dash,bash		/bin/sh
+	 ash,dash,bash		/usr/bin/bash}"
+
+DIRS="${DIRS} /tmp"
+
+FIXUP="${FIXUP}
+	:> /etc/fstab
+	sh +m
+"
+
+OUTPUT="KERNEL=__KERNEL__
+INITRD=__INITRD__
+"
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 02/15] Handle the case of a DNS server on localhost
  2022-07-06  7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
  2022-07-06  7:28 ` [PATCH 01/15] test: Add external mbuto profile, drop udhcpc, and switch to it David Gibson
@ 2022-07-06  7:28 ` David Gibson
  2022-07-06  7:28 ` [PATCH 03/15] tests: qemu-system-ppc64le isn't a thing David Gibson
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 24+ messages in thread
From: David Gibson @ 2022-07-06  7:28 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 1874 bytes --]

By default, passt detects the nameserver used by the host system by reading
/etc/resolv.conf, and advertises that to the guest via DHCP.  However this
breaks down if the host's nameserver is local (on 127.0.0.1 or ::1);
connecting to localhost on the guest won't reach the host's nameserver.

Using a local nameserver is a reasonably common case when using dnsmasq
or similar to merge name resolution on a home network with name resolution
from an organization-private VPN.

We already have the gateway mapping support to allow reaching host-local
services from the guest via the address of the default gateway.  Add code
to detect the case of a local DNS server and use the gateway mapping to
advertise it usefully to the guest.

Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
 conf.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/conf.c b/conf.c
index 22949fd..13cb5a1 100644
--- a/conf.c
+++ b/conf.c
@@ -350,6 +350,14 @@ static void get_dns(struct ctx *c)
 			if (!dns4_set &&
 			    dns4 - &c->dns4[0] < ARRAY_SIZE(c->dns4) - 1 &&
 			    inet_pton(AF_INET, p + 1, dns4)) {
+				/* We can only access local addresses via the gw redirect */
+				if (ntohl(*dns4) >> IN_CLASSA_NSHIFT == IN_LOOPBACKNET) {
+					if (c->no_map_gw) {
+						*dns4 = 0;
+						continue;
+					}
+					*dns4 = c->gw4;
+				}
 				dns4++;
 				*dns4 = 0;
 			}
@@ -357,6 +365,14 @@ static void get_dns(struct ctx *c)
 			if (!dns6_set &&
 			    dns6 - &c->dns6[0] < ARRAY_SIZE(c->dns6) - 1 &&
 			    inet_pton(AF_INET6, p + 1, dns6)) {
+				/* We can only access local addresses via the gw redirect */
+				if (IN6_IS_ADDR_LOOPBACK(dns6)) {
+					if (c->no_map_gw) {
+						memset(dns6, 0, sizeof(*dns6));
+						continue;
+					}
+					memcpy(dns6, &c->gw6, sizeof(*dns6));
+				}
 				dns6++;
 				memset(dns6, 0, sizeof(*dns6));
 			}
-- 
@@ -350,6 +350,14 @@ static void get_dns(struct ctx *c)
 			if (!dns4_set &&
 			    dns4 - &c->dns4[0] < ARRAY_SIZE(c->dns4) - 1 &&
 			    inet_pton(AF_INET, p + 1, dns4)) {
+				/* We can only access local addresses via the gw redirect */
+				if (ntohl(*dns4) >> IN_CLASSA_NSHIFT == IN_LOOPBACKNET) {
+					if (c->no_map_gw) {
+						*dns4 = 0;
+						continue;
+					}
+					*dns4 = c->gw4;
+				}
 				dns4++;
 				*dns4 = 0;
 			}
@@ -357,6 +365,14 @@ static void get_dns(struct ctx *c)
 			if (!dns6_set &&
 			    dns6 - &c->dns6[0] < ARRAY_SIZE(c->dns6) - 1 &&
 			    inet_pton(AF_INET6, p + 1, dns6)) {
+				/* We can only access local addresses via the gw redirect */
+				if (IN6_IS_ADDR_LOOPBACK(dns6)) {
+					if (c->no_map_gw) {
+						memset(dns6, 0, sizeof(*dns6));
+						continue;
+					}
+					memcpy(dns6, &c->gw6, sizeof(*dns6));
+				}
 				dns6++;
 				memset(dns6, 0, sizeof(*dns6));
 			}
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 03/15] tests: qemu-system-ppc64le isn't a thing
  2022-07-06  7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
  2022-07-06  7:28 ` [PATCH 01/15] test: Add external mbuto profile, drop udhcpc, and switch to it David Gibson
  2022-07-06  7:28 ` [PATCH 02/15] Handle the case of a DNS server on localhost David Gibson
@ 2022-07-06  7:28 ` David Gibson
  2022-07-06  7:28 ` [PATCH 04/15] Invoke specific qemu-system-* binaries David Gibson
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 24+ messages in thread
From: David Gibson @ 2022-07-06  7:28 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 4267 bytes --]

Several tests run pp64le guests using "qemu-system-ppc64le".  But, at the
system level there's no difference between ppc64 and ppc64le - it's the
same hardware, just placed into different endian modes by OS early boot
code.  Reflecting that, qemu only supplies a single "qemu-system-ppc64".

Some distros alias qemu-system-ppc64le to qemu-system-ppc64 (Debian does),
but it's best not to count on this (Fedora doesn't, for example).

Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
 test/distro/debian | 8 ++++----
 test/distro/ubuntu | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/test/distro/debian b/test/distro/debian
index efbd057..0ed541a 100644
--- a/test/distro/debian
+++ b/test/distro/debian
@@ -12,7 +12,7 @@
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
 temp	PIDFILE
-htools	wget virt-edit guestfish head sed cat kill qemu-system-aarch64 qemu-system-ppc64le
+htools	wget virt-edit guestfish head sed cat kill 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
@@ -168,7 +168,7 @@ 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-ppc64le -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	apt-get update
@@ -252,7 +252,7 @@ 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-ppc64le -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 sleep	2
 host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
@@ -318,7 +318,7 @@ host	virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty(a)tty1.serv
 host	virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty(a).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-ppc64le -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 sleep	2
 host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
diff --git a/test/distro/ubuntu b/test/distro/ubuntu
index 448409a..50ed727 100644
--- a/test/distro/ubuntu
+++ b/test/distro/ubuntu
@@ -12,7 +12,7 @@
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
 temp	PIDFILE
-htools	wget virt-edit guestfish head sed cat kill qemu-system-ppc64le qemu-system-s390x
+htools	wget virt-edit guestfish head sed cat kill qemu-system-ppc64 qemu-system-s390x
 
 # Quick pasta test: send message from init to ns, and from ns to init
 def	distro_quick_pasta_test
@@ -118,7 +118,7 @@ host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init.conf
 host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-log-shutdown.conf
 host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
 
-host	./qrap 5 qemu-system-ppc64le -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	apt-get update
-- 
@@ -12,7 +12,7 @@
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
 temp	PIDFILE
-htools	wget virt-edit guestfish head sed cat kill qemu-system-ppc64le qemu-system-s390x
+htools	wget virt-edit guestfish head sed cat kill qemu-system-ppc64 qemu-system-s390x
 
 # Quick pasta test: send message from init to ns, and from ns to init
 def	distro_quick_pasta_test
@@ -118,7 +118,7 @@ host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init.conf
 host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-log-shutdown.conf
 host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
 
-host	./qrap 5 qemu-system-ppc64le -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	apt-get update
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 04/15] Invoke specific qemu-system-* binaries
  2022-07-06  7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
                   ` (2 preceding siblings ...)
  2022-07-06  7:28 ` [PATCH 03/15] tests: qemu-system-ppc64le isn't a thing David Gibson
@ 2022-07-06  7:28 ` David Gibson
  2022-07-06  7:28 ` [PATCH 05/15] tests: Introduce makefile for building test assets David Gibson
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 24+ messages in thread
From: David Gibson @ 2022-07-06  7:28 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 21969 bytes --]

A lot of tests and examples invoke qemu with the command "kvm".  However,
as far as I can tell, "kvm" being aliased to the appropriate qemu system
binary is Debian specific.  The binary names from qemu upstream -
qemu-system-$ARCH - also aren't universal, but they are more common (they
should be good for both Debian and Fedora at least).

In order to still get KVM acceleration when available, we use the option
"-M accel=kvm:tcg" to tell qemu to try using either KVM or TCG in that
order

A number of the places we invoked "kvm" are expecting specifically an x86
guest, and so it's also safer to explicitly invoke qemu-system-x86_64.

Some others appear to be independent of the target arch (just wanting the
same arch as the host to allow KVM acceleration).  Although I suspect there
may be more subtle x86 specific options in the qemu command lines, attempt
to preserve arch independence by using $(uname -m).

Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
 passt.1              |  6 +++---
 test/demo/passt      |  2 +-
 test/distro/debian   | 12 ++++++------
 test/distro/fedora   | 22 +++++++++++-----------
 test/distro/opensuse | 10 +++++-----
 test/distro/ubuntu   |  8 ++++----
 test/lib/setup       | 17 +++++++++++++----
 7 files changed, 43 insertions(+), 34 deletions(-)

diff --git a/passt.1 b/passt.1
index 3dccc63..c7c43be 100644
--- a/passt.1
+++ b/passt.1
@@ -616,16 +616,16 @@ NDP/DHCPv6:
 UNIX domain socket bound at /tmp/passt_1.socket
 
 You can now start qrap:
-    ./qrap 5 kvm ... -net socket,fd=5 -net nic,model=virtio
+    ./qrap 5 qemu-system-x86_64 ... -net socket,fd=5 -net nic,model=virtio
 or directly qemu, patched with:
     qemu/0001-net-Allow-also-UNIX-domain-sockets-to-be-used-as-net.patch
 as follows:
-    kvm ... -net socket,connect=/tmp/passt_1.socket -net nic,model=virtio
+    qemu-system-x86_64 ... -net socket,connect=/tmp/passt_1.socket -net nic,model=virtio
 
 .fi
 .BR "	[From another terminal]"
 .nf
-$ ./qrap 5 kvm test.qcow2 -m 1024 -display none -nodefaults -nographic -net socket,fd=5 -net nic,model=virtio
+$ ./qrap 5 qemu-system-x86_64 test.qcow2 -m 1024 -display none -nodefaults -nographic -net socket,fd=5 -net nic,model=virtio
 Connected to /tmp/passt_1.socket
 
 .fi
diff --git a/test/demo/passt b/test/demo/passt
index 7c69e94..b67ed26 100644
--- a/test/demo/passt
+++ b/test/demo/passt
@@ -103,7 +103,7 @@ nl
 say	  back-end to passt's UNIX domain socket.
 sleep	2
 hout	VMLINUZ echo "/boot/vmlinuz-$(uname -r)"
-guest	../passt/qrap 5 kvm -m 4096 -cpu host -smp 4 -kernel __VMLINUZ__ -initrd passt.img -nographic -serial stdio -nodefaults -append "console=ttyS0 virtio-net.napi_tx=1" -device virtio-net-pci,netdev=hostnet0,x-txburst=16384 -netdev socket,fd=5,id=hostnet0
+guest	../passt/qrap 5 qemu-system-x86_64 -enable-kvm -m 4096 -cpu host -smp 4 -kernel __VMLINUZ__ -initrd passt.img -nographic -serial stdio -nodefaults -append "console=ttyS0 virtio-net.napi_tx=1" -device virtio-net-pci,netdev=hostnet0,x-txburst=16384 -netdev socket,fd=5,id=hostnet0
 sleep	10
 
 nl
diff --git a/test/distro/debian b/test/distro/debian
index 0ed541a..ce3b9e7 100644
--- a/test/distro/debian
+++ b/test/distro/debian
@@ -12,7 +12,7 @@
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
 temp	PIDFILE
-htools	wget virt-edit guestfish head sed cat kill qemu-system-aarch64 qemu-system-ppc64
+htools	wget virt-edit guestfish 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
@@ -54,7 +54,7 @@ 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 kvm -M pc -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=__IMG__,if=virtio -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	apt-get update
@@ -81,7 +81,7 @@ host	virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty(a)tty1.serv
 host	guestfish --rw -a __IMG__ -i rm /lib/systemd/system/serial-getty(a).service
 host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
 
-host	./qrap 5 kvm -M pc -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	apt-get update
@@ -105,7 +105,7 @@ host	virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty(a)tty1.serv
 host	guestfish --rw -a __IMG__ -i rm /lib/systemd/system/serial-getty(a).service
 host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
 
-host	./qrap 5 kvm -M pc -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	apt-get update
@@ -193,7 +193,7 @@ host	virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty(a)tty1.serv
 host	guestfish --rw -a __IMG__ -i rm /lib/systemd/system/serial-getty(a).service
 host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
 
-host	./qrap 5 kvm -M pc -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 sleep	2
 host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
@@ -275,7 +275,7 @@ host	virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty(a)tty1.serv
 host	guestfish --rw -a __IMG__ -i rm /lib/systemd/system/serial-getty(a).service
 host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
 
-host	./qrap 5 kvm -M pc -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 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 c82d973..2a8e3e9 100644
--- a/test/distro/fedora
+++ b/test/distro/fedora
@@ -12,7 +12,7 @@
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
 temp	PIDFILE
-htools	wget virt-edit guestfish head sed cat kill
+htools	wget virt-edit guestfish 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
@@ -75,7 +75,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.se
 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 kvm -M pc -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	yum -y install make gcc nmap-ncat
@@ -105,7 +105,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.se
 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 kvm -M pc -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	yum -y install make gcc nmap-ncat
@@ -132,7 +132,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.se
 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 kvm -M pc -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	yum -y install make gcc nmap-ncat
@@ -187,7 +187,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.se
 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 kvm -M pc -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	yum -y install make gcc nmap-ncat
@@ -242,7 +242,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.se
 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 kvm -M pc -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	yum -y install make gcc nmap-ncat
@@ -297,7 +297,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.se
 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 kvm -M pc -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	yum -y install make gcc nmap-ncat
@@ -352,7 +352,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.se
 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 kvm -M pc -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	yum -y install make gcc nmap-ncat
@@ -407,7 +407,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.se
 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 kvm -M pc -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	yum -y install make gcc nmap-ncat
@@ -462,7 +462,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.se
 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 kvm -M pc -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	yum -y install make gcc nmap-ncat
@@ -517,7 +517,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.se
 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 kvm -M pc -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	yum -y install make gcc nmap-ncat
diff --git a/test/distro/opensuse b/test/distro/opensuse
index 2b49a5b..18e1c81 100644
--- a/test/distro/opensuse
+++ b/test/distro/opensuse
@@ -12,7 +12,7 @@
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
 temp	PIDFILE
-htools	wget virt-edit guestfish head sed cat kill kvm qemu-system-aarch64 xzcat tr
+htools	wget virt-edit guestfish head sed cat kill qemu-system-x86_64 qemu-system-aarch64 xzcat tr
 
 # Quick pasta test: send message from init to ns, and from ns to init
 def	distro_quick_pasta_test
@@ -51,7 +51,7 @@ host	guestfish --rw -a __IMG__ -i rm /etc/systemd/system/default.target.wants/je
 host	virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty(a)tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
 host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
 
-host	./qrap 5 kvm -M pc -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 host	ip link set eth0 up
 sleep	2
@@ -79,7 +79,7 @@ host	guestfish --rw -a __IMG__ -i rm /etc/systemd/system/default.target.wants/je
 host	virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty(a)tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
 host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
 
-host	./qrap 5 kvm -M pc -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 host	ip link set eth0 up
 sleep	2
@@ -104,7 +104,7 @@ host	guestfish --rw -a __IMG__ -i rm /etc/systemd/system/default.target.wants/je
 host	virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty(a)tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
 host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
 
-host	./qrap 5 kvm -M pc -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 # Multiple prompt logins might come up here
 sleep	10
 host	PS1='$ '
@@ -186,7 +186,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/serial-getty(a).servi
 host	virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty(a)tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
 host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
 
-host	./qrap 5 kvm -M pc -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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 host	ip link set ens2 up
 sleep	2
diff --git a/test/distro/ubuntu b/test/distro/ubuntu
index 50ed727..20b861a 100644
--- a/test/distro/ubuntu
+++ b/test/distro/ubuntu
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: AGPL-3.0-or-later
+<# SPDX-License-Identifier: AGPL-3.0-or-later
 #
 # PASST - Plug A Simple Socket Transport
 #  for qemu/UNIX domain socket mode
@@ -12,7 +12,7 @@
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
 temp	PIDFILE
-htools	wget virt-edit guestfish head sed cat kill qemu-system-ppc64 qemu-system-s390x
+htools	wget virt-edit guestfish head sed cat kill qemu-system-x86_64 qemu-system-ppc64 qemu-system-s390x
 
 # Quick pasta test: send message from init to ns, and from ns to init
 def	distro_quick_pasta_test
@@ -55,7 +55,7 @@ host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init.conf
 host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-log-shutdown.conf
 host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
 
-host	./qrap 5 kvm -M pc -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=__IMG__,if=virtio -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	apt-get update
@@ -88,7 +88,7 @@ host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init.conf
 host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-log-shutdown.conf
 host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
 
-host	./qrap 5 kvm -M pc -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=__IMG__,if=virtio -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	apt-get update
diff --git a/test/lib/setup b/test/lib/setup
index afa5101..97e603c 100755
--- a/test/lib/setup
+++ b/test/lib/setup
@@ -58,7 +58,9 @@ setup_passt() {
 	pane_run PASST "valgrind --max-stackframe=$((4 * 1024 * 1024)) --trace-children=yes --vgdb=no --error-exitcode=1 --suppressions=test/valgrind.supp ./passt ${__opts} -f -t 10001 -u 10001 -P passt.pid"
 	sleep 5
 
-	pane_run GUEST './qrap 5 kvm -m '${VMEM}' -cpu host -smp '${VCPUS} \
+	pane_run GUEST './qrap 5 qemu-system-$(uname -m)'                  \
+		' -machine accel=kvm'                                      \
+		' -m '${VMEM}' -cpu host -smp '${VCPUS}                    \
 		' -kernel ' "/boot/vmlinuz-$(uname -r)"			   \
 		' -initrd mbuto.img -nographic -serial stdio'		   \
 		' -nodefaults'						   \
@@ -170,7 +172,10 @@ setup_passt_in_ns() {
 	fi
 	sleep 5
 
-	pane_run GUEST './qrap 5 kvm -m '${VMEM}' -cpu host -smp '${VCPUS} \
+	pane_run GUEST './qrap 5 qemu-system-$(uname -m)'                  \
+		' -machine accel=kvm'                                      \
+		' -M accel=kvm:tcg'                                        \
+		' -m '${VMEM}' -cpu host -smp '${VCPUS}                    \
 		' -kernel ' "/boot/vmlinuz-$(uname -r)"			   \
 		' -initrd mbuto.img -nographic -serial stdio'		   \
 		' -nodefaults'						   \
@@ -259,7 +264,9 @@ setup_two_guests() {
 	pane_run GUEST_2 'cp mbuto.img mbuto_2.img'
 	pane_status GUEST_2
 
-	pane_run GUEST_1 './qrap 5 kvm -m '${VMEM}' -cpu host -smp '${VCPUS} \
+	pane_run GUEST_1 './qrap 5 qemu-system-$(uname -m)'                  \
+		' -M accel=kvm:tcg'                                          \
+		' -m '${VMEM}' -cpu host -smp '${VCPUS}                      \
 		' -kernel ' "/boot/vmlinuz-$(uname -r)"			     \
 		' -initrd mbuto.img -nographic -serial stdio'		     \
 		' -nodefaults'						     \
@@ -267,7 +274,9 @@ setup_two_guests() {
 		'virtio-net.napi_tx=1"'					     \
 		" -device virtio-net-pci,netdev=hostnet0,x-txburst=16384"    \
 		" -netdev socket,fd=5,id=hostnet0"
-	pane_run GUEST_2 './qrap 5 kvm -m '${VMEM}' -cpu host -smp '${VCPUS} \
+	pane_run GUEST_2 './qrap 5 qemu-system-$(uname -m)'                  \
+		' -M accel=kvm:tcg'                                          \
+		' -m '${VMEM}' -cpu host -smp '${VCPUS}                      \
 		' -kernel ' "/boot/vmlinuz-$(uname -r)"			     \
 		' -initrd mbuto_2.img -nographic -serial stdio'		     \
 		' -nodefaults'						     \
-- 
@@ -58,7 +58,9 @@ setup_passt() {
 	pane_run PASST "valgrind --max-stackframe=$((4 * 1024 * 1024)) --trace-children=yes --vgdb=no --error-exitcode=1 --suppressions=test/valgrind.supp ./passt ${__opts} -f -t 10001 -u 10001 -P passt.pid"
 	sleep 5
 
-	pane_run GUEST './qrap 5 kvm -m '${VMEM}' -cpu host -smp '${VCPUS} \
+	pane_run GUEST './qrap 5 qemu-system-$(uname -m)'                  \
+		' -machine accel=kvm'                                      \
+		' -m '${VMEM}' -cpu host -smp '${VCPUS}                    \
 		' -kernel ' "/boot/vmlinuz-$(uname -r)"			   \
 		' -initrd mbuto.img -nographic -serial stdio'		   \
 		' -nodefaults'						   \
@@ -170,7 +172,10 @@ setup_passt_in_ns() {
 	fi
 	sleep 5
 
-	pane_run GUEST './qrap 5 kvm -m '${VMEM}' -cpu host -smp '${VCPUS} \
+	pane_run GUEST './qrap 5 qemu-system-$(uname -m)'                  \
+		' -machine accel=kvm'                                      \
+		' -M accel=kvm:tcg'                                        \
+		' -m '${VMEM}' -cpu host -smp '${VCPUS}                    \
 		' -kernel ' "/boot/vmlinuz-$(uname -r)"			   \
 		' -initrd mbuto.img -nographic -serial stdio'		   \
 		' -nodefaults'						   \
@@ -259,7 +264,9 @@ setup_two_guests() {
 	pane_run GUEST_2 'cp mbuto.img mbuto_2.img'
 	pane_status GUEST_2
 
-	pane_run GUEST_1 './qrap 5 kvm -m '${VMEM}' -cpu host -smp '${VCPUS} \
+	pane_run GUEST_1 './qrap 5 qemu-system-$(uname -m)'                  \
+		' -M accel=kvm:tcg'                                          \
+		' -m '${VMEM}' -cpu host -smp '${VCPUS}                      \
 		' -kernel ' "/boot/vmlinuz-$(uname -r)"			     \
 		' -initrd mbuto.img -nographic -serial stdio'		     \
 		' -nodefaults'						     \
@@ -267,7 +274,9 @@ setup_two_guests() {
 		'virtio-net.napi_tx=1"'					     \
 		" -device virtio-net-pci,netdev=hostnet0,x-txburst=16384"    \
 		" -netdev socket,fd=5,id=hostnet0"
-	pane_run GUEST_2 './qrap 5 kvm -m '${VMEM}' -cpu host -smp '${VCPUS} \
+	pane_run GUEST_2 './qrap 5 qemu-system-$(uname -m)'                  \
+		' -M accel=kvm:tcg'                                          \
+		' -m '${VMEM}' -cpu host -smp '${VCPUS}                      \
 		' -kernel ' "/boot/vmlinuz-$(uname -r)"			     \
 		' -initrd mbuto_2.img -nographic -serial stdio'		     \
 		' -nodefaults'						     \
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 05/15] tests: Introduce makefile for building test assets
  2022-07-06  7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
                   ` (3 preceding siblings ...)
  2022-07-06  7:28 ` [PATCH 04/15] Invoke specific qemu-system-* binaries David Gibson
@ 2022-07-06  7:28 ` David Gibson
  2022-07-06  7:29 ` [PATCH 06/15] tests: Move mbuto download and execution to asset build David Gibson
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 24+ messages in thread
From: David Gibson @ 2022-07-06  7:28 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 1622 bytes --]

A number of passt/pasta testcases have initial steps which are just about
building images or other assets we need for the test proper.  Repeating
these for each test run can be quite costly.

This patch makes a start on moving this sort of test asset building to
a separate phase before running the tests proper.  For now just add a
Makefile to handle the asset building (although it doesn't build
anything yet), and make the path where we'll be building the assets
available to the tests.

Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
 test/Makefile | 27 +++++++++++++++++++++++++++
 test/lib/test |  2 +-
 2 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 test/Makefile

diff --git a/test/Makefile b/test/Makefile
new file mode 100644
index 0000000..02c60a3
--- /dev/null
+++ b/test/Makefile
@@ -0,0 +1,27 @@
+# SPDX-License-Identifier: AGPL-3.0-or-later
+#
+# Tests makefile
+#
+# Copyright Red Hat
+# Author: David Gibson <david(a)gibson.dropbear.id.au>
+
+DOWNLOAD_ASSETS =
+LOCAL_ASSETS =
+
+ASSETS = $(DOWNLOAD_ASSETS) $(LOCAL_ASSETS)
+
+assets: $(ASSETS)
+
+check: assets
+	./run
+
+debug: assets
+	DEBUG=1 ./run
+
+clean:
+	rm -f perf.js *~
+	rm -f $(LOCAL_ASSETS)
+	rm -rf test_logs
+
+realclean: clean
+	rm -rf $(DOWNLOAD_ASSETS)
diff --git a/test/lib/test b/test/lib/test
index 09e8340..96dab2b 100755
--- a/test/lib/test
+++ b/test/lib/test
@@ -393,7 +393,7 @@ test_one() {
 
 	[ ${CI} -eq 1 ] && video_link "${1}"
 
-	TEST_ONE_subs=
+	TEST_ONE_subs="$(list_add_pair "" "__BASEPATH__" "${BASEPATH}")"
 	TEST_ONE_nok=-1
 	TEST_ONE_perf_nok=0
 	TEST_ONE_skip=0
-- 
@@ -393,7 +393,7 @@ test_one() {
 
 	[ ${CI} -eq 1 ] && video_link "${1}"
 
-	TEST_ONE_subs=
+	TEST_ONE_subs="$(list_add_pair "" "__BASEPATH__" "${BASEPATH}")"
 	TEST_ONE_nok=-1
 	TEST_ONE_perf_nok=0
 	TEST_ONE_skip=0
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 06/15] tests: Move mbuto download and execution to asset build
  2022-07-06  7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
                   ` (4 preceding siblings ...)
  2022-07-06  7:28 ` [PATCH 05/15] tests: Introduce makefile for building test assets David Gibson
@ 2022-07-06  7:29 ` David Gibson
  2022-07-06  7:29 ` [PATCH 07/15] tests: Search multiple places for aarch64 EDK2 bios image David Gibson
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 24+ messages in thread
From: David Gibson @ 2022-07-06  7:29 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 4491 bytes --]

Move the download of mbuto and using it to create a sample initramfs to
the asset build makefile, rather than embedding it in the test scripts
themselves.

The two_guests tests used to use two separate copies of the mbuto
image.  As an initramfs the mbuto image is strictly readonly though,
so that's not necessary.  So, also use the same image for both guests.

Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
 test/.gitignore |  2 ++
 test/Makefile   | 10 ++++++++--
 test/lib/setup  | 23 ++++++-----------------
 3 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/test/.gitignore b/test/.gitignore
index edb2221..895c3ae 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1,2 +1,4 @@
 perf.js
 test_logs/
+mbuto/
+*.img
diff --git a/test/Makefile b/test/Makefile
index 02c60a3..b72280d 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -5,13 +5,19 @@
 # Copyright Red Hat
 # Author: David Gibson <david(a)gibson.dropbear.id.au>
 
-DOWNLOAD_ASSETS =
-LOCAL_ASSETS =
+DOWNLOAD_ASSETS = mbuto
+LOCAL_ASSETS = mbuto.img
 
 ASSETS = $(DOWNLOAD_ASSETS) $(LOCAL_ASSETS)
 
 assets: $(ASSETS)
 
+mbuto:
+	git clone git://mbuto.sh/mbuto
+
+mbuto.img: passt.mbuto mbuto
+	./mbuto/mbuto -p ./$< -c lz4 -f $@
+
 check: assets
 	./run
 
diff --git a/test/lib/setup b/test/lib/setup
index 97e603c..604cfee 100755
--- a/test/lib/setup
+++ b/test/lib/setup
@@ -13,6 +13,7 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
+INITRAMFS="${BASEPATH}/mbuto.img"
 VCPUS="$( [ $(nproc) -ge 8 ] && echo 6 || echo $(( $(nproc) / 2 + 1 )) )"
 __mem_kib="$(sed -n 's/MemTotal:[ ]*\([0-9]*\) kB/\1/p' /proc/meminfo)"
 VMEM="$((${__mem_kib} / 1024 / 4))"
@@ -24,21 +25,12 @@ setup_build() {
 	layout_host
 }
 
-# setup_passt() - Build guest initrd with mbuto, start qemu and passt
+# setup_passt() - Start qemu and passt
 setup_passt() {
 	MODE=passt
 
 	layout_passt
 
-	__mbuto_dir="$(mktemp -d)"
-	pane_run GUEST "git -C ${__mbuto_dir} clone git://mbuto.sh/mbuto"
-	pane_status GUEST
-
-	pane_run GUEST "${__mbuto_dir}/mbuto/mbuto -p test/passt.mbuto -c lz4 -f mbuto.img"
-	pane_status GUEST
-
-	rm -rf "${__mbuto_dir}"
-
 	# Ports:
 	#
 	#              guest    |        host
@@ -62,7 +54,7 @@ setup_passt() {
 		' -machine accel=kvm'                                      \
 		' -m '${VMEM}' -cpu host -smp '${VCPUS}                    \
 		' -kernel ' "/boot/vmlinuz-$(uname -r)"			   \
-		' -initrd mbuto.img -nographic -serial stdio'		   \
+		' -initrd '${INITRAMFS}' -nographic -serial stdio'	   \
 		' -nodefaults'						   \
 		' -append "console=ttyS0 mitigations=off apparmor=0 '	   \
 		'virtio-net.napi_tx=1"'					   \
@@ -177,7 +169,7 @@ setup_passt_in_ns() {
 		' -M accel=kvm:tcg'                                        \
 		' -m '${VMEM}' -cpu host -smp '${VCPUS}                    \
 		' -kernel ' "/boot/vmlinuz-$(uname -r)"			   \
-		' -initrd mbuto.img -nographic -serial stdio'		   \
+		' -initrd '${INITRAMFS}' -nographic -serial stdio'	   \
 		' -nodefaults'						   \
 		' -append "console=ttyS0 mitigations=off apparmor=0 '	   \
 		'virtio-net.napi_tx=1"'					   \
@@ -261,14 +253,11 @@ setup_two_guests() {
 	[ ${TRACE} -eq 1 ] && __opts="${__opts} --trace"
 	pane_run PASST_2 "./passt -f ${__opts} -t 10004 -u 10004"
 
-	pane_run GUEST_2 'cp mbuto.img mbuto_2.img'
-	pane_status GUEST_2
-
 	pane_run GUEST_1 './qrap 5 qemu-system-$(uname -m)'                  \
 		' -M accel=kvm:tcg'                                          \
 		' -m '${VMEM}' -cpu host -smp '${VCPUS}                      \
 		' -kernel ' "/boot/vmlinuz-$(uname -r)"			     \
-		' -initrd mbuto.img -nographic -serial stdio'		     \
+		' -initrd '${INITRAMFS}' -nographic -serial stdio'	     \
 		' -nodefaults'						     \
 		' -append "console=ttyS0 mitigations=off apparmor=0 '	     \
 		'virtio-net.napi_tx=1"'					     \
@@ -278,7 +267,7 @@ setup_two_guests() {
 		' -M accel=kvm:tcg'                                          \
 		' -m '${VMEM}' -cpu host -smp '${VCPUS}                      \
 		' -kernel ' "/boot/vmlinuz-$(uname -r)"			     \
-		' -initrd mbuto_2.img -nographic -serial stdio'		     \
+		' -initrd '${INITRAMFS}' -nographic -serial stdio'	     \
 		' -nodefaults'						     \
 		' -append "console=ttyS0 mitigations=off apparmor=0 '	     \
 		'virtio-net.napi_tx=1"'					     \
-- 
@@ -13,6 +13,7 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
+INITRAMFS="${BASEPATH}/mbuto.img"
 VCPUS="$( [ $(nproc) -ge 8 ] && echo 6 || echo $(( $(nproc) / 2 + 1 )) )"
 __mem_kib="$(sed -n 's/MemTotal:[ ]*\([0-9]*\) kB/\1/p' /proc/meminfo)"
 VMEM="$((${__mem_kib} / 1024 / 4))"
@@ -24,21 +25,12 @@ setup_build() {
 	layout_host
 }
 
-# setup_passt() - Build guest initrd with mbuto, start qemu and passt
+# setup_passt() - Start qemu and passt
 setup_passt() {
 	MODE=passt
 
 	layout_passt
 
-	__mbuto_dir="$(mktemp -d)"
-	pane_run GUEST "git -C ${__mbuto_dir} clone git://mbuto.sh/mbuto"
-	pane_status GUEST
-
-	pane_run GUEST "${__mbuto_dir}/mbuto/mbuto -p test/passt.mbuto -c lz4 -f mbuto.img"
-	pane_status GUEST
-
-	rm -rf "${__mbuto_dir}"
-
 	# Ports:
 	#
 	#              guest    |        host
@@ -62,7 +54,7 @@ setup_passt() {
 		' -machine accel=kvm'                                      \
 		' -m '${VMEM}' -cpu host -smp '${VCPUS}                    \
 		' -kernel ' "/boot/vmlinuz-$(uname -r)"			   \
-		' -initrd mbuto.img -nographic -serial stdio'		   \
+		' -initrd '${INITRAMFS}' -nographic -serial stdio'	   \
 		' -nodefaults'						   \
 		' -append "console=ttyS0 mitigations=off apparmor=0 '	   \
 		'virtio-net.napi_tx=1"'					   \
@@ -177,7 +169,7 @@ setup_passt_in_ns() {
 		' -M accel=kvm:tcg'                                        \
 		' -m '${VMEM}' -cpu host -smp '${VCPUS}                    \
 		' -kernel ' "/boot/vmlinuz-$(uname -r)"			   \
-		' -initrd mbuto.img -nographic -serial stdio'		   \
+		' -initrd '${INITRAMFS}' -nographic -serial stdio'	   \
 		' -nodefaults'						   \
 		' -append "console=ttyS0 mitigations=off apparmor=0 '	   \
 		'virtio-net.napi_tx=1"'					   \
@@ -261,14 +253,11 @@ setup_two_guests() {
 	[ ${TRACE} -eq 1 ] && __opts="${__opts} --trace"
 	pane_run PASST_2 "./passt -f ${__opts} -t 10004 -u 10004"
 
-	pane_run GUEST_2 'cp mbuto.img mbuto_2.img'
-	pane_status GUEST_2
-
 	pane_run GUEST_1 './qrap 5 qemu-system-$(uname -m)'                  \
 		' -M accel=kvm:tcg'                                          \
 		' -m '${VMEM}' -cpu host -smp '${VCPUS}                      \
 		' -kernel ' "/boot/vmlinuz-$(uname -r)"			     \
-		' -initrd mbuto.img -nographic -serial stdio'		     \
+		' -initrd '${INITRAMFS}' -nographic -serial stdio'	     \
 		' -nodefaults'						     \
 		' -append "console=ttyS0 mitigations=off apparmor=0 '	     \
 		'virtio-net.napi_tx=1"'					     \
@@ -278,7 +267,7 @@ setup_two_guests() {
 		' -M accel=kvm:tcg'                                          \
 		' -m '${VMEM}' -cpu host -smp '${VCPUS}                      \
 		' -kernel ' "/boot/vmlinuz-$(uname -r)"			     \
-		' -initrd mbuto_2.img -nographic -serial stdio'		     \
+		' -initrd '${INITRAMFS}' -nographic -serial stdio'	     \
 		' -nodefaults'						     \
 		' -append "console=ttyS0 mitigations=off apparmor=0 '	     \
 		'virtio-net.napi_tx=1"'					     \
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 07/15] tests: Search multiple places for aarch64 EDK2 bios image
  2022-07-06  7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
                   ` (5 preceding siblings ...)
  2022-07-06  7:29 ` [PATCH 06/15] tests: Move mbuto download and execution to asset build David Gibson
@ 2022-07-06  7:29 ` David Gibson
  2022-07-06  7:29 ` [PATCH 08/15] Clean up passt.pid file David Gibson
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 24+ messages in thread
From: David Gibson @ 2022-07-06  7:29 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 12177 bytes --]

Apparently qemu's ARM virt machine needs to be explicitly given a firmware
image, rather than just supplying a sane default.  Unfortunately the EDK2
firmware image we need isn't in the same place on all host distros.

Currently the test scripts hardcode the Debian location, meaning it will
break on hosts that have it somewhere else.  This patch searches multiple
locations for the firmware, and creates a local link during the asset build
phase, which the tests can then use.

For now it only searches the locations used by Debian and Fedora, but
that's a small improvement in robustness already, and can be later improved
further if we need to.

Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
 test/.gitignore             |  1 +
 test/Makefile               |  5 ++++-
 test/distro/debian          |  6 +++---
 test/distro/fedora          | 16 ++++++++--------
 test/distro/opensuse        |  2 +-
 test/find-arm64-firmware.sh | 13 +++++++++++++
 6 files changed, 30 insertions(+), 13 deletions(-)
 create mode 100755 test/find-arm64-firmware.sh

diff --git a/test/.gitignore b/test/.gitignore
index 895c3ae..360da92 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -2,3 +2,4 @@ perf.js
 test_logs/
 mbuto/
 *.img
+QEMU_EFI.fd
diff --git a/test/Makefile b/test/Makefile
index b72280d..9990841 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -6,7 +6,7 @@
 # Author: David Gibson <david(a)gibson.dropbear.id.au>
 
 DOWNLOAD_ASSETS = mbuto
-LOCAL_ASSETS = mbuto.img
+LOCAL_ASSETS = mbuto.img QEMU_EFI.fd
 
 ASSETS = $(DOWNLOAD_ASSETS) $(LOCAL_ASSETS)
 
@@ -18,6 +18,9 @@ mbuto:
 mbuto.img: passt.mbuto mbuto
 	./mbuto/mbuto -p ./$< -c lz4 -f $@
 
+QEMU_EFI.fd:
+	./find-arm64-firmware.sh $@
+
 check: assets
 	./run
 
diff --git a/test/distro/debian b/test/distro/debian
index ce3b9e7..9992b69 100644
--- a/test/distro/debian
+++ b/test/distro/debian
@@ -136,7 +136,7 @@ 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 /usr/share/qemu-efi-aarch64/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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 sleep	2
 host	apt-get update
@@ -222,7 +222,7 @@ 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 /usr/share/qemu-efi-aarch64/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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 sleep	2
 host	apt-get update
 host	apt-get -y install make gcc netcat-openbsd
@@ -296,7 +296,7 @@ host	wget https://cloud.debian.org/images/cloud/sid/daily/latest/debian-sid-nocl
 host	virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty(a).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 /usr/share/qemu-efi-aarch64/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 __IMG__ -net socket,fd=5 -net nic,model=virtio
 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 2a8e3e9..9fbba6b 100644
--- a/test/distro/fedora
+++ b/test/distro/fedora
@@ -158,7 +158,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.se
 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 /usr/share/qemu-efi-aarch64/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 __IMG__ -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci
 host	PS1='$ '
 sleep	2
 host	yum -y install make gcc nmap-ncat
@@ -213,7 +213,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.se
 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 /usr/share/qemu-efi-aarch64/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 __IMG__ -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci
 host	PS1='$ '
 sleep	2
 host	yum -y install make gcc nmap-ncat
@@ -268,7 +268,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.se
 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 /usr/share/qemu-efi-aarch64/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 __IMG__ -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci
 host	PS1='$ '
 sleep	2
 host	yum -y install make gcc nmap-ncat
@@ -323,7 +323,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.se
 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 /usr/share/qemu-efi-aarch64/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 __IMG__ -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci
 host	PS1='$ '
 sleep	2
 host	yum -y install make gcc nmap-ncat
@@ -378,7 +378,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.se
 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 /usr/share/qemu-efi-aarch64/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 __IMG__ -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci
 host	PS1='$ '
 sleep	2
 host	yum -y install make gcc nmap-ncat
@@ -433,7 +433,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.se
 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 /usr/share/qemu-efi-aarch64/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 __IMG__ -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci
 host	PS1='$ '
 sleep	2
 host	yum -y install make gcc nmap-ncat
@@ -488,7 +488,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.se
 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 /usr/share/qemu-efi-aarch64/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 __IMG__ -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci
 host	PS1='$ '
 sleep	2
 host	yum -y install make gcc nmap-ncat
@@ -543,7 +543,7 @@ host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init-local.se
 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 /usr/share/qemu-efi-aarch64/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 __IMG__ -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci
 host	PS1='$ '
 sleep	2
 host	yum -y install make gcc nmap-ncat
diff --git a/test/distro/opensuse b/test/distro/opensuse
index 18e1c81..f2da9fe 100644
--- a/test/distro/opensuse
+++ b/test/distro/opensuse
@@ -130,7 +130,7 @@ host	wget http://download.opensuse.org/ports/aarch64/tumbleweed/appliances/openS
 host	virt-edit -a __IMG__ -m /dev/sda3 /usr/lib/systemd/system/serial-getty(a).service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -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 /usr/share/qemu-efi-aarch64/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __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 -nodefaults -nographic -vga none -serial stdio __IMG__ -net socket,fd=5 -net nic,model=virtio
 host	PS1='$ '
 host	ip link set enp0s1 up
 sleep	10
diff --git a/test/find-arm64-firmware.sh b/test/find-arm64-firmware.sh
new file mode 100755
index 0000000..3182620
--- /dev/null
+++ b/test/find-arm64-firmware.sh
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+LOCATIONS="/usr/share/qemu-efi-aarch64 /usr/share/edk2/aarch64"
+
+for l in $LOCATIONS; do
+    if [ -f "$l/QEMU_EFI.fd" ]; then
+	ln -s "$l/QEMU_EFI.fd" "$1"
+	exit 0
+    fi
+done
+
+echo "Couldn't find QEMU_EFI.fd" >&2
+exit 1
-- 
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+LOCATIONS="/usr/share/qemu-efi-aarch64 /usr/share/edk2/aarch64"
+
+for l in $LOCATIONS; do
+    if [ -f "$l/QEMU_EFI.fd" ]; then
+	ln -s "$l/QEMU_EFI.fd" "$1"
+	exit 0
+    fi
+done
+
+echo "Couldn't find QEMU_EFI.fd" >&2
+exit 1
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 08/15] Clean up passt.pid file
  2022-07-06  7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
                   ` (6 preceding siblings ...)
  2022-07-06  7:29 ` [PATCH 07/15] tests: Search multiple places for aarch64 EDK2 bios image David Gibson
@ 2022-07-06  7:29 ` David Gibson
  2022-07-06  7:29 ` [PATCH 09/15] tests: Remove unused set_mode() function David Gibson
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 24+ messages in thread
From: David Gibson @ 2022-07-06  7:29 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 885 bytes --]

If the tests are interrupted at the right point a passt.pid file can be
left over.  Clean it up with "make clean" and add it to .gitignore so it
doesn't get accidentally committed.

Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
 .gitignore | 1 +
 Makefile   | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 89d9919..4b86fff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@
 /qrap
 /pasta.1
 /seccomp.h
+/passt.pid
diff --git a/Makefile b/Makefile
index c441af3..0077fc9 100644
--- a/Makefile
+++ b/Makefile
@@ -122,7 +122,8 @@ valgrind: all
 .PHONY: clean
 clean:
 	$(RM) $(BIN) *.o seccomp.h pasta.1 \
-		passt.tar passt.tar.gz *.deb *.rpm
+		passt.tar passt.tar.gz *.deb *.rpm \
+		passt.pid
 
 install: $(BIN) $(MANPAGES)
 	mkdir -p $(DESTDIR)$(prefix)/bin $(DESTDIR)$(prefix)/share/man/man1
-- 
@@ -122,7 +122,8 @@ valgrind: all
 .PHONY: clean
 clean:
 	$(RM) $(BIN) *.o seccomp.h pasta.1 \
-		passt.tar passt.tar.gz *.deb *.rpm
+		passt.tar passt.tar.gz *.deb *.rpm \
+		passt.pid
 
 install: $(BIN) $(MANPAGES)
 	mkdir -p $(DESTDIR)$(prefix)/bin $(DESTDIR)$(prefix)/share/man/man1
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 09/15] tests: Remove unused set_mode() function
  2022-07-06  7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
                   ` (7 preceding siblings ...)
  2022-07-06  7:29 ` [PATCH 08/15] Clean up passt.pid file David Gibson
@ 2022-07-06  7:29 ` David Gibson
  2022-07-06  7:29 ` [PATCH 10/15] tests: Remove not-very-useful "req" directive David Gibson
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 24+ messages in thread
From: David Gibson @ 2022-07-06  7:29 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 860 bytes --]

This utility function is never called.

Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
 test/lib/util | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/test/lib/util b/test/lib/util
index 906bd9e..dee6c8d 100755
--- a/test/lib/util
+++ b/test/lib/util
@@ -114,19 +114,6 @@ subs_apply() {
 	IFS="${__ifs}"
 }
 
-# set_mode() - Set 'passt' or 'pasta' mode for terminal control, renaming panes
-# $1:	Mode to be set
-set_mode() {
-	MODE="${1}"
-	if [ "${1}" = "pasta" ]; then
-		tmux select-pane -t ${PANE_GUEST} -T "namespace"
-		tmux select-pane -t ${PANE_PASST} -T "pasta"
-	else
-		tmux select-pane -t ${PANE_GUEST} -T "guest"
-		tmux select-pane -t ${PANE_PASST} -T "passt"
-	fi
-}
-
 # get_info_cols() - Get number of columns for info pane
 get_info_cols() {
 	__log_pane_cols=
-- 
@@ -114,19 +114,6 @@ subs_apply() {
 	IFS="${__ifs}"
 }
 
-# set_mode() - Set 'passt' or 'pasta' mode for terminal control, renaming panes
-# $1:	Mode to be set
-set_mode() {
-	MODE="${1}"
-	if [ "${1}" = "pasta" ]; then
-		tmux select-pane -t ${PANE_GUEST} -T "namespace"
-		tmux select-pane -t ${PANE_PASST} -T "pasta"
-	else
-		tmux select-pane -t ${PANE_GUEST} -T "guest"
-		tmux select-pane -t ${PANE_PASST} -T "passt"
-	fi
-}
-
 # get_info_cols() - Get number of columns for info pane
 get_info_cols() {
 	__log_pane_cols=
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 10/15] tests: Remove not-very-useful "req" directive
  2022-07-06  7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
                   ` (8 preceding siblings ...)
  2022-07-06  7:29 ` [PATCH 09/15] tests: Remove unused set_mode() function David Gibson
@ 2022-07-06  7:29 ` David Gibson
  2022-07-06  7:29 ` [PATCH 11/15] tests: Don't automatically traverse directories of test files David Gibson
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 24+ messages in thread
From: David Gibson @ 2022-07-06  7:29 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 4306 bytes --]

The test scripts support a "req" directive which requires one test script
to be run before another.  It's implemented by doing a topological sort
based on these directives in the runner scripts, which is about as awkward
as you'd expect in Bourne shell.

It turns out we only use this functionality in one place - to make the
"make install" test run after the plain "make" test.  We also already have
a simpler way of making sure tests run in a specific order: just put them
into the same test script file.

So, remove support for the "req" directive and just fold the build/all and
build/install test scripts together.

Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
 test/build/all     | 22 +++++++++++++++++++++-
 test/build/install | 34 ----------------------------------
 test/lib/test      | 28 ++++++++++------------------
 3 files changed, 31 insertions(+), 53 deletions(-)
 delete mode 100644 test/build/install

diff --git a/test/build/all b/test/build/all
index 6043793..1a89b77 100644
--- a/test/build/all
+++ b/test/build/all
@@ -11,7 +11,7 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-htools	make cc rm uname getconf
+htools	make cc rm uname getconf mkdir cp rm man
 
 test	Build passt
 host	make clean
@@ -40,3 +40,23 @@ host	CFLAGS="-Werror" make
 check	[ -f passt ]
 check	[ -h pasta ]
 check	[ -f qrap ]
+
+tempdir	TEMP
+
+test	Install
+host	prefix=__TEMP__ make install
+check	[ -f __TEMP__/bin/passt ]
+check	[ -h __TEMP__/bin/pasta ]
+check	[ -f __TEMP__/bin/qrap ]
+check	man -M __TEMP__/share/man -W passt
+check	man -M __TEMP__/share/man -W pasta
+check	man -M __TEMP__/share/man -W qrap
+
+test	Uninstall
+host	prefix=__TEMP__ make uninstall
+check	! [ -f __TEMP__/bin/passt ]
+check	! [ -h __TEMP__/bin/pasta ]
+check	! [ -f __TEMP__/bin/qrap ]
+check	! man -M __TEMP__/share/man -W passt 2>/dev/null
+check	! man -M __TEMP__/share/man -W pasta 2>/dev/null
+check	! man -M __TEMP__/share/man -W qrap 2>/dev/null
diff --git a/test/build/install b/test/build/install
deleted file mode 100644
index 2c93647..0000000
--- a/test/build/install
+++ /dev/null
@@ -1,34 +0,0 @@
-# SPDX-License-Identifier: AGPL-3.0-or-later
-#
-# PASST - Plug A Simple Socket Transport
-#  for qemu/UNIX domain socket mode
-#
-# PASTA - Pack A Subtle Tap Abstraction
-#  for network namespace/tap device mode
-#
-# test/build/install - Check that binaries and man pages can be installed
-#
-# Copyright (c) 2021 Red Hat GmbH
-# Author: Stefano Brivio <sbrivio(a)redhat.com>
-
-req	build/all
-htools	make mkdir cp rm man
-tempdir	TEMP
-
-test	Install
-host	prefix=__TEMP__ make install
-check	[ -f __TEMP__/bin/passt ]
-check	[ -h __TEMP__/bin/pasta ]
-check	[ -f __TEMP__/bin/qrap ]
-check	man -M __TEMP__/share/man -W passt
-check	man -M __TEMP__/share/man -W pasta
-check	man -M __TEMP__/share/man -W qrap
-
-test	Uninstall
-host	prefix=__TEMP__ make uninstall
-check	! [ -f __TEMP__/bin/passt ]
-check	! [ -h __TEMP__/bin/pasta ]
-check	! [ -f __TEMP__/bin/qrap ]
-check	! man -M __TEMP__/share/man -W passt 2>/dev/null
-check	! man -M __TEMP__/share/man -W pasta 2>/dev/null
-check	! man -M __TEMP__/share/man -W qrap 2>/dev/null
diff --git a/test/lib/test b/test/lib/test
index 96dab2b..ae42864 100755
--- a/test/lib/test
+++ b/test/lib/test
@@ -418,29 +418,21 @@ test_one() {
 # $1:	Name of directory containing set of test files, relative to test/
 test() {
 	__list=
-	__rem=1
 
 	cd test
-	while [ ${__rem} -eq 1 ]; do
-		__rem=0
-		for __f in "${1}"/*; do
-			__type="$(file -b --mime-type ${__f})"
-			if [ "${__type}" = "text/x-shellscript" ]; then
-				__list="$(list_add "${__list}" "${__f}")"
-				continue
-			fi
+	for __f in "${1}"/*; do
+		__type="$(file -b --mime-type ${__f})"
+		if [ "${__type}" = "text/x-shellscript" ]; then
+			__list="$(list_add "${__list}" "${__f}")"
+			continue
+		fi
 
-			if [ -n "$(file_def "${__f}" onlyfor)" ] && \
+		if [ -n "$(file_def "${__f}" onlyfor)" ] && \
 			   ! list_has "$(file_def "${__f}" onlyfor)" "${MODE}"; then
-				continue
-			fi
+			continue
+		fi
 
-			if list_has_all "${__list}" "$(file_def "${__f}" req)"; then
-				__list="$(list_add "${__list}" "${__f}")"
-			else
-				__rem=1
-			fi
-		done
+		__list="$(list_add "${__list}" "${__f}")"
 	done
 	cd ..
 
-- 
@@ -418,29 +418,21 @@ test_one() {
 # $1:	Name of directory containing set of test files, relative to test/
 test() {
 	__list=
-	__rem=1
 
 	cd test
-	while [ ${__rem} -eq 1 ]; do
-		__rem=0
-		for __f in "${1}"/*; do
-			__type="$(file -b --mime-type ${__f})"
-			if [ "${__type}" = "text/x-shellscript" ]; then
-				__list="$(list_add "${__list}" "${__f}")"
-				continue
-			fi
+	for __f in "${1}"/*; do
+		__type="$(file -b --mime-type ${__f})"
+		if [ "${__type}" = "text/x-shellscript" ]; then
+			__list="$(list_add "${__list}" "${__f}")"
+			continue
+		fi
 
-			if [ -n "$(file_def "${__f}" onlyfor)" ] && \
+		if [ -n "$(file_def "${__f}" onlyfor)" ] && \
 			   ! list_has "$(file_def "${__f}" onlyfor)" "${MODE}"; then
-				continue
-			fi
+			continue
+		fi
 
-			if list_has_all "${__list}" "$(file_def "${__f}" req)"; then
-				__list="$(list_add "${__list}" "${__f}")"
-			else
-				__rem=1
-			fi
-		done
+		__list="$(list_add "${__list}" "${__f}")"
 	done
 	cd ..
 
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 11/15] tests: Don't automatically traverse directories of test files
  2022-07-06  7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
                   ` (9 preceding siblings ...)
  2022-07-06  7:29 ` [PATCH 10/15] tests: Remove not-very-useful "req" directive David Gibson
@ 2022-07-06  7:29 ` David Gibson
  2022-07-06  7:29 ` [PATCH 12/15] tests: Explicitly list test files in test/run, remove "onlyfor" support David Gibson
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 24+ messages in thread
From: David Gibson @ 2022-07-06  7:29 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 3213 bytes --]

The top level listing control of which tests to run is in test/run, however
it uses the test() function which runs an entire directory of test files,
filtered by some criteria.  This makes it awkward to narrow down to a
subset of tests when debugging a specific failure.

To make this easier, have test() take an explicit list of test files to
run, and have the caller in test/run handle the directory traversal.  The
construct we use for this is pretty awkward to handle the fact that we're
in the source tree root directory rather than test/ at this point in
test/run.  Later cleanups will improve that.

Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
 test/lib/test |  4 ++--
 test/run      | 48 ++++++++++++++++++++++++------------------------
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/test/lib/test b/test/lib/test
index ae42864..12f2588 100755
--- a/test/lib/test
+++ b/test/lib/test
@@ -415,12 +415,12 @@ test_one() {
 }
 
 # test() - Build list of tests to run, in order, then issue test_one()
-# $1:	Name of directory containing set of test files, relative to test/
+# $@:	Test files to run, relative to test/
 test() {
 	__list=
 
 	cd test
-	for __f in "${1}"/*; do
+	for __f; do
 		__type="$(file -b --mime-type ${__f})"
 		if [ "${__type}" = "text/x-shellscript" ]; then
 			__list="$(list_add "${__list}" "${__f}")"
diff --git a/test/run b/test/run
index d9e5107..342d99e 100755
--- a/test/run
+++ b/test/run
@@ -60,43 +60,43 @@ run() {
 	[ ${CI} -eq 1 ]   && video_start ci
 
 	setup build
-	test build
-	test distro
+	test $(cd test && echo build/*)
+	test $(cd test && echo distro/*)
 
 	setup pasta
-	test ndp
-	test dhcp
-	test tcp
-	test udp
+	test $(cd test && echo ndp/*)
+	test $(cd test && echo dhcp/*)
+	test $(cd test && echo tcp/*)
+	test $(cd test && echo udp/*)
 	teardown pasta
 
 	setup passt
-	test ndp
-	test dhcp
-	test tcp
-	test udp
-	test valgrind
+	test $(cd test && echo ndp/*)
+	test $(cd test && echo dhcp/*)
+	test $(cd test && echo tcp/*)
+	test $(cd test && echo udp/*)
+	test $(cd test && echo valgrind/*)
 	teardown passt
 
 	VALGRIND=1
 	setup passt_in_ns
-	test ndp
-	test dhcp
-	test icmp
-	test tcp
-	test udp
-	test valgrind
+	test $(cd test && echo ndp/*)
+	test $(cd test && echo dhcp/*)
+	test $(cd test && echo icmp/*)
+	test $(cd test && echo tcp/*)
+	test $(cd test && echo udp/*)
+	test $(cd test && echo valgrind/*)
 	teardown passt_in_ns
 
 	VALGRIND=0
 	setup passt_in_ns
-	test ndp
-	test dhcp
-	test perf
+	test $(cd test && echo ndp/*)
+	test $(cd test && echo dhcp/*)
+	test $(cd test && echo perf/*)
 	teardown passt_in_ns
 
 	setup two_guests
-	test two_guests
+	test $(cd test && echo two_guests/*)
 	teardown two_guests
 
 	perf_finish
@@ -125,21 +125,21 @@ demo() {
 	layout_demo_passt
 	video_start demo_passt
 	MODE=passt
-	test demo
+	test $(cd test && echo demo/*)
 	video_stop
 	teardown demo_passt
 
 	layout_demo_pasta
 	video_start demo_pasta
 	MODE=pasta
-	test demo
+	test $(cd test && echo demo/*)
 	video_stop
 	teardown demo_pasta
 
 	layout_demo_podman
 	video_start demo_podman
 	MODE=podman
-	test demo
+	test $(cd test && echo demo/*)
 	video_stop
 	teardown_demo_podman
 
-- 
@@ -60,43 +60,43 @@ run() {
 	[ ${CI} -eq 1 ]   && video_start ci
 
 	setup build
-	test build
-	test distro
+	test $(cd test && echo build/*)
+	test $(cd test && echo distro/*)
 
 	setup pasta
-	test ndp
-	test dhcp
-	test tcp
-	test udp
+	test $(cd test && echo ndp/*)
+	test $(cd test && echo dhcp/*)
+	test $(cd test && echo tcp/*)
+	test $(cd test && echo udp/*)
 	teardown pasta
 
 	setup passt
-	test ndp
-	test dhcp
-	test tcp
-	test udp
-	test valgrind
+	test $(cd test && echo ndp/*)
+	test $(cd test && echo dhcp/*)
+	test $(cd test && echo tcp/*)
+	test $(cd test && echo udp/*)
+	test $(cd test && echo valgrind/*)
 	teardown passt
 
 	VALGRIND=1
 	setup passt_in_ns
-	test ndp
-	test dhcp
-	test icmp
-	test tcp
-	test udp
-	test valgrind
+	test $(cd test && echo ndp/*)
+	test $(cd test && echo dhcp/*)
+	test $(cd test && echo icmp/*)
+	test $(cd test && echo tcp/*)
+	test $(cd test && echo udp/*)
+	test $(cd test && echo valgrind/*)
 	teardown passt_in_ns
 
 	VALGRIND=0
 	setup passt_in_ns
-	test ndp
-	test dhcp
-	test perf
+	test $(cd test && echo ndp/*)
+	test $(cd test && echo dhcp/*)
+	test $(cd test && echo perf/*)
 	teardown passt_in_ns
 
 	setup two_guests
-	test two_guests
+	test $(cd test && echo two_guests/*)
 	teardown two_guests
 
 	perf_finish
@@ -125,21 +125,21 @@ demo() {
 	layout_demo_passt
 	video_start demo_passt
 	MODE=passt
-	test demo
+	test $(cd test && echo demo/*)
 	video_stop
 	teardown demo_passt
 
 	layout_demo_pasta
 	video_start demo_pasta
 	MODE=pasta
-	test demo
+	test $(cd test && echo demo/*)
 	video_stop
 	teardown demo_pasta
 
 	layout_demo_podman
 	video_start demo_podman
 	MODE=podman
-	test demo
+	test $(cd test && echo demo/*)
 	video_stop
 	teardown_demo_podman
 
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 12/15] tests: Explicitly list test files in test/run, remove "onlyfor" support
  2022-07-06  7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
                   ` (10 preceding siblings ...)
  2022-07-06  7:29 ` [PATCH 11/15] tests: Don't automatically traverse directories of test files David Gibson
@ 2022-07-06  7:29 ` David Gibson
  2022-07-06  7:29 ` [PATCH 13/15] tests: Move distro image download to asset build makefile David Gibson
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 24+ messages in thread
From: David Gibson @ 2022-07-06  7:29 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 12584 bytes --]

Currently test/run uses wildcards to run all of the tests in a directory.
However, that wildcard list is filtered down by the "onlyfor" directives
in the test files... usually to a single file.

Therefore, just explicitly list the files we *really* want to run for this
test mode.  This makes it easier to see at the top level what tests will
be executed, and to change that list temporarily while debugging specific
failures.

This means the "onlyfor" directive no longer has any purpose, and we can
remove it.  "onlyfor" was also the only used of the $MODE variable, so we
can remove that too.

Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
 test/demo/passt           |  1 -
 test/demo/pasta           |  1 -
 test/demo/podman          |  2 --
 test/dhcp/passt           |  1 -
 test/dhcp/pasta           |  1 -
 test/icmp/passt_in_ns     |  1 -
 test/lib/setup            | 10 -------
 test/lib/test             |  9 ------
 test/ndp/passt            |  1 -
 test/ndp/pasta            |  1 -
 test/perf/passt_tcp       |  1 -
 test/perf/passt_udp       |  1 -
 test/perf/pasta_tcp       |  1 -
 test/perf/pasta_udp       |  1 -
 test/run                  | 58 +++++++++++++++++++++------------------
 test/tcp/passt            |  1 -
 test/tcp/passt_in_ns      |  1 -
 test/tcp/pasta            |  1 -
 test/udp/passt            |  1 -
 test/udp/passt_in_ns      |  1 -
 test/udp/pasta            |  1 -
 test/valgrind/passt       |  1 -
 test/valgrind/passt_in_ns |  1 -
 23 files changed, 31 insertions(+), 67 deletions(-)

diff --git a/test/demo/passt b/test/demo/passt
index b67ed26..f71392b 100644
--- a/test/demo/passt
+++ b/test/demo/passt
@@ -11,7 +11,6 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	passt
 say	This is a short introduction to 
 em	passt
 say	.
diff --git a/test/demo/pasta b/test/demo/pasta
index 754b320..f4b7da2 100644
--- a/test/demo/pasta
+++ b/test/demo/pasta
@@ -11,7 +11,6 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	pasta
 say	This is a short introduction to 
 em	pasta
 say	.
diff --git a/test/demo/podman b/test/demo/podman
index 3a73784..540e456 100644
--- a/test/demo/podman
+++ b/test/demo/podman
@@ -11,8 +11,6 @@
 # Copyright (c) 2022 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	podman
-
 set	OPTS -Z -w 4M -l 1M -P 2 -t10 --pacing-timer 10000
 
 say	This is an overview of 
diff --git a/test/dhcp/passt b/test/dhcp/passt
index 4648821..00047a9 100644
--- a/test/dhcp/passt
+++ b/test/dhcp/passt
@@ -11,7 +11,6 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	passt passt_in_ns
 gtools	ip jq dhclient sed tr
 htools	ip jq sed tr head
 
diff --git a/test/dhcp/pasta b/test/dhcp/pasta
index 4652d09..65b1d42 100644
--- a/test/dhcp/pasta
+++ b/test/dhcp/pasta
@@ -11,7 +11,6 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	pasta
 nstools	ip jq /sbin/dhclient
 htools	ip jq
 
diff --git a/test/icmp/passt_in_ns b/test/icmp/passt_in_ns
index e1d9f7b..e4ac4ff 100644
--- a/test/icmp/passt_in_ns
+++ b/test/icmp/passt_in_ns
@@ -16,7 +16,6 @@
 # to create "ping" sockets. Inside the namespace, there's a single group, which
 # is allowed by default to create them.
 
-onlyfor	passt_in_ns
 nstools	ip jq sleep
 gtools	ping ip jq
 
diff --git a/test/lib/setup b/test/lib/setup
index 604cfee..0d0f3cf 100755
--- a/test/lib/setup
+++ b/test/lib/setup
@@ -20,15 +20,11 @@ VMEM="$((${__mem_kib} / 1024 / 4))"
 
 # setup_build() - Set up pane layout for build tests
 setup_build() {
-	MODE=build
-
 	layout_host
 }
 
 # setup_passt() - Start qemu and passt
 setup_passt() {
-	MODE=passt
-
 	layout_passt
 
 	# Ports:
@@ -65,8 +61,6 @@ setup_passt() {
 
 # setup_pasta() - Create a network and user namespace, connect pasta to it
 setup_pasta() {
-	MODE=pasta
-
 	layout_pasta
 
 	pane_run NS 'echo $$'
@@ -98,8 +92,6 @@ setup_pasta() {
 
 # setup_passt_in_ns() - Set up namespace (with pasta), run qemu and passt into it
 setup_passt_in_ns() {
-	MODE=passt_in_ns
-
 	layout_passt_in_pasta
 
 	# Ports:
@@ -180,8 +172,6 @@ setup_passt_in_ns() {
 
 # setup_two_guests() - Set up two namespace, run qemu and passt in both of them
 setup_two_guests() {
-	MODE=passt_in_ns
-
 	layout_two_guests
 
 	# Ports:
diff --git a/test/lib/test b/test/lib/test
index 12f2588..cb89e0b 100755
--- a/test/lib/test
+++ b/test/lib/test
@@ -13,9 +13,6 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-# Empty, 'passt' or 'pasta', to match against 'onlyfor' directive
-MODE=
-
 # test_iperf3() - Ugly helper for iperf3c/iperf3s directives
 # $1:	Role: client or server
 # $2:	Pane name, can be lowercase
@@ -426,12 +423,6 @@ test() {
 			__list="$(list_add "${__list}" "${__f}")"
 			continue
 		fi
-
-		if [ -n "$(file_def "${__f}" onlyfor)" ] && \
-			   ! list_has "$(file_def "${__f}" onlyfor)" "${MODE}"; then
-			continue
-		fi
-
 		__list="$(list_add "${__list}" "${__f}")"
 	done
 	cd ..
diff --git a/test/ndp/passt b/test/ndp/passt
index 155ff26..d6b4c40 100644
--- a/test/ndp/passt
+++ b/test/ndp/passt
@@ -11,7 +11,6 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	passt passt_in_ns
 gtools	ip jq sipcalc grep
 htools	ip jq sipcalc grep cut
 
diff --git a/test/ndp/pasta b/test/ndp/pasta
index ef9dee7..2a2dd1a 100644
--- a/test/ndp/pasta
+++ b/test/ndp/pasta
@@ -11,7 +11,6 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	pasta
 nstools	ip jq sipcalc grep cut
 htools	ip jq sipcalc grep cut
 
diff --git a/test/perf/passt_tcp b/test/perf/passt_tcp
index c97178e..74a39ba 100644
--- a/test/perf/passt_tcp
+++ b/test/perf/passt_tcp
@@ -11,7 +11,6 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	passt_in_ns
 gtools	sysctl ip jq nproc seq sleep bc iperf3 tcp_rr tcp_crr # From neper
 nstools	sysctl ip jq nproc seq sleep bc iperf3 tcp_rr tcp_crr
 htools	bc head sed seq
diff --git a/test/perf/passt_udp b/test/perf/passt_udp
index 5155099..a22a550 100644
--- a/test/perf/passt_udp
+++ b/test/perf/passt_udp
@@ -11,7 +11,6 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	passt_in_ns
 gtools	sysctl ip jq nproc sleep iperf3 udp_rr # From neper
 nstools	ip jq sleep iperf3 udp_rr
 htools	bc head sed
diff --git a/test/perf/pasta_tcp b/test/perf/pasta_tcp
index 5ef0f69..f4e97cb 100644
--- a/test/perf/pasta_tcp
+++ b/test/perf/pasta_tcp
@@ -11,7 +11,6 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	passt_in_ns
 htools	head ip seq bc sleep iperf3 tcp_rr tcp_crr jq sed
 nstools	sysctl nproc ip seq bc sleep iperf3 tcp_rr tcp_crr jq sed
 
diff --git a/test/perf/pasta_udp b/test/perf/pasta_udp
index 114a9bc..5f750b5 100644
--- a/test/perf/pasta_udp
+++ b/test/perf/pasta_udp
@@ -11,7 +11,6 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	passt_in_ns
 htools	bc head ip sleep iperf3 udp_rr jq sed
 nstools	ip sleep iperf3 udp_rr jq sed
 
diff --git a/test/run b/test/run
index 342d99e..3e5d56b 100755
--- a/test/run
+++ b/test/run
@@ -60,43 +60,50 @@ run() {
 	[ ${CI} -eq 1 ]   && video_start ci
 
 	setup build
-	test $(cd test && echo build/*)
-	test $(cd test && echo distro/*)
+	test build/all
+	test build/static_checkers
+	test distro/debian
+	test distro/fedora
+	test distro/opensuse
+	test distro/ubuntu
 
 	setup pasta
-	test $(cd test && echo ndp/*)
-	test $(cd test && echo dhcp/*)
-	test $(cd test && echo tcp/*)
-	test $(cd test && echo udp/*)
+	test ndp/pasta
+	test dhcp/pasta
+	test tcp/pasta
+	test udp/pasta
 	teardown pasta
 
 	setup passt
-	test $(cd test && echo ndp/*)
-	test $(cd test && echo dhcp/*)
-	test $(cd test && echo tcp/*)
-	test $(cd test && echo udp/*)
-	test $(cd test && echo valgrind/*)
+	test ndp/passt
+	test dhcp/passt
+	test tcp/passt
+	test udp/passt
+	test valgrind/passt
 	teardown passt
 
 	VALGRIND=1
 	setup passt_in_ns
-	test $(cd test && echo ndp/*)
-	test $(cd test && echo dhcp/*)
-	test $(cd test && echo icmp/*)
-	test $(cd test && echo tcp/*)
-	test $(cd test && echo udp/*)
-	test $(cd test && echo valgrind/*)
+	test ndp/passt
+	test dhcp/passt
+	test icmp/passt_in_ns
+	test tcp/passt_in_ns
+	test udp/passt_in_ns
+	test valgrind/passt_in_ns
 	teardown passt_in_ns
 
 	VALGRIND=0
 	setup passt_in_ns
-	test $(cd test && echo ndp/*)
-	test $(cd test && echo dhcp/*)
-	test $(cd test && echo perf/*)
+	test ndp/passt
+	test dhcp/passt
+	test perf/passt_tcp
+	test perf/passt_udp
+	test perf/pasta_tcp
+	test perf/pasta_udp
 	teardown passt_in_ns
 
 	setup two_guests
-	test $(cd test && echo two_guests/*)
+	test two_guests/basic
 	teardown two_guests
 
 	perf_finish
@@ -124,22 +131,19 @@ demo() {
 
 	layout_demo_passt
 	video_start demo_passt
-	MODE=passt
-	test $(cd test && echo demo/*)
+	test demo/passt
 	video_stop
 	teardown demo_passt
 
 	layout_demo_pasta
 	video_start demo_pasta
-	MODE=pasta
-	test $(cd test && echo demo/*)
+	test demo/pasta
 	video_stop
 	teardown demo_pasta
 
 	layout_demo_podman
 	video_start demo_podman
-	MODE=podman
-	test $(cd test && echo demo/*)
+	test demo/podman
 	video_stop
 	teardown_demo_podman
 
diff --git a/test/tcp/passt b/test/tcp/passt
index b47a36d..4baa610 100644
--- a/test/tcp/passt
+++ b/test/tcp/passt
@@ -11,7 +11,6 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	passt
 gtools	nc ip jq cat md5sum cut
 htools	dd nc ip jq cat md5sum cut
 
diff --git a/test/tcp/passt_in_ns b/test/tcp/passt_in_ns
index 4229a3a..2a11e0b 100644
--- a/test/tcp/passt_in_ns
+++ b/test/tcp/passt_in_ns
@@ -11,7 +11,6 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	passt_in_ns
 gtools	nc ip jq cat md5sum cut
 htools	dd nc ip jq cat md5sum cut
 nstools	nc ip jq cat md5sum cut
diff --git a/test/tcp/pasta b/test/tcp/pasta
index 531da04..068393a 100644
--- a/test/tcp/pasta
+++ b/test/tcp/pasta
@@ -11,7 +11,6 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	pasta
 htools	dd ncat ip jq cat md5sum cut
 nstools	ncat ip jq cat md5sum cut
 
diff --git a/test/udp/passt b/test/udp/passt
index 492fb12..8a848bd 100644
--- a/test/udp/passt
+++ b/test/udp/passt
@@ -11,7 +11,6 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	passt
 gtools	nc tee grep cat ip jq md5sum cut
 htools	printf dd nc tee grep cat ip jq md5sum cut
 
diff --git a/test/udp/passt_in_ns b/test/udp/passt_in_ns
index 71bda04..3607251 100644
--- a/test/udp/passt_in_ns
+++ b/test/udp/passt_in_ns
@@ -11,7 +11,6 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	passt_in_ns
 gtools	nc tee grep cat ip jq md5sum cut
 nstools	nc tee grep cat ip jq md5sum cut
 htools	printf dd nc tee grep cat ip jq md5sum cut
diff --git a/test/udp/pasta b/test/udp/pasta
index 3123c42..a7e5015 100644
--- a/test/udp/pasta
+++ b/test/udp/pasta
@@ -11,7 +11,6 @@
 # Copyright (c) 2021 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	pasta
 nstools	ncat tee grep cat ip jq md5sum cut
 htools	printf dd ncat tee grep cat ip jq md5sum cut
 
diff --git a/test/valgrind/passt b/test/valgrind/passt
index 3af943a..f8bcf00 100644
--- a/test/valgrind/passt
+++ b/test/valgrind/passt
@@ -11,7 +11,6 @@
 # Copyright (c) 2022 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	passt
 test	valgrind: exit code
 
 hout	PASST_PID cat passt.pid
diff --git a/test/valgrind/passt_in_ns b/test/valgrind/passt_in_ns
index bf50c7e..d28e251 100644
--- a/test/valgrind/passt_in_ns
+++ b/test/valgrind/passt_in_ns
@@ -11,7 +11,6 @@
 # Copyright (c) 2022 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	passt_in_ns
 test	valgrind: exit code
 
 nsout	PASST_PID cat passt.pid
-- 
@@ -11,7 +11,6 @@
 # Copyright (c) 2022 Red Hat GmbH
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
-onlyfor	passt_in_ns
 test	valgrind: exit code
 
 nsout	PASST_PID cat passt.pid
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 13/15] tests: Move distro image download to asset build makefile
  2022-07-06  7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
                   ` (11 preceding siblings ...)
  2022-07-06  7:29 ` [PATCH 12/15] tests: Explicitly list test files in test/run, remove "onlyfor" support David Gibson
@ 2022-07-06  7:29 ` David Gibson
  2022-07-06  7:29 ` [PATCH 14/15] tests: Prepare distro images during asset build phase David Gibson
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 24+ messages in thread
From: David Gibson @ 2022-07-06  7:29 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 36698 bytes --]

Rather than directly download distro images from the test scripts, handle
all the downloads during the test asset build, then just clone them for
the tests themselves.  This avoids repeated downloads which can be very
slow when debugging failing tests.

Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
 test/.gitignore      |   2 +
 test/Makefile        | 131 ++++++++++++++++++++++++++++++++++++++++++-
 test/distro/debian   |  25 +++++----
 test/distro/fedora   |  38 ++++++-------
 test/distro/opensuse |  14 ++---
 test/distro/ubuntu   |  14 ++---
 6 files changed, 178 insertions(+), 46 deletions(-)

diff --git a/test/.gitignore b/test/.gitignore
index 360da92..225ecd9 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -3,3 +3,5 @@ test_logs/
 mbuto/
 *.img
 QEMU_EFI.fd
+*.qcow2
+*.raw.xz
diff --git a/test/Makefile b/test/Makefile
index 9990841..b858e0e 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -5,7 +5,54 @@
 # Copyright Red Hat
 # Author: David Gibson <david(a)gibson.dropbear.id.au>
 
-DOWNLOAD_ASSETS = mbuto
+WGET = wget -c
+
+DEBIAN_IMGS = debian-8.11.0-openstack-amd64.qcow2 \
+	debian-9-nocloud-amd64-daily-20200210-166.qcow2 \
+	debian-10-nocloud-amd64.qcow2 \
+	debian-10-generic-arm64.qcow2 \
+	debian-10-generic-ppc64el.qcow2 \
+	debian-11-nocloud-amd64.qcow2 \
+	debian-11-generic-arm64.qcow2 \
+	debian-11-generic-ppc64el.qcow2 \
+	debian-sid-nocloud-amd64-daily.qcow2 \
+	debian-sid-nocloud-arm64-daily.qcow2 \
+	debian-sid-nocloud-ppc64el-daily.qcow2
+
+FEDORA_IMGS = Fedora-Cloud-Base-26-1.5.x86_64.qcow2 \
+	Fedora-Cloud-Base-27-1.6.x86_64.qcow2 \
+	Fedora-Cloud-Base-28-1.1.x86_64.qcow2 \
+	Fedora-Cloud-Base-28-1.1.aarch64.qcow2 \
+	Fedora-Cloud-Base-29-1.2.x86_64.qcow2 \
+	Fedora-Cloud-Base-29-1.2.aarch64.qcow2 \
+	Fedora-Cloud-Base-30-1.2.x86_64.qcow2 \
+	Fedora-Cloud-Base-30-1.2.aarch64.qcow2 \
+	Fedora-Cloud-Base-31-1.9.x86_64.qcow2 \
+	Fedora-Cloud-Base-31-1.9.aarch64.qcow2 \
+	Fedora-Cloud-Base-32-1.6.x86_64.qcow2 \
+	Fedora-Cloud-Base-32-1.6.aarch64.qcow2 \
+	Fedora-Cloud-Base-33-1.2.x86_64.qcow2 \
+	Fedora-Cloud-Base-33-1.2.aarch64.qcow2 \
+	Fedora-Cloud-Base-34-1.2.x86_64.qcow2 \
+	Fedora-Cloud-Base-34-1.2.aarch64.qcow2 \
+	Fedora-Cloud-Base-35-1.2.x86_64.qcow2 \
+	Fedora-Cloud-Base-35-1.2.aarch64.qcow2
+
+OPENSUSE_IMGS = openSUSE-Leap-15.1-JeOS.x86_64-kvm-and-xen.qcow2 \
+	openSUSE-Leap-15.2-JeOS.x86_64-kvm-and-xen.qcow2 \
+	openSUSE-Leap-15.3-JeOS.x86_64-kvm-and-xen.qcow2 \
+	openSUSE-Tumbleweed-ARM-JeOS-efi.aarch64.raw.xz \
+	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 \
+	trusty-server-cloudimg-i386-disk1.img \
+	trusty-server-cloudimg-ppc64el-disk1.img \
+	xenial-server-cloudimg-powerpc-disk1.img \
+	jammy-server-cloudimg-s390x.img
+
+DOWNLOAD_ASSETS = mbuto \
+	$(DEBIAN_IMGS) $(FEDORA_IMGS) $(OPENSUSE_IMGS) $(UBUNTU_IMGS)
 LOCAL_ASSETS = mbuto.img QEMU_EFI.fd
 
 ASSETS = $(DOWNLOAD_ASSETS) $(LOCAL_ASSETS)
@@ -34,3 +81,85 @@ clean:
 
 realclean: clean
 	rm -rf $(DOWNLOAD_ASSETS)
+
+# Debian downloads
+debian-8.11.0-openstack-%.qcow2:
+	$(WGET) -O $@ https://cloud.debian.org/images/cloud/OpenStack/archive/8.11.0/debian-8.11.0-openstack-$*.qcow2
+
+debian-9-nocloud-%-daily-20200210-166.qcow2:
+	$(WGET) -O $@ https://cloud.debian.org/images/cloud/stretch/daily/20200210-166/debian-9-nocloud-$*-daily-20200210-166.qcow2
+
+debian-10-nocloud-%.qcow2:
+	$(WGET) -O $@ https://cloud.debian.org/images/cloud/buster/latest/debian-10-nocloud-$*.qcow2
+
+debian-10-generic-%.qcow2:
+	$(WGET) -O $@ https://cloud.debian.org/images/cloud/buster/latest/debian-10-generic-$*.qcow2
+
+debian-11-nocloud-%.qcow2:
+	$(WGET) -O $@ https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-nocloud-$*.qcow2
+
+debian-11-generic-%.qcow2:
+	$(WGET) -O $@ https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-generic-$*.qcow2
+
+debian-sid-nocloud-%-daily.qcow2:
+	$(WGET) -O $@ https://cloud.debian.org/images/cloud/sid/daily/latest/debian-sid-nocloud-$*-daily.qcow2
+
+# Fedora downloads
+Fedora-Cloud-Base-26-1.5.%.qcow2:
+	$(WGET) -O $@ http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/26/CloudImages/$*/images/Fedora-Cloud-Base-26-1.5.$*.qcow2
+
+Fedora-Cloud-Base-27-1.6.%.qcow2:
+	$(WGET) -O $@ http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/27/CloudImages/$*/images/Fedora-Cloud-Base-27-1.6.$*.qcow2
+
+Fedora-Cloud-Base-28-1.1.%.qcow2:
+	$(WGET) -O $@ http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/28/Cloud/$*/images/Fedora-Cloud-Base-28-1.1.$*.qcow2
+
+Fedora-Cloud-Base-29-1.2.%.qcow2:
+	$(WGET) -O $@ http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/29/Cloud/$*/images/Fedora-Cloud-Base-29-1.2.$*.qcow2
+
+Fedora-Cloud-Base-30-1.2.%.qcow2:
+	$(WGET) -O $@ http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/30/Cloud/$*/images/Fedora-Cloud-Base-30-1.2.$*.qcow2
+
+Fedora-Cloud-Base-31-1.9.%.qcow2:
+	$(WGET) -O $@ http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/31/Cloud/$*/images/Fedora-Cloud-Base-31-1.9.$*.qcow2
+
+Fedora-Cloud-Base-32-1.6.%.qcow2:
+	$(WGET) -O $@ https://download.fedoraproject.org/pub/fedora/linux/releases/32/Cloud/$*/images/Fedora-Cloud-Base-32-1.6.$*.qcow2
+
+Fedora-Cloud-Base-33-1.2.%.qcow2:
+	$(WGET) -O $@ https://download.fedoraproject.org/pub/fedora/linux/releases/33/Cloud/$*/images/Fedora-Cloud-Base-33-1.2.$*.qcow2
+
+Fedora-Cloud-Base-34-1.2.%.qcow2:
+	$(WGET) -O $@ https://download.fedoraproject.org/pub/fedora/linux//releases/34/Cloud/$*/images/Fedora-Cloud-Base-34-1.2.$*.qcow2
+
+Fedora-Cloud-Base-35-1.2.%.qcow2:
+	$(WGET) -O $@ https://download.fedoraproject.org/pub/fedora/linux/releases/35/Cloud/$*/images/Fedora-Cloud-Base-35-1.2.$*.qcow2
+
+# OpenSuSE downloads
+openSUSE-Leap-15.1-JeOS.x86_64-kvm-and-xen.qcow2:
+	$(WGET) -O $@ https://download.opensuse.org/distribution/leap/15.1/jeos/openSUSE-Leap-15.1-JeOS.x86_64-kvm-and-xen.qcow2
+
+openSUSE-Leap-15.2-JeOS.x86_64-kvm-and-xen.qcow2:
+	$(WGET) -O $@ https://download.opensuse.org/distribution/leap/15.2/appliances/openSUSE-Leap-15.2-JeOS.x86_64-kvm-and-xen.qcow2
+
+openSUSE-Leap-15.3-JeOS.x86_64-kvm-and-xen.qcow2:
+	$(WGET) -O $@ https://download.opensuse.org/distribution/leap/15.3/appliances/openSUSE-Leap-15.3-JeOS.x86_64-kvm-and-xen.qcow2
+
+openSUSE-Tumbleweed-ARM-JeOS-efi.aarch64.raw.xz:
+	$(WGET) -O $@ http://download.opensuse.org/ports/aarch64/tumbleweed/appliances/openSUSE-Tumbleweed-ARM-JeOS-efi.aarch64.raw.xz
+
+openSUSE-Tumbleweed-ARM-JeOS-efi.armv7l.raw.xz:
+	$(WGET) -O $@ http://download.opensuse.org/ports/armv7hl/tumbleweed/appliances/openSUSE-Tumbleweed-ARM-JeOS-efi.armv7l.raw.xz
+
+openSUSE-Tumbleweed-JeOS.x86_64-kvm-and-xen.qcow2:
+	$(WGET) -O $@ https://download.opensuse.org/tumbleweed/appliances/openSUSE-Tumbleweed-JeOS.x86_64-kvm-and-xen.qcow2
+
+# Ubuntu downloads
+trusty-server-cloudimg-%-disk1.img:
+	$(WGET) -O $@ https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-$*-disk1.img
+
+xenial-server-cloudimg-powerpc-disk1.img:
+	$(WGET) -O $@ https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-powerpc-disk1.img
+
+jammy-server-cloudimg-s390x.img:
+	$(WGET) -O $@ https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-s390x.img
diff --git a/test/distro/debian b/test/distro/debian
index 9992b69..a7a0f98 100644
--- a/test/distro/debian
+++ b/test/distro/debian
@@ -12,7 +12,7 @@
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
 temp	PIDFILE
-htools	wget virt-edit guestfish head sed cat kill qemu-system-x86_64 qemu-system-aarch64 qemu-system-ppc64
+htools	qemu-img virt-edit guestfish 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
@@ -45,7 +45,7 @@ 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	wget https://cloud.debian.org/images/cloud/OpenStack/archive/8.11.0/debian-8.11.0-openstack-amd64.qcow2 -O __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(a)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(a).service
 host	guestfish --rw -a __IMG__ -i rm /etc/init.d/cloud-config
@@ -76,7 +76,7 @@ hout	PID cat __PIDFILE__
 test	Debian GNU/Linux 9 (stretch, oldoldstable), amd64
 
 temp	IMG
-host	wget https://cloud.debian.org/images/cloud/stretch/daily/20200210-166/debian-9-nocloud-amd64-daily-20200210-166.qcow2 -O __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(a)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(a).service
 host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
@@ -100,7 +100,7 @@ sleep	1
 test	Debian GNU/Linux 10 (buster, oldstable), amd64
 
 temp	IMG
-host	wget https://cloud.debian.org/images/cloud/buster/latest/debian-10-nocloud-amd64.qcow2 -O __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(a)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(a).service
 host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
@@ -124,7 +124,7 @@ sleep	1
 test	Debian GNU/Linux 10 (buster, oldstable), aarch64
 
 temp	IMG
-host	wget https://cloud.debian.org/images/cloud/buster/latest/debian-10-generic-arm64.qcow2 -O __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(a).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
@@ -155,7 +155,8 @@ sleep	1
 test	Debian GNU/Linux 10 (buster, oldstable), ppc64le
 
 temp	IMG
-host	wget https://cloud.debian.org/images/cloud/buster/latest/debian-10-generic-ppc64el.qcow2 -O __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(a)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(a).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
@@ -188,7 +189,7 @@ hostb	reset
 test	Debian GNU/Linux 11 (bullseye, stable), amd64
 
 temp	IMG
-host	wget https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-nocloud-amd64.qcow2 -O __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(a)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(a).service
 host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
@@ -210,7 +211,7 @@ sleep	1
 test	Debian GNU/Linux 11 (bullseye, stable), aarch64
 
 temp	IMG
-host	wget https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-generic-arm64.qcow2 -O __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(a).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
@@ -239,7 +240,7 @@ sleep	1
 test	Debian GNU/Linux 11 (bullseye, stable), ppc64le
 
 temp	IMG
-host	wget https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-generic-ppc64el.qcow2 -O __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(a)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(a).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
@@ -270,7 +271,7 @@ hostb	reset
 test	Debian GNU/Linux sid (experimental), amd64
 
 temp	IMG
-host	wget https://cloud.debian.org/images/cloud/sid/daily/latest/debian-sid-nocloud-amd64-daily.qcow2 -O __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(a)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(a).service
 host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
@@ -292,7 +293,7 @@ sleep	1
 test	Debian GNU/Linux sid (experimental), aarch64
 
 temp	IMG
-host	wget https://cloud.debian.org/images/cloud/sid/daily/latest/debian-sid-nocloud-arm64-daily.qcow2 -O __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(a).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/
 
@@ -313,7 +314,7 @@ sleep	1
 test	Debian GNU/Linux sid (experimental), ppc64le
 
 temp	IMG
-host	wget https://cloud.debian.org/images/cloud/sid/daily/latest/debian-sid-nocloud-ppc64el-daily.qcow2 -O __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(a)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(a).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/
diff --git a/test/distro/fedora b/test/distro/fedora
index 9fbba6b..783d0ea 100644
--- a/test/distro/fedora
+++ b/test/distro/fedora
@@ -12,7 +12,7 @@
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
 temp	PIDFILE
-htools	wget virt-edit guestfish head sed cat kill qemu-system-x86_64
+htools	qemu-img virt-edit guestfish 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
@@ -66,7 +66,7 @@ hout	GUEST_FILES ls -1 *.c *.h *.sh passt.1 qrap.1 Makefile | tr '\n' ' '; echo
 test	Fedora 26, x86_64
 
 temp	IMG
-host	wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/26/CloudImages/x86_64/images/Fedora-Cloud-Base-26-1.5.x86_64.qcow2 -O __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(a)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(a).service
 host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service
@@ -96,7 +96,7 @@ hout	PID cat __PIDFILE__
 test	Fedora 27, x86_64
 
 temp	IMG
-host	wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/27/CloudImages/x86_64/images/Fedora-Cloud-Base-27-1.6.x86_64.qcow2 -O __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(a)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(a).service
 host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service
@@ -123,7 +123,7 @@ sleep	1
 test	Fedora 28, x86_64
 
 temp	IMG
-host	wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/28/Cloud/x86_64/images/Fedora-Cloud-Base-28-1.1.x86_64.qcow2 -O __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(a)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(a).service
 host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service
@@ -150,7 +150,7 @@ sleep	1
 test	Fedora 28, aarch64
 
 temp	IMG
-host	wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/28/Cloud/aarch64/images/Fedora-Cloud-Base-28-1.1.aarch64.qcow2 -O __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(a).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
@@ -179,7 +179,7 @@ host	echo
 test	Fedora 29, x86_64
 
 temp	IMG
-host	wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/29/Cloud/x86_64/images/Fedora-Cloud-Base-29-1.2.x86_64.qcow2 -O __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(a).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
@@ -205,7 +205,7 @@ sleep	1
 test	Fedora 29, aarch64
 
 temp	IMG
-host	wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/29/Cloud/aarch64/images/Fedora-Cloud-Base-29-1.2.aarch64.qcow2 -O __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(a).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
@@ -234,7 +234,7 @@ host	echo
 test	Fedora 30, x86_64
 
 temp	IMG
-host	wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/30/Cloud/x86_64/images/Fedora-Cloud-Base-30-1.2.x86_64.qcow2 -O __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(a).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
@@ -260,7 +260,7 @@ sleep	1
 test	Fedora 30, aarch64
 
 temp	IMG
-host	wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/30/Cloud/aarch64/images/Fedora-Cloud-Base-30-1.2.aarch64.qcow2 -O __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(a).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
@@ -289,7 +289,7 @@ host	echo
 test	Fedora 31, x86_64
 
 temp	IMG
-host	wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/31/Cloud/x86_64/images/Fedora-Cloud-Base-31-1.9.x86_64.qcow2 -O __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(a).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
@@ -315,7 +315,7 @@ sleep	1
 test	Fedora 31, aarch64
 
 temp	IMG
-host	wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/31/Cloud/aarch64/images/Fedora-Cloud-Base-31-1.9.aarch64.qcow2 -O __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(a).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
@@ -344,7 +344,7 @@ host	echo
 test	Fedora 32, x86_64
 
 temp	IMG
-host	wget https://download.fedoraproject.org/pub/fedora/linux/releases/32/Cloud/x86_64/images/Fedora-Cloud-Base-32-1.6.x86_64.qcow2 -O __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(a).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
@@ -370,7 +370,7 @@ sleep	1
 test	Fedora 32, aarch64
 
 temp	IMG
-host	wget https://download.fedoraproject.org/pub/fedora/linux/releases/32/Cloud/aarch64/images/Fedora-Cloud-Base-32-1.6.aarch64.qcow2 -O __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(a).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
@@ -399,7 +399,7 @@ host	echo
 test	Fedora 33, x86_64
 
 temp	IMG
-host	wget https://download.fedoraproject.org/pub/fedora/linux/releases/33/Cloud/x86_64/images/Fedora-Cloud-Base-33-1.2.x86_64.qcow2 -O __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(a).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
@@ -425,7 +425,7 @@ sleep	1
 test	Fedora 33, aarch64
 
 temp	IMG
-host	wget https://download.fedoraproject.org/pub/fedora/linux/releases/33/Cloud/aarch64/images/Fedora-Cloud-Base-33-1.2.aarch64.qcow2 -O __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(a).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
@@ -454,7 +454,7 @@ host	echo
 test	Fedora 34, x86_64
 
 temp	IMG
-host	wget https://download.fedoraproject.org/pub/fedora/linux//releases/34/Cloud/x86_64/images/Fedora-Cloud-Base-34-1.2.x86_64.qcow2 -O __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(a).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
@@ -480,7 +480,7 @@ sleep	1
 test	Fedora 34, aarch64
 
 temp	IMG
-host	wget https://download.fedoraproject.org/pub/fedora/linux//releases/34/Cloud/aarch64/images/Fedora-Cloud-Base-34-1.2.aarch64.qcow2 -O __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(a).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
@@ -509,7 +509,7 @@ host	echo
 test	Fedora 35, x86_64
 
 temp	IMG
-host	wget https://download.fedoraproject.org/pub/fedora/linux/releases/35/Cloud/x86_64/images/Fedora-Cloud-Base-35-1.2.x86_64.qcow2 -O __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(a).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
@@ -535,7 +535,7 @@ sleep	1
 test	Fedora 35, aarch64
 
 temp	IMG
-host	wget https://download.fedoraproject.org/pub/fedora/linux/releases/35/Cloud/aarch64/images/Fedora-Cloud-Base-35-1.2.aarch64.qcow2 -O __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(a).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
diff --git a/test/distro/opensuse b/test/distro/opensuse
index f2da9fe..f9ace68 100644
--- a/test/distro/opensuse
+++ b/test/distro/opensuse
@@ -12,7 +12,7 @@
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
 temp	PIDFILE
-htools	wget virt-edit guestfish head sed cat kill qemu-system-x86_64 qemu-system-aarch64 xzcat tr
+htools	qemu-img virt-edit guestfish head sed cat kill qemu-system-x86_64 qemu-system-aarch64 xzcat tr
 
 # Quick pasta test: send message from init to ns, and from ns to init
 def	distro_quick_pasta_test
@@ -45,7 +45,7 @@ hout	GUEST_FILES ls -1 *.c *.h *.sh passt.1 qrap.1 Makefile | tr '\n' ' '; echo
 test	OpenSUSE Leap 15.1
 
 temp	IMG
-host	wget https://download.opensuse.org/distribution/leap/15.1/jeos/openSUSE-Leap-15.1-JeOS.x86_64-kvm-and-xen.qcow2 -O __IMG__
+host	qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/openSUSE-Leap-15.1-JeOS.x86_64-kvm-and-xen.qcow2 __IMG__
 host	guestfish --rw -a __IMG__ -i rm '/usr/lib/systemd/system/systemd-journald.service'
 host	guestfish --rw -a __IMG__ -i rm /etc/systemd/system/default.target.wants/jeos-firstboot.service
 host	virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty(a)tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
@@ -73,7 +73,7 @@ hout	PID cat __PIDFILE__
 
 test	OpenSUSE Leap 15.2
 
-host	wget https://download.opensuse.org/distribution/leap/15.2/appliances/openSUSE-Leap-15.2-JeOS.x86_64-kvm-and-xen.qcow2 -O __IMG__
+host	qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/openSUSE-Leap-15.2-JeOS.x86_64-kvm-and-xen.qcow2 __IMG__
 host	guestfish --rw -a __IMG__ -i rm '/usr/lib/systemd/system/systemd-journald.service'
 host	guestfish --rw -a __IMG__ -i rm /etc/systemd/system/default.target.wants/jeos-firstboot.service
 host	virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty(a)tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
@@ -98,7 +98,7 @@ sleep	1
 
 test	OpenSUSE Leap 15.3
 
-host	wget https://download.opensuse.org/distribution/leap/15.3/appliances/openSUSE-Leap-15.3-JeOS.x86_64-kvm-and-xen.qcow2 -O __IMG__
+host	qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/openSUSE-Leap-15.3-JeOS.x86_64-kvm-and-xen.qcow2 __IMG__
 host	guestfish --rw -a __IMG__ -i rm '/usr/lib/systemd/system/systemd-journald.service'
 host	guestfish --rw -a __IMG__ -i rm /etc/systemd/system/default.target.wants/jeos-firstboot.service
 host	virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty(a)tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
@@ -126,7 +126,7 @@ sleep	1
 test	OpenSUSE Tumbleweed aarch64
 
 temp	IMG
-host	wget http://download.opensuse.org/ports/aarch64/tumbleweed/appliances/openSUSE-Tumbleweed-ARM-JeOS-efi.aarch64.raw.xz -O - | xzcat > __IMG__
+host	xzcat __BASEPATH__/openSUSE-Tumbleweed-ARM-JeOS-efi.aarch64.raw.xz > __IMG__
 host	virt-edit -a __IMG__ -m /dev/sda3 /usr/lib/systemd/system/serial-getty(a).service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 %I $TERM/g'
 host	guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
 
@@ -153,7 +153,7 @@ test	OpenSUSE Tumbleweed armv7l
 temp	IMG
 temp	ZIMAGE
 temp	INITRD
-host	wget http://download.opensuse.org/ports/armv7hl/tumbleweed/appliances/openSUSE-Tumbleweed-ARM-JeOS-efi.armv7l.raw.xz -O - | xz -d > __IMG__
+host	xzcat __BASEPATH__/openSUSE-Tumbleweed-ARM-JeOS-efi.armv7l.raw.xz -O > __IMG__
 host	guestfish -a __IMG__ -i download /boot/zImage __ZIMAGE__
 host	guestfish -a __IMG__ -i download /boot/initrd __INITRD__
 host	virt-edit -a __IMG__ -m /dev/sda3 /usr/lib/systemd/system/serial-getty(a).service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 %I $TERM/g'
@@ -179,7 +179,7 @@ sleep	1
 test	OpenSUSE Tumbleweed
 
 temp	IMG
-host	wget https://download.opensuse.org/tumbleweed/appliances/openSUSE-Tumbleweed-JeOS.x86_64-kvm-and-xen.qcow2 -O __IMG__
+host	qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/openSUSE-Tumbleweed-JeOS.x86_64-kvm-and-xen.qcow2 __IMG__
 host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/systemd-journald.service
 host	guestfish --rw -a __IMG__ -i rm /etc/systemd/system/default.target.wants/jeos-firstboot.service
 host	guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/serial-getty(a).service
diff --git a/test/distro/ubuntu b/test/distro/ubuntu
index 20b861a..6e094d7 100644
--- a/test/distro/ubuntu
+++ b/test/distro/ubuntu
@@ -1,4 +1,4 @@
-<# SPDX-License-Identifier: AGPL-3.0-or-later
+# SPDX-License-Identifier: AGPL-3.0-or-later
 #
 # PASST - Plug A Simple Socket Transport
 #  for qemu/UNIX domain socket mode
@@ -12,7 +12,7 @@
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
 temp	PIDFILE
-htools	wget virt-edit guestfish head sed cat kill qemu-system-x86_64 qemu-system-ppc64 qemu-system-s390x
+htools	qemu-img virt-edit guestfish head sed cat kill qemu-system-x86_64 qemu-system-ppc64 qemu-system-s390x
 
 # Quick pasta test: send message from init to ns, and from ns to init
 def	distro_quick_pasta_test
@@ -44,7 +44,7 @@ hout	GUEST_FILES ls -1 *.c *.h *.sh passt.1 qrap.1 Makefile | tr '\n' ' '; echo
 test	Ubuntu 14.04.5 LTS (Trusty Tahr), amd64
 
 temp	IMG
-host	wget https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img -O __IMG__
+host	qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/trusty-server-cloudimg-amd64-disk1.img __IMG__
 host	virt-edit -a __IMG__ /etc/init/ttyS0.conf -e 's/\/getty/\/getty --autologin root/'
 host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-config.conf
 host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-final.conf
@@ -77,7 +77,7 @@ hout	PID cat __PIDFILE__
 test	Ubuntu 14.04.5 LTS (Trusty Tahr), i386
 
 temp	IMG
-host	wget https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-i386-disk1.img -O __IMG__
+host	qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/trusty-server-cloudimg-i386-disk1.img __IMG__
 host	virt-edit -a __IMG__ /etc/init/ttyS0.conf -e 's/\/getty/\/getty --autologin root/'
 host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-config.conf
 host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-final.conf
@@ -107,7 +107,7 @@ sleep	1
 test	Ubuntu 14.04.5 LTS (Trusty Tahr), ppc64le
 
 temp	IMG
-host	wget https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-ppc64el-disk1.img -O __IMG__
+host	qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/trusty-server-cloudimg-ppc64el-disk1.img __IMG__
 host	virt-edit -a __IMG__ /etc/init/hvc0.conf -e 's/\/getty/\/getty --autologin root/'
 host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-config.conf
 host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-final.conf
@@ -140,7 +140,7 @@ host	echo
 test	Ubuntu 16.04 LTS (Xenial Xerus), ppc64 (be)
 
 temp	IMG
-host	wget https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-powerpc-disk1.img -O __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(a).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
@@ -170,7 +170,7 @@ host	echo
 
 test	Ubuntu 22.04 (Jammy Jellyfish), s390x
 temp	IMG
-host	wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-s390x.img -O __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(a).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
-- 
@@ -1,4 +1,4 @@
-<# SPDX-License-Identifier: AGPL-3.0-or-later
+# SPDX-License-Identifier: AGPL-3.0-or-later
 #
 # PASST - Plug A Simple Socket Transport
 #  for qemu/UNIX domain socket mode
@@ -12,7 +12,7 @@
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
 temp	PIDFILE
-htools	wget virt-edit guestfish head sed cat kill qemu-system-x86_64 qemu-system-ppc64 qemu-system-s390x
+htools	qemu-img virt-edit guestfish head sed cat kill qemu-system-x86_64 qemu-system-ppc64 qemu-system-s390x
 
 # Quick pasta test: send message from init to ns, and from ns to init
 def	distro_quick_pasta_test
@@ -44,7 +44,7 @@ hout	GUEST_FILES ls -1 *.c *.h *.sh passt.1 qrap.1 Makefile | tr '\n' ' '; echo
 test	Ubuntu 14.04.5 LTS (Trusty Tahr), amd64
 
 temp	IMG
-host	wget https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img -O __IMG__
+host	qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/trusty-server-cloudimg-amd64-disk1.img __IMG__
 host	virt-edit -a __IMG__ /etc/init/ttyS0.conf -e 's/\/getty/\/getty --autologin root/'
 host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-config.conf
 host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-final.conf
@@ -77,7 +77,7 @@ hout	PID cat __PIDFILE__
 test	Ubuntu 14.04.5 LTS (Trusty Tahr), i386
 
 temp	IMG
-host	wget https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-i386-disk1.img -O __IMG__
+host	qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/trusty-server-cloudimg-i386-disk1.img __IMG__
 host	virt-edit -a __IMG__ /etc/init/ttyS0.conf -e 's/\/getty/\/getty --autologin root/'
 host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-config.conf
 host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-final.conf
@@ -107,7 +107,7 @@ sleep	1
 test	Ubuntu 14.04.5 LTS (Trusty Tahr), ppc64le
 
 temp	IMG
-host	wget https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-ppc64el-disk1.img -O __IMG__
+host	qemu-img create -f qcow2 -F qcow2 -b __BASEPATH__/trusty-server-cloudimg-ppc64el-disk1.img __IMG__
 host	virt-edit -a __IMG__ /etc/init/hvc0.conf -e 's/\/getty/\/getty --autologin root/'
 host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-config.conf
 host	guestfish --rw -a __IMG__ -i rm /etc/init/cloud-final.conf
@@ -140,7 +140,7 @@ host	echo
 test	Ubuntu 16.04 LTS (Xenial Xerus), ppc64 (be)
 
 temp	IMG
-host	wget https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-powerpc-disk1.img -O __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(a).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
@@ -170,7 +170,7 @@ host	echo
 
 test	Ubuntu 22.04 (Jammy Jellyfish), s390x
 temp	IMG
-host	wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-s390x.img -O __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(a).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
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 14/15] tests: Prepare distro images during asset build phase
  2022-07-06  7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
                   ` (12 preceding siblings ...)
  2022-07-06  7:29 ` [PATCH 13/15] tests: Move distro image download to asset build makefile David Gibson
@ 2022-07-06  7:29 ` David Gibson
  2022-07-06  7:29 ` [PATCH 15/15] tests: Remove unused DNS6 calculation from fedora tests David Gibson
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 24+ messages in thread
From: David Gibson @ 2022-07-06  7:29 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 46388 bytes --]

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(a)gibson.dropbear.id.au>
---
 test/.gitignore            |   1 +
 test/Makefile              |  22 +++-
 test/distro/debian         | 125 +++-------------------
 test/distro/fedora         | 205 ++++---------------------------------
 test/distro/ubuntu         |  25 +----
 test/prepare-distro-img.sh |  18 ++++
 6 files changed, 70 insertions(+), 326 deletions(-)
 create mode 100755 test/prepare-distro-img.sh

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..e2d10a8 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
+	$(DEBIAN_IMGS) $(FEDORA_IMGS) $(UBUNTU_IMGS)
+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(a)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(a)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(a).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(a)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(a).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(a)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(a).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(a).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(a)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(a).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(a)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(a).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(a).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(a)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(a).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(a)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(a).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(a).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(a)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(a).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(a)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(a)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(a).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(a)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(a).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(a)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(a).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(a).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(a).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(a).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(a).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(a).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(a).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(a).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(a).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(a).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(a).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(a).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(a).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(a).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(a).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(a).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(a).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(a).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(a).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
-- 
@@ -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(a).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
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 15/15] tests: Remove unused DNS6 calculation from fedora tests
  2022-07-06  7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
                   ` (13 preceding siblings ...)
  2022-07-06  7:29 ` [PATCH 14/15] tests: Prepare distro images during asset build phase David Gibson
@ 2022-07-06  7:29 ` David Gibson
  2022-07-07 14:53 ` [PATCH 00/15] Test fixes, batch 4 Stefano Brivio
  2022-07-13 23:39 ` Stefano Brivio
  16 siblings, 0 replies; 24+ messages in thread
From: David Gibson @ 2022-07-06  7:29 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 2602 bytes --]

The Fedora test file extracts some information from the host resolv.conf
into a DNS6 variable which is then never used.  Remove this unnecessary
step, which is presumably a leftover from an earlier iteration.

This was the only user of 'head' and 'sed' in the test file, so those can
also be removed from the required tools.  The debian and ubuntu test files
also listed 'head' and 'sed' as tools, although they don't use them,
I'm guessing because of an earlier version which had the same DNS6 code.
Remove those as well.

The opensuse test file still actually uses DNS6, so leave it there for now.
The DNS handling and network config handling for SuSE looks to be kind of
broken, but fixing that is a job for another day.

Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
 test/distro/debian | 2 +-
 test/distro/fedora | 3 +--
 test/distro/ubuntu | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/test/distro/debian b/test/distro/debian
index ad0ec30..abbbaa2 100644
--- a/test/distro/debian
+++ b/test/distro/debian
@@ -12,7 +12,7 @@
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
 temp	PIDFILE
-htools	head sed cat kill qemu-system-x86_64 qemu-system-aarch64 qemu-system-ppc64
+htools	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
diff --git a/test/distro/fedora b/test/distro/fedora
index f225a8e..56805c5 100644
--- a/test/distro/fedora
+++ b/test/distro/fedora
@@ -12,7 +12,7 @@
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
 temp	PIDFILE
-htools	head sed cat kill qemu-system-x86_64
+htools	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
@@ -59,7 +59,6 @@ endef
 hostb	./passt -P __PIDFILE__ &
 sleep	1
 host	echo
-hout	DNS6 sed -n 's/^nameserver \([^:]*:\)\([^%]*\).*/\1\2/p' /etc/resolv.conf | head -1
 
 test	Fedora 26, x86_64
 
diff --git a/test/distro/ubuntu b/test/distro/ubuntu
index 3a80e37..b9a0446 100644
--- a/test/distro/ubuntu
+++ b/test/distro/ubuntu
@@ -12,7 +12,7 @@
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
 temp	PIDFILE
-htools	qemu-img virt-edit guestfish head sed cat kill qemu-system-x86_64 qemu-system-ppc64 qemu-system-s390x
+htools	qemu-img virt-edit guestfish cat kill qemu-system-x86_64 qemu-system-ppc64 qemu-system-s390x
 
 # Quick pasta test: send message from init to ns, and from ns to init
 def	distro_quick_pasta_test
-- 
@@ -12,7 +12,7 @@
 # Author: Stefano Brivio <sbrivio(a)redhat.com>
 
 temp	PIDFILE
-htools	qemu-img virt-edit guestfish head sed cat kill qemu-system-x86_64 qemu-system-ppc64 qemu-system-s390x
+htools	qemu-img virt-edit guestfish cat kill qemu-system-x86_64 qemu-system-ppc64 qemu-system-s390x
 
 # Quick pasta test: send message from init to ns, and from ns to init
 def	distro_quick_pasta_test
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/15] Test fixes, batch 4
  2022-07-06  7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
                   ` (14 preceding siblings ...)
  2022-07-06  7:29 ` [PATCH 15/15] tests: Remove unused DNS6 calculation from fedora tests David Gibson
@ 2022-07-07 14:53 ` Stefano Brivio
  2022-07-11  9:42   ` Stefano Brivio
  2022-07-13 23:39 ` Stefano Brivio
  16 siblings, 1 reply; 24+ messages in thread
From: Stefano Brivio @ 2022-07-07 14:53 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 1410 bytes --]

On Wed,  6 Jul 2022 17:28:54 +1000
David Gibson <david(a)gibson.dropbear.id.au> wrote:

> This set supersedes the previous "batch 3" which had some problems.
> This fixes a number of problems I've encountered trying to run the
> passt tests on a Fedora host.  It also makes a number of small
> cleanups and improvements to the test running framework.
> 
> David Gibson (14):
>   Handle the case of a DNS server on localhost
>   tests: qemu-system-ppc64le isn't a thing
>   Invoke specific qemu-system-* binaries
>   tests: Introduce makefile for building test assets
>   tests: Move mbuto download and execution to asset build
>   tests: Search multiple places for aarch64 EDK2 bios image
>   Clean up passt.pid file
>   tests: Remove unused set_mode() function
>   tests: Remove not-very-useful "req" directive
>   tests: Don't automatically traverse directories of test files
>   tests: Explicitly list test files in test/run, remove "onlyfor"
>     support
>   tests: Move distro image download to asset build makefile
>   tests: Prepare distro images during asset build phase
>   tests: Remove unused DNS6 calculation from fedora tests
> 
> Stefano Brivio (1):
>   test: Add external mbuto profile, drop udhcpc, and switch to it

Thanks a lot, it all looks good to me, I would just drop 1/15 (mbuto
profile) as I already replaced it with a v2 patch.

I'm running the tests now, let's see. :)

-- 
Stefano


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/15] Test fixes, batch 4
  2022-07-07 14:53 ` [PATCH 00/15] Test fixes, batch 4 Stefano Brivio
@ 2022-07-11  9:42   ` Stefano Brivio
  2022-07-12  8:26     ` David Gibson
  0 siblings, 1 reply; 24+ messages in thread
From: Stefano Brivio @ 2022-07-11  9:42 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 268 bytes --]

On Thu, 7 Jul 2022 16:53:11 +0200
Stefano Brivio <sbrivio(a)redhat.com> wrote:

> [...]
>
> I'm running the tests now, let's see. :)

For some reason qemu refuses to boot the OpenSUSE Leap 15.1 image made
this way, I haven't really looked into that yet.

-- 
Stefano


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/15] Test fixes, batch 4
  2022-07-11  9:42   ` Stefano Brivio
@ 2022-07-12  8:26     ` David Gibson
  2022-07-12 12:13       ` Stefano Brivio
  0 siblings, 1 reply; 24+ messages in thread
From: David Gibson @ 2022-07-12  8:26 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 986 bytes --]

On Mon, Jul 11, 2022 at 11:42:09AM +0200, Stefano Brivio wrote:
> On Thu, 7 Jul 2022 16:53:11 +0200
> Stefano Brivio <sbrivio(a)redhat.com> wrote:
> 
> > [...]
> >
> > I'm running the tests now, let's see. :)
> 
> For some reason qemu refuses to boot the OpenSUSE Leap 15.1 image made
> this way, I haven't really looked into that yet.

Huh.  I ran into a bunch of problems with the OpenSUSE Leap images
when I tried to do the image preparation stuff for them.  But when I
rolled that back and just did the image download separate, it seemed
to work for me.  Well... that is, it boots up and executes commands
okay.  The test fails, I think because I have no IPv6 nameservers on
the host, which is messing with the scripting here, but the same thing
happens before the change to image downloads.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/15] Test fixes, batch 4
  2022-07-12  8:26     ` David Gibson
@ 2022-07-12 12:13       ` Stefano Brivio
  2022-07-13  2:11         ` David Gibson
  0 siblings, 1 reply; 24+ messages in thread
From: Stefano Brivio @ 2022-07-12 12:13 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 1706 bytes --]

On Tue, 12 Jul 2022 18:26:37 +1000
David Gibson <david(a)gibson.dropbear.id.au> wrote:

> On Mon, Jul 11, 2022 at 11:42:09AM +0200, Stefano Brivio wrote:
> > On Thu, 7 Jul 2022 16:53:11 +0200
> > Stefano Brivio <sbrivio(a)redhat.com> wrote:
> >   
> > > [...]
> > >
> > > I'm running the tests now, let's see. :)  
> > 
> > For some reason qemu refuses to boot the OpenSUSE Leap 15.1 image made
> > this way, I haven't really looked into that yet.  
> 
> Huh.  I ran into a bunch of problems with the OpenSUSE Leap images
> when I tried to do the image preparation stuff for them.  But when I
> rolled that back and just did the image download separate, it seemed
> to work for me.  Well... that is, it boots up and executes commands
> okay.

Ah, wait a moment, did you perhaps forget to commit the
distro/opensuse part for patch 14/15? The changes for distro/debian and
distro/fedora in that patch look complete, distro/ubuntu has changes
just for two versions, and distro/opensuse is not changed by that patch
at all.

It took me a bit to figure out because the prepared images actually
work, but the test doesn't use them -- it's trying to use a temporary
file that doesn't exist anymore.

> The test fails, I think because I have no IPv6 nameservers on
> the host, which is messing with the scripting here, but the same thing
> happens before the change to image downloads.

If you're wondering why I went that way with OpenSUSE: I was too lazy
to find out how to configure the interface in a "proper" way, so I just
bring eth0 up, which sets up IPv6 addresses and routes via NDP. I guess
it simply needs:

  wicked ifup eth0

and then we can use both IPv4 and IPv6, but I haven't tried.

-- 
Stefano


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/15] Test fixes, batch 4
  2022-07-12 12:13       ` Stefano Brivio
@ 2022-07-13  2:11         ` David Gibson
  2022-07-13  6:04           ` Stefano Brivio
  0 siblings, 1 reply; 24+ messages in thread
From: David Gibson @ 2022-07-13  2:11 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 2613 bytes --]

On Tue, Jul 12, 2022 at 02:13:07PM +0200, Stefano Brivio wrote:
> On Tue, 12 Jul 2022 18:26:37 +1000
> David Gibson <david(a)gibson.dropbear.id.au> wrote:
> 
> > On Mon, Jul 11, 2022 at 11:42:09AM +0200, Stefano Brivio wrote:
> > > On Thu, 7 Jul 2022 16:53:11 +0200
> > > Stefano Brivio <sbrivio(a)redhat.com> wrote:
> > >   
> > > > [...]
> > > >
> > > > I'm running the tests now, let's see. :)  
> > > 
> > > For some reason qemu refuses to boot the OpenSUSE Leap 15.1 image made
> > > this way, I haven't really looked into that yet.  
> > 
> > Huh.  I ran into a bunch of problems with the OpenSUSE Leap images
> > when I tried to do the image preparation stuff for them.  But when I
> > rolled that back and just did the image download separate, it seemed
> > to work for me.  Well... that is, it boots up and executes commands
> > okay.
> 
> Ah, wait a moment, did you perhaps forget to commit the
> distro/opensuse part for patch 14/15? The changes for distro/debian and
> distro/fedora in that patch look complete, distro/ubuntu has changes
> just for two versions, and distro/opensuse is not changed by that patch
> at all.

No.  I fiddled around with handling the SuSE and older Ubuntu images,
got bogged down in details and decided to postpone that until a later
time.  So I'm deliberately only handling the images which can be
handled by the common script I added there for now.

> It took me a bit to figure out because the prepared images actually
> work, but the test doesn't use them -- it's trying to use a temporary
> file that doesn't exist anymore.

Um, what prepared images? AFAICT my Makefile only generates prepared
images for Debian, Fedora and the newer Ubuntu cases.  For SuSE and
the older Ubuntu the test scripts now have qemu-img commands creating
temporary images from the pre-downlaoded images (added in patch 13/15).


> > The test fails, I think because I have no IPv6 nameservers on
> > the host, which is messing with the scripting here, but the same thing
> > happens before the change to image downloads.
> 
> If you're wondering why I went that way with OpenSUSE: I was too lazy
> to find out how to configure the interface in a "proper" way, so I just
> bring eth0 up, which sets up IPv6 addresses and routes via NDP. I guess
> it simply needs:
> 
>   wicked ifup eth0
> 
> and then we can use both IPv4 and IPv6, but I haven't tried.

Right.  Maybe I'll look at that if I get time.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/15] Test fixes, batch 4
  2022-07-13  2:11         ` David Gibson
@ 2022-07-13  6:04           ` Stefano Brivio
  2022-07-13 10:19             ` David Gibson
  0 siblings, 1 reply; 24+ messages in thread
From: Stefano Brivio @ 2022-07-13  6:04 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 2280 bytes --]

On Wed, 13 Jul 2022 12:11:24 +1000
David Gibson <david(a)gibson.dropbear.id.au> wrote:

> On Tue, Jul 12, 2022 at 02:13:07PM +0200, Stefano Brivio wrote:
> > On Tue, 12 Jul 2022 18:26:37 +1000
> > David Gibson <david(a)gibson.dropbear.id.au> wrote:
> >   
> > > On Mon, Jul 11, 2022 at 11:42:09AM +0200, Stefano Brivio wrote:  
> > > > On Thu, 7 Jul 2022 16:53:11 +0200
> > > > Stefano Brivio <sbrivio(a)redhat.com> wrote:
> > > >     
> > > > > [...]
> > > > >
> > > > > I'm running the tests now, let's see. :)    
> > > > 
> > > > For some reason qemu refuses to boot the OpenSUSE Leap 15.1 image made
> > > > this way, I haven't really looked into that yet.    
> > > 
> > > Huh.  I ran into a bunch of problems with the OpenSUSE Leap images
> > > when I tried to do the image preparation stuff for them.  But when I
> > > rolled that back and just did the image download separate, it seemed
> > > to work for me.  Well... that is, it boots up and executes commands
> > > okay.  
> > 
> > Ah, wait a moment, did you perhaps forget to commit the
> > distro/opensuse part for patch 14/15? The changes for distro/debian and
> > distro/fedora in that patch look complete, distro/ubuntu has changes
> > just for two versions, and distro/opensuse is not changed by that patch
> > at all.  
> 
> No.  I fiddled around with handling the SuSE and older Ubuntu images,
> got bogged down in details and decided to postpone that until a later
> time.  So I'm deliberately only handling the images which can be
> handled by the common script I added there for now.
> 
> > It took me a bit to figure out because the prepared images actually
> > work, but the test doesn't use them -- it's trying to use a temporary
> > file that doesn't exist anymore.  
> 
> Um, what prepared images? AFAICT my Makefile only generates prepared
> images for Debian, Fedora and the newer Ubuntu cases.  For SuSE and
> the older Ubuntu the test scripts now have qemu-img commands creating
> temporary images from the pre-downlaoded images (added in patch 13/15).

Oops, right, I missed that, I was confused by the fact that the image
didn't exist.

I guess DOWNLOAD_ASSETS (from patch 13/15) in test/Makefile should also
include OPENSUSE_IMGS, that's all. Added, re-running the whole thing
now.

-- 
Stefano


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/15] Test fixes, batch 4
  2022-07-13  6:04           ` Stefano Brivio
@ 2022-07-13 10:19             ` David Gibson
  0 siblings, 0 replies; 24+ messages in thread
From: David Gibson @ 2022-07-13 10:19 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 3161 bytes --]

On Wed, Jul 13, 2022 at 08:04:14AM +0200, Stefano Brivio wrote:
> On Wed, 13 Jul 2022 12:11:24 +1000
> David Gibson <david(a)gibson.dropbear.id.au> wrote:
> 
> > On Tue, Jul 12, 2022 at 02:13:07PM +0200, Stefano Brivio wrote:
> > > On Tue, 12 Jul 2022 18:26:37 +1000
> > > David Gibson <david(a)gibson.dropbear.id.au> wrote:
> > >   
> > > > On Mon, Jul 11, 2022 at 11:42:09AM +0200, Stefano Brivio wrote:  
> > > > > On Thu, 7 Jul 2022 16:53:11 +0200
> > > > > Stefano Brivio <sbrivio(a)redhat.com> wrote:
> > > > >     
> > > > > > [...]
> > > > > >
> > > > > > I'm running the tests now, let's see. :)    
> > > > > 
> > > > > For some reason qemu refuses to boot the OpenSUSE Leap 15.1 image made
> > > > > this way, I haven't really looked into that yet.    
> > > > 
> > > > Huh.  I ran into a bunch of problems with the OpenSUSE Leap images
> > > > when I tried to do the image preparation stuff for them.  But when I
> > > > rolled that back and just did the image download separate, it seemed
> > > > to work for me.  Well... that is, it boots up and executes commands
> > > > okay.  
> > > 
> > > Ah, wait a moment, did you perhaps forget to commit the
> > > distro/opensuse part for patch 14/15? The changes for distro/debian and
> > > distro/fedora in that patch look complete, distro/ubuntu has changes
> > > just for two versions, and distro/opensuse is not changed by that patch
> > > at all.  
> > 
> > No.  I fiddled around with handling the SuSE and older Ubuntu images,
> > got bogged down in details and decided to postpone that until a later
> > time.  So I'm deliberately only handling the images which can be
> > handled by the common script I added there for now.
> > 
> > > It took me a bit to figure out because the prepared images actually
> > > work, but the test doesn't use them -- it's trying to use a temporary
> > > file that doesn't exist anymore.  
> > 
> > Um, what prepared images? AFAICT my Makefile only generates prepared
> > images for Debian, Fedora and the newer Ubuntu cases.  For SuSE and
> > the older Ubuntu the test scripts now have qemu-img commands creating
> > temporary images from the pre-downlaoded images (added in patch 13/15).
> 
> Oops, right, I missed that, I was confused by the fact that the image
> didn't exist.
> 
> I guess DOWNLOAD_ASSETS (from patch 13/15) in test/Makefile should also
> include OPENSUSE_IMGS, that's all. Added, re-running the whole thing
> now.

Ah, dammit, you're right.  In fact OPENSUSE_IMGS is in the list in
13/15, then it's incorrectly removed in 14/15.  IIRC, I took it off
the download list, because I got some weird results which I thought
meant that just the download patch was breaking the opensuse tests.
Eventually realized I was misinterpreting the results, but forgot to
put it back in the list.  Didn't catch it because the downloads were
so slow I never removed the images to try the build from scratch.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/15] Test fixes, batch 4
  2022-07-06  7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
                   ` (15 preceding siblings ...)
  2022-07-07 14:53 ` [PATCH 00/15] Test fixes, batch 4 Stefano Brivio
@ 2022-07-13 23:39 ` Stefano Brivio
  16 siblings, 0 replies; 24+ messages in thread
From: Stefano Brivio @ 2022-07-13 23:39 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 1451 bytes --]

On Wed,  6 Jul 2022 17:28:54 +1000
David Gibson <david(a)gibson.dropbear.id.au> wrote:

> This set supersedes the previous "batch 3" which had some problems.
> This fixes a number of problems I've encountered trying to run the
> passt tests on a Fedora host.  It also makes a number of small
> cleanups and improvements to the test running framework.
> 
> David Gibson (14):
>   Handle the case of a DNS server on localhost
>   tests: qemu-system-ppc64le isn't a thing
>   Invoke specific qemu-system-* binaries
>   tests: Introduce makefile for building test assets
>   tests: Move mbuto download and execution to asset build
>   tests: Search multiple places for aarch64 EDK2 bios image
>   Clean up passt.pid file
>   tests: Remove unused set_mode() function
>   tests: Remove not-very-useful "req" directive
>   tests: Don't automatically traverse directories of test files
>   tests: Explicitly list test files in test/run, remove "onlyfor"
>     support
>   tests: Move distro image download to asset build makefile
>   tests: Prepare distro images during asset build phase
>   tests: Remove unused DNS6 calculation from fedora tests
> 
> Stefano Brivio (1):
>   test: Add external mbuto profile, drop udhcpc, and switch to it

Applied without 1/15 (superseded) and with minimal modifications to
13/15 (OPENSUSE_IMGS added to download assets in Makefile, dropped
spurious -O options from xzcat command in distro/opensuse). Thanks!

-- 
Stefano


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2022-07-13 23:39 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06  7:28 [PATCH 00/15] Test fixes, batch 4 David Gibson
2022-07-06  7:28 ` [PATCH 01/15] test: Add external mbuto profile, drop udhcpc, and switch to it David Gibson
2022-07-06  7:28 ` [PATCH 02/15] Handle the case of a DNS server on localhost David Gibson
2022-07-06  7:28 ` [PATCH 03/15] tests: qemu-system-ppc64le isn't a thing David Gibson
2022-07-06  7:28 ` [PATCH 04/15] Invoke specific qemu-system-* binaries David Gibson
2022-07-06  7:28 ` [PATCH 05/15] tests: Introduce makefile for building test assets David Gibson
2022-07-06  7:29 ` [PATCH 06/15] tests: Move mbuto download and execution to asset build David Gibson
2022-07-06  7:29 ` [PATCH 07/15] tests: Search multiple places for aarch64 EDK2 bios image David Gibson
2022-07-06  7:29 ` [PATCH 08/15] Clean up passt.pid file David Gibson
2022-07-06  7:29 ` [PATCH 09/15] tests: Remove unused set_mode() function David Gibson
2022-07-06  7:29 ` [PATCH 10/15] tests: Remove not-very-useful "req" directive David Gibson
2022-07-06  7:29 ` [PATCH 11/15] tests: Don't automatically traverse directories of test files David Gibson
2022-07-06  7:29 ` [PATCH 12/15] tests: Explicitly list test files in test/run, remove "onlyfor" support David Gibson
2022-07-06  7:29 ` [PATCH 13/15] tests: Move distro image download to asset build makefile David Gibson
2022-07-06  7:29 ` [PATCH 14/15] tests: Prepare distro images during asset build phase David Gibson
2022-07-06  7:29 ` [PATCH 15/15] tests: Remove unused DNS6 calculation from fedora tests David Gibson
2022-07-07 14:53 ` [PATCH 00/15] Test fixes, batch 4 Stefano Brivio
2022-07-11  9:42   ` Stefano Brivio
2022-07-12  8:26     ` David Gibson
2022-07-12 12:13       ` Stefano Brivio
2022-07-13  2:11         ` David Gibson
2022-07-13  6:04           ` Stefano Brivio
2022-07-13 10:19             ` David Gibson
2022-07-13 23:39 ` Stefano Brivio

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).