From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202502 header.b=KczjcQdT; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 750EA5A0274 for ; Wed, 12 Mar 2025 06:27:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202502; t=1741757218; bh=RCUouqWi4QvwA/27xrXZ+SN9ygmMXjP9oNR4RKnTqas=; h=From:To:Cc:Subject:Date:From; b=KczjcQdT9mCHHeBBzk3se8LR4itzLVTRdm5dWkQONHimRzPTYZX0YmqytCG4blCpM qb+DkapcHVNTjnuL9tJrIUg7SkmNbDiIg2je5MJDjRxOOweB9qmsRLn7BwoP4buDv3 aXWOxPRWdQxCZw/OqoiygXfshVfnZMGjZlvQPMhWF+rIV4gpSfFWWrfk7LyoTD+23H EDiaaeVnOJ1T5G4ITOKsCARkrozGQ/KOG750vW+72jEgPFNF/+333vhl5sBDfCu2Ra YG+gn4mglkiB+jXQd4a6tyJH8+ktBy5mMwDt8yexT/cWyzSQhtH7zRUCIbRuSesQrG ASX9Fz+u/F55g== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4ZCJz654cSz4x8R; Wed, 12 Mar 2025 16:26:58 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH] test/perf: Simplify iperf3 server lifetime management Date: Wed, 12 Mar 2025 16:26:57 +1100 Message-ID: <20250312052657.3683261-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.48.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: GHBKNHIX6N2ZNWSUCGR77ZQ2IY46DSJH X-Message-ID-Hash: GHBKNHIX6N2ZNWSUCGR77ZQ2IY46DSJH X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: After we start the iperf3 server in the background, we have a sleep to make sure it's ready to receive connections. We can simplify this slightly by using the -D option to have iperf3 background itself rather than backgrounding it manually. That won't return until the server is ready to use. Signed-off-by: David Gibson --- test/lib/test | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/lib/test b/test/lib/test index 758250a2..73496741 100755 --- a/test/lib/test +++ b/test/lib/test @@ -20,10 +20,7 @@ test_iperf3s() { __sctx="${1}" __port="${2}" - pane_or_context_run_bg "${__sctx}" \ - 'iperf3 -s -p'${__port}' & echo $! > s.pid' \ - - sleep 1 # Wait for server to be ready + pane_or_context_run "${__sctx}" 'iperf3 -s -p'${__port}' -D -I s.pid' } # test_iperf3k() - Kill iperf3 server @@ -31,7 +28,7 @@ test_iperf3s() { test_iperf3k() { __sctx="${1}" - pane_or_context_run "${__sctx}" 'kill -INT $(cat s.pid); rm s.pid' + pane_or_context_run "${__sctx}" 'kill -INT $(cat s.pid)' sleep 1 # Wait for kernel to free up ports } -- 2.48.1