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.… -O __IMG__ +tempimg IMG https://cloud.debian.org/images/cloud/OpenStack/archive/8.11.0/debian-8.11.… 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@.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-n… -O __IMG__ +tempimg IMG https://cloud.debian.org/images/cloud/stretch/daily/20200210-166/debian-9-n… 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@.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… -O __IMG__ +tempimg IMG https://cloud.debian.org/images/cloud/buster/latest/debian-10-nocloud-amd64… 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@.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… -O __IMG__ +tempimg IMG https://cloud.debian.org/images/cloud/buster/latest/debian-10-generic-arm64… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service @@ -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-ppc64… -O __IMG__ +tempimg IMG https://cloud.debian.org/images/cloud/buster/latest/debian-10-generic-ppc64… 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@.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-amd… -O __IMG__ +tempimg IMG https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-nocloud-amd… 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@.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-arm… -O __IMG__ +tempimg IMG https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-generic-arm… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service @@ -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-ppc… -O __IMG__ +tempimg IMG https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-generic-ppc… 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@.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-a… -O __IMG__ +tempimg IMG https://cloud.debian.org/images/cloud/sid/daily/latest/debian-sid-nocloud-a… 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@.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-a… -O __IMG__ +tempimg IMG https://cloud.debian.org/images/cloud/sid/daily/latest/debian-sid-nocloud-a… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/ @@ -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-p… -O __IMG__ +tempimg IMG https://cloud.debian.org/images/cloud/sid/daily/latest/debian-sid-nocloud-p… 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@.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/Clou… -O __IMG__ +tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/26/Clou… 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@.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/Clou… -O __IMG__ +tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/27/Clou… 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@.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/Clou… -O __IMG__ +tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/28/Clou… 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@.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/Clou… -O __IMG__ +tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/28/Clou… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service @@ -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/Clou… -O __IMG__ +tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/29/Clou… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service @@ -204,8 +199,7 @@ sleep 1 test Fedora 29, aarch64 -temp IMG -host wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/29/Clou… -O __IMG__ +tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/29/Clou… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service @@ -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/Clou… -O __IMG__ +tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/30/Clou… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service @@ -259,8 +252,7 @@ sleep 1 test Fedora 30, aarch64 -temp IMG -host wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/30/Clou… -O __IMG__ +tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/30/Clou… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service @@ -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/Clou… -O __IMG__ +tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/31/Clou… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service @@ -314,8 +305,7 @@ sleep 1 test Fedora 31, aarch64 -temp IMG -host wget http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/31/Clou… -O __IMG__ +tempimg IMG http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/31/Clou… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service @@ -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_6… -O __IMG__ +tempimg IMG https://download.fedoraproject.org/pub/fedora/linux/releases/32/Cloud/x86_6… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service @@ -369,8 +358,7 @@ sleep 1 test Fedora 32, aarch64 -temp IMG -host wget https://download.fedoraproject.org/pub/fedora/linux/releases/32/Cloud/aarch… -O __IMG__ +tempimg IMG https://download.fedoraproject.org/pub/fedora/linux/releases/32/Cloud/aarch… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service @@ -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_6… -O __IMG__ +tempimg IMG https://download.fedoraproject.org/pub/fedora/linux/releases/33/Cloud/x86_6… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service @@ -424,8 +411,7 @@ sleep 1 test Fedora 33, aarch64 -temp IMG -host wget https://download.fedoraproject.org/pub/fedora/linux/releases/33/Cloud/aarch… -O __IMG__ +tempimg IMG https://download.fedoraproject.org/pub/fedora/linux/releases/33/Cloud/aarch… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service @@ -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_… -O __IMG__ +tempimg IMG https://download.fedoraproject.org/pub/fedora/linux//releases/34/Cloud/x86_… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service @@ -479,8 +464,7 @@ sleep 1 test Fedora 34, aarch64 -temp IMG -host wget https://download.fedoraproject.org/pub/fedora/linux//releases/34/Cloud/aarc… -O __IMG__ +tempimg IMG https://download.fedoraproject.org/pub/fedora/linux//releases/34/Cloud/aarc… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service @@ -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_6… -O __IMG__ +tempimg IMG https://download.fedoraproject.org/pub/fedora/linux/releases/35/Cloud/x86_6… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service @@ -534,8 +517,7 @@ sleep 1 test Fedora 35, aarch64 -temp IMG -host wget https://download.fedoraproject.org/pub/fedora/linux/releases/35/Cloud/aarch… -O __IMG__ +tempimg IMG https://download.fedoraproject.org/pub/fedora/linux/releases/35/Cloud/aarch… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service 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.… -O __IMG__ +tempimg IMG https://download.opensuse.org/distribution/leap/15.1/jeos/openSUSE-Leap-15.… 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-Le… -O __IMG__ +tempimg IMG https://download.opensuse.org/distribution/leap/15.2/appliances/openSUSE-Le… 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-Le… -O __IMG__ +tempimg IMG https://download.opensuse.org/distribution/leap/15.3/appliances/openSUSE-Le… 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-JeO… -O __IMG__ +tempimg IMG https://download.opensuse.org/tumbleweed/appliances/openSUSE-Tumbleweed-JeO… 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@.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… -O __IMG__ +tempimg IMG https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64… 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-… -O __IMG__ +tempimg IMG https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-i386-… 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-ppc64… -O __IMG__ +tempimg IMG https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-ppc64… 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-power… -O __IMG__ +tempimg IMG https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-power… host virt-edit -a __IMG__ /lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /etc/systemd/system/cloud-init.target.wants/cloud-config.service host guestfish --rw -a __IMG__ -i rm /etc/systemd/system/cloud-init.target.wants/cloud-final.service @@ -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.i… -O __IMG__ +tempimg IMG https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-s390x.i… host virt-edit -a __IMG__ /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-config.service host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/cloud-init.service 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 -- 2.36.1