Skip to content

Commit ad3ff66

Browse files
committed
Merge: selftests: stable backport for 10.1 phase 1
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/635 JIRA: https://issues.redhat.com/browse/RHEL-84558 Signed-off-by: Hangbin Liu <haliu@redhat.com> Approved-by: Phil Sutter <psutter@redhat.com> Approved-by: Marcelo Ricardo Leitner <mleitner@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Julio Faracco <jfaracco@redhat.com>
2 parents e8cb243 + 646cdcd commit ad3ff66

35 files changed

+2378
-843
lines changed

tools/testing/selftests/drivers/net/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ On the target machine, running the tests will use netdevsim by default::
107107
1..1
108108
# timeout set to 45
109109
# selftests: drivers/net: ping.py
110-
# KTAP version 1
110+
# TAP version 13
111111
# 1..3
112112
# ok 1 ping.test_v4
113113
# ok 2 ping.test_v6
@@ -128,7 +128,7 @@ Create a config with remote info::
128128
Run the test::
129129

130130
[/root] # ./ksft-net-drv/drivers/net/ping.py
131-
KTAP version 1
131+
TAP version 13
132132
1..3
133133
ok 1 ping.test_v4
134134
ok 2 ping.test_v6 # SKIP Test requires IPv6 connectivity

tools/testing/selftests/drivers/net/lib/py/env.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pathlib import Path
66
from lib.py import KsftSkipEx, KsftXfailEx
77
from lib.py import ksft_setup
8-
from lib.py import cmd, ethtool, ip
8+
from lib.py import cmd, ethtool, ip, CmdExitFailure
99
from lib.py import NetNS, NetdevSimDev
1010
from .remote import Remote
1111

