Skip to content

Commit a48395f

Browse files
Stanislav Fomichevkuba-moo
authored andcommitted
selftests: net: ksft: replace 95 with errno.EOPNOTSUPP
Petr suggested to use errno.EOPNOTSUPP instead of hard-coded 95 in the new test case. Adjust existing ones to match this style. Signed-off-by: Stanislav Fomichev <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent f879306 commit a48395f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

tools/testing/selftests/drivers/net/hw/pp_alloc_fail.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22
# SPDX-License-Identifier: GPL-2.0
33

4+
import errno
45
import time
56
import os
67
from lib.py import ksft_run, ksft_exit, ksft_pr
@@ -61,7 +62,7 @@ def check_traffic_flowing():
6162
try:
6263
stats = get_stats()
6364
except NlError as e:
64-
if e.nl_msg.error == -95:
65+
if e.nl_msg.error == -errno.EOPNOTSUPP:
6566
stats = {}
6667
else:
6768
raise

tools/testing/selftests/drivers/net/stats.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def check_pause(cfg) -> None:
2020
try:
2121
ethnl.pause_get({"header": {"dev-index": cfg.ifindex}})
2222
except NlError as e:
23-
if e.error == 95:
23+
if e.error == errno.EOPNOTSUPP:
2424
raise KsftXfailEx("pause not supported by the device")
2525
raise
2626

@@ -35,7 +35,7 @@ def check_fec(cfg) -> None:
3535
try:
3636
ethnl.fec_get({"header": {"dev-index": cfg.ifindex}})
3737
except NlError as e:
38-
if e.error == 95:
38+
if e.error == errno.EOPNOTSUPP:
3939
raise KsftXfailEx("FEC not supported by the device")
4040
raise
4141

@@ -120,7 +120,7 @@ def qstat_by_ifindex(cfg) -> None:
120120
# loopback has no stats
121121
with ksft_raises(NlError) as cm:
122122
netfam.qstats_get({"ifindex": 1}, dump=True)
123-
ksft_eq(cm.exception.nl_msg.error, -95)
123+
ksft_eq(cm.exception.nl_msg.error, -errno.EOPNOTSUPP)
124124
ksft_eq(cm.exception.nl_msg.extack['bad-attr'], '.ifindex')
125125

126126
# Try to get stats for lowest unused ifindex but not 0

0 commit comments

Comments
 (0)