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 <david@gibson.dropbear.id.au>
This commit is contained in:
parent
c71a5e8528
commit
1c36c8d3f8
15 changed files with 69 additions and 82 deletions
|
@ -41,22 +41,21 @@ check [ -f passt ]
|
||||||
check [ -h pasta ]
|
check [ -h pasta ]
|
||||||
check [ -f qrap ]
|
check [ -f qrap ]
|
||||||
|
|
||||||
tempdir TEMP
|
|
||||||
|
|
||||||
test Install
|
test Install
|
||||||
host prefix=__TEMP__ make install
|
host mkdir __STATEDIR__/prefix
|
||||||
check [ -f __TEMP__/bin/passt ]
|
host prefix=__STATEDIR__/prefix make install
|
||||||
check [ -h __TEMP__/bin/pasta ]
|
check [ -f __STATEDIR__/prefix/bin/passt ]
|
||||||
check [ -f __TEMP__/bin/qrap ]
|
check [ -h __STATEDIR__/prefix/bin/pasta ]
|
||||||
check man -M __TEMP__/share/man -W passt
|
check [ -f __STATEDIR__/prefix/bin/qrap ]
|
||||||
check man -M __TEMP__/share/man -W pasta
|
check man -M __STATEDIR__/prefix/share/man -W passt
|
||||||
check man -M __TEMP__/share/man -W qrap
|
check man -M __STATEDIR__/prefix/share/man -W pasta
|
||||||
|
check man -M __STATEDIR__/prefix/share/man -W qrap
|
||||||
|
|
||||||
test Uninstall
|
test Uninstall
|
||||||
host prefix=__TEMP__ make uninstall
|
host prefix=__STATEDIR__/prefix make uninstall
|
||||||
check ! [ -f __TEMP__/bin/passt ]
|
check ! [ -f __STATEDIR__/prefix/bin/passt ]
|
||||||
check ! [ -h __TEMP__/bin/pasta ]
|
check ! [ -h __STATEDIR__/prefix/bin/pasta ]
|
||||||
check ! [ -f __TEMP__/bin/qrap ]
|
check ! [ -f __STATEDIR__/prefix/bin/qrap ]
|
||||||
check ! man -M __TEMP__/share/man -W passt 2>/dev/null
|
check ! man -M __STATEDIR__/prefix/share/man -W passt 2>/dev/null
|
||||||
check ! man -M __TEMP__/share/man -W pasta 2>/dev/null
|
check ! man -M __STATEDIR__/prefix/share/man -W pasta 2>/dev/null
|
||||||
check ! man -M __TEMP__/share/man -W qrap 2>/dev/null
|
check ! man -M __STATEDIR__/prefix/share/man -W qrap 2>/dev/null
|
||||||
|
|
|
@ -20,8 +20,7 @@ sleep 3
|
||||||
|
|
||||||
say Let's fetch the source
|
say Let's fetch the source
|
||||||
sleep 1
|
sleep 1
|
||||||
tempdir TEMPDIR
|
host cd __STATEDIR__
|
||||||
host cd __TEMPDIR__
|
|
||||||
host git clone git://passt.top/passt
|
host git clone git://passt.top/passt
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
|
@ -52,10 +51,10 @@ host q
|
||||||
nl
|
nl
|
||||||
nl
|
nl
|
||||||
say Let's create a small initramfs image for the guest.
|
say Let's create a small initramfs image for the guest.
|
||||||
guest cd __TEMPDIR__
|
guest cd __STATEDIR__
|
||||||
guest git clone git://mbuto.sh/mbuto
|
guest git clone git://mbuto.sh/mbuto
|
||||||
guest cd mbuto
|
guest cd mbuto
|
||||||
guest ./mbuto -f passt.img -p __TEMPDIR__/passt/test/passt.mbuto -c lz4
|
guest ./mbuto -f passt.img -p __STATEDIR__/passt/test/passt.mbuto -c lz4
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
nl
|
nl
|
||||||
|
@ -69,7 +68,7 @@ nl
|
||||||
say 'pasta' demo above.
|
say 'pasta' demo above.
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|
||||||
passt cd __TEMPDIR__/passt
|
passt cd __STATEDIR__/passt
|
||||||
passtb ./pasta -P /tmp/pasta.pid
|
passtb ./pasta -P /tmp/pasta.pid
|
||||||
sleep 3
|
sleep 3
|
||||||
passt /sbin/dhclient -4 --no-pid
|
passt /sbin/dhclient -4 --no-pid
|
||||||
|
|
|
@ -20,8 +20,7 @@ sleep 3
|
||||||
|
|
||||||
say Let's fetch the source
|
say Let's fetch the source
|
||||||
sleep 1
|
sleep 1
|
||||||
tempdir TEMPDIR
|
host cd __STATEDIR__
|
||||||
host cd __TEMPDIR__
|
|
||||||
host git clone git://passt.top/passt
|
host git clone git://passt.top/passt
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
|
@ -47,7 +46,7 @@ sleep 10
|
||||||
nl
|
nl
|
||||||
say without PID, it will create a namespace.
|
say without PID, it will create a namespace.
|
||||||
sleep 3
|
sleep 3
|
||||||
passt cd __TEMPDIR__/passt
|
passt cd __STATEDIR__/passt
|
||||||
passtb ./pasta -P /tmp/pasta.pid
|
passtb ./pasta -P /tmp/pasta.pid
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|
||||||
|
@ -140,13 +139,12 @@ say can also take packet captures.
|
||||||
sleep 3
|
sleep 3
|
||||||
passt exit
|
passt exit
|
||||||
sleep 2
|
sleep 2
|
||||||
temp TEMP
|
passtb ./pasta -p __STATEDIR__/demo_pasta.pcap
|
||||||
passtb ./pasta -p __TEMP__.pcap
|
|
||||||
sleep 2
|
sleep 2
|
||||||
passt
|
passt
|
||||||
passt /sbin/dhclient -4 --no-pid
|
passt /sbin/dhclient -4 --no-pid
|
||||||
sleep 2
|
sleep 2
|
||||||
hostb tshark -r __TEMP__.pcap
|
hostb tshark -r __STATEDIR__/demo_pasta.pcap
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
nl
|
nl
|
||||||
|
@ -257,7 +255,7 @@ sleep 2
|
||||||
killp PASST
|
killp PASST
|
||||||
killp HOST
|
killp HOST
|
||||||
sleep 2
|
sleep 2
|
||||||
ns cd __TEMPDIR__/passt
|
ns cd __STATEDIR__/passt
|
||||||
nsb perf report -g --max-stack 3
|
nsb perf report -g --max-stack 3
|
||||||
sleep 10
|
sleep 10
|
||||||
|
|
||||||
|
|
|
@ -24,14 +24,13 @@ sleep 3
|
||||||
|
|
||||||
say Let's fetch Podman
|
say Let's fetch Podman
|
||||||
sleep 1
|
sleep 1
|
||||||
tempdir TEMPDIR
|
host git -C __STATEDIR__ clone https://github.com/containers/podman.git
|
||||||
host git -C __TEMPDIR__ clone https://github.com/containers/podman.git
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
say , patch it
|
say , patch it
|
||||||
sleep 1
|
sleep 1
|
||||||
host cp ../contrib/podman/0001-libpod-Add-pasta-networking-mode.patch __TEMPDIR__/podman
|
host cp ../contrib/podman/0001-libpod-Add-pasta-networking-mode.patch __STATEDIR__/podman
|
||||||
host cd __TEMPDIR__/podman
|
host cd __STATEDIR__/podman
|
||||||
host git am -3 0001-libpod-Add-pasta-networking-mode.patch
|
host git am -3 0001-libpod-Add-pasta-networking-mode.patch
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
|
@ -54,7 +53,7 @@ nl
|
||||||
say Let's start a container with it
|
say Let's start a container with it
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
ns1 cd __TEMPDIR__/podman
|
ns1 cd __STATEDIR__/podman
|
||||||
ns1b ./bin/podman run --rm -ti alpine sh
|
ns1b ./bin/podman run --rm -ti alpine sh
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
|
@ -64,7 +63,7 @@ say and one with
|
||||||
em pasta
|
em pasta
|
||||||
say instead.
|
say instead.
|
||||||
|
|
||||||
ns2 cd __TEMPDIR__/podman
|
ns2 cd __STATEDIR__/podman
|
||||||
ns2b ./bin/podman run --net=pasta --rm -ti alpine sh
|
ns2b ./bin/podman run --net=pasta --rm -ti alpine sh
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
# Copyright (c) 2021 Red Hat GmbH
|
# Copyright (c) 2021 Red Hat GmbH
|
||||||
# Author: Stefano Brivio <sbrivio@redhat.com>
|
# Author: Stefano Brivio <sbrivio@redhat.com>
|
||||||
|
|
||||||
temp PIDFILE
|
set PIDFILE __STATEDIR__/passt.pid
|
||||||
htools cat kill qemu-system-x86_64 qemu-system-aarch64 qemu-system-ppc64
|
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
|
# Quick pasta test: send message from init to ns, and from ns to init
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
# Copyright (c) 2021 Red Hat GmbH
|
# Copyright (c) 2021 Red Hat GmbH
|
||||||
# Author: Stefano Brivio <sbrivio@redhat.com>
|
# Author: Stefano Brivio <sbrivio@redhat.com>
|
||||||
|
|
||||||
temp PIDFILE
|
set PIDFILE __STATEDIR__/passt.pid
|
||||||
htools cat kill qemu-system-x86_64
|
htools cat kill qemu-system-x86_64
|
||||||
|
|
||||||
# Quick pasta test: send message from init to ns, and from ns to init
|
# Quick pasta test: send message from init to ns, and from ns to init
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
# Copyright (c) 2021 Red Hat GmbH
|
# Copyright (c) 2021 Red Hat GmbH
|
||||||
# Author: Stefano Brivio <sbrivio@redhat.com>
|
# Author: Stefano Brivio <sbrivio@redhat.com>
|
||||||
|
|
||||||
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
|
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
|
# 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
|
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 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 '/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 /etc/systemd/system/default.target.wants/jeos-firstboot.service
|
||||||
|
@ -73,6 +73,7 @@ hout PID cat __PIDFILE__
|
||||||
|
|
||||||
test OpenSUSE Leap 15.2
|
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 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 '/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 /etc/systemd/system/default.target.wants/jeos-firstboot.service
|
||||||
|
@ -98,6 +99,7 @@ sleep 1
|
||||||
|
|
||||||
test OpenSUSE Leap 15.3
|
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 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 '/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 /etc/systemd/system/default.target.wants/jeos-firstboot.service
|
||||||
|
@ -125,7 +127,7 @@ sleep 1
|
||||||
|
|
||||||
test OpenSUSE Tumbleweed aarch64
|
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 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 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 guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/
|
||||||
|
@ -150,9 +152,9 @@ sleep 1
|
||||||
|
|
||||||
test OpenSUSE Tumbleweed armv7l
|
test OpenSUSE Tumbleweed armv7l
|
||||||
|
|
||||||
temp IMG
|
set IMG __STATEDIR__/opensuse-tumbleweed-armv7l.img
|
||||||
temp ZIMAGE
|
set ZIMAGE __STATEDIR__/opensuse-tumbleweed-armv7l.zimage
|
||||||
temp INITRD
|
set INITRD __STATEDIR__/opensuse-tumbleweed-armv7l.initrd
|
||||||
host xzcat __BASEPATH__/openSUSE-Tumbleweed-ARM-JeOS-efi.armv7l.raw.xz > __IMG__
|
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/zImage __ZIMAGE__
|
||||||
host guestfish -a __IMG__ -i download /boot/initrd __INITRD__
|
host guestfish -a __IMG__ -i download /boot/initrd __INITRD__
|
||||||
|
@ -178,7 +180,7 @@ sleep 1
|
||||||
|
|
||||||
test OpenSUSE Tumbleweed
|
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 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 /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 /etc/systemd/system/default.target.wants/jeos-firstboot.service
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
# Copyright (c) 2021 Red Hat GmbH
|
# Copyright (c) 2021 Red Hat GmbH
|
||||||
# Author: Stefano Brivio <sbrivio@redhat.com>
|
# Author: Stefano Brivio <sbrivio@redhat.com>
|
||||||
|
|
||||||
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
|
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
|
# 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
|
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 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 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-config.conf
|
||||||
|
@ -101,7 +101,7 @@ hout PID cat __PIDFILE__
|
||||||
|
|
||||||
test Ubuntu 14.04.5 LTS (Trusty Tahr), i386
|
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 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 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-config.conf
|
||||||
|
@ -131,7 +131,7 @@ sleep 1
|
||||||
|
|
||||||
test Ubuntu 14.04.5 LTS (Trusty Tahr), ppc64le
|
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 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 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-config.conf
|
||||||
|
|
|
@ -99,16 +99,6 @@ test_one_line() {
|
||||||
IFS= eval TEST_ONE_DEF_$TEST_ONE_in_def=
|
IFS= eval TEST_ONE_DEF_$TEST_ONE_in_def=
|
||||||
IFS="${__ifs}"
|
IFS="${__ifs}"
|
||||||
;;
|
;;
|
||||||
"tempdir")
|
|
||||||
__tmpdir="$(mktemp -d)"
|
|
||||||
TEST_ONE_subs="$(list_add_pair "${TEST_ONE_subs}" "__${__arg}__" "${__tmpdir}")"
|
|
||||||
TEST_ONE_dirclean="$(list_add "${TEST_ONE_dirclean}" "${__tmpdir}")"
|
|
||||||
;;
|
|
||||||
"temp")
|
|
||||||
__tmpfile="$(mktemp)"
|
|
||||||
TEST_ONE_subs="$(list_add_pair "${TEST_ONE_subs}" "__${__arg}__" "${__tmpfile}")"
|
|
||||||
TEST_ONE_dirclean="$(list_add "${TEST_ONE_dirclean}" "${__tmpfile}")"
|
|
||||||
;;
|
|
||||||
"test")
|
"test")
|
||||||
[ ${TEST_ONE_perf_nok} -eq 0 ] || TEST_ONE_nok=1
|
[ ${TEST_ONE_perf_nok} -eq 0 ] || TEST_ONE_nok=1
|
||||||
[ ${TEST_ONE_nok} -eq 1 ] && status_test_fail
|
[ ${TEST_ONE_nok} -eq 1 ] && status_test_fail
|
||||||
|
|
|
@ -15,7 +15,7 @@ gtools socat ip jq md5sum cut
|
||||||
htools dd socat ip jq md5sum cut
|
htools dd socat ip jq md5sum cut
|
||||||
|
|
||||||
test TCP/IPv4: host to guest: big transfer
|
test TCP/IPv4: host to guest: big transfer
|
||||||
temp TEMP_BIG
|
set TEMP_BIG __STATEDIR__/big
|
||||||
guestb socat -u TCP4-LISTEN:10001,reuseaddr OPEN:test_big.bin,create,trunc
|
guestb socat -u TCP4-LISTEN:10001,reuseaddr OPEN:test_big.bin,create,trunc
|
||||||
sleep 1
|
sleep 1
|
||||||
host dd if=/dev/urandom bs=1M count=10 > __TEMP_BIG__
|
host dd if=/dev/urandom bs=1M count=10 > __TEMP_BIG__
|
||||||
|
@ -34,7 +34,7 @@ hout HOST_MD5_BIG md5sum __TEMP_BIG__ | cut -d' ' -f1
|
||||||
check [ "__GUEST_MD5_BIG__" = "__HOST_MD5_BIG__" ]
|
check [ "__GUEST_MD5_BIG__" = "__HOST_MD5_BIG__" ]
|
||||||
|
|
||||||
test TCP/IPv4: host to guest: small transfer
|
test TCP/IPv4: host to guest: small transfer
|
||||||
temp TEMP_SMALL
|
set TEMP_SMALL __STATEDIR__/small
|
||||||
guestb socat -u TCP4-LISTEN:10001,reuseaddr OPEN:test_small.bin,create,trunc
|
guestb socat -u TCP4-LISTEN:10001,reuseaddr OPEN:test_small.bin,create,trunc
|
||||||
sleep 1
|
sleep 1
|
||||||
host dd if=/dev/urandom bs=2k count=1 > __TEMP_SMALL__
|
host dd if=/dev/urandom bs=2k count=1 > __TEMP_SMALL__
|
||||||
|
|
|
@ -15,9 +15,9 @@ gtools socat tee grep cat ip jq md5sum cut
|
||||||
htools printf dd socat tee grep cat ip jq md5sum cut
|
htools printf dd socat tee grep cat ip jq md5sum cut
|
||||||
|
|
||||||
test UDP/IPv4: host to guest
|
test UDP/IPv4: host to guest
|
||||||
temp TEMP
|
set TEMP __STATEDIR__/data
|
||||||
temp SC_PID
|
set SC_PID __STATEDIR__/socat.pid
|
||||||
guestb (socat -u UDP4-LISTEN:10001 STDOUT & echo $! > __SC_PID__) | tee test.bin | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
|
guestb (socat -u UDP4-LISTEN:10001 STDOUT & echo $! > sc.pid) | tee test.bin | (grep -qm1 "END_OF_TEST" && kill $(cat sc.pid))
|
||||||
sleep 1
|
sleep 1
|
||||||
host dd if=/dev/urandom bs=1k count=5 > __TEMP__ && printf "\nEND_OF_TEST\n" >> __TEMP__
|
host dd if=/dev/urandom bs=1k count=5 > __TEMP__ && printf "\nEND_OF_TEST\n" >> __TEMP__
|
||||||
host socat -u OPEN:__TEMP__ UDP4:127.0.0.1:10001
|
host socat -u OPEN:__TEMP__ UDP4:127.0.0.1:10001
|
||||||
|
|
|
@ -16,7 +16,7 @@ htools dd socat ip jq md5sum cut
|
||||||
nstools socat ip jq md5sum cut
|
nstools socat ip jq md5sum cut
|
||||||
|
|
||||||
test TCP/IPv4: host to guest: big transfer
|
test TCP/IPv4: host to guest: big transfer
|
||||||
temp TEMP_BIG
|
set TEMP_BIG __STATEDIR__/big.img
|
||||||
guestb socat -u TCP4-LISTEN:10001 OPEN:test_big.bin,create,trunc
|
guestb socat -u TCP4-LISTEN:10001 OPEN:test_big.bin,create,trunc
|
||||||
sleep 1
|
sleep 1
|
||||||
host dd if=/dev/urandom bs=1M count=10 of=__TEMP_BIG__
|
host dd if=/dev/urandom bs=1M count=10 of=__TEMP_BIG__
|
||||||
|
@ -27,7 +27,7 @@ gout GUEST_MD5_BIG md5sum test_big.bin | cut -d' ' -f1
|
||||||
check [ "__GUEST_MD5_BIG__" = "__MD5_BIG__" ]
|
check [ "__GUEST_MD5_BIG__" = "__MD5_BIG__" ]
|
||||||
|
|
||||||
test TCP/IPv4: host to ns: big transfer
|
test TCP/IPv4: host to ns: big transfer
|
||||||
temp TEMP_NS_BIG
|
set TEMP_NS_BIG __STATEDIR__/big_ns.img
|
||||||
nsb socat -u TCP4-LISTEN:10002 OPEN:__TEMP_NS_BIG__,create,trunc
|
nsb socat -u TCP4-LISTEN:10002 OPEN:__TEMP_NS_BIG__,create,trunc
|
||||||
host socat -u OPEN:__TEMP_BIG__ TCP4:127.0.0.1:10002
|
host socat -u OPEN:__TEMP_BIG__ TCP4:127.0.0.1:10002
|
||||||
nsw
|
nsw
|
||||||
|
@ -82,7 +82,7 @@ gout GUEST_MD5_BIG md5sum test_big.bin | cut -d' ' -f1
|
||||||
check [ "__GUEST_MD5_BIG__" = "__MD5_BIG__" ]
|
check [ "__GUEST_MD5_BIG__" = "__MD5_BIG__" ]
|
||||||
|
|
||||||
test TCP/IPv4: host to guest: small transfer
|
test TCP/IPv4: host to guest: small transfer
|
||||||
temp TEMP_SMALL
|
set TEMP_SMALL __STATEDIR__/small.img
|
||||||
guestb socat -u TCP4-LISTEN:10001 OPEN:test_small.bin,create,trunc
|
guestb socat -u TCP4-LISTEN:10001 OPEN:test_small.bin,create,trunc
|
||||||
sleep 1
|
sleep 1
|
||||||
host dd if=/dev/urandom bs=2k count=100 of=__TEMP_SMALL__
|
host dd if=/dev/urandom bs=2k count=100 of=__TEMP_SMALL__
|
||||||
|
@ -93,7 +93,7 @@ gout GUEST_MD5_SMALL md5sum test_small.bin | cut -d' ' -f1
|
||||||
check [ "__GUEST_MD5_SMALL__" = "__MD5_SMALL__" ]
|
check [ "__GUEST_MD5_SMALL__" = "__MD5_SMALL__" ]
|
||||||
|
|
||||||
test TCP/IPv4: host to ns: small transfer
|
test TCP/IPv4: host to ns: small transfer
|
||||||
temp TEMP_NS_SMALL
|
set TEMP_NS_SMALL __STATEDIR__/small_ns.img
|
||||||
nsb socat -u TCP4-LISTEN:10002 OPEN:__TEMP_NS_SMALL__,create,trunc
|
nsb socat -u TCP4-LISTEN:10002 OPEN:__TEMP_NS_SMALL__,create,trunc
|
||||||
host socat -u OPEN:__TEMP_SMALL__ TCP4:127.0.0.1:10002
|
host socat -u OPEN:__TEMP_SMALL__ TCP4:127.0.0.1:10002
|
||||||
nsw
|
nsw
|
||||||
|
|
|
@ -16,8 +16,8 @@ nstools socat tee grep cat ip jq md5sum cut
|
||||||
htools printf dd socat tee grep cat ip jq md5sum cut
|
htools printf dd socat tee grep cat ip jq md5sum cut
|
||||||
|
|
||||||
test UDP/IPv4: host to guest
|
test UDP/IPv4: host to guest
|
||||||
temp TEMP
|
set TEMP __STATEDIR__/data
|
||||||
temp SC_PID
|
set SC_PID __STATEDIR__/socat.pid
|
||||||
guestb (socat -u UDP4-LISTEN:10001 STDOUT & echo $! > sc.pid) | tee test.bin | (grep -qm1 "END_OF_TEST" && kill $(cat sc.pid))
|
guestb (socat -u UDP4-LISTEN:10001 STDOUT & echo $! > sc.pid) | tee test.bin | (grep -qm1 "END_OF_TEST" && kill $(cat sc.pid))
|
||||||
sleep 1
|
sleep 1
|
||||||
host dd if=/dev/urandom bs=1k count=5 > __TEMP__ && printf "\nEND_OF_TEST\n" >> __TEMP__
|
host dd if=/dev/urandom bs=1k count=5 > __TEMP__ && printf "\nEND_OF_TEST\n" >> __TEMP__
|
||||||
|
@ -28,7 +28,7 @@ gout GUEST_MD5 md5sum test.bin | cut -d' ' -f1
|
||||||
check [ "__GUEST_MD5__" = "__MD5__" ]
|
check [ "__GUEST_MD5__" = "__MD5__" ]
|
||||||
|
|
||||||
test UDP/IPv4: host to ns
|
test UDP/IPv4: host to ns
|
||||||
temp TEMP_NS
|
set TEMP_NS __STATEDIR__/data_ns
|
||||||
nsb (socat -u UDP4-LISTEN:10002 STDOUT & echo $! > __SC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
|
nsb (socat -u UDP4-LISTEN:10002 STDOUT & echo $! > __SC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
|
||||||
host socat -u OPEN:__TEMP__ UDP4:127.0.0.1:10002
|
host socat -u OPEN:__TEMP__ UDP4:127.0.0.1:10002
|
||||||
nsw
|
nsw
|
||||||
|
|
|
@ -15,8 +15,8 @@ htools dd socat ip jq md5sum cut
|
||||||
nstools socat ip jq md5sum cut
|
nstools socat ip jq md5sum cut
|
||||||
|
|
||||||
test TCP/IPv4: host to ns: big transfer
|
test TCP/IPv4: host to ns: big transfer
|
||||||
temp TEMP_BIG
|
set TEMP_BIG __STATEDIR__/big
|
||||||
temp TEMP_NS_BIG
|
set TEMP_NS_BIG __STATEDIR__/big_ns
|
||||||
nsb socat -u TCP4-LISTEN:10002,bind=127.0.0.1 OPEN:__TEMP_NS_BIG__,create,trunc
|
nsb socat -u TCP4-LISTEN:10002,bind=127.0.0.1 OPEN:__TEMP_NS_BIG__,create,trunc
|
||||||
host dd if=/dev/urandom bs=1M count=10 of=__TEMP_BIG__
|
host dd if=/dev/urandom bs=1M count=10 of=__TEMP_BIG__
|
||||||
host socat -u OPEN:__TEMP_BIG__ TCP4:127.0.0.1:10002
|
host socat -u OPEN:__TEMP_BIG__ TCP4:127.0.0.1:10002
|
||||||
|
@ -41,8 +41,8 @@ hout HOST_MD5_BIG md5sum __TEMP_BIG__ | cut -d' ' -f1
|
||||||
check [ "__HOST_MD5_BIG__" = "__MD5_BIG__" ]
|
check [ "__HOST_MD5_BIG__" = "__MD5_BIG__" ]
|
||||||
|
|
||||||
test TCP/IPv4: host to ns: small transfer
|
test TCP/IPv4: host to ns: small transfer
|
||||||
temp TEMP_SMALL
|
set TEMP_SMALL __STATEDIR__/small
|
||||||
temp TEMP_NS_SMALL
|
set TEMP_NS_SMALL __STATEDIR__/small_ns
|
||||||
nsb socat -u TCP4-LISTEN:10002,bind=127.0.0.1 OPEN:__TEMP_NS_SMALL__,create,trunc
|
nsb socat -u TCP4-LISTEN:10002,bind=127.0.0.1 OPEN:__TEMP_NS_SMALL__,create,trunc
|
||||||
host dd if=/dev/urandom bs=2k count=1 of=__TEMP_SMALL__
|
host dd if=/dev/urandom bs=2k count=1 of=__TEMP_SMALL__
|
||||||
host socat OPEN:__TEMP_SMALL__ TCP4:127.0.0.1:10002
|
host socat OPEN:__TEMP_SMALL__ TCP4:127.0.0.1:10002
|
||||||
|
|
|
@ -15,10 +15,10 @@ nstools socat tee grep cat ip jq md5sum cut
|
||||||
htools printf dd socat tee grep cat ip jq md5sum cut
|
htools printf dd socat tee grep cat ip jq md5sum cut
|
||||||
|
|
||||||
test UDP/IPv4: host to ns
|
test UDP/IPv4: host to ns
|
||||||
temp TEMP
|
set TEMP __STATEDIR__/data
|
||||||
temp TEMP_NS
|
set TEMP_NS __STATEDIR__/data_ns
|
||||||
temp NC_PID
|
set SC_PID __STATEDIR__/socat.pid
|
||||||
nsb (socat -u UDP4-LISTEN:10002,bind=127.0.0.1 STDOUT & echo $! > __NC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
|
nsb (socat -u UDP4-LISTEN:10002,bind=127.0.0.1 STDOUT & echo $! > __SC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
|
||||||
host dd if=/dev/urandom bs=1k count=5 > __TEMP__ && printf "\nEND_OF_TEST\n" >> __TEMP__
|
host dd if=/dev/urandom bs=1k count=5 > __TEMP__ && printf "\nEND_OF_TEST\n" >> __TEMP__
|
||||||
|
|
||||||
host socat OPEN:__TEMP__ UDP4:127.0.0.1:10002
|
host socat OPEN:__TEMP__ UDP4:127.0.0.1:10002
|
||||||
|
@ -28,7 +28,7 @@ nsout NS_MD5 md5sum __TEMP_NS__ | cut -d' ' -f1
|
||||||
check [ "__NS_MD5__" = "__MD5__" ]
|
check [ "__NS_MD5__" = "__MD5__" ]
|
||||||
|
|
||||||
test UDP/IPv4: ns to host (recvmmsg/sendmmsg)
|
test UDP/IPv4: ns to host (recvmmsg/sendmmsg)
|
||||||
hostb (socat -u UDP4-LISTEN:10003,bind=127.0.0.1 STDOUT & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
|
hostb (socat -u UDP4-LISTEN:10003,bind=127.0.0.1 STDOUT & echo $! > __SC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
|
||||||
sleep 1
|
sleep 1
|
||||||
ns socat OPEN:__TEMP_NS__ UDP4:127.0.0.1:10003
|
ns socat OPEN:__TEMP_NS__ UDP4:127.0.0.1:10003
|
||||||
hostw
|
hostw
|
||||||
|
@ -36,7 +36,7 @@ hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
|
||||||
check [ "__HOST_MD5__" = "__MD5__" ]
|
check [ "__HOST_MD5__" = "__MD5__" ]
|
||||||
|
|
||||||
test UDP/IPv4: ns to host (via tap)
|
test UDP/IPv4: ns to host (via tap)
|
||||||
hostb (socat -u UDP4-LISTEN:10003 STDOUT & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
|
hostb (socat -u UDP4-LISTEN:10003 STDOUT & echo $! > __SC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
|
||||||
nsout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
|
nsout GW ip -j -4 route show|jq -rM '.[] | select(.dst == "default").gateway'
|
||||||
ns socat -u OPEN:__TEMP_NS__ UDP4:__GW__:10003
|
ns socat -u OPEN:__TEMP_NS__ UDP4:__GW__:10003
|
||||||
hostw
|
hostw
|
||||||
|
@ -44,7 +44,7 @@ hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
|
||||||
check [ "__HOST_MD5__" = "__MD5__" ]
|
check [ "__HOST_MD5__" = "__MD5__" ]
|
||||||
|
|
||||||
test UDP/IPv6: host to ns
|
test UDP/IPv6: host to ns
|
||||||
nsb (socat -u UDP6-LISTEN:10002,bind=[::1] STDOUT & echo $! > __NC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
|
nsb (socat -u UDP6-LISTEN:10002,bind=[::1] STDOUT & echo $! > __SC_PID__) | tee __TEMP_NS__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
|
||||||
host socat -u OPEN:__TEMP__ UDP6:[::1]:10002
|
host socat -u OPEN:__TEMP__ UDP6:[::1]:10002
|
||||||
nsw
|
nsw
|
||||||
hout MD5 md5sum __TEMP__ | cut -d' ' -f1
|
hout MD5 md5sum __TEMP__ | cut -d' ' -f1
|
||||||
|
@ -52,7 +52,7 @@ nsout NS_MD5 md5sum __TEMP_NS__ | cut -d' ' -f1
|
||||||
check [ "__NS_MD5__" = "__MD5__" ]
|
check [ "__NS_MD5__" = "__MD5__" ]
|
||||||
|
|
||||||
test UDP/IPv6: ns to host (recvmmsg/sendmmsg)
|
test UDP/IPv6: ns to host (recvmmsg/sendmmsg)
|
||||||
hostb (socat -u UDP6-LISTEN:10003,bind=[::1] STDOUT & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
|
hostb (socat -u UDP6-LISTEN:10003,bind=[::1] STDOUT & echo $! > __SC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
|
||||||
sleep 1
|
sleep 1
|
||||||
ns socat -u OPEN:__TEMP_NS__ UDP6:[::1]:10003
|
ns socat -u OPEN:__TEMP_NS__ UDP6:[::1]:10003
|
||||||
hostw
|
hostw
|
||||||
|
@ -60,7 +60,7 @@ hout HOST_MD5 md5sum __TEMP__ | cut -d' ' -f1
|
||||||
check [ "__HOST_MD5__" = "__MD5__" ]
|
check [ "__HOST_MD5__" = "__MD5__" ]
|
||||||
|
|
||||||
test UDP/IPv6: ns to host (via tap)
|
test UDP/IPv6: ns to host (via tap)
|
||||||
hostb (socat -u UDP6-LISTEN:10003 STDOUT & echo $! > __NC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __NC_PID__))
|
hostb (socat -u UDP6-LISTEN:10003 STDOUT & echo $! > __SC_PID__) | tee __TEMP__ | (grep -qm1 "END_OF_TEST" && kill $(cat __SC_PID__))
|
||||||
nsout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
|
nsout GW6 ip -j -6 route show|jq -rM '.[] | select(.dst == "default").gateway'
|
||||||
nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
|
nsout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
|
||||||
ns socat -u OPEN:__TEMP_NS__ UDP6:[__GW6__%__IFNAME__]:10003
|
ns socat -u OPEN:__TEMP_NS__ UDP6:[__GW6__%__IFNAME__]:10003
|
||||||
|
|
Loading…
Reference in a new issue