Merge branch 'selftests-assortment-of-fixes'
Petr Machata says: ==================== selftests: Assortment of fixes This is a loose follow-up to the Kernel CI patchset posted recently. It contains various fixes that were supposed to be part of said patchset, but didn't fit due to its size. The latter 4 patches were written independently of the CI effort, but again didn't fit in their intended patchsets. - Patch #1 unifies code of two very similar looking functions, busywait() and slowwait(). - Patch #2 adds sanity checks around the setting of NETIFS, which carries list of interfaces to run on. - Patch #3 changes bail_on_lldpad() to SKIP instead of FAILing. - Patches #4 to #7 fix issues in selftests. - Patches #8 to #10 add topology diagrams to several selftests. This should have been part of the mlxsw leg of NH group stats patches, but again, it did not fit in due to size. ==================== Link: https://lore.kernel.org/r/cover.1712940759.git.petrm@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
@@ -65,9 +65,8 @@ same_speeds_autoneg_off()
|
||||
setup_wait_dev_with_timeout $h1
|
||||
setup_wait_dev_with_timeout $h2
|
||||
ping_do $h1 192.0.2.2
|
||||
check_err $? "speed $speed autoneg off"
|
||||
log_test "force of same speed autoneg off"
|
||||
log_info "speed = $speed"
|
||||
check_err $? "ping with speed $speed autoneg off"
|
||||
log_test "force speed $speed on both ends"
|
||||
done
|
||||
|
||||
ethtool -s $h2 autoneg on
|
||||
@@ -112,9 +111,8 @@ combination_of_neg_on_and_off()
|
||||
setup_wait_dev_with_timeout $h1
|
||||
setup_wait_dev_with_timeout $h2
|
||||
ping_do $h1 192.0.2.2
|
||||
check_err $? "h1-speed=$speed autoneg off, h2 autoneg on"
|
||||
log_test "one side with autoneg off and another with autoneg on"
|
||||
log_info "force speed = $speed"
|
||||
check_err $? "ping with h1-speed=$speed autoneg off, h2 autoneg on"
|
||||
log_test "force speed $speed vs. autoneg"
|
||||
done
|
||||
|
||||
ethtool -s $h1 autoneg on
|
||||
@@ -207,10 +205,9 @@ advertise_subset_of_speeds()
|
||||
setup_wait_dev_with_timeout $h1
|
||||
setup_wait_dev_with_timeout $h2
|
||||
ping_do $h1 192.0.2.2
|
||||
check_err $? "h1=$speed_1_to_advertise, h2=$speed_2_to_advertise ($speed_value)"
|
||||
check_err $? "ping with h1=$speed_1_to_advertise, h2=$speed_2_to_advertise ($speed_value)"
|
||||
|
||||
log_test "advertise subset of speeds"
|
||||
log_info "h1=$speed_1_to_advertise, h2=$speed_2_to_advertise"
|
||||
log_test "advertise $speed_1_to_advertise vs. $speed_2_to_advertise"
|
||||
done
|
||||
|
||||
ethtool -s $h2 autoneg on
|
||||
|
||||
@@ -44,6 +44,7 @@ bucket_test()
|
||||
# Mausezahn does not include FCS bytes in its length - but the
|
||||
# histogram counters do
|
||||
len=$((len - ETH_FCS_LEN))
|
||||
len=$((len > 0 ? len : 0))
|
||||
|
||||
before=$(ethtool --json -S $iface --groups rmon | \
|
||||
jq -r ".[0].rmon[\"${set}-pktsNtoM\"][$bucket].val")
|
||||
|
||||
@@ -50,6 +50,7 @@ ALL_TESTS="
|
||||
NUM_NETIFS=4
|
||||
lib_dir=$(dirname "$0")
|
||||
source "$lib_dir"/../../../net/forwarding/lib.sh
|
||||
source "$lib_dir"/../../../net/forwarding/tc_common.sh
|
||||
|
||||
h1_create()
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@ NUM_NETIFS=6
|
||||
lib_dir=$(dirname "$0")
|
||||
source "$lib_dir"/../../../net/forwarding/lib.sh
|
||||
source "$lib_dir"/../../../net/forwarding/ipip_lib.sh
|
||||
source "$lib_dir"/../../../net/forwarding/tc_common.sh
|
||||
|
||||
setup_prepare()
|
||||
{
|
||||
|
||||
@@ -24,8 +24,8 @@ setup_prepare()
|
||||
busywait "$TIMEOUT" wait_for_port_up ethtool $swp2
|
||||
check_err $? "ports did not come up"
|
||||
|
||||
local lanes_exist=$(ethtool $swp1 | grep 'Lanes:')
|
||||
if [[ -z $lanes_exist ]]; then
|
||||
busywait $TIMEOUT sh -c "ethtool $swp1 | grep -q Lanes:"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
log_test "SKIP: driver does not support lanes setting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -122,8 +122,9 @@ autoneg()
|
||||
ethtool_set $swp1 speed $max_speed lanes $lanes
|
||||
ip link set dev $swp1 up
|
||||
ip link set dev $swp2 up
|
||||
busywait "$TIMEOUT" wait_for_port_up ethtool $swp2
|
||||
check_err $? "ports did not come up"
|
||||
|
||||
busywait $TIMEOUT sh -c "ethtool $swp1 | grep -q Lanes:"
|
||||
check_err $? "Lanes parameter is not presented on time"
|
||||
|
||||
check_lanes $swp1 $lanes $max_speed
|
||||
log_test "$lanes lanes is autonegotiated"
|
||||
@@ -160,8 +161,9 @@ autoneg_force_mode()
|
||||
ethtool_set $swp2 speed $max_speed lanes $lanes autoneg off
|
||||
ip link set dev $swp1 up
|
||||
ip link set dev $swp2 up
|
||||
busywait "$TIMEOUT" wait_for_port_up ethtool $swp2
|
||||
check_err $? "ports did not come up"
|
||||
|
||||
busywait $TIMEOUT sh -c "ethtool $swp1 | grep -q Lanes:"
|
||||
check_err $? "Lanes parameter is not presented on time"
|
||||
|
||||
check_lanes $swp1 $lanes $max_speed
|
||||
log_test "Autoneg off, $lanes lanes detected during force mode"
|
||||
|
||||
@@ -95,27 +95,9 @@ source "$net_forwarding_dir/../lib.sh"
|
||||
# timeout in seconds
|
||||
slowwait()
|
||||
{
|
||||
local timeout=$1; shift
|
||||
local timeout_sec=$1; shift
|
||||
|
||||
local start_time="$(date -u +%s)"
|
||||
while true
|
||||
do
|
||||
local out
|
||||
out=$("$@")
|
||||
local ret=$?
|
||||
if ((!ret)); then
|
||||
echo -n "$out"
|
||||
return 0
|
||||
fi
|
||||
|
||||
local current_time="$(date -u +%s)"
|
||||
if ((current_time - start_time > timeout)); then
|
||||
echo -n "$out"
|
||||
return 1
|
||||
fi
|
||||
|
||||
sleep 0.1
|
||||
done
|
||||
loopy_wait "sleep 0.1" "$((timeout_sec * 1000))" "$@"
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
@@ -291,11 +273,6 @@ if [[ "$REQUIRE_MTOOLS" = "yes" ]]; then
|
||||
require_command mreceive
|
||||
fi
|
||||
|
||||
if [[ ! -v NUM_NETIFS ]]; then
|
||||
echo "SKIP: importer does not define \"NUM_NETIFS\""
|
||||
exit $ksft_skip
|
||||
fi
|
||||
|
||||
##############################################################################
|
||||
# Command line options handling
|
||||
|
||||
@@ -314,6 +291,23 @@ done
|
||||
##############################################################################
|
||||
# Network interfaces configuration
|
||||
|
||||
if [[ ! -v NUM_NETIFS ]]; then
|
||||
echo "SKIP: importer does not define \"NUM_NETIFS\""
|
||||
exit $ksft_skip
|
||||
fi
|
||||
|
||||
if (( NUM_NETIFS > ${#NETIFS[@]} )); then
|
||||
echo "SKIP: Importer requires $NUM_NETIFS NETIFS, but only ${#NETIFS[@]} are defined (${NETIFS[@]})"
|
||||
exit $ksft_skip
|
||||
fi
|
||||
|
||||
for i in $(seq ${#NETIFS[@]}); do
|
||||
if [[ ! ${NETIFS[p$i]} ]]; then
|
||||
echo "SKIP: NETIFS[p$i] not given"
|
||||
exit $ksft_skip
|
||||
fi
|
||||
done
|
||||
|
||||
create_netif_veth()
|
||||
{
|
||||
local i
|
||||
@@ -2144,6 +2138,8 @@ bail_on_lldpad()
|
||||
{
|
||||
local reason1="$1"; shift
|
||||
local reason2="$1"; shift
|
||||
local caller=${FUNCNAME[1]}
|
||||
local src=${BASH_SOURCE[1]}
|
||||
|
||||
if systemctl is-active --quiet lldpad; then
|
||||
|
||||
@@ -2164,7 +2160,8 @@ bail_on_lldpad()
|
||||
an environment variable ALLOW_LLDPAD to a
|
||||
non-empty string.
|
||||
EOF
|
||||
exit 1
|
||||
log_test_skip $src:$caller
|
||||
exit $EXIT_STATUS
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -1,6 +1,41 @@
|
||||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
# +-------------------------+
|
||||
# | H1 |
|
||||
# | $h1 + |
|
||||
# | 192.0.2.2/24 | |
|
||||
# | 2001:db8:1::2/64 | |
|
||||
# +-------------------|-----+
|
||||
# |
|
||||
# +-------------------|----------------------+
|
||||
# | | R1 |
|
||||
# | $rp11 + |
|
||||
# | 192.0.2.1/24 |
|
||||
# | 2001:db8:1::1/64 |
|
||||
# | |
|
||||
# | + $rp12 + $rp13 |
|
||||
# | | 169.254.2.12/24 | 169.254.3.13/24 |
|
||||
# | | fe80:2::12/64 | fe80:3::13/64 |
|
||||
# +--|--------------------|------------------+
|
||||
# | |
|
||||
# +--|--------------------|------------------+
|
||||
# | + $rp22 + $rp23 |
|
||||
# | 169.254.2.22/24 169.254.3.23/24 |
|
||||
# | fe80:2::22/64 fe80:3::23/64 |
|
||||
# | |
|
||||
# | $rp21 + |
|
||||
# | 198.51.100.1/24 | |
|
||||
# | 2001:db8:2::1/64 | R2 |
|
||||
# +-------------------|----------------------+
|
||||
# |
|
||||
# +-------------------|-----+
|
||||
# | | |
|
||||
# | $h2 + |
|
||||
# | 198.51.100.2/24 |
|
||||
# | 2001:db8:2::2/64 H2 |
|
||||
# +-------------------------+
|
||||
|
||||
ALL_TESTS="
|
||||
ping_ipv4
|
||||
ping_ipv6
|
||||
|
||||
@@ -1,6 +1,41 @@
|
||||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
# +-------------------------+
|
||||
# | H1 |
|
||||
# | $h1 + |
|
||||
# | 192.0.2.2/24 | |
|
||||
# | 2001:db8:1::2/64 | |
|
||||
# +-------------------|-----+
|
||||
# |
|
||||
# +-------------------|----------------------+
|
||||
# | | R1 |
|
||||
# | $rp11 + |
|
||||
# | 192.0.2.1/24 |
|
||||
# | 2001:db8:1::1/64 |
|
||||
# | |
|
||||
# | + $rp12 + $rp13 |
|
||||
# | | 169.254.2.12/24 | 169.254.3.13/24 |
|
||||
# | | fe80:2::12/64 | fe80:3::13/64 |
|
||||
# +--|--------------------|------------------+
|
||||
# | |
|
||||
# +--|--------------------|------------------+
|
||||
# | + $rp22 + $rp23 |
|
||||
# | 169.254.2.22/24 169.254.3.23/24 |
|
||||
# | fe80:2::22/64 fe80:3::23/64 |
|
||||
# | |
|
||||
# | $rp21 + |
|
||||
# | 198.51.100.1/24 | |
|
||||
# | 2001:db8:2::1/64 | R2 |
|
||||
# +-------------------|----------------------+
|
||||
# |
|
||||
# +-------------------|-----+
|
||||
# | | |
|
||||
# | $h2 + |
|
||||
# | 198.51.100.2/24 |
|
||||
# | 2001:db8:2::2/64 H2 |
|
||||
# +-------------------------+
|
||||
|
||||
ALL_TESTS="
|
||||
ping_ipv4
|
||||
ping_ipv6
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
# +-------------------------+ +-------------------------+
|
||||
# | H1 | | H2 |
|
||||
# | $h1 + | | $h2 + |
|
||||
# | 192.0.2.2/24 | | | 198.51.100.2/24 | |
|
||||
# | 2001:db8:1::2/64 | | | 2001:db8:2::2/64 | |
|
||||
# +-------------------|-----+ +-------------------|-----+
|
||||
# | |
|
||||
# +-------------------|----------------------------|-----+
|
||||
# | R1 | | |
|
||||
# | $rp1 + $rp2 + |
|
||||
# | 192.0.2.1/24 198.51.100.1/24 |
|
||||
# | 2001:db8:1::1/64 2001:db8:2::1/64 |
|
||||
# +------------------------------------------------------+
|
||||
|
||||
ALL_TESTS="
|
||||
ping_ipv4
|
||||
ping_ipv6
|
||||
|
||||
@@ -58,9 +58,10 @@ ksft_exit_status_merge()
|
||||
$ksft_xfail $ksft_pass $ksft_skip $ksft_fail
|
||||
}
|
||||
|
||||
busywait()
|
||||
loopy_wait()
|
||||
{
|
||||
local timeout=$1; shift
|
||||
local sleep_cmd=$1; shift
|
||||
local timeout_ms=$1; shift
|
||||
|
||||
local start_time="$(date -u +%s%3N)"
|
||||
while true
|
||||
@@ -74,13 +75,22 @@ busywait()
|
||||
fi
|
||||
|
||||
local current_time="$(date -u +%s%3N)"
|
||||
if ((current_time - start_time > timeout)); then
|
||||
if ((current_time - start_time > timeout_ms)); then
|
||||
echo -n "$out"
|
||||
return 1
|
||||
fi
|
||||
|
||||
$sleep_cmd
|
||||
done
|
||||
}
|
||||
|
||||
busywait()
|
||||
{
|
||||
local timeout_ms=$1; shift
|
||||
|
||||
loopy_wait : "$timeout_ms" "$@"
|
||||
}
|
||||
|
||||
cleanup_ns()
|
||||
{
|
||||
local ns=""
|
||||
|
||||
Reference in New Issue
Block a user