From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top
Subject: [PATCH 3/5] tests: Cache downloaded guest images
Date: Thu, 23 Jun 2022 12:22:56 +1000 [thread overview]
Message-ID: <20220623022258.4033116-4-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20220623022258.4033116-1-david@gibson.dropbear.id.au>
[-- Attachment #1: Type: text/plain, Size: 31378 bytes --]
The "distro" tests download a lot of distro guest images. This is done
from scratch, from the primary upstream site, on every single run. For
those of us network-distant from those primary sites, this gets *very*
tedious.
Add an extra testing command "testimg" which will make a scratch image,
while caching the download of the original unmodified image. The approach
isn't entirely bulletproof, but it should be good enough for our purposes.
In addition to caching the raw downloaded images, this also makes the
temporary qcow2 images use the raw image as a backing file, which means
less space consumed in /tmp if the temporary image isn't cleaned up.
Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
test/.gitignore | 1 +
test/distro/debian | 35 ++++++++++-----------------
test/distro/fedora | 56 +++++++++++++++-----------------------------
test/distro/opensuse | 12 ++++------
test/distro/ubuntu | 17 +++++---------
test/lib/test | 12 ++++++++++
test/run | 4 ++++
7 files changed, 59 insertions(+), 78 deletions(-)
diff --git a/test/.gitignore b/test/.gitignore
index edb2221..3ca2ae2 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1,2 +1,3 @@
perf.js
test_logs/
+test_imgs/
diff --git a/test/distro/debian b/test/distro/debian
index ce3b9e7..6c25f22 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 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
@@ -44,8 +44,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__
+tempimg IMG https://cloud.debian.org/images/cloud/OpenStack/archive/8.11.0/debian-8.11.0-openstack-amd64.qcow2
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
@@ -75,8 +74,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__
+tempimg IMG https://cloud.debian.org/images/cloud/stretch/daily/20200210-166/debian-9-nocloud-amd64-daily-20200210-166.qcow2
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/
@@ -99,8 +97,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__
+tempimg IMG https://cloud.debian.org/images/cloud/buster/latest/debian-10-nocloud-amd64.qcow2
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/
@@ -123,8 +120,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__
+tempimg IMG https://cloud.debian.org/images/cloud/buster/latest/debian-10-generic-arm64.qcow2
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
@@ -154,8 +150,7 @@ 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__
+tempimg IMG https://cloud.debian.org/images/cloud/buster/latest/debian-10-generic-ppc64el.qcow2
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
@@ -187,8 +182,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__
+tempimg IMG https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-nocloud-amd64.qcow2
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/
@@ -209,8 +203,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__
+tempimg IMG https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-generic-arm64.qcow2
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
@@ -238,8 +231,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__
+tempimg IMG https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-generic-ppc64el.qcow2
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
@@ -269,8 +261,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__
+tempimg IMG https://cloud.debian.org/images/cloud/sid/daily/latest/debian-sid-nocloud-amd64-daily.qcow2
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/
@@ -291,8 +282,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__
+tempimg IMG https://cloud.debian.org/images/cloud/sid/daily/latest/debian-sid-nocloud-arm64-daily.qcow2
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/
@@ -312,8 +302,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__
+tempimg IMG https://cloud.debian.org/images/cloud/sid/daily/latest/debian-sid-nocloud-ppc64el-daily.qcow2
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 2a8e3e9..904c987 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 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
@@ -65,8 +65,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__
+tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/26/CloudImages/x86_64/images/Fedora-Cloud-Base-26-1.5.x86_64.qcow2
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
@@ -95,8 +94,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__
+tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/27/CloudImages/x86_64/images/Fedora-Cloud-Base-27-1.6.x86_64.qcow2
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
@@ -122,8 +120,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__
+tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/28/Cloud/x86_64/images/Fedora-Cloud-Base-28-1.1.x86_64.qcow2
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
@@ -149,8 +146,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__
+tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/28/Cloud/aarch64/images/Fedora-Cloud-Base-28-1.1.aarch64.qcow2
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
@@ -178,8 +174,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__
+tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/29/Cloud/x86_64/images/Fedora-Cloud-Base-29-1.2.x86_64.qcow2
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
@@ -204,8 +199,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__
+tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/29/Cloud/aarch64/images/Fedora-Cloud-Base-29-1.2.aarch64.qcow2
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
@@ -233,8 +227,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__
+tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/30/Cloud/x86_64/images/Fedora-Cloud-Base-30-1.2.x86_64.qcow2
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
@@ -259,8 +252,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__
+tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/30/Cloud/aarch64/images/Fedora-Cloud-Base-30-1.2.aarch64.qcow2
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
@@ -288,8 +280,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__
+tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/31/Cloud/x86_64/images/Fedora-Cloud-Base-31-1.9.x86_64.qcow2
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
@@ -314,8 +305,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__
+tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/31/Cloud/aarch64/images/Fedora-Cloud-Base-31-1.9.aarch64.qcow2
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
@@ -343,8 +333,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__
+tempimg IMG https://download.fedoraproject.org/pub/fedora/linux/releases/32/Cloud/x86_64/images/Fedora-Cloud-Base-32-1.6.x86_64.qcow2
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
@@ -369,8 +358,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__
+tempimg IMG https://download.fedoraproject.org/pub/fedora/linux/releases/32/Cloud/aarch64/images/Fedora-Cloud-Base-32-1.6.aarch64.qcow2
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
@@ -398,8 +386,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__
+tempimg IMG https://download.fedoraproject.org/pub/fedora/linux/releases/33/Cloud/x86_64/images/Fedora-Cloud-Base-33-1.2.x86_64.qcow2
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
@@ -424,8 +411,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__
+tempimg IMG https://download.fedoraproject.org/pub/fedora/linux/releases/33/Cloud/aarch64/images/Fedora-Cloud-Base-33-1.2.aarch64.qcow2
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
@@ -453,8 +439,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__
+tempimg IMG https://download.fedoraproject.org/pub/fedora/linux//releases/34/Cloud/x86_64/images/Fedora-Cloud-Base-34-1.2.x86_64.qcow2
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
@@ -479,8 +464,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__
+tempimg IMG https://download.fedoraproject.org/pub/fedora/linux//releases/34/Cloud/aarch64/images/Fedora-Cloud-Base-34-1.2.aarch64.qcow2
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
@@ -508,8 +492,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__
+tempimg IMG https://download.fedoraproject.org/pub/fedora/linux/releases/35/Cloud/x86_64/images/Fedora-Cloud-Base-35-1.2.x86_64.qcow2
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
@@ -534,8 +517,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__
+tempimg IMG https://download.fedoraproject.org/pub/fedora/linux/releases/35/Cloud/aarch64/images/Fedora-Cloud-Base-35-1.2.aarch64.qcow2
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 132474b..617656d 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-x86_64 qemu-system-aarch64 xzcat tr
+htools virt-edit guestfish head sed cat kill kvm 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
@@ -44,8 +44,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__
+tempimg IMG https://download.opensuse.org/distribution/leap/15.1/jeos/openSUSE-Leap-15.1-JeOS.x86_64-kvm-and-xen.qcow2
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 +72,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__
+tempimg IMG https://download.opensuse.org/distribution/leap/15.2/appliances/openSUSE-Leap-15.2-JeOS.x86_64-kvm-and-xen.qcow2
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 +97,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__
+tempimg IMG https://download.opensuse.org/distribution/leap/15.3/appliances/openSUSE-Leap-15.3-JeOS.x86_64-kvm-and-xen.qcow2
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'
@@ -178,8 +177,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__
+tempimg IMG https://download.opensuse.org/tumbleweed/appliances/openSUSE-Tumbleweed-JeOS.x86_64-kvm-and-xen.qcow2
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..c8c3970 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-x86_64 qemu-system-ppc64 qemu-system-s390x
+htools 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
@@ -43,8 +43,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__
+tempimg IMG https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.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
@@ -76,8 +75,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__
+tempimg IMG https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-i386-disk1.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
@@ -106,8 +104,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__
+tempimg IMG https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-ppc64el-disk1.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
@@ -139,8 +136,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__
+tempimg IMG https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-powerpc-disk1.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
@@ -169,8 +165,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__
+tempimg IMG https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-s390x.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/lib/test b/test/lib/test
index 09e8340..cfb2886 100755
--- a/test/lib/test
+++ b/test/lib/test
@@ -128,6 +128,18 @@ test_one_line() {
TEST_ONE_subs="$(list_add_pair "${TEST_ONE_subs}" "__${__arg}__" "${__tmpfile}")"
TEST_ONE_dirclean="$(list_add "${TEST_ONE_dirclean}" "${__tmpfile}")"
;;
+ "tempimg")
+ __varname="${__arg%% *}"
+ __url="${__arg#* }"
+ __tmpfile="$(mktemp)"
+ TEST_ONE_subs="$(list_add_pair "${TEST_ONE_subs}" "__${__varname}__" "${__tmpfile}")"
+ TEST_ONE_dirclean="$(list_add "${TEST_ONE_dirclean}" "${__tmpfile}")"
+ __cachename="${IMGDIR}/$(basename ${__url})"
+ pane_run HOST wget -c -O "${__cachename}" "${__url}"
+ pane_status HOST || TEST_ONE_nok=1
+ pane_run HOST qemu-img create -f qcow2 -F qcow2 -b "${__cachename}" "${__tmpfile}"
+ pane_status HOST || TEST_ONE_nok=1
+ ;;
"test")
[ ${TEST_ONE_perf_nok} -eq 0 ] || TEST_ONE_nok=1
[ ${TEST_ONE_nok} -eq 1 ] && status_test_fail
diff --git a/test/run b/test/run
index d9e5107..3d0ea79 100755
--- a/test/run
+++ b/test/run
@@ -26,6 +26,9 @@ BASEPATH=${BASEPATH:-"$(pwd)"}
LOGDIR=${LOGDIR:-"${BASEPATH}/test_logs"}
LOGFILE=${LOGFILE:-"${LOGDIR}/test.log"}
+# Location of downloaded guest image files
+IMGDIR=${IMGDIR:-"${BASEPATH}/test_imgs"}
+
# If set, skip typing delays while issuing commands in panes
FAST=${FAST:-1}
@@ -162,6 +165,7 @@ else
rm -rf "${LOGDIR}"
mkdir -p "${LOGDIR}"
:> "${LOGFILE}"
+ mkdir -p "${IMGDIR}"
trap "cleanup" EXIT
run_term
trap "" EXIT
--
@@ -26,6 +26,9 @@ BASEPATH=${BASEPATH:-"$(pwd)"}
LOGDIR=${LOGDIR:-"${BASEPATH}/test_logs"}
LOGFILE=${LOGFILE:-"${LOGDIR}/test.log"}
+# Location of downloaded guest image files
+IMGDIR=${IMGDIR:-"${BASEPATH}/test_imgs"}
+
# If set, skip typing delays while issuing commands in panes
FAST=${FAST:-1}
@@ -162,6 +165,7 @@ else
rm -rf "${LOGDIR}"
mkdir -p "${LOGDIR}"
:> "${LOGFILE}"
+ mkdir -p "${IMGDIR}"
trap "cleanup" EXIT
run_term
trap "" EXIT
--
2.36.1
next prev parent reply other threads:[~2022-06-23 2:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-23 2:22 [PATCH 0/5] Test fixes, batch 3 David Gibson
2022-06-23 2:22 ` [PATCH 1/5] tests: qemu-system-ppc64le isn't a thing David Gibson
2022-06-23 2:22 ` [PATCH 2/5] Invoke specific qemu-system-* binaries David Gibson
2022-06-28 5:25 ` David Gibson
2022-06-23 2:22 ` David Gibson [this message]
2022-06-23 2:22 ` [PATCH 4/5] Handle the case of a DNS server on localhost David Gibson
2022-06-23 2:22 ` [PATCH 5/5] tests: Try multiple paths for aarch64 EDK2 bios image David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220623022258.4033116-4-david@gibson.dropbear.id.au \
--to=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).