@@ -234,7 +234,12 @@ def wait_hw_stats_settle(self):
234234
Good drivers will tell us via ethtool what their sync period is.
235235
"""
236236
if self._stats_settle_time is None:
237-
data = ethtool("-c " + self.ifname, json=True)[0]
237+
data = {}
238+
try:
239+
data = ethtool("-c " + self.ifname, json=True)[0]
240+
except CmdExitFailure as e:
241+
if "Operation not supported" not in e.cmd.stderr:
242+
raise
238243

239244
self._stats_settle_time = 0.025 + \
240245
data.get('stats-block-usecs', 0) / 1000 / 1000

tools/testing/selftests/drivers/net/mlxsw/rif_bridge.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ ALL_TESTS="
1212
bridge_rif_remaster_port
1313
"
1414

15+
REQUIRE_TEAMD="yes"
1516
NUM_NETIFS=2
1617
source $lib_dir/lib.sh
1718
source $lib_dir/devlink_lib.sh

tools/testing/selftests/drivers/net/mlxsw/rif_lag.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ALL_TESTS="
1010
lag_rif_nomaster_addr
1111
"
1212

13+
REQUIRE_TEAMD="yes"
1314
NUM_NETIFS=2
1415
source $lib_dir/lib.sh
1516
source $lib_dir/devlink_lib.sh

tools/testing/selftests/drivers/net/mlxsw/rif_lag_vlan.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ALL_TESTS="
1010
lag_rif_nomaster_addr
1111
"
1212

13+
REQUIRE_TEAMD="yes"
1314
NUM_NETIFS=2
1415
source $lib_dir/lib.sh
1516
source $lib_dir/devlink_lib.sh

tools/testing/selftests/net/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ TEST_PROGS += test_vxlan_vnifiltering.sh
7878
TEST_GEN_FILES += io_uring_zerocopy_tx
7979
TEST_PROGS += io_uring_zerocopy_tx.sh
8080
TEST_GEN_FILES += bind_bhash
81-
TEST_GEN_PROGS += netlink-dumps
8281
TEST_GEN_PROGS += sk_bind_sendto_listen
8382
TEST_GEN_PROGS += sk_connect_zero_addr
8483
TEST_GEN_PROGS += sk_so_peek_off
@@ -100,7 +99,7 @@ TEST_PROGS += bpf_offload.py
10099
TEST_PROGS += ipv6_route_update_soft_lockup.sh
101100

102101
# YNL files, must be before "include ..lib.mk"
103-
YNL_GEN_FILES := ncdevmem
102+
YNL_GEN_FILES := ncdevmem netlink-dumps
104103
TEST_GEN_FILES += $(YNL_GEN_FILES)
105104

106105
TEST_FILES := settings

tools/testing/selftests/net/bpf_offload.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,11 @@ def bpftool_prog_list_wait(expected=0, n_retry=20):
207207
raise Exception("Time out waiting for program counts to stabilize want %d, have %d" % (expected, nprogs))
208208

209209
def bpftool_map_list_wait(expected=0, n_retry=20, ns=""):
210+
nmaps = None
210211
for i in range(n_retry):
211212
maps = bpftool_map_list(ns=ns)
212-
if len(maps) == expected:
213+
nmaps = len(maps)
214+
if nmaps == expected:
213215
return maps
214216
time.sleep(0.05)
215217
raise Exception("Time out waiting for map counts to stabilize want %d, have %d" % (expected, nmaps))
@@ -594,8 +596,9 @@ def check_extack_nsim(output, reference, args):
594596
check_extack(output, "netdevsim: " + reference, args)
595597

596598
def check_no_extack(res, needle):
597-
fail((res[1] + res[2]).count(needle) or (res[1] + res[2]).count("Warning:"),
598-
"Found '%s' in command output, leaky extack?" % (needle))
599+
haystack = (res[1] + res[2]).strip()
600+
fail(haystack.count(needle) or haystack.count("Warning:"),
601+
"Unexpected command output, leaky extack? ('%s', '%s')" % (needle, haystack))
599602

600603
def check_verifier_log(output, reference):
601604
lines = output.split("\n")
@@ -707,6 +710,7 @@ def test_multi_prog(simdev, sim, obj, modename, modeid):
707710
base_map_names = [
708711
'pid_iter.rodata', # created on each bpftool invocation
709712
'libbpf_det_bind', # created on each bpftool invocation
713+
'libbpf_global',
710714
]
711715

712716
# Check netdevsim

tools/testing/selftests/net/cmsg_time.sh

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,28 @@ BAD=0
3434
TOTAL=0
3535

3636
check_result() {
37+
local ret=$1
38+
local got=$2
39+
local exp=$3
40+
local case=$4
41+
local xfail=$5
42+
local xf=
43+
local inc=
44+
45+
if [ "$xfail" == "xfail" ]; then
46+
xf="(XFAIL)"
47+
inc=0
48+
else
49+
inc=1
50+
fi
51+
3752
((TOTAL++))
38-
if [ $1 -ne 0 ]; then
39-
echo " Case $4 returned $1, expected 0"
40-
((BAD++))
53+
if [ $ret -ne 0 ]; then
54+
echo " Case $case returned $ret, expected 0 $xf"
55+
((BAD+=inc))
4156
elif [ "$2" != "$3" ]; then
42-
echo " Case $4 returned '$2', expected '$3'"
43-
((BAD++))
57+
echo " Case $case returned '$got', expected '$exp' $xf"
58+
((BAD+=inc))
4459
fi
4560
}
4661

@@ -66,14 +81,14 @@ for i in "-4 $TGT4" "-6 $TGT6"; do
6681
awk '/SND/ { if ($3 > 1000) print "OK"; }')
6782
check_result $? "$ts" "OK" "$prot - TXTIME abs"
6883

69-
[ "$KSFT_MACHINE_SLOW" = yes ] && delay=8000 || delay=1000
84+
[ "$KSFT_MACHINE_SLOW" = yes ] && xfail=xfail
7085

71-
ts=$(ip netns exec $NS ./cmsg_sender -p $p $i 1234 -t -d $delay |
86+
ts=$(ip netns exec $NS ./cmsg_sender -p $p $i 1234 -t -d 1000 |
7287
awk '/SND/ {snd=$3}
7388
/SCHED/ {sch=$3}
74-
END { if (snd - sch > '$((delay/2))') print "OK";
75-
else print snd, "-", sch, "<", '$((delay/2))'; }')
76-
check_result $? "$ts" "OK" "$prot - TXTIME rel"
89+
END { if (snd - sch > 500) print "OK";
90+
else print snd, "-", sch, "<", 500; }')
91+
check_result $? "$ts" "OK" "$prot - TXTIME rel" $xfail
7792
done
7893
done
7994

tools/testing/selftests/net/config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ CONFIG_DUMMY=y
1818
CONFIG_BRIDGE_VLAN_FILTERING=y
1919
CONFIG_BRIDGE=y
2020
CONFIG_CRYPTO_CHACHA20POLY1305=m
21+
CONFIG_DEBUG_INFO_BTF=y
22+
CONFIG_DEBUG_INFO_BTF_MODULES=n
2123
CONFIG_VLAN_8021Q=y
2224
CONFIG_GENEVE=m
2325
CONFIG_IFB=y

tools/testing/selftests/net/fcnal-test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3667,7 +3667,7 @@ ipv6_addr_bind_novrf()
36673667
# when it really should not
36683668
a=${NSA_LO_IP6}
36693669
log_start
3670-
show_hint "Tecnically should fail since address is not on device but kernel allows"
3670+
show_hint "Technically should fail since address is not on device but kernel allows"
36713671
run_cmd nettest -6 -s -l ${a} -I ${NSA_DEV} -t1 -b
36723672
log_test_addr ${a} $? 0 "TCP socket bind to out of scope local address"
36733673
}
@@ -3724,7 +3724,7 @@ ipv6_addr_bind_vrf()
37243724
# passes when it really should not
37253725
a=${VRF_IP6}
37263726
log_start
3727-
show_hint "Tecnically should fail since address is not on device but kernel allows"
3727+
show_hint "Technically should fail since address is not on device but kernel allows"
37283728
run_cmd nettest -6 -s -l ${a} -I ${NSA_DEV} -t1 -b
37293729
log_test_addr ${a} $? 0 "TCP socket bind to VRF address with device bind"
37303730

0 commit comments

Comments
 (0)