From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org, shuah@kernel.org,
sdf@fomichev.me, almasrymina@google.com, noren@nvidia.com,
linux-kselftest@vger.kernel.org, ap420073@gmail.com,
Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next 4/5] selftests: net: terminate bkg() commands on exception
Date: Mon, 11 Aug 2025 16:13:33 -0700 [thread overview]
Message-ID: <20250811231334.561137-5-kuba@kernel.org> (raw)
In-Reply-To: <20250811231334.561137-1-kuba@kernel.org>
There is a number of:
with bkg("socat ..LISTEN..", exit_wait=True)
uses in the tests. If whatever is supposed to send the traffic
fails we will get stuck in the bkg(). Try to kill the process
in case of exception, to avoid the long wait.
A specific example where this happens is the devmem Tx tests.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
tools/testing/selftests/net/lib/py/utils.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py
index f395c90fb0f1..4ac9249c85ab 100644
--- a/tools/testing/selftests/net/lib/py/utils.py
+++ b/tools/testing/selftests/net/lib/py/utils.py
@@ -117,6 +117,7 @@ import time
shell=shell, fail=fail, ns=ns, host=host,
ksft_wait=ksft_wait)
self.terminate = not exit_wait and not ksft_wait
+ self._exit_wait = exit_wait
self.check_fail = fail
if shell and self.terminate:
@@ -127,7 +128,9 @@ import time
return self
def __exit__(self, ex_type, ex_value, ex_tb):
- return self.process(terminate=self.terminate, fail=self.check_fail)
+ # Force termination on exception
+ terminate = self.terminate or (self._exit_wait and ex_type)
+ return self.process(terminate=terminate, fail=self.check_fail)
global_defer_queue = []
--
2.50.1
next prev parent reply other threads:[~2025-08-11 23:13 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 23:13 [PATCH net-next 0/5] selftests: drv-net: improve zerocopy tests Jakub Kicinski
2025-08-11 23:13 ` [PATCH net-next 1/5] selftests: drv-net: add configs for zerocopy Rx Jakub Kicinski
2025-08-11 23:52 ` Joe Damato
2025-08-12 16:56 ` Mina Almasry
2025-08-11 23:13 ` [PATCH net-next 2/5] selftests: drv-net: devmem: remove sudo from system() calls Jakub Kicinski
2025-08-11 23:55 ` Joe Damato
2025-08-11 23:58 ` Jakub Kicinski
2025-08-12 16:58 ` Mina Almasry
2025-08-11 23:13 ` [PATCH net-next 3/5] selftests: drv-net: devmem: add / correct the IPv6 support Jakub Kicinski
2025-08-12 0:07 ` Joe Damato
2025-08-12 17:00 ` Mina Almasry
2025-08-11 23:13 ` Jakub Kicinski [this message]
2025-08-12 0:08 ` [PATCH net-next 4/5] selftests: net: terminate bkg() commands on exception Joe Damato
2025-08-12 17:02 ` Mina Almasry
2025-08-11 23:13 ` [PATCH net-next 5/5] selftests: drv-net: devmem: flip the direction of Tx tests Jakub Kicinski
2025-08-12 0:15 ` Joe Damato
2025-08-12 18:32 ` Mina Almasry
2025-08-12 16:46 ` [PATCH net-next 0/5] selftests: drv-net: improve zerocopy tests Stanislav Fomichev
2025-08-13 1:50 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250811231334.561137-5-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=almasrymina@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=ap420073@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=noren@nvidia.com \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).