2021-02-25 19:59:36 -05:00
#!/usr/bin/env bash
2021-10-17 18:13:06 +02:00
# SPDX-License-Identifier: LGPL-2.1-or-later
2021-02-25 19:59:36 -05:00
set -ex
set -o pipefail
setup( ) {
systemd-analyze log-level debug
2021-09-29 20:30:08 +02:00
for i in { 0..3} ;
2021-02-25 19:59:36 -05:00
do
2021-09-29 20:30:08 +02:00
ip netns del " ns ${ i } " || true
ip link del " veth ${ i } " || true
ip netns add " ns ${ i } "
ip link add " veth ${ i } " type veth peer name " veth ${ i } _ "
ip link set " veth ${ i } _ " netns " ns ${ i } "
ip -n " ns ${ i } " link set dev " veth ${ i } _ " up
ip -n " ns ${ i } " link set dev lo up
ip -n " ns ${ i } " addr add "192.168.113." $(( 4 * i+1)) /30 dev " veth ${ i } _ "
ip link set dev " veth ${ i } " up
2023-12-15 03:22:52 +01:00
ip link property add dev " veth ${ i } " altname " veth ${ i } -altname-with-more-than-15-chars "
2021-09-29 20:30:08 +02:00
ip addr add "192.168.113." $(( 4 * i+2)) /30 dev " veth ${ i } "
2021-02-25 19:59:36 -05:00
done
}
2023-05-16 20:55:45 +02:00
# shellcheck disable=SC2317
2021-02-25 19:59:36 -05:00
teardown( ) {
set +e
2023-05-16 20:55:45 +02:00
for i in { 0..3} ; do
2021-09-29 20:30:08 +02:00
ip netns del " ns ${ i } "
ip link del " veth ${ i } "
2021-02-25 19:59:36 -05:00
done
systemd-analyze log-level info
}
KERNEL_VERSION = " $( uname -r) "
KERNEL_MAJOR = " ${ KERNEL_VERSION %%.* } "
2021-12-10 20:07:35 +09:00
KERNEL_MINOR = " ${ KERNEL_VERSION # " $KERNEL_MAJOR " . } "
2021-02-25 19:59:36 -05:00
KERNEL_MINOR = " ${ KERNEL_MINOR %%.* } "
MAJOR_REQUIRED = 5
MINOR_REQUIRED = 7
if [ [ " $KERNEL_MAJOR " -lt $MAJOR_REQUIRED || ( " $KERNEL_MAJOR " -eq $MAJOR_REQUIRED && " $KERNEL_MINOR " -lt $MINOR_REQUIRED ) ] ] ; then
echo "kernel is not 5.7+" >>/skipped
2024-04-02 20:37:30 +02:00
exit 77
2021-02-25 19:59:36 -05:00
fi
2021-12-11 11:54:01 +09:00
if systemctl --version | grep -q -F -- "-BPF_FRAMEWORK" ; then
2021-12-10 19:51:23 +09:00
echo "bpf-framework is disabled" >>/skipped
2024-04-02 20:37:30 +02:00
exit 77
2021-12-10 19:51:23 +09:00
fi
2021-02-25 19:59:36 -05:00
trap teardown EXIT
setup
systemctl start --wait testsuite-62-1.service
systemctl start --wait testsuite-62-2.service
systemctl start --wait testsuite-62-3.service
systemctl start --wait testsuite-62-4.service
systemctl start --wait testsuite-62-5.service
2023-07-12 15:49:55 +02:00
touch /testok