From nobody Thu Sep 18 08:16:30 2025 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:ab0:35eb:0:0:0:0:0 with SMTP id w11csp2243124uau; Mon, 27 Jun 2022 18:03:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tskTFwNZWG7ZbuWZCct9j2Ru/9qAHsuX/X1aZGSl6Bq1zsy3FO74dJOuP+lJWgnMizI3ZZ X-Received: by 2002:a17:902:aa05:b0:16a:5113:229d with SMTP id be5-20020a170902aa0500b0016a5113229dmr949990plb.111.1656378181943; Mon, 27 Jun 2022 18:03:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656378181; cv=none; d=google.com; s=arc-20160816; b=W/0V+rHVkZoYbzUBtegLwDPtU+nb0BnDrZPHR8qYsWFltsKJIq9/SAJOTEfHwaQYJl Nx2CtE9zTbTmlBhkmyBRRhke+2X5wxwOhlToSMhtGGwBGJ7AdE3PexMs5DIxD1j2J0M1 AnEMgwoMzEdNR+kCPh6ATFGutWwSBYwRdc7H2gcfzWnMDdfUJ1NTVrIyJPEBQOnjHtbn IineIg86uXm2pedYF29jHnGW/sfFwrq26yykKuNmo5opy1r+pqDGMRhMMoNvwJu4rSQW LvbkntT2WtzYZrqvAbkvv/UH1Wtxwt+cS5Cglfga2IrSSpgJwqtgyDc/glVzSs+TBar8 PXog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=phpY90U2NwA1o84zYTLS67UfEb2dXuhHfUg8bGuo1A0=; b=YlHrT2pKKOJspw2b0r4UkbqFLdR7pOErFt87DHrZn433ukWJI5gsGyq512wid8c8yJ Kso2ThlYoG+M3lIUPpz6M2mGg0bYXWvs8P43BWCUedWf4892MRiXHZ12h1VtxrAMECMy BusB43CkN2sHpSueUoyAqg+LT0XQtibL4F2gHVXhjfFgsli4i9avUlkdH5fPa3DjTtH2 iiaZjdj8Fj3s3UvALTbPtrGRGg+eSkM5DVKVxB+X6QcvlVkMJjS5BIMEuLeAnkZN+iej qHWebP/5pH+bs5kjzKIM7daSRSUbmq/ARb3GBdLK5cAGq46jabESaRtBIwhTdqFio5XY 8Isw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=meaX0c77; spf=pass (google.com: domain of mptcp+bounces-5855-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="mptcp+bounces-5855-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id lp17-20020a17090b4a9100b001ea91760f6esi23959606pjb.79.2022.06.27.18.03.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jun 2022 18:03:01 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-5855-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=meaX0c77; spf=pass (google.com: domain of mptcp+bounces-5855-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="mptcp+bounces-5855-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 78BA4280C34 for ; Tue, 28 Jun 2022 01:03:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C25A37C; Tue, 28 Jun 2022 01:02:55 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 16F98371 for ; Tue, 28 Jun 2022 01:02:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656378174; x=1687914174; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xdhf3V1g/dBHaAbST9bmAT6lwS7AVSUrw7phueh2+nE=; b=meaX0c77CuOZbDl1DBNoP8wLelTwhGdxUWufzXTjxFWcGY/YDua/aaJZ 5NhHkZa1eiPI0Uk4kQMPENohu+oXc2ZDilmqkMs4ipbGlAg4cW3XEsAET pdHsvE4IOvUVFbjqeZGng9ksn1H/RoYjB5vs1dEEFOXryqET5hQEiC5R+ QcaosLBXnEziDKU1YOuRlTLlArtW96zCvQIsPhVHqqiKmKKLY27kJhsL0 ShsnSN0x326NjtKu6emlazcTHIH3IlKmdk6pwT0Bc5pMyhMPmNz5Q+OAB V4IdUEEnsWZFtJWF1UJmBtaysU6z3Mm/P0+A2fzc6pCLzGOVpC5RKWuW6 w==; X-IronPort-AV: E=McAfee;i="6400,9594,10391"; a="270347721" X-IronPort-AV: E=Sophos;i="5.92,227,1650956400"; d="scan'208";a="270347721" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 18:02:51 -0700 X-IronPort-AV: E=Sophos;i="5.92,227,1650956400"; d="scan'208";a="692867406" Received: from cgarner-mobl1.amr.corp.intel.com (HELO mjmartin-desk2.intel.com) ([10.251.0.217]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 18:02:51 -0700 From: Mat Martineau To: netdev@vger.kernel.org Cc: Paolo Abeni , davem@davemloft.net, kuba@kernel.org, edumazet@google.com, fw@strlen.de, geliang.tang@suse.com, matthieu.baerts@tessares.net, mptcp@lists.linux.dev, Mat Martineau Subject: [PATCH net 7/9] selftests: mptcp: more stable diag tests Date: Mon, 27 Jun 2022 18:02:41 -0700 Message-Id: <20220628010243.166605-8-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220628010243.166605-1-mathew.j.martineau@linux.intel.com> References: <20220628010243.166605-1-mathew.j.martineau@linux.intel.com> 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: Paolo Abeni The mentioned test-case still use an hard-coded-len sleep to wait for a relative large number of connection to be established. On very slow VM and with debug build such timeout could be exceeded, causing failures in our CI. Address the issue polling for the expected condition several times, up to an unreasonable high amount of time. On reasonably fast system the self-tests will be faster then before, on very slow one we will still catch the correct condition. Fixes: df62f2ec3df6 ("selftests/mptcp: add diag interface tests") Signed-off-by: Paolo Abeni Signed-off-by: Mat Martineau --- tools/testing/selftests/net/mptcp/diag.sh | 48 +++++++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/self= tests/net/mptcp/diag.sh index 9dd43d7d957b..515859a5168b 100755 --- a/tools/testing/selftests/net/mptcp/diag.sh +++ b/tools/testing/selftests/net/mptcp/diag.sh @@ -61,6 +61,39 @@ chk_msk_nr() __chk_nr "grep -c token:" $* } =20 +wait_msk_nr() +{ + local condition=3D"grep -c token:" + local expected=3D$1 + local timeout=3D20 + local msg nr + local max=3D0 + local i=3D0 + + shift 1 + msg=3D$* + + while [ $i -lt $timeout ]; do + nr=3D$(ss -inmHMN $ns | $condition) + [ $nr =3D=3D $expected ] && break; + [ $nr -gt $max ] && max=3D$nr + i=3D$((i + 1)) + sleep 1 + done + + printf "%-50s" "$msg" + if [ $i -ge $timeout ]; then + echo "[ fail ] timeout while expecting $expected max $max last $nr" + ret=3D$test_cnt + elif [ $nr !=3D $expected ]; then + echo "[ fail ] expected $expected found $nr" + ret=3D$test_cnt + else + echo "[ ok ]" + fi + test_cnt=3D$((test_cnt+1)) +} + chk_msk_fallback_nr() { __chk_nr "grep -c fallback" $* @@ -146,7 +179,7 @@ ip -n $ns link set dev lo up echo "a" | \ timeout ${timeout_test} \ ip netns exec $ns \ - ./mptcp_connect -p 10000 -l -t ${timeout_poll} \ + ./mptcp_connect -p 10000 -l -t ${timeout_poll} -w 20 \ 0.0.0.0 >/dev/null & wait_local_port_listen $ns 10000 chk_msk_nr 0 "no msk on netns creation" @@ -155,7 +188,7 @@ chk_msk_listen 10000 echo "b" | \ timeout ${timeout_test} \ ip netns exec $ns \ - ./mptcp_connect -p 10000 -r 0 -t ${timeout_poll} \ + ./mptcp_connect -p 10000 -r 0 -t ${timeout_poll} -w 20 \ 127.0.0.1 >/dev/null & wait_connected $ns 10000 chk_msk_nr 2 "after MPC handshake " @@ -167,13 +200,13 @@ flush_pids echo "a" | \ timeout ${timeout_test} \ ip netns exec $ns \ - ./mptcp_connect -p 10001 -l -s TCP -t ${timeout_poll} \ + ./mptcp_connect -p 10001 -l -s TCP -t ${timeout_poll} -w 20 \ 0.0.0.0 >/dev/null & wait_local_port_listen $ns 10001 echo "b" | \ timeout ${timeout_test} \ ip netns exec $ns \ - ./mptcp_connect -p 10001 -r 0 -t ${timeout_poll} \ + ./mptcp_connect -p 10001 -r 0 -t ${timeout_poll} -w 20 \ 127.0.0.1 >/dev/null & wait_connected $ns 10001 chk_msk_fallback_nr 1 "check fallback" @@ -184,7 +217,7 @@ for I in `seq 1 $NR_CLIENTS`; do echo "a" | \ timeout ${timeout_test} \ ip netns exec $ns \ - ./mptcp_connect -p $((I+10001)) -l -w 10 \ + ./mptcp_connect -p $((I+10001)) -l -w 20 \ -t ${timeout_poll} 0.0.0.0 >/dev/null & done wait_local_port_listen $ns $((NR_CLIENTS + 10001)) @@ -193,12 +226,11 @@ for I in `seq 1 $NR_CLIENTS`; do echo "b" | \ timeout ${timeout_test} \ ip netns exec $ns \ - ./mptcp_connect -p $((I+10001)) -w 10 \ + ./mptcp_connect -p $((I+10001)) -w 20 \ -t ${timeout_poll} 127.0.0.1 >/dev/null & done -sleep 1.5 =20 -chk_msk_nr $((NR_CLIENTS*2)) "many msk socket present" +wait_msk_nr $((NR_CLIENTS*2)) "many msk socket present" flush_pids =20 exit $ret --=20 2.37.0