From nobody Thu Sep 18 06:47:58 2025 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a9f:3042:0:0:0:0:0 with SMTP id i2csp363308uab; Wed, 15 Jun 2022 23:52:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tt0SGenrj5Zrqmk3g4kWGlGIwsB/uaoZ0LC3DvIIlnc82bDhkp2PBhydovOwH6Ryr+CCfS X-Received: by 2002:a05:6a00:22ce:b0:51c:15ac:3977 with SMTP id f14-20020a056a0022ce00b0051c15ac3977mr3385543pfj.3.1655362327642; Wed, 15 Jun 2022 23:52:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655362327; cv=none; d=google.com; s=arc-20160816; b=fFezUtnnQxdrRiCKkRkhCxkPYvLX0JtFv7Saa/pCZCDqp1ZLqQfS/I3SW+pWFvuFFU G+jYvBYhp/qkPJNZSRPP992mlQHW/8EGoedK8lFRXSLjsED0HXXt2Gj/nvD6notHNnVQ wF9pzdt/hhgA9qd+gjk+peIra9fTavxLb/4sLwuNnvR2t7Y5846B/GdA91FPR7nH+KaH bjqYNbYGc7ATrvOcWzMJhziFGMepLmPyPl+PDhyFnYhBn8wfKwqcnWbI/dp5Lkc2XgLk nRv+ahnzNmhh318JAVwKyidzy2D3fqZqLGEDKscZ1J26bMO3HGJYRBdduyjaCGRMxjYn hRMw== 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:message-id:date:subject:to:from :dkim-signature; bh=THx0NjOxNkUhsKM+gRYeN5FJwnj/dCCToPdXiCcNG2g=; b=lpyai9nwMjhlaUuknOy6L9QSJsEzXcHq5gB88Q3CU0jcshMamET8Abnjuq7wgt6Sdo YhD47vyCsrhARrhzFC3FV6tRZGm9Bb9xYWejrvBNcLhCT96RTakABslCoxx5cK16qx5k pYLn9Ts8U16zhOxAhLJ4Ljqor0XjZwIKY0kRQ9OjJtTiPGngFyvY4CD6Jz84XjvnWIIy /igEuvQXOhp3EI30L2VMcBo4jllgNkpSCLS47YdTWRbEZzaJD97ZgJ3KKFV3QgQlO+XG iQr7jW+iIKHcQXkoQJ3Z75HriDknaRkZA2XaVCGWmKDEgFgoBMU5j27uSCOMpCtsERYX 3wYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=i4Bp2FJG; spf=pass (google.com: domain of mptcp+bounces-5675-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.88.99 as permitted sender) smtp.mailfrom="mptcp+bounces-5675-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id kk4-20020a17090b4a0400b001df95edac97si5916500pjb.4.2022.06.15.23.52.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Jun 2022 23:52:07 -0700 (PDT) Received-SPF: pass (google.com: domain of mptcp+bounces-5675-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=i4Bp2FJG; spf=pass (google.com: domain of mptcp+bounces-5675-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 139.178.88.99 as permitted sender) smtp.mailfrom="mptcp+bounces-5675-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 04659280A8B for ; Thu, 16 Jun 2022 06:52:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 141AA15D2; Thu, 16 Jun 2022 06:52:06 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 8B6227A for ; Thu, 16 Jun 2022 06:52:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655362323; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=THx0NjOxNkUhsKM+gRYeN5FJwnj/dCCToPdXiCcNG2g=; b=i4Bp2FJGamnfl/fyryNo1i8SGyh8pTdw+CI1O3dBk8+lnzGppG9wJtv8r6Du7qsOdSF3ZA dZq8AIpKiO+HfJgi1LcK/p25vDHhjzIT+PxDhgvGVMCNGnDfijSf71x4rYtVTYdIn/ZqAJ 3GQafjGxTqEO0AixJcYXIodcdKXoHX4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-370-w1epVuvPPgWmWtwfw9HyNg-1; Thu, 16 Jun 2022 02:52:02 -0400 X-MC-Unique: w1epVuvPPgWmWtwfw9HyNg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D3F8785A581 for ; Thu, 16 Jun 2022 06:52:01 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.193.220]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6722E2026D2D for ; Thu, 16 Jun 2022 06:52:01 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-net] selftests: mptcp: more stable diag tests Date: Thu, 16 Jun 2022 08:51:56 +0200 Message-Id: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pabeni@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8"; x-default="true" 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 Reviewed-by: Mat Martineau --- tools/testing/selftests/net/mptcp/diag.sh | 40 ++++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/self= tests/net/mptcp/diag.sh index 9dd43d7d957b..ee2f238255ec 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" $* @@ -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.35.3