summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/net/lib/py/utils.py
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2024-12-19 16:31:16 -0800
committerJakub Kicinski <kuba@kernel.org>2024-12-23 10:12:20 -0800
commitf288c7a1ba268a9ed58a7971142a98a1e41a3c73 (patch)
tree34ad53fb7fc79e8a54708e781912e1d6dbbcae5f /tools/testing/selftests/net/lib/py/utils.py
parent85101bda1387e85eabf77cd416bfc38e14f1bce6 (diff)
downloadlinux-f288c7a1ba268a9ed58a7971142a98a1e41a3c73.tar.gz
linux-f288c7a1ba268a9ed58a7971142a98a1e41a3c73.tar.bz2
linux-f288c7a1ba268a9ed58a7971142a98a1e41a3c73.zip
selftests: drv-net: assume stats refresh is 0 if no ethtool -c support
Tests using HW stats wait for them to stabilize, using data from ethtool -c as the delay. Not all drivers implement ethtool -c so handle the errors gracefully. Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/20241220003116.1458863-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/testing/selftests/net/lib/py/utils.py')
-rw-r--r--tools/testing/selftests/net/lib/py/utils.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py
index 72590c3f90f1..9e3bcddcf3e8 100644
--- a/tools/testing/selftests/net/lib/py/utils.py
+++ b/tools/testing/selftests/net/lib/py/utils.py
@@ -10,7 +10,9 @@ import time
class CmdExitFailure(Exception):
- pass
+ def __init__(self, msg, cmd_obj):
+ super().__init__(msg)
+ self.cmd = cmd_obj
class cmd:
@@ -48,7 +50,7 @@ class cmd:
if len(stderr) > 0 and stderr[-1] == "\n":
stderr = stderr[:-1]
raise CmdExitFailure("Command failed: %s\nSTDOUT: %s\nSTDERR: %s" %
- (self.proc.args, stdout, stderr))
+ (self.proc.args, stdout, stderr), self)
class bkg(cmd):