Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp313285lqs; Tue, 5 Mar 2024 02:53:43 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWoDxbNtGZsQttyaoBHBr+CJJaxcJdUw/qOnattJ9lnudGLZj+Fj/1PwfezHpGemhRkepXmX/whCl2A7Um6xCTsu6aGcydBP8wgwz4h9g== X-Google-Smtp-Source: AGHT+IG6IuiRqu0O7+zoguJixmEcc5C5FSn7Fv7VJA0V1YSRlSL7hcsD3dnKp/Vr3kVfPUrgT81w X-Received: by 2002:a0c:f706:0:b0:690:50b3:20ab with SMTP id w6-20020a0cf706000000b0069050b320abmr1515491qvn.41.1709636023577; Tue, 05 Mar 2024 02:53:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709636023; cv=pass; d=google.com; s=arc-20160816; b=miFLoSyFi93Zaxcn/wVhjFwc+7QMNgdQBtEGnilch2vfCuTOkoNv2YouJ516kbufri e9y2eXiim1EuS1Vpp/oHXWYlXGgDa7byKZaqDUXXcj4K8c3XBrmaIt078+wfnj7hs7Ak nBI+H7Buhpm1HOZHp1LdC6GJ/dbJC6YYoyl/Ol+D2w4OemebJDMOU1QuZFmmzWSpx4oC PMJNSH0SN7uNWBDPhl2rhp2WFbtckaEFl24y1/+elBbWDgjBBa0KvCMXxyKhHjdxpvYR bvnpIzctTepGNas+FkrYNzgqislyGARU0kw6svXPEVb1mNM6MfSZzKMu+2tmQ/8AbOrG m/0Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=2yzQIquF+NHiEbRBtuLtW+UZApdDSeCXYrkiGyRVjNo=; fh=Z1YWgvxkmJ0/+y4FkLRSZ5mzUdtmyDAS67SU6REkp38=; b=LjTh/bZRmt9BCgjt6mEjGr90V5Vst1KyR1jpM8nXPfl+9PYLa85VrAoPrzmNErZzJU XkDtWHlqscIXMSD/kyREGzuCs9xu7JQhW5CeWrBOCMDXHWreKC5DS9owcfnByx8laATr eGuZkzv7coiuPeMqhBLnsl9kYMW0WiNlI/a2DN/JqpEidXjiSb7MRwr/l+VDbfaIb1e0 9TvhA0CvkZbODVoBzDxkQ9Bb6ouM068qQvXXHdddVhhmrB2pGo1cyEFEcFKn2xnFi5Pg LQSZRotm7pitit+OU67Zchj/jUfw+N7PN+5h7tZyQNwR/0bMkcr/R6aKCqD0v8/VhgoS f/wQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Z3xr6nd8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-92172-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92172-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id iu2-20020ad45cc2000000b0068feee484b5si11879831qvb.174.2024.03.05.02.53.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 02:53:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92172-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Z3xr6nd8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-92172-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92172-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E68DC1C22D06 for ; Tue, 5 Mar 2024 10:53:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8E9BC63103; Tue, 5 Mar 2024 10:43:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Z3xr6nd8" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAFC262A0F; Tue, 5 Mar 2024 10:43:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709635412; cv=none; b=feUXBZQIyGh7rAMk66Rc6W/bPbotj8awzTeYs1h00BkSerxq9Tty4ifY9Dr4yLl/KYii4E3MbEoyARN6HGfyNHZ4brsKgWmT1CwtLEeatVSSDt+y5xBRSHY0t/J+Ih5bGh4v3puTo7baD/cc0JwCfhpANyjeQIpsOiIjYnJqZMM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709635412; c=relaxed/simple; bh=TXr6T5gctPLk+weuAPDK0CvjU5ZW8VNUAi1/4q57pf4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=X5HmHNeYjad11w9aADxzAHtVI1tiYOAicIrNYcetS3t3lCpSooUJ0oKeGlkZGFdW9DSKhTtICIAXE5Uis8526Wfn4CxwXL+lbPeUcQFpz50Zb5q46l7HpmqU4BjWrz82Uij6nra7SJI2KEEVWfMV+KZx1zv4fRl+cqKdKXljDzM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Z3xr6nd8; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0665C43390; Tue, 5 Mar 2024 10:43:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709635412; bh=TXr6T5gctPLk+weuAPDK0CvjU5ZW8VNUAi1/4q57pf4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Z3xr6nd8OG2diHS35Sun6lQrVCP54cyxSEd4HvDucM4XZ7Lr8zqeqJ02UZpl2Md/x hmiIaKDefnhqvqd5uDoIsrdm+iSYJWI6HLTIey2yhv8i3sddQ0727t8qptOFucttNU e38+geUzX8IgZ0+q6POWx9Ws+b4rVsY2ildKn7Zw4wmdewBqvlNck5Y2VV5yal875O twJhRpKX52VrlX5id37RwaJQZDzXXFh+9bVPcIdIrB9vpT/vEPWNXw7/5WkW2mbto7 sOLHHTw6m2LjCLDJZ5FhtV2mnicq5ZhYCjn1xm07bQzrUByaH7/dkl29wWtf+GVbsm nnpc8UlDMPZoA== From: "Matthieu Baerts (NGI0)" Date: Tue, 05 Mar 2024 11:42:43 +0100 Subject: [PATCH net-next 13/13] selftests: userspace pm: avoid relaunching pm events Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240305-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v1-13-66618ea5504e@kernel.org> References: <20240305-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v1-0-66618ea5504e@kernel.org> In-Reply-To: <20240305-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v1-0-66618ea5504e@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2205; i=matttbe@kernel.org; h=from:subject:message-id; bh=TXr6T5gctPLk+weuAPDK0CvjU5ZW8VNUAi1/4q57pf4=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl5vcdWvZOlF2dPM/bD8EnzbOzzLBJwJOoByS1P 3r1cAhJyQ+JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeb3HQAKCRD2t4JPQmmg c4+5EADm9uVDUc6EJ98F/z11Xr2mgCzFqi6CL43XvSyGOX2H9WUjRqBpXarILE96pJKA0UqTBud 4HmdnxUonGh90yAdafBjv1euH4YvmFcXytveabyynQGhCiTlzBLYivAzRosBvMualqwYleGuyRG 9zidzrEbtrX/7veysAJKcmt/FL+bhPevPZiluISaVG+4RAyPcg9+t6WXOX4VEYzJoXz/3bfyWsv dkjliFqmtY48uUDXNo4mSZtmosKYw/T9Nc7JbkvxKYIeEUp7MnhADjl7NMUU+Og0ekR4Nilz5Ms jJgVfeZDqgGBsG8UFCQKlIWugY2N0VTmztjNSxc9L2XZZawoRo5kjwRab5Pnu4oLLbmPUH9AmJk iyMrZS81zhAAIndOYMMyihupT8qtainXlGsR23p9Ob79Kc8scwwNFO3TF3agFrBlnDM6v2bMrof qNBr/EYSSRyCxVZT57pijkWzAzN3wKWCkqMt+QN5VQSDvwrNYKSLNZAsgxBqpsADyYo/0fx49oR pJD3aU2Xm0MMooFItelhJ9TB+5tVY4qVj/g8UYwiY0iKwRe/5F6TZDmf7phc9moYHeSTcfBh61I K5j1PWe+gcLNGDXfPgKDGEpPlhf43E9YJLBSjgzM0YbXcxcSDFHJJmRuU91EeetOukvKlRtTEiQ AmeOZFiLFh7j2RA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 'make_connection' is launched twice: once for IPv4, once for IPv6. But then, the "pm_nl_ctl events" was launched a first time, killed, then relaunched after for no particular reason. We can then move this code, and the generation of the temp file to exchange, to the init part, and remove extra conditions that no longer needed. Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/userspace_pm.sh | 29 ++++++++++------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh index 3200d0b96d53..b0cce8f065d8 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -149,17 +149,23 @@ ip -net "$ns2" addr add dead:beef:1::2/64 dev ns2eth1 nodad ip -net "$ns2" addr add dead:beef:2::2/64 dev ns2eth1 nodad ip -net "$ns2" link set ns2eth1 up +file=$(mktemp) +mptcp_lib_make_file "$file" 2 1 + +# Capture netlink events over the two network namespaces running +# the MPTCP client and server +client_evts=$(mktemp) +mptcp_lib_events "${ns2}" "${client_evts}" client_evts_pid +server_evts=$(mktemp) +mptcp_lib_events "${ns1}" "${server_evts}" server_evts_pid +sleep 0.5 + print_title "Init" print_test "Created network namespaces ns1, ns2" test_pass make_connection() { - if [ -z "$file" ]; then - file=$(mktemp) - fi - mptcp_lib_make_file "$file" 2 1 - local is_v6=$1 local app_port=$app4_port local connect_addr="10.0.1.1" @@ -173,17 +179,8 @@ make_connection() is_v6="v4" fi - # Capture netlink events over the two network namespaces running - # the MPTCP client and server - if [ -z "$client_evts" ]; then - client_evts=$(mktemp) - fi - mptcp_lib_events "${ns2}" "${client_evts}" client_evts_pid - if [ -z "$server_evts" ]; then - server_evts=$(mktemp) - fi - mptcp_lib_events "${ns1}" "${server_evts}" server_evts_pid - sleep 0.5 + :>"$client_evts" + :>"$server_evts" # Run the server ip netns exec "$ns1" \ -- 2.43.0