From 1c36c8d3f8e05d6dbde2842b6c9f78ffc538036c Mon Sep 17 00:00:00 2001 From: David Gibson Date: Tue, 13 Sep 2022 14:35:23 +1000 Subject: test: Use paths in __STATEDIR__ instead of 'temp' and 'tempdir' directives Instead of using the 'temp' and 'tempdir' DSL directives to create temporary files, use fixed paths relative to __STATEDIR__. This has two advantages: 1) The files are automatically cleaned up if the tests fail (and even if that doesn't work they're easier to clean up manuall) 2) When debugging tests it's easier to figure out which of the temporary files are relevant to whatever's going wrong Signed-off-by: David Gibson --- test/distro/debian | 2 +- test/distro/fedora | 2 +- test/distro/opensuse | 16 +++++++++------- test/distro/ubuntu | 8 ++++---- 4 files changed, 15 insertions(+), 13 deletions(-) (limited to 'test/distro') diff --git a/test/distro/debian b/test/distro/debian index 83fb32d..4a19f95 100644 --- a/test/distro/debian +++ b/test/distro/debian @@ -11,7 +11,7 @@ # Copyright (c) 2021 Red Hat GmbH # Author: Stefano Brivio -temp PIDFILE +set PIDFILE __STATEDIR__/passt.pid 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 diff --git a/test/distro/fedora b/test/distro/fedora index daad6a4..a8d3b51 100644 --- a/test/distro/fedora +++ b/test/distro/fedora @@ -11,7 +11,7 @@ # Copyright (c) 2021 Red Hat GmbH # Author: Stefano Brivio -temp PIDFILE +set PIDFILE __STATEDIR__/passt.pid htools cat kill qemu-system-x86_64 # Quick pasta test: send message from init to ns, and from ns to init diff --git a/test/distro/opensuse b/test/distro/opensuse index d48deb7..314870f 100644 --- a/test/distro/opensuse +++ b/test/distro/opensuse @@ -11,7 +11,7 @@ # Copyright (c) 2021 Red Hat GmbH # Author: Stefano Brivio -temp PIDFILE +set PIDFILE __STATEDIR__/passt.pid 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 @@ -44,7 +44,7 @@ hout GUEST_FILES ls -1 *.c *.h *.sh passt.1 qrap.1 Makefile README.md | tr '\n' test OpenSUSE Leap 15.1 -temp IMG +set IMG __STATEDIR__/opensuse-15.1-x86_64.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 @@ -73,6 +73,7 @@ hout PID cat __PIDFILE__ test OpenSUSE Leap 15.2 +set IMG __STATEDIR__/opensuse-15.2-x86_64.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 @@ -98,6 +99,7 @@ sleep 1 test OpenSUSE Leap 15.3 +set IMG __STATEDIR__/opensuse-15.3-x86_64.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 @@ -125,7 +127,7 @@ sleep 1 test OpenSUSE Tumbleweed aarch64 -temp IMG +set IMG __STATEDIR__/opensuse-tumbleweed-aarch64.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@.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/ @@ -150,9 +152,9 @@ sleep 1 test OpenSUSE Tumbleweed armv7l -temp IMG -temp ZIMAGE -temp INITRD +set IMG __STATEDIR__/opensuse-tumbleweed-armv7l.img +set ZIMAGE __STATEDIR__/opensuse-tumbleweed-armv7l.zimage +set INITRD __STATEDIR__/opensuse-tumbleweed-armv7l.initrd host xzcat __BASEPATH__/openSUSE-Tumbleweed-ARM-JeOS-efi.armv7l.raw.xz > __IMG__ host guestfish -a __IMG__ -i download /boot/zImage __ZIMAGE__ host guestfish -a __IMG__ -i download /boot/initrd __INITRD__ @@ -178,7 +180,7 @@ sleep 1 test OpenSUSE Tumbleweed -temp IMG +set IMG __STATEDIR__/opensuse-tumbleweed-x86_64.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 diff --git a/test/distro/ubuntu b/test/distro/ubuntu index 5e67a46..aa42c99 100644 --- a/test/distro/ubuntu +++ b/test/distro/ubuntu @@ -11,7 +11,7 @@ # Copyright (c) 2021 Red Hat GmbH # Author: Stefano Brivio -temp PIDFILE +set PIDFILE __STATEDIR__/passt.pid 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 @@ -68,7 +68,7 @@ hout GUEST_FILES ls -1 *.c *.h *.sh passt.1 qrap.1 Makefile README.md | tr '\n' test Ubuntu 14.04.5 LTS (Trusty Tahr), amd64 -temp IMG +set IMG __STATEDIR__/ubuntu-14.04-amd64.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 @@ -101,7 +101,7 @@ hout PID cat __PIDFILE__ test Ubuntu 14.04.5 LTS (Trusty Tahr), i386 -temp IMG +set IMG __STATEDIR__/ubuntu-14.04-i386.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 @@ -131,7 +131,7 @@ sleep 1 test Ubuntu 14.04.5 LTS (Trusty Tahr), ppc64le -temp IMG +set IMG __STATEDIR__/ubuntu-14.04-ppc64le.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 -- cgit v1.2.3