1
0
mirror of https://passt.top/passt synced 2024-11-05 20:31:11 +00:00
passt/test/distro/fedora
David Gibson a8598c7e70 test: Convert distro tests to use socat instead of nc/ncat
We've recently converted most of our tests to use socat instead of
nc/netcat/ncat, because socat is more powerful and we don't need to deal
with the several possible variants of netcat.

We still use nc or ncat for the distro tests.  Because there we control
the guest environment and can pick our tools, there isn't the same reason
to switch to socat.  However, using socat here as well makes the tests
a bit easier to read, and doesn't require people reading or modifying them
to become familiar with an additional tool.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[sbrivio: keep using netcat-openbsd in Ubuntu 16.04 ppc64 test, as socat
 is unavailable there]
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
2022-08-20 19:07:12 +02:00

397 lines
10 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/fedora - Fedora builds, get packages via passt, test pasta
#
# Copyright (c) 2021 Red Hat GmbH
# Author: Stefano Brivio <sbrivio@redhat.com>
temp PIDFILE
htools 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
host (socat -u TCP6-LISTEN:10000,bind=[::1] OPEN:/tmp/init_msg,create,trunc; echo "from_init" | socat -u STDIN TCP6:[::1]:9999) &
hostb ./pasta
sleep 1
host PS1='$ '
host socat -u TCP6-LISTEN:9999,bind=[::1] OPEN:/tmp/ns_msg,create,trunc &
sleep 2
host echo "from_ns" | socat -u STDIN TCP6:[::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
# Bracketed paste mode off, needed from Fedora 34
def distro_quick_pasta_test_fedora34
host bind 'set enable-bracketed-paste off'
host (socat -u TCP6-LISTEN:10000,bind=[::1] OPEN:/tmp/init_msg,create,trunc; echo "from_init" | socat -u STDIN TCP6:[::1]:9999) &
hostb ./pasta
sleep 1
host PS1='$ '
host bind 'set enable-bracketed-paste off'
host socat -u TCP6-LISTEN:9999,bind=[::1] OPEN:/tmp/ns_msg,create,trunc &
sleep 2
host echo "from_ns" | socat -u STDIN TCP6:[::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
test Fedora 26, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-26-1.5.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
check [ __RET__ -eq 0 ]
distro_quick_pasta_test
hint
sleep 1
# PIDFILE is cleaned up when the next test starts, read it now
hout PID cat __PIDFILE__
test Fedora 27, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-27-1.6.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
check [ __RET__ -eq 0 ]
distro_quick_pasta_test
hint
sleep 1
test Fedora 28, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-28-1.1.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
check [ __RET__ -eq 0 ]
distro_quick_pasta_test
hint
sleep 1
test Fedora 28, aarch64
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 __BASEPATH__/prepared-Fedora-Cloud-Base-28-1.1.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc socat
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 Fedora 29, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-29-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
check [ __RET__ -eq 0 ]
distro_quick_pasta_test
hint
sleep 1
test Fedora 29, aarch64
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 __BASEPATH__/prepared-Fedora-Cloud-Base-29-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc socat
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 Fedora 30, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-30-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
check [ __RET__ -eq 0 ]
distro_quick_pasta_test
hint
sleep 1
test Fedora 30, aarch64
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 __BASEPATH__/prepared-Fedora-Cloud-Base-30-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc socat
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 Fedora 31, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-31-1.9.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
check [ __RET__ -eq 0 ]
distro_quick_pasta_test
hint
sleep 1
test Fedora 31, aarch64
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 __BASEPATH__/prepared-Fedora-Cloud-Base-31-1.9.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc socat
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 Fedora 32, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-32-1.6.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
check [ __RET__ -eq 0 ]
distro_quick_pasta_test
hint
sleep 1
test Fedora 32, aarch64
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 __BASEPATH__/prepared-Fedora-Cloud-Base-32-1.6.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc socat
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 Fedora 33, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-33-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
check [ __RET__ -eq 0 ]
distro_quick_pasta_test
hint
sleep 1
test Fedora 33, aarch64
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 __BASEPATH__/prepared-Fedora-Cloud-Base-33-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc socat
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 Fedora 34, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-34-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
check [ __RET__ -eq 0 ]
distro_quick_pasta_test_fedora34
hint
sleep 1
test Fedora 34, aarch64
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 __BASEPATH__/prepared-Fedora-Cloud-Base-34-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
check [ __RET__ -eq 0 ]
distro_quick_pasta_test_fedora34
hint
sleep 1
hostb reset
sleep 1
host echo
test Fedora 35, x86_64
host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-35-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
check [ __RET__ -eq 0 ]
distro_quick_pasta_test_fedora34
hint
sleep 1
test Fedora 35, aarch64
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 __BASEPATH__/prepared-Fedora-Cloud-Base-35-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot
host PS1='$ '
sleep 2
host yum -y install make gcc socat
host make clean
hout RET CFLAGS="-Werror" make; echo $?
check [ __RET__ -eq 0 ]
distro_quick_pasta_test_fedora34
hint
sleep 1
hostb reset
sleep 1
host echo
host kill __PID__