From nobody Mon Sep 16 19:40:00 2024 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 DA3331CD06 for ; Fri, 24 May 2024 06:49:02 +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=1716533342; cv=none; b=hLxv9YuQnGrdDoo5hHuQztRP/Oh/gEUoe8uBF9gPc2lrrNR+f7xZGhMA804aQkzVSb0/my6yL4Bqjrn9WPg7jPCKnRq5a+eczLG7EyLjggsISNqdMQQ35h6NP27DCuRSR6T9y6ivVCYl3p3yn6cnDGVTu1kNfpgbtKzt4lmHwgE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716533342; c=relaxed/simple; bh=Qafg1LrrHGL1wxi2rQVV5TA9CrpP6nJeHGwuJSXES6E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZcKpQ4Ruy/d2f/Xb11Vd+Ykimhy77FGFIwaRyEwOLI1P283EMa+yEiQ+o/A0dSrX4KE0VHEbyHuTWIzCmkw+PZALcLaT5tCeSXdRMF0A7E8XgC4xSctz2+lxGs57r+R76XNZzdbfT5BzZdn/S/og88Zqjt9PM3UlTbH+Gc1zxc0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DsN/JMh1; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DsN/JMh1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82088C32786; Fri, 24 May 2024 06:49:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716533342; bh=Qafg1LrrHGL1wxi2rQVV5TA9CrpP6nJeHGwuJSXES6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DsN/JMh1Rl9W6PaO0UZ9YrYne5SfZtk6vZ4uxBDGUVF5CqtYT/kR6S9vDUAGPK3u/ 19w09YdNmVdSjYYKNB7D37mpscbvFW5D4EkL/xKb2IF5zgabsQYe5Uadm6QuSk9xSI 7KD3o/HYIRrDE+HWNvXsb4RAsTYtdus4yCzzrD403Iz4AXnfoY2jz4DWQ4zLq4x8Mz NY4xLh3flb3gckx5fkS61BGX/HTQV9WW2ClGvPyyezHbQw1sMIzTCUQ2VJqOu8mnlU UfVuNrzcW2TiXOvTGKwXoPHXLAJeboVNRnF5wJvZQry/+xPQ2l0N9dBkuZa5Nzg0UA gpvm/ifulgSmA== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v4 1/6] selftests: net: rename ns in setup/cleanup_ns Date: Fri, 24 May 2024 14:48:46 +0800 Message-ID: <7a877165562901175b913285b3bb844f2cbc49c9.1716533107.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang The helpers setup_ns and cleanup_ns don't work when a namespace named "ns" is passed to them. For example, in net/mptcp/diag.sh, the name of the namespace is "ns". If "setup_ns ns" is used in it, diag.sh fails with errors: Invalid netns name "./mptcp_connect" Cannot open network namespace "10000": No such file or directory Cannot open network namespace "10000": No such file or directory That is because "ns" is also a local variable in both setup_ns and cleanup_ns. To solve this, this patch renames the local variable "ns" as "_ns". Also a ns_name valid check has been added to setup_ns. If "_ns" is passed in as a ns_name, setup_ns helper exits. Signed-off-by: Geliang Tang --- tools/testing/selftests/net/lib.sh | 33 ++++++++++++++++++------------ 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/n= et/lib.sh index edc030e81a46..ce611bc73098 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -128,7 +128,7 @@ slowwait_for_counter() =20 cleanup_ns() { - local ns=3D"" + local _ns=3D"" local errexit=3D0 local ret=3D0 =20 @@ -138,10 +138,11 @@ cleanup_ns() set +e fi =20 - for ns in "$@"; do - ip netns delete "${ns}" &> /dev/null - if ! busywait $BUSYWAIT_TIMEOUT ip netns list \| grep -vq "^$ns$" &> /de= v/null; then - echo "Warn: Failed to remove namespace $ns" + for _ns in "$@"; do + ip netns delete "${_ns}" &> /dev/null + if ! busywait $BUSYWAIT_TIMEOUT ip netns list \ + \| grep -vq "^$_ns$" &> /dev/null; then + echo "Warn: Failed to remove namespace $_ns" ret=3D1 fi done @@ -159,29 +160,35 @@ cleanup_all_ns() # setup_ns local remote setup_ns() { - local ns=3D"" + local _ns=3D"" local ns_name=3D"" local ns_list=3D"" local ns_exist=3D for ns_name in "$@"; do + if [ "${ns_name}" =3D=3D "_ns" ]; then + echo "Failed to setup namespace '${ns_name}': invalid name" + cleanup_ns "$ns_list" + set -e + return $ksft_fail + fi # Some test may setup/remove same netns multi times if unset ${ns_name} 2> /dev/null; then - ns=3D"${ns_name,,}-$(mktemp -u XXXXXX)" - eval readonly ${ns_name}=3D"$ns" + _ns=3D"${ns_name,,}-$(mktemp -u XXXXXX)" + eval readonly ${ns_name}=3D"$_ns" ns_exist=3Dfalse else - eval ns=3D'$'${ns_name} - cleanup_ns "$ns" + eval _ns=3D'$'${ns_name} + cleanup_ns "$_ns" ns_exist=3Dtrue fi =20 - if ! ip netns add "$ns"; then + if ! ip netns add "$_ns"; then echo "Failed to create namespace $ns_name" cleanup_ns "$ns_list" return $ksft_skip fi - ip -n "$ns" link set lo up - ! $ns_exist && ns_list=3D"$ns_list $ns" + ip -n "$_ns" link set lo up + ! $ns_exist && ns_list=3D"$ns_list $_ns" done NS_LIST=3D"$NS_LIST $ns_list" } --=20 2.43.0 From nobody Mon Sep 16 19:40:00 2024 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 F3A0D1CD06 for ; Fri, 24 May 2024 06:49:04 +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=1716533345; cv=none; b=YUv8N6yhLR2RBP3bXta8Ho8tKIe/P3dHkn877MWPZ8cCT1ly+CwVNh05IpK6diDu2X48YDBzRUYI9A1XPLQQ7K7qykdBHlCTUzskhi8V1Cq3ZSGMTLPHOx8wPwDqnLpnaEiczEQazSW1uHMRKylUtS43zT1UWppcKfWQMexhoB4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716533345; c=relaxed/simple; bh=aHCtjdh6+rJVHVct9JaQ/sVbsDM5Iq4vPqBYpbmkC40=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nuu+nK/hNtnOvITdKz45yVJET93z9jgcntYzIKMr1QwEcjsYoFAlzk5yfHUtNV5TmvDSt+0tlnXfg93CqFBQ0d4hFmv1d0HVH5jBNfCjsL68bBH/39B8jsB8TE5y2V4v54fDIMyvWFEBAAmrq/VjgwTRCNhSLVyk76/8zPxNQLU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=U/JDSjCF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="U/JDSjCF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A65CC2BBFC; Fri, 24 May 2024 06:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716533344; bh=aHCtjdh6+rJVHVct9JaQ/sVbsDM5Iq4vPqBYpbmkC40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U/JDSjCFneexdoiYc6aHCP72fuYt7JAdXh4A3YznYhTIB3gFjokNv9rh92zFQHH8E E81GbwkuUl4JvQxLs+ten1/6U+fdLDg22SNYiRvrNeM+13Pv4mJWbUP4uE3+3BusGg 5sCLd8LdoVsoBLPT1LB3Iqfw4ys1ouJqVujRv8H32PNTuR1CCGkzfmHyRvUafHOn/2 PiIXYNgDjhV5g7TXY/enjTnacieSxfzcgvD3D3wkvB2galradLXCf2Vngrr661H9vH tDaHjYskGm0SYW1p6gnJCZHITnGK8IoPYtCJCtNyvEAboOxtQkXO4qCCgBiKdZh3j7 W/CntzsYOz0Zg== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v4 2/6] selftests: mptcp: rename ns to _ns in get_counter Date: Fri, 24 May 2024 14:48:47 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang If "setup_ns ns" is used in diag.sh, it fails with errors: ./mptcp_lib.sh: line 289: local: ns: readonly variable 13 ....chk 2 cestab [ OK ] 14 ....chk 2->0 msk in use after flush [ OK ] That is because "ns" is also a local variable in mptcp_lib_get_counter. To solve this, this patch renames it as "_ns". Signed-off-by: Geliang Tang --- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing= /selftests/net/mptcp/mptcp_lib.sh index 6ffa9b7a3260..3397bf511f41 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -312,11 +312,11 @@ mptcp_lib_is_v6() { =20 # $1: ns, $2: MIB counter mptcp_lib_get_counter() { - local ns=3D"${1}" + local _ns=3D"${1}" local counter=3D"${2}" local count =20 - count=3D$(ip netns exec "${ns}" nstat -asz "${counter}" | + count=3D$(ip netns exec "${_ns}" nstat -asz "${counter}" | awk 'NR=3D=3D1 {next} {print $2}') if [ -z "${count}" ]; then mptcp_lib_fail_if_expected_feature "${counter} counter" --=20 2.43.0 From nobody Mon Sep 16 19:40:00 2024 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 CBAD811720 for ; Fri, 24 May 2024 06:49:06 +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=1716533346; cv=none; b=JC4RsyfDO3B8I1kp2q8dO2QqleZW9/MI1AypTBvr6+KREnLVmfk9h9xiY9E2QLZbveAJwIT20rSij7YLdzSt8wOANeFkvNe6Sn81gqOLZUZ++moe2gdd4BSorh/rEN6JCEfKOXjh822eB/fmfjmnKY7g/rFHppkrrJKaIL40yNY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716533346; c=relaxed/simple; bh=v2sGNKS/Xrx7OMlqyQZcHSY6Hy3dBAUf/3LuuWKk4WM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fMC7lHpg+uhfsHrrC6MnJrxaxUV4dZt0z73uZ17eRFr40N/vRfR90KndZXObXH38y0w1cR8O/2ZHYcPFZ2laW1aJqb6QnI3G1JXAZFkWGVZscES3wiEp9KVf3cNl44h2k5J1STgIlKpzf3SscceUs5gGZI4QMC08pCcZDxhchXU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WczIf4yO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WczIf4yO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34652C2BD11; Fri, 24 May 2024 06:49:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716533346; bh=v2sGNKS/Xrx7OMlqyQZcHSY6Hy3dBAUf/3LuuWKk4WM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WczIf4yOWJ4lm258DE9YKREx1vMwzsq7/ZHQJtTbbPjCeObkwC+Vt34Y6xwusEm3J O2igU5O6qZemnmCdtnkQvMVEJ9X/tHOrL6jlundIgStqish3rUlGRAYPujdbEq8XuU SGbA5YV99tE6uRvZnF74bs3a60ukEtFMoq4EQuMBDwibxPQYPIiepXAsNG1QaTI39x 267jn4/dovfyBUJN9qWEB6EjwdPdGRDaty4OBarbMny+Oyi+J2qbLD1whOd5cfJxzM WLWhVMVzFmQsMyMrugPlz7cwS2eaMTw4Kff7e0EBvTgFNZogyBVcCcKgfThK2+Nh6P yKaU10r9z2uPA== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v4 3/6] selftests: mptcp: use setup/cleanup_ns helpers Date: Fri, 24 May 2024 14:48:48 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang This patch includes lib.sh into mptcp_lib.sh, uses setup_ns helper defined in lib.sh to set up namespaces in mptcp_lib_ns_init(), and uses cleanup_ns to delete namespaces in mptcp_lib_ns_exit(). Signed-off-by: Geliang Tang --- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing= /selftests/net/mptcp/mptcp_lib.sh index 3397bf511f41..60f802e808a7 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -1,6 +1,8 @@ #! /bin/bash # SPDX-License-Identifier: GPL-2.0 =20 +. "$(dirname "${0}")/../lib.sh" + readonly KSFT_PASS=3D0 readonly KSFT_FAIL=3D1 readonly KSFT_SKIP=3D4 @@ -438,17 +440,13 @@ mptcp_lib_check_tools() { } =20 mptcp_lib_ns_init() { - local sec rndh - - sec=3D$(date +%s) - rndh=3D$(printf %x "${sec}")-$(mktemp -u XXXXXX) + if ! setup_ns ${@}; then + mptcp_lib_pr_fail "Failed to setup namespace ${@}" + exit ${KSFT_FAIL} + fi =20 local netns for netns in "${@}"; do - eval "${netns}=3D${netns}-${rndh}" - - ip netns add "${!netns}" || exit ${KSFT_SKIP} - ip -net "${!netns}" link set lo up ip netns exec "${!netns}" sysctl -q net.mptcp.enabled=3D1 ip netns exec "${!netns}" sysctl -q net.ipv4.conf.all.rp_filter=3D0 ip netns exec "${!netns}" sysctl -q net.ipv4.conf.default.rp_filter=3D0 @@ -456,9 +454,10 @@ mptcp_lib_ns_init() { } =20 mptcp_lib_ns_exit() { + cleanup_ns "${@}" + local netns for netns in "${@}"; do - ip netns del "${netns}" rm -f /tmp/"${netns}".{nstat,out} done } --=20 2.43.0 From nobody Mon Sep 16 19:40:00 2024 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 5CB8E11720 for ; Fri, 24 May 2024 06:49:08 +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=1716533348; cv=none; b=BCH9l9Vdfr8SJadiwduYU4z4LQzV538NwKFo6e0Y4M718/tF6CtrqFsKIod9qaniuoNVvUo/zjd8mUTkC+2k9x7lH35ae+sTMtn1Vhe4ozrRg8ODEje8FzCUZtor4K2zuXwc8M1No0hZIkWrMNZH9+DaYv5jleazxVN61inoT4w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716533348; c=relaxed/simple; bh=D94f7tCpA8bNG91b284y77ri1VvUdY02S9+axO3A/c0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b2lYleOlqXvcP51LmOyRjuJhsjfn/Fj7k27+zFFeMBFs9+E6ZxN/ut1qY6i5urGiWn3tXpzwptF2MKDcoGB4M3+0sPR09GUGnTuNsZAqQ+ORK0uW83OcbaEXLR8OrIt4NLi2fYDmpfbChBydS3C1iL8i11kEc+lN4GBZGBkaoSM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IBSU6hhV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IBSU6hhV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EE6EC2BBFC; Fri, 24 May 2024 06:49:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716533348; bh=D94f7tCpA8bNG91b284y77ri1VvUdY02S9+axO3A/c0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IBSU6hhVJSxt+J2yirWXrH8JNVZnApC5ANB6ttazOmpPdK8zSvRr7LRFwBuP8bzC9 w7CwFifpk1oDfxXi7dPbVqA09u+ClMCx2bxxF+jO9c2ne6BgRbVNAKQcHL0LRIWG/e GwZDBWQD+M2oRDDaMPv5o4/l+3LjwoeZChhQfjXplAlY7qXcgbv2wwAVU2gjWdb0SA Gx2cNSm7thIjNI0d/DyHTdMq6YUXHB97W4rxJgF2DsMqsq4AMYlho2eN9TepbWvTlM 9fqpB2QzPGArvO38VJzpLq8IfHOC4RPbII0RqWg02dm7K/BAVUhrbdQMJNQyXuvLUL qAhLmwrSJzaPg== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v4 4/6] selftests: mptcp: diag: trap cleanup after ns_init Date: Fri, 24 May 2024 14:48:49 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang mptcp_lib_ns_init may fail sometimes, then ns isn't setup correctly. In that case, cleanup is invoked, and ns is used in cleanup. So an "Invalid netns name ''" error occurs. The patch moves "trap cleanup" from the front of mptcp_lib_ns_init to the back of it to fix this. Signed-off-by: Geliang Tang --- tools/testing/selftests/net/mptcp/diag.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/self= tests/net/mptcp/diag.sh index 776d43a6922d..cabe6f8f489f 100755 --- a/tools/testing/selftests/net/mptcp/diag.sh +++ b/tools/testing/selftests/net/mptcp/diag.sh @@ -266,8 +266,8 @@ wait_connected() done } =20 -trap cleanup EXIT mptcp_lib_ns_init ns +trap cleanup EXIT =20 echo "a" | \ timeout ${timeout_test} \ --=20 2.43.0 From nobody Mon Sep 16 19:40:00 2024 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 D70B911720 for ; Fri, 24 May 2024 06:49:09 +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=1716533349; cv=none; b=nRwpdx0Hwh+IDQ+xzL7WPfl1AXmRA+jDlpevGNylIxpNUe51mEMLdo3z8LdwvSx7icL7iz8Ue2+qL8ZJ5G7pRTY/CJQ4t5YE8Zg3aE3j71H+9RSRQdmfs7ulhfB+170O+ELuRQGDaQdakFqDPfY8R63Yboxqz6KpqNO3TCUg+N0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716533349; c=relaxed/simple; bh=l3vrUnQlYhO7CnIVJzFaFVZl346RR7h2rJH1bKwi7OY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eO4wvaZ391gLOHECdastmK5eZKjAa3bQqh3mpBK8ahuFuVxJsKIl9vXvbTqEdAyieK+YkOMzZ1Yl32KOggvmDRrUiwMWCR/oUzWDRAAlvxwBrJX0oJlLin0VxPLwU+fEJFh/XqIEuHSbibg27Iu+hJjBoiaVfQ37fMLmUIWv8vA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=so8H77fD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="so8H77fD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBEE5C32786; Fri, 24 May 2024 06:49:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716533349; bh=l3vrUnQlYhO7CnIVJzFaFVZl346RR7h2rJH1bKwi7OY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=so8H77fDhS6YGLLQGOV5KRcXOtliyrS1Yp+gC/OxOhn+v0HkldG9TWy3UrWeXlnkL iFG0/T/M+oadRduBuysSqyaZA4Oe0qWyItvU+wLzO3AHw9aNiqxDFblrtwN0P0wp2B xUsetkCSDI1CKopVyYqvbK326J7iPTwzYFkUHcyOnh+xSQ/RV9uUdjexPEqyESU0qi IOYTpCc5g0e9A9FlmwZaIzir5jhB8yREKe3FU00Qnc0Ns9mvMsjh0iLBsvceQzaoFF jd//QNOWuzmKi68DXyR38WRqGhkT9KxwxxavYaprgYaav4i6GWLQVGwxKIrPdqfHtj gXqYPtVCYEuiw== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v4 5/6] selftests: mptcp: join: print title after init_partial Date: Fri, 24 May 2024 14:48:50 +0800 Message-ID: <4716cd1f4f594b2cc68e9e6692898eb725de8ce5.1716533107.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang init_partial may fail sometimes, in that case, titles shouldn't be printed out. So the patch moves mptcp_lib_print_title from the front of init_partial to the back of it. Signed-off-by: Geliang Tang --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 2b66c5fa71eb..d20a053eee8f 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -269,8 +269,6 @@ reset() return 1 fi =20 - mptcp_lib_print_title "${TEST_NAME}" - if [ "${init}" !=3D "1" ]; then init else @@ -279,6 +277,8 @@ reset() =20 init_partial =20 + mptcp_lib_print_title "${TEST_NAME}" + return 0 } =20 --=20 2.43.0 From nobody Mon Sep 16 19:40:00 2024 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 47BF011720 for ; Fri, 24 May 2024 06:49:11 +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=1716533351; cv=none; b=Zk7vlmhEqxrpqoFOzTKb6PG9iaCb0EBqj/PWBY6IJYD4do47fImEC6/u9WXY8w71stymr4DcJRXPn1d+jXV2sdD7HtHOWKVlnWRc/22ZwImgEYaC9zAAEaMqNTbiOcnF0WfY5BLiyapRLIExAbRyFWQ6syIQn+ymQZAE5UYr8pY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716533351; c=relaxed/simple; bh=dfl2sjKyu7D/KM7JDBNVtwKtibJ3MddGG4AT+iVWvC8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OGd1RYmd6d1mBJA52U/8W+wS+v126MnOG5X0zZX5MkBSBoHajlqc/HKpQBJbIrECtb98FxolFESJeFsXBoXuj7hdbJPv0rT2hGjs6tXUADp2YeWRgFMNROzLJN2gAyJMXjJgUyc4bfnpqRF67noTG9thEJ6WB7EKEdwz/pUJrCM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MmEqdH+F; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MmEqdH+F" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53C8CC2BD11; Fri, 24 May 2024 06:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716533351; bh=dfl2sjKyu7D/KM7JDBNVtwKtibJ3MddGG4AT+iVWvC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MmEqdH+FOBabc2/iqh8MbM0b0m0b9bZsEV3XpMRBq6S6fYY+mgE3yYs2oj79zgJ9F TPWb6JEsE2JYX6jScieseflEoxnACov4P4uR05OCvf22QNzg3NodU+R/JdJ8v7hpZr b9Eq/gAqN7hYh38o31I+krK3vbsL62YxZx37+ZUFlI/ydFGhV0ylWjjBLgLiZ+L94j 3Kv51at/1QOM3WlC1k30nbwr0MavskdPkkYSZ4DSuAKMXiTNv12jWNWEuRLSP4DKcL jXG51wjuxO2c2dEQN5OJIgt2r+gAlxGIhK+A40GeuN6d088x+XGZkjOJY87Eihk5Qm yreviysUkjzJw== From: Geliang Tang To: mptcp@lists.linux.dev Cc: Geliang Tang Subject: [PATCH mptcp-next v4 6/6] selftests: mptcp: use wait_local_port_listen helper Date: Fri, 24 May 2024 14:48:51 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang This patch includes net_helper.sh into mptcp_lib.sh, uses the helper wait_local_port_listen() defined in it to implement the similar mptcp helper. This can drop some duplicate code. Signed-off-by: Geliang Tang --- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing= /selftests/net/mptcp/mptcp_lib.sh index 60f802e808a7..b539a5436560 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -2,6 +2,7 @@ # SPDX-License-Identifier: GPL-2.0 =20 . "$(dirname "${0}")/../lib.sh" +. "$(dirname "${0}")/../net_helper.sh" =20 readonly KSFT_PASS=3D0 readonly KSFT_FAIL=3D1 @@ -363,20 +364,7 @@ mptcp_lib_check_transfer() { =20 # $1: ns, $2: port mptcp_lib_wait_local_port_listen() { - local listener_ns=3D"${1}" - local port=3D"${2}" - - local port_hex - port_hex=3D"$(printf "%04X" "${port}")" - - local _ - for _ in $(seq 10); do - ip netns exec "${listener_ns}" cat /proc/net/tcp* | \ - awk "BEGIN {rc=3D1} {if (\$2 ~ /:${port_hex}\$/ && \$4 ~ /0A/) \ - {rc=3D0; exit}} END {exit rc}" && - break - sleep 0.1 - done + wait_local_port_listen "${@}" "tcp" } =20 mptcp_lib_check_output() { --=20 2.43.0