Netdev List
 help / color / mirror / Atom feed
From: Rishikesh Jethwani <rjethwani@purestorage.com>
To: netdev@vger.kernel.org
Cc: Rishikesh Jethwani <rjethwani@purestorage.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org
Subject: [PATCH net v3 6/9] selftests: net: py: add a timeout argument to bkg()
Date: Fri,  4 Dec 2026 16:53:53 -0700	[thread overview]
Message-ID: <20261204235642.36653-7-rjethwani@purestorage.com> (raw)
In-Reply-To: <20261204235642.36653-1-rjethwani@purestorage.com>

Let callers override the 20-second context-exit timeout for
long-running commands. None waits indefinitely on normal exit, but
gives a readiness-enabled command one second to exit on cancellation.
An explicit zero still means no grace period.

Signed-off-by: Rishikesh Jethwani <rjethwani@purestorage.com>
---
 tools/testing/selftests/net/lib/py/utils.py | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py
index 9edfc4f88621..1db7a21db642 100644
--- a/tools/testing/selftests/net/lib/py/utils.py
+++ b/tools/testing/selftests/net/lib/py/utils.py
@@ -274,7 +274,11 @@ class cmd:
             if self.proc.poll() is None:
                 if terminate:
                     self._kill_group(signal.SIGTERM)
-                self._drain_until_exit((out, err), timeout=timeout)
+                # None waits forever elsewhere; cleanup must end. Not
+                # "timeout or 1", which would change an explicit 0.
+                self._drain_until_exit((out, err),
+                                       timeout=1 if timeout is None
+                                       else timeout)
             self._collect_reaped(out, err)
 
     def _collect_reaped(self, out, err):
@@ -385,11 +389,12 @@ class bkg(cmd):
     """
     def __init__(self, comm, shell=None, fail=None, expect_fail=None,
                  ns=None, host=None, exit_wait=False, ksft_ready=None,
-                 ksft_wait=None):
+                 ksft_wait=None, timeout=20):
         super().__init__(comm, background=True,
                          shell=shell, fail=fail, expect_fail=expect_fail,
                          ns=ns, host=host, ksft_ready=ksft_ready,
                          ksft_wait=ksft_wait)
+        self.timeout = timeout
         self.terminate = not exit_wait and not ksft_wait
         self._exit_wait = exit_wait
         self.check_fail = fail
@@ -410,15 +415,18 @@ class bkg(cmd):
             terminate = terminate or (self._exit_wait and ex_type is not None)
         if ex_type is None:
             return self.process(terminate=terminate, fail=self.check_fail,
-                                expect_fail=self.expect_fail)
+                                expect_fail=self.expect_fail,
+                                timeout=self.timeout)
         # Cancelled, e.g. by Ctrl-C: stop the command and what it started,
         # without replacing the exception in flight.
         if self._own_pgrp:
-            self._cleanup_quietly(self._reap_cancelled, terminate, 20)
+            self._cleanup_quietly(self._reap_cancelled, terminate,
+                                  self.timeout)
         else:
             self._cleanup_quietly(self.process, terminate=terminate,
                                   fail=self.check_fail,
-                                  expect_fail=self.expect_fail)
+                                  expect_fail=self.expect_fail,
+                                  timeout=self.timeout)
         return None
 
 
-- 
2.50.1


  parent reply	other threads:[~2026-12-04 23:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 23:53 [PATCH net v3 0/9] tls: device: don't put offload plaintext on the wire Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 1/9] net: don't fragment skbs that still need device crypto Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 2/9] tls: device: keep tls_sw_fallback() from encrypting its own output Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 3/9] tls: device: don't let the NIC encrypt fallback output again Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 4/9] tls: device: remove the dead start marker bypass in TX fallback Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 5/9] selftests: net: py: reap commands that fail to report ready Rishikesh Jethwani
2026-12-04 23:53 ` Rishikesh Jethwani [this message]
2026-12-04 23:53 ` [PATCH net v3 7/9] selftests: net: add TLS offload over bond tests Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 8/9] selftests: net: test TLS fallback after rerouting to an upper device Rishikesh Jethwani
2026-12-04 23:53 ` [PATCH net v3 9/9] selftests: net: verify that IP refuses to fragment TLS offload data Rishikesh Jethwani

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=20261204235642.36653-7-rjethwani@purestorage.com \
    --to=rjethwani@purestorage.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=willemb@google.com \
    /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