mirror of
https://passt.top/passt
synced 2024-12-23 06:05:23 +00:00
c5f4ba1b1b
Distribution packages reasonably expect to have a human-readable Markdown version of the README under /usr/share/doc/, but all we have right now is a heavily web-oriented version. Introduce a ugly hack to strip web-oriented parts from the current README and install it. It should probably work the other way around: a human-readable README could be used as a source for the web page. But cgit needs a file that's in the tree, not something that can be built, and https://passt.top/ is based on cgit. It should eventually be doable to work around this in cgit, instead. Reported-by: Benson Muite <benson_muite@emailplus.org> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
207 lines
7.9 KiB
Plaintext
207 lines
7.9 KiB
Plaintext
# 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/opensuse - OpenSUSE builds, get packages via passt, test pasta
|
|
#
|
|
# Copyright (c) 2021 Red Hat GmbH
|
|
# Author: Stefano Brivio <sbrivio@redhat.com>
|
|
|
|
temp PIDFILE
|
|
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
|
|
def distro_quick_pasta_test
|
|
host (nc -6 -l -p 10000 > /tmp/init_msg; echo "from_init" | nc -N ::1 9999) &
|
|
hostb ./pasta
|
|
sleep 1
|
|
host PS1='$ '
|
|
host nc -6 -l -p 9999 > /tmp/ns_msg &
|
|
sleep 2
|
|
host echo "from_ns" | nc -N ::1 10000
|
|
sleep 2
|
|
host echo
|
|
sleep 1
|
|
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 DNS6 sed -n 's/^nameserver \([^:]*:\)\([^%]*\).*/\1\2/p' /etc/resolv.conf | head -1
|
|
hout GUEST_FILES ls -1 *.c *.h *.sh passt.1 qrap.1 Makefile README.md | tr '\n' ' '; echo
|
|
|
|
|
|
test OpenSUSE Leap 15.1
|
|
|
|
temp 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
|
|
host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
|
|
host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
|
|
|
|
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
|
|
host PS1='$ '
|
|
host ip link set eth0 up
|
|
sleep 2
|
|
host echo "DNSSERVERS='__DNS6__'" | netconfig modify -s dns_resolver -i eth0
|
|
# zypper sometimes segfaults, hence the retries
|
|
host for i in $(seq 1 10); do zypper install -y gcc make netcat-openbsd && break; done; echo
|
|
|
|
host make clean
|
|
host CFLAGS="-Werror" make
|
|
|
|
distro_quick_pasta_test
|
|
|
|
hint
|
|
sleep 1
|
|
|
|
# PIDFILE is cleaned up when the next test starts, read it now
|
|
hout PID cat __PIDFILE__
|
|
|
|
|
|
test OpenSUSE Leap 15.2
|
|
|
|
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
|
|
host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
|
|
host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
|
|
|
|
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
|
|
host PS1='$ '
|
|
host ip link set eth0 up
|
|
sleep 2
|
|
host echo "DNSSERVERS='__DNS6__'" | netconfig modify -s dns_resolver -i eth0
|
|
# zypper sometimes segfaults, hence the retries
|
|
host for i in $(seq 1 10); do zypper install -y gcc make netcat-openbsd && break; done; echo
|
|
|
|
host make clean
|
|
host CFLAGS="-Werror" make
|
|
|
|
distro_quick_pasta_test
|
|
|
|
hint
|
|
sleep 1
|
|
|
|
|
|
test OpenSUSE Leap 15.3
|
|
|
|
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
|
|
host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
|
|
host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
|
|
|
|
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
|
|
# Multiple prompt logins might come up here
|
|
sleep 10
|
|
host PS1='$ '
|
|
host ip link set eth0 up
|
|
sleep 2
|
|
host echo "DNSSERVERS='__DNS6__'" | netconfig modify -s dns_resolver -i eth0
|
|
# zypper sometimes segfaults, hence the retries
|
|
host for i in $(seq 1 10); do zypper install -y gcc make netcat-openbsd && break; done; echo
|
|
|
|
host make clean
|
|
host CFLAGS="-Werror" make
|
|
|
|
distro_quick_pasta_test
|
|
|
|
hint
|
|
sleep 1
|
|
|
|
|
|
test OpenSUSE Tumbleweed aarch64
|
|
|
|
temp 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/
|
|
|
|
host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __IMG__ -net socket,fd=5 -net nic,model=virtio
|
|
host PS1='$ '
|
|
host ip link set enp0s1 up
|
|
sleep 10
|
|
host echo "DNSSERVERS='__DNS6__'" | netconfig modify -s dns_resolver -i enp0s1
|
|
sleep 10
|
|
# No segfaults ever seen with this
|
|
host zypper install -y gcc make netcat-openbsd; echo
|
|
|
|
host make clean
|
|
host CFLAGS="-Werror" make
|
|
|
|
distro_quick_pasta_test
|
|
|
|
hint
|
|
sleep 1
|
|
|
|
|
|
test OpenSUSE Tumbleweed armv7l
|
|
|
|
temp IMG
|
|
temp ZIMAGE
|
|
temp 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__
|
|
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/
|
|
|
|
host ./qrap 5 qemu-system-arm -M virt -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none -kernel __ZIMAGE__ -initrd __INITRD__ -append 'root=/dev/sda3' -drive if=none,file=__IMG__,format=raw,id=hd,media=disk -device virtio-scsi-device -device scsi-hd,drive=hd -netdev socket,fd=5,id=passt -device virtio-net-device,netdev=passt
|
|
host PS1='$ '
|
|
host ip link set eth0 up
|
|
sleep 10
|
|
host echo "DNSSERVERS='__DNS6__'" | netconfig modify -s dns_resolver -i eth0
|
|
sleep 10
|
|
host zypper install -y gcc make netcat-openbsd; echo
|
|
|
|
host make clean
|
|
host CFLAGS="-Werror" make
|
|
|
|
distro_quick_pasta_test
|
|
|
|
hint
|
|
sleep 1
|
|
|
|
|
|
test OpenSUSE Tumbleweed
|
|
|
|
temp 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
|
|
host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/serial-getty@.service
|
|
host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty@tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g'
|
|
host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
|
|
|
|
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio
|
|
host PS1='$ '
|
|
host ip link set ens2 up
|
|
sleep 2
|
|
host echo "DNSSERVERS='__DNS6__'" | netconfig modify -s dns_resolver -i ens2
|
|
# zypper sometimes segfaults, hence the retries
|
|
host for i in $(seq 1 10); do zypper install -y gcc make netcat-openbsd && break; done; echo
|
|
|
|
host make clean
|
|
host CFLAGS="-Werror" make
|
|
|
|
distro_quick_pasta_test
|
|
|
|
hint
|
|
sleep 1
|
|
|
|
|
|
host kill __PID__
|