Re: [PATCH net-next v4 3/3] selftests: net: add netpoll basic functionality test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Willem,

On Mon, Jul 07, 2025 at 10:56:32PM -0400, Willem de Bruijn wrote:
> > +def test_netpoll(cfg: NetDrvEpEnv) -> None:

<snip>

> > +        bpftrace_stop()
> 
> One risk with stateful tests is that the state is not reset if the
> test exists (or crashes) before reaching the cleanup logic. There
> are ways around it. Jakub added defer for this purpose, for one.

Agree. Jakub suggested about "defer" a while ago, but I didn't realize
we had a "defer" helper in our test framework. For a second I though
Jakub was talking calling the stop later, my bad.

Now that you raised it, I found that we have "defer" as a helper, and we
definitely should use it. How about something as simple as:

	diff --git a/tools/testing/selftests/drivers/net/netpoll_basic.py b/tools/testing/selftests/drivers/net/netpoll_basic.py
	index 398ac959151b3..6017b71f154b2 100755
	--- a/tools/testing/selftests/drivers/net/netpoll_basic.py
	+++ b/tools/testing/selftests/drivers/net/netpoll_basic.py
	@@ -27,6 +27,7 @@ from typing import Optional

	from lib.py import (
	bpftrace,
	+    defer,
	ip,
	ethtool,
	GenerateTraffic,
	@@ -251,6 +252,7 @@ def do_netpoll_flush_monitored(cfg: NetDrvEpEnv, ifname: str, target_name: str)
	# Start bpftrace in parallel, so, it is watching
	# netpoll_poll_dev() while we are sending netconsole messages
	bpftrace_start()
	+    defer(bpftrace_stop)

	do_netpoll_flush(cfg, ifname, target_name)

	@@ -338,7 +340,6 @@ def test_netpoll(cfg: NetDrvEpEnv) -> None:
		# Revert RX/TX queues
		ethtool_set_rx_tx_queue(ifname, original_queues[0], original_queues[1])
		netcons_delete_target(target_name)

Thanks for th heads-up and review,
--breno




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux