aboutgitcodebugslistschat
path: root/test/prepare-distro-img.sh
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-07-06 17:29:08 +1000
committerStefano Brivio <sbrivio@redhat.com>2022-07-14 01:36:02 +0200
commitd2802ec874fd70b4c4dda6158f63612d6f1bffc0 (patch)
tree3eaebdcf202eeb7643ef9a5c4987e4a531af8529 /test/prepare-distro-img.sh
parent32c5e054795e811420db84eb913e00ac3af8fc2b (diff)
downloadpasst-d2802ec874fd70b4c4dda6158f63612d6f1bffc0.tar
passt-d2802ec874fd70b4c4dda6158f63612d6f1bffc0.tar.gz
passt-d2802ec874fd70b4c4dda6158f63612d6f1bffc0.tar.bz2
passt-d2802ec874fd70b4c4dda6158f63612d6f1bffc0.tar.lz
passt-d2802ec874fd70b4c4dda6158f63612d6f1bffc0.tar.xz
passt-d2802ec874fd70b4c4dda6158f63612d6f1bffc0.tar.zst
passt-d2802ec874fd70b4c4dda6158f63612d6f1bffc0.zip
tests: Prepare distro images during asset build phase
Before booting the guest images, the distro test cases need to modify the guest images, using virt-edit and guestfish, to boot in the way we need. At present this gets repeated on every test run, even though it's not really doing anything we want to test for. In addition many of the images have the same preparation steps leading to a lot of duplicated stages in the tests. A number of additional images can be prepared using common steps, even if the ones used now have small differences. Therefore move the preparation of most of the guest images to the asset build phase, where they can be done a single time for multiple test runs, using a common preparation script. We can even avoid making a copy of the disk image for booting, by using qemu's -snapshot option. A few of the distros (openSUSE and older Ubuntu) do need different steps. For now we don't chage how they are run, they could possibly be handled more like this in future. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'test/prepare-distro-img.sh')
-rwxr-xr-xtest/prepare-distro-img.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/prepare-distro-img.sh b/test/prepare-distro-img.sh
new file mode 100755
index 0000000..aeb97a0
--- /dev/null
+++ b/test/prepare-distro-img.sh
@@ -0,0 +1,18 @@
+#! /bin/sh -e
+
+IMG="$1"
+PASST_FILES="$(echo ../*.c ../*.h ../*.sh ../*.1 ../Makefile)"
+
+virt-edit -a $IMG /lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g'
+
+guestfish --rw -a $IMG -i <<EOF
+rm-f /usr/lib/systemd/system/cloud-config.service
+rm-f /usr/lib/systemd/system/cloud-init.service
+rm-f /usr/lib/systemd/system/cloud-init-local.service
+rm-f /usr/lib/systemd/system/cloud-final.service
+rm-f /etc/init.d/cloud-config
+rm-f /etc/init.d/cloud-final
+rm-f /etc/init.d/cloud-init
+rm-f /etc/init.d/cloud-init-local
+copy-in $PASST_FILES /root/
+EOF