Skip to content

Commit 68a0522

Browse files
kuba-moodavem330
authored andcommitted
selftests: drv-net: update remaining Python init files
Convert remaining __init__ files similar to what we did in commit b615879 ("selftests: drv-net: make linters happy with our imports") Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Stanislav Fomichev <sdf@fomichev.me> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 65946ea commit 68a0522

File tree

3 files changed

+57
-16
lines changed

3 files changed

+57
-16
lines changed
Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# SPDX-License-Identifier: GPL-2.0
22

3+
"""
4+
Driver test environment (hardware-only tests).
5+
NetDrvEnv and NetDrvEpEnv are the main environment classes.
6+
Former is for local host only tests, latter creates / connects
7+
to a remote endpoint. See NIPA wiki for more information about
8+
running and writing driver tests.
9+
"""
10+
311
import sys
412
from pathlib import Path
513

@@ -8,26 +16,36 @@
816
try:
917
sys.path.append(KSFT_DIR.as_posix())
1018

11-
from net.lib.py import *
12-
from drivers.net.lib.py import *
13-
1419
# Import one by one to avoid pylint false positives
20+
from net.lib.py import NetNS, NetNSEnter, NetdevSimDev
1521
from net.lib.py import EthtoolFamily, NetdevFamily, NetshaperFamily, \
1622
NlError, RtnlFamily, DevlinkFamily, PSPFamily
1723
from net.lib.py import CmdExitFailure
18-
from net.lib.py import bkg, cmd, defer, ethtool, fd_read_timeout, ip, \
19-
rand_port, tool, wait_port_listen
20-
from net.lib.py import fd_read_timeout
24+
from net.lib.py import bkg, cmd, bpftool, bpftrace, defer, ethtool, \
25+
fd_read_timeout, ip, rand_port, wait_port_listen, wait_file
2126
from net.lib.py import KsftSkipEx, KsftFailEx, KsftXfailEx
2227
from net.lib.py import ksft_disruptive, ksft_exit, ksft_pr, ksft_run, \
2328
ksft_setup
2429
from net.lib.py import ksft_eq, ksft_ge, ksft_in, ksft_is, ksft_lt, \
2530
ksft_ne, ksft_not_in, ksft_raises, ksft_true, ksft_gt, ksft_not_none
26-
from net.lib.py import NetNSEnter
27-
from drivers.net.lib.py import GenerateTraffic
31+
from drivers.net.lib.py import GenerateTraffic, Remote
2832
from drivers.net.lib.py import NetDrvEnv, NetDrvEpEnv
33+
34+
__all__ = ["NetNS", "NetNSEnter", "NetdevSimDev",
35+
"EthtoolFamily", "NetdevFamily", "NetshaperFamily",
36+
"NlError", "RtnlFamily", "DevlinkFamily", "PSPFamily",
37+
"CmdExitFailure",
38+
"bkg", "cmd", "bpftool", "bpftrace", "defer", "ethtool",
39+
"fd_read_timeout", "ip", "rand_port",
40+
"wait_port_listen", "wait_file",
41+
"KsftSkipEx", "KsftFailEx", "KsftXfailEx",
42+
"ksft_disruptive", "ksft_exit", "ksft_pr", "ksft_run",
43+
"ksft_setup",
44+
"ksft_eq", "ksft_ge", "ksft_in", "ksft_is", "ksft_lt",
45+
"ksft_ne", "ksft_not_in", "ksft_raises", "ksft_true", "ksft_gt",
46+
"ksft_not_none", "ksft_not_none",
47+
"NetDrvEnv", "NetDrvEpEnv", "GenerateTraffic", "Remote"]
2948
except ModuleNotFoundError as e:
30-
ksft_pr("Failed importing `net` library from kernel sources")
31-
ksft_pr(str(e))
32-
ktap_result(True, comment="SKIP")
49+
print("Failed importing `net` library from kernel sources")
50+
print(str(e))
3351
sys.exit(4)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
NlError, RtnlFamily, DevlinkFamily, PSPFamily
2323
from net.lib.py import CmdExitFailure
2424
from net.lib.py import bkg, cmd, bpftool, bpftrace, defer, ethtool, \
25-
fd_read_timeout, ip, rand_port, tool, wait_port_listen, wait_file
25+
fd_read_timeout, ip, rand_port, wait_port_listen, wait_file
2626
from net.lib.py import KsftSkipEx, KsftFailEx, KsftXfailEx
2727
from net.lib.py import ksft_disruptive, ksft_exit, ksft_pr, ksft_run, \
2828
ksft_setup
@@ -34,7 +34,7 @@
3434
"NlError", "RtnlFamily", "DevlinkFamily", "PSPFamily",
3535
"CmdExitFailure",
3636
"bkg", "cmd", "bpftool", "bpftrace", "defer", "ethtool",
37-
"fd_read_timeout", "ip", "rand_port", "tool",
37+
"fd_read_timeout", "ip", "rand_port",
3838
"wait_port_listen", "wait_file",
3939
"KsftSkipEx", "KsftFailEx", "KsftXfailEx",
4040
"ksft_disruptive", "ksft_exit", "ksft_pr", "ksft_run",
Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
11
# SPDX-License-Identifier: GPL-2.0
22

3+
"""
4+
Python selftest helpers for netdev.
5+
"""
6+
37
from .consts import KSRC
4-
from .ksft import *
8+
from .ksft import KsftFailEx, KsftSkipEx, KsftXfailEx, ksft_pr, ksft_eq, \
9+
ksft_ne, ksft_true, ksft_not_none, ksft_in, ksft_not_in, ksft_is, \
10+
ksft_ge, ksft_gt, ksft_lt, ksft_raises, ksft_busy_wait, \
11+
ktap_result, ksft_disruptive, ksft_setup, ksft_run, ksft_exit
512
from .netns import NetNS, NetNSEnter
6-
from .nsim import *
7-
from .utils import *
13+
from .nsim import NetdevSim, NetdevSimDev
14+
from .utils import CmdExitFailure, fd_read_timeout, cmd, bkg, defer, \
15+
bpftool, ip, ethtool, bpftrace, rand_port, wait_port_listen, wait_file
816
from .ynl import NlError, YnlFamily, EthtoolFamily, NetdevFamily, RtnlFamily, RtnlAddrFamily
917
from .ynl import NetshaperFamily, DevlinkFamily, PSPFamily
18+
19+
__all__ = ["KSRC",
20+
"KsftFailEx", "KsftSkipEx", "KsftXfailEx", "ksft_pr", "ksft_eq",
21+
"ksft_ne", "ksft_true", "ksft_not_none", "ksft_in", "ksft_not_in",
22+
"ksft_is", "ksft_ge", "ksft_gt", "ksft_lt", "ksft_raises",
23+
"ksft_busy_wait", "ktap_result", "ksft_disruptive", "ksft_setup",
24+
"ksft_run", "ksft_exit",
25+
"NetNS", "NetNSEnter",
26+
"CmdExitFailure", "fd_read_timeout", "cmd", "bkg", "defer",
27+
"bpftool", "ip", "ethtool", "bpftrace", "rand_port",
28+
"wait_port_listen", "wait_file",
29+
"NetdevSim", "NetdevSimDev",
30+
"NetshaperFamily", "DevlinkFamily", "PSPFamily", "NlError",
31+
"YnlFamily", "EthtoolFamily", "NetdevFamily", "RtnlFamily",
32+
"RtnlAddrFamily"]

0 commit comments

Comments
 (0)