Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH net-next] selftests: drv-net: print device info at the start
@ 2026-08-03 21:19 Jakub Kicinski
  2026-08-05 16:26 ` Simon Horman
  2026-08-06  1:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2026-08-03 21:19 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Jakub Kicinski,
	shuah, sdf, dw, linux-kselftest

When a reviewer asks a developer to run an upstream test during code
review, it's often ambiguous whether the test was actually run against
a real device, or just against netdevsim. Print the driver name and
ifname at the start of the test, e.g.:

  # Interface: enp0s13f0u1u4, driver: r8152
  TAP version 13
  1..1
  ok 1 ...

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: shuah@kernel.org
CC: sdf@fomichev.me
CC: dw@davidwei.uk
CC: linux-kselftest@vger.kernel.org
---
 .../selftests/drivers/net/lib/py/env.py       | 21 ++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/drivers/net/lib/py/env.py b/tools/testing/selftests/drivers/net/lib/py/env.py
index e4acf3d8333f..a8e8029868a7 100644
--- a/tools/testing/selftests/drivers/net/lib/py/env.py
+++ b/tools/testing/selftests/drivers/net/lib/py/env.py
@@ -7,7 +7,7 @@ import time
 import json
 from pathlib import Path
 from lib.py import KsftSkipEx, KsftXfailEx
-from lib.py import ksft_setup, wait_file
+from lib.py import ksft_pr, ksft_setup, wait_file
 from lib.py import cmd, ethtool, ip, CmdExitFailure
 from lib.py import NetNS, NetdevSimDev, UserNetNS
 from .remote import Remote
@@ -31,6 +31,7 @@ from . import bpftool, RtnlFamily, Netlink
 
         # Following attrs must be set be inheriting classes
         self.dev = None
+        self.ifname = None
 
     def _load_env_file(self):
         env = os.environ.copy()
@@ -58,6 +59,22 @@ from . import bpftool, RtnlFamily, Netlink
     def __del__(self):
         pass
 
+    def _print_dev_info(self):
+        """
+        Show whether the test ran on real hardware or netdevsim.
+        Useful to confirm when results are shared on the mailing list.
+        """
+        driver = "unknown"
+        try:
+            info = ethtool(f"-i {self.ifname}").stdout
+            for line in info.splitlines():
+                if line.startswith("driver:"):
+                    driver = line.split(':', 1)[1].strip() or driver
+                    break
+        except (CmdExitFailure, FileNotFoundError):
+            pass
+        ksft_pr(f"Interface: {self.ifname}, driver: {driver}")
+
     def __enter__(self):
         ip(f"link set dev {self.dev['ifname']} up")
         wait_file(f"/sys/class/net/{self.dev['ifname']}/carrier",
@@ -94,6 +111,7 @@ from . import bpftool, RtnlFamily, Netlink
             self.dev = self._ns.nsims[0].dev
         self.ifname = self.dev['ifname']
         self.ifindex = self.dev['ifindex']
+        self._print_dev_info()
 
     def __del__(self):
         if self._ns:
@@ -163,6 +181,7 @@ from . import bpftool, RtnlFamily, Netlink
 
         self.ifname = self.dev['ifname']
         self.ifindex = self.dev['ifindex']
+        self._print_dev_info()
 
         # resolve remote interface name
         self.remote_ifname = self.resolve_remote_ifc()
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] selftests: drv-net: print device info at the start
  2026-08-03 21:19 [PATCH net-next] selftests: drv-net: print device info at the start Jakub Kicinski
@ 2026-08-05 16:26 ` Simon Horman
  2026-08-06  1:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2026-08-05 16:26 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, shuah, sdf, dw,
	linux-kselftest

On Mon, Aug 03, 2026 at 02:19:44PM -0700, Jakub Kicinski wrote:
> When a reviewer asks a developer to run an upstream test during code
> review, it's often ambiguous whether the test was actually run against
> a real device, or just against netdevsim. Print the driver name and
> ifname at the start of the test, e.g.:
> 
>   # Interface: enp0s13f0u1u4, driver: r8152
>   TAP version 13
>   1..1
>   ok 1 ...
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] selftests: drv-net: print device info at the start
  2026-08-03 21:19 [PATCH net-next] selftests: drv-net: print device info at the start Jakub Kicinski
  2026-08-05 16:26 ` Simon Horman
@ 2026-08-06  1:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-08-06  1:20 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, shuah, sdf,
	dw, linux-kselftest

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon,  3 Aug 2026 14:19:44 -0700 you wrote:
> When a reviewer asks a developer to run an upstream test during code
> review, it's often ambiguous whether the test was actually run against
> a real device, or just against netdevsim. Print the driver name and
> ifname at the start of the test, e.g.:
> 
>   # Interface: enp0s13f0u1u4, driver: r8152
>   TAP version 13
>   1..1
>   ok 1 ...
> 
> [...]

Here is the summary with links:
  - [net-next] selftests: drv-net: print device info at the start
    https://git.kernel.org/netdev/net-next/c/9cb1d062b094

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-06  1:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03 21:19 [PATCH net-next] selftests: drv-net: print device info at the start Jakub Kicinski
2026-08-05 16:26 ` Simon Horman
2026-08-06  1:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox