diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2022-01-26 07:45:16 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-01-28 18:51:50 +0100 |
commit | 6e61b4040a0bc495a53ff413dbf2555aab98d89a (patch) | |
tree | 0b8adf92bb6fa08974f687fc2298b4be4d0b6572 /test/distro/ubuntu | |
parent | 808ab390a01ffbb926295f3366dee6dc73ba601c (diff) | |
download | passt-6e61b4040a0bc495a53ff413dbf2555aab98d89a.tar passt-6e61b4040a0bc495a53ff413dbf2555aab98d89a.tar.gz passt-6e61b4040a0bc495a53ff413dbf2555aab98d89a.tar.bz2 passt-6e61b4040a0bc495a53ff413dbf2555aab98d89a.tar.lz passt-6e61b4040a0bc495a53ff413dbf2555aab98d89a.tar.xz passt-6e61b4040a0bc495a53ff413dbf2555aab98d89a.tar.zst passt-6e61b4040a0bc495a53ff413dbf2555aab98d89a.zip |
test: Add distribution tests for several architectures and kernel versions
The new tests check build and a simple case with pasta sending a
short message in both directions (namespace to init, init to
namespace).
Tests cover a mix of Debian, Fedora, OpenSUSE and Ubuntu combinations
on aarch64, i386, ppc64, ppc64le, s390x, x86_64.
Builds tested starting from approximately glibc 2.19, gcc 4.7, and
actual functionality approximately from 4.4 kernels, glibc 2.25,
gcc 4.8, all the way up to current glibc/gcc/kernel versions.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test/distro/ubuntu')
-rw-r--r-- | test/distro/ubuntu | 208 |
1 files changed, 208 insertions, 0 deletions
diff --git a/test/distro/ubuntu b/test/distro/ubuntu new file mode 100644 index 0000000..fcd3861 --- /dev/null +++ b/test/distro/ubuntu @@ -0,0 +1,208 @@ +# 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/distro/ubuntu - Ubuntu builds, get packages via passt, test pasta +# +# Copyright (c) 2021 Red Hat GmbH +# Author: Stefano Brivio <sbrivio@redhat.com> + +temp PIDFILE +htools wget virt-edit guestfish head sed cat kill qemu-system-ppc64le qemu-system-s390x + +# Quick pasta test: send message from init to ns, and from ns to init +def distro_quick_pasta_test +host (nc -w1 -6 -l -p 10000 > /tmp/init_msg; echo "from_init" | nc -q0 ::1 9999) & +hostb ./pasta +sleep 1 +host PS1='$ ' +host nc -w1 -6 -l -p 9999 > /tmp/ns_msg & +sleep 2 +host echo "from_ns" | nc -q0 ::1 10000 +sleep 2 +host echo +hout NS_MSG cat /tmp/ns_msg +check [ __NS_MSG__ = "from_init" ] +hostb exit +host echo +hout INIT_MSG cat /tmp/init_msg +check [ __INIT_MSG__ = "from_ns" ] +endef + +# Start passt, set common variables +hostb ./passt -P __PIDFILE__ & +sleep 1 +host echo +hout GUEST_FILES ls -1 *.c *.h *.sh 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 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 +host guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init-container.conf +host guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init-local.conf +host guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init-nonet.conf +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 PS1='$ ' +sleep 2 +host apt-get update +host apt-get -y install make gcc netcat-openbsd + +host make clean +hout RET CFLAGS="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits" make; echo $? +check [ __RET__ -eq 0 ] + +# TODO: pasta test skipped for the moment: clone() as called by NS_CALL hangs +# with wrapper provided by glibc 2.19, probably wrong argument order. + +hint +sleep 1 + +# PIDFILE is cleaned up when the next test starts, read it now +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 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 +host guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init-container.conf +host guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init-local.conf +host guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init-nonet.conf +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 PS1='$ ' +sleep 2 +host apt-get update +host apt-get -y install make gcc netcat-openbsd + +host make clean +hout RET CFLAGS="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits -Wno-sign-compare" make; echo $? +check [ __RET__ -eq 0 ] + +# TODO: pasta test skipped for the moment: clone() as called by NS_CALL hangs +# with wrapper provided by glibc 2.19, probably wrong argument order. + +hint +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 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 +host guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init-container.conf +host guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init-local.conf +host guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init-nonet.conf +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 PS1='$ ' +sleep 2 +host apt-get update +host apt-get -y install make gcc netcat-openbsd + +host make clean +hout RET CFLAGS="-Wno-missing-field-initializers -Wno-missing-braces -Wno-type-limits -Wno-sign-compare" make; echo $? +check [ __RET__ -eq 0 ] + +# TODO: pasta test skipped for the moment: clone() as called by NS_CALL hangs +# with wrapper provided by glibc 2.19, probably wrong argument order. + +hint +sleep 1 +hostb reset +sleep 1 +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 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 +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 PS1='$ ' +host dhclient +host apt-get update +host apt-get -y install make gcc netcat-openbsd + +host make clean +hout RET CFLAGS="-Werror" make; echo $? +check [ __RET__ -eq 0 ] + +distro_quick_pasta_test + +hint +sleep 1 +hostb reset +sleep 1 +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 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 +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 service systemd-resolved stop +host apt-get -y remove needrestart snapd +host dhclient +sleep 2 +host apt-get update +host apt-get -y install make gcc netcat-openbsd + +host make clean +hout RET CFLAGS="-Werror" make; echo $? +check [ __RET__ -eq 0 ] + +host export SHELL="/bin/dash" +host dash +distro_quick_pasta_test + +hint +sleep 1 +hostb reset +sleep 1 +host echo + + +host kill __PID__ |