From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.228 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796428616; b=qKaZMcAqa4ezXaEK5ptYI2ygNSN1jOQKlxLXQUE9m47zvZ6XZTNyoHdI7eIq0QuqB4M9 Vi4OqMiNJOsLrCR2BYHp5yNvb83hsQ9/TafY9ANNEmf1gXbXIczoNnzSooFvN/SmYmfR+ Xj5kudXVUqowZwMIdKjKMwME3n6XdIZid2a/Bpppcm5f3/UQam+IsHUogMivc5ZT8qiMK utEPjCg8yjTk9nQfPqa82mFLlgNq369ssmKxUgBTZ64RlRYC6vWklS6ZE0Wg87D16mC5h /mIDFVm5qKIMM+L83rd31Xqra7I1+qgPVBkSgGujm6iTVEPa1v/ajInkRjLOw58EpnA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796428616; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:X-Relaying-Domain: Received:Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=LDsgjiS9Gg/Tm+d05AfDkDvxJyirchilfuco3ArnlCw=; b=EAHVSijgGRlbpvgf/vx0ZyEwrlcqp25Mnnf495RwmrIijBx6xqIVuL2ITp2Q0xh81vCr Jx9YmPLE1nP53e3iRFbD+BH4RkRnnGg/ViR+d3gcwbGFyDKNLSwO4SKVDSSrod03vTpOi c8Ey00co4Hl2imoYoPHy1O1QV4n5d8pBNPwH77FsOZVcglP3dwgo/b9iwFrYj6JyJzJzy Jp1komIPtRlKLpXZyCftOqrVUL6OgeulZZRr7UM7WptrnJUhrVHVYzay+KV8T6VDvlp7P u1PWMGhocMFljMi/Sy7bq9S8KgnTDFQukiEYuyZasiaBKxmltcbyIBRWri4uFQiaEXQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=purestorage.com; spf=pass smtp.mailfrom=purestorage.com; dkim=pass header.d=purestorage.com header.i=@purestorage.com header.a=rsa-sha256 header.s=google2022 header.b=Kjjv6gjY; arc=none smtp.remote-ip=209.85.215.228 Received: from mail-pg1-f228.google.com (mail-pg1-f228.google.com [209.85.215.228]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B2B8606A688 for ; Fri, 4 Dec 2026 23:56:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7B2B8606A688 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.a=rsa-sha256 header.s=google2022 header.b=Kjjv6gjY Received: by mail-pg1-f228.google.com with SMTP id 41be03b00d2f7-cc4aa18f9afso662623a12.3 for ; Fri, 04 Dec 2026 15:56:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1796428614; x=1797033414; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=LDsgjiS9Gg/Tm+d05AfDkDvxJyirchilfuco3ArnlCw=; b=Kjjv6gjYFObplhmLQdXvIt7LoG5qWgfyprLebhObLoSFsOVoBezvY37OFlAPz+r1bx HVK8qGqaTplt8vJCzkFqGZ7wlUWl+SlYUF8uoh7EchTpIpsGHAa5B57m/UgUTT2BQGE/ SadSBJdF6tk3s2sVgZ5nK0YCJMFSDmaYUvzWIgkERHuNF8qnhZNgMRP1CludkhLD+86N UHSHuN3R4ztABGCW0DOSp7iqoT3CmKjGdv3GnmyLbl+C9VKmqgOitRovTJ6Z8ZUMwzZ+ J0LUNj+kY02UwCtcun5uwdNgCJxJkEm48NgIKVjQ6/KsVH1U9APMoygDgtz1flx95aH7 SmpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796428614; x=1797033414; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=LDsgjiS9Gg/Tm+d05AfDkDvxJyirchilfuco3ArnlCw=; b=1BVcXIxHzLzaA0mKXfmMnjQGaJaWrsOz3lbvbeL4vlCY12GGmOcb0nnKQC2Ieclw3u h+8sCYutFzNO+tJrZKZn0W8ecBVNx6NMgZVCR81yJ6WbdrtN5fToXuM2SyInc9zARBwR NJA+POpBM9vxG0h/LnpYyDqmKSPtbELb1y4bnSyRpVjSfzq4b/Nb8OgO+WGKOpu97LpL r60DUEjLkopYbVjEx3rxV8FTzpFm6emB9p5bXjafhBtJlNOtl41bNh21TYeODyYutWdt sSMKLXkkiyST84YGbGiRBspegD2oZQFqXRERnmfV6UjYAfBzV0S0quKfTXyXbcfWHJHB fbEA== X-Gm-Message-State: AB4q+uEuIlla37yQugFFTkAtT4iT2yGgf6Tq2CBO+wBv40XRp+TkfQ1n hIHyn08+uAj4jiMJaHo+VyIZy43aiV3HaxBTHAgzyVwoe6Rz6ImnJas9cg5lvTeRbDokI8yyaLr v5J3as7n8+Vqr+DrjmALio0rPu3B2uNZlq1qw X-Gm-Gg: AZFdTZfOfYSwqT3idtkrxIZ+PI2I1KkXEq5hmOL4U7qC/bP1NXeftBtWZcJBXwTSD47 m+XVZAFHQXmnJTw+QVC+DajpdCEJXBa1LRtRduY0XUO6XhrDj8IGRBZIwRx/2oA9BPblvL/3gjz /6cV7CQQMF9o0zRSOuGwyhQo2gW+Un4YzL+fXjY5/8hha/InDBA7EN9Y3VoOYs0KEo1i3Mub9LC H7L3/0rpV3Ojzl4W8Z+f2m77olDlkziyf/br8INORQQzh4yx5PEuULz1+xnuLGe5z0Jdp7Hqd1m CVJ3ZD7S8f9lshbWVmKJUvbt75l0AfdOCFVjkiFmzNedCjvHRw658Pj4pwnDsIccq1sPZzhrQp/ pyXpV3jJwEwZY3ztYQ4H+Q1LaOrcvWdgfvkQ= X-Received: by 2002:a17:90b:5688:b0:3b5:b5f3:52fa with SMTP id 98e67ed59e1d1-3b5e061c059mr3185816a91.10.1796428613749; Fri, 04 Dec 2026 15:56:53 -0800 (PST) Received: from c7-smtp-2026.dev.purestorage.com ([208.88.159.129]) by smtp-relay.gmail.com with ESMTPS id 98e67ed59e1d1-3b5ddc55a30sm2492289a91.7.2026.12.04.15.56.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 15:56:53 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-rjethwani.dev.purestorage.com (dev-rjethwani.dev.purestorage.com [10.17.2.234]) by c7-smtp-2026.dev.purestorage.com (Postfix) with ESMTP id 1DDD6400F2; Fri, 4 Dec 2026 16:56:53 -0700 (MST) Received: by dev-rjethwani.dev.purestorage.com (Postfix, from userid 1557719937) id 1B7F5DCE140; Fri, 4 Dec 2026 16:56:53 -0700 (MST) From: Rishikesh Jethwani To: netdev@vger.kernel.org Cc: Rishikesh Jethwani , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , Simon Horman , Shuah Khan , 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 Message-ID: <20261204235642.36653-7-rjethwani@purestorage.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20261204235642.36653-1-rjethwani@purestorage.com> References: <20261204235642.36653-1-rjethwani@purestorage.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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