From nobody Sun Feb 8 19:21:06 2026 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6402:358d:0:0:0:0 with SMTP id y13csp814094edc; Mon, 7 Mar 2022 12:44:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzuYTmhbsQO0fX8GsIQ9FSAzhg15Y4cNIeDWIfDgXptRo1Yw6kUV+sV7kcw3wyE/a6q+B36 X-Received: by 2002:a25:415:0:b0:628:dfc6:fcc7 with SMTP id 21-20020a250415000000b00628dfc6fcc7mr9743071ybe.605.1646685892136; Mon, 07 Mar 2022 12:44:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646685892; cv=none; d=google.com; s=arc-20160816; b=KM7/BcPfwdDEQnOHSPFjhT24ix8zyXmGLjAnBOPDagC+NeKPbECWoLOQOrXtoNdL5k JIFIwSRXKwQ6Uq5ia7Ax5jIK9yCO93AzNvh1XmAo9mD/nkAspbPdQfIvHtePn53jjDo+ 1bNvfhVlFlyR6uA1/QLXTeBgMOpVnN9aCxJacA7VfNuuxhTRVOmfi2Bt0z/c8i9kcxx+ /J62InH0Z1ImA8l7h0qMHwTXGIAUlhxkUKNR4vkwvkyBce7NtXI87t+0iMfTdauWG2Sw VkW+tud6Or7M0/Xc5Wv7o3QOdAY9YzBNcWRbswayEO/m0SnsxFTh9QmXQNP9CVEu/YpN KtZg== 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=/nNAJwzNt0XHfOFzjp8njQbnNfWNQIBnFFrcqGHy7Hc=; b=FSu3Q+zMfutIPPPOz2LwCmBJ2XXwq+B81hzOzc+w/DtdB1fDHBivjIgC9cKygTxAXK CcsjPIPCXREiFNkzGLwdKFJ9fOTzzUdVzF8FuGoluQvDOMK9/M8lLlUSN7W+Ln/q0V+b uuwB8nCD6HgwQ3HWMjRCXVDxt2esnbfqf0bjqYMaSQgOK+hTCe4kcVOPvi2PNqv7IvDp hQ7shGnvnr1ID/RgWfjJwV1onlGpQv3NE40byYO3DKRfAp/VUiorB42EkDExTjCBtinf KWzOcp+Jhd5x6oEampxCGTFaTH/gZLr2EbEmxyWBwhqJUq2uR09nvAqhabl+TLfMRkzv mBTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Gm3grsgE; spf=pass (google.com: domain of mptcp+bounces-4134-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-4134-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ewr.edge.kernel.org (ewr.edge.kernel.org. [2604:1380:1:3600::1]) by mx.google.com with ESMTPS id 84-20020a251657000000b0060de457f8b9si9438651ybw.526.2022.03.07.12.44.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Mar 2022 12:44:52 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-4134-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) client-ip=2604:1380:1:3600::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Gm3grsgE; spf=pass (google.com: domain of mptcp+bounces-4134-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-4134-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 ewr.edge.kernel.org (Postfix) with ESMTPS id B967A1C0B5C for ; Mon, 7 Mar 2022 20:44:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C00254350; Mon, 7 Mar 2022 20:44:48 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 AAD854349 for ; Mon, 7 Mar 2022 20:44:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646685887; x=1678221887; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=R4tIQUAOTRz1Si2gcqBM3+CXn/RCAkFxYB6IZ5aqlfw=; b=Gm3grsgEAKlUoRKCSh0lp6ubrmlqkwL6HoqFssxdEh6GEOeIgY2xbFOJ F6B7T98MuspqJX9FyoRDR05fk57P2WJ9gjv3uexhhItA6vN++h1VhadjL qklL/2BArWf48vvRc0nXa9HadxB4slM7Dr2yVhNukC8fd3wP5rX/2ZT0/ Z14jffv3Km87iqAHbxinBkx4Ba/N6nU6FjNCe4B/LMru9jirb7UFsmpE3 A3F6ZDMLSMvKKUUlkwzsfACyou7fy9hUzs/LfrvrU6w9w1kkEDJ1od0Yt 1p1ufCGdnhQI/U2qGnfwkVZxeUT2bRL8pFHGpxGFjRSIAJEmB/ncvnZdI A==; X-IronPort-AV: E=McAfee;i="6200,9189,10279"; a="317731785" X-IronPort-AV: E=Sophos;i="5.90,163,1643702400"; d="scan'208";a="317731785" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2022 12:44:45 -0800 X-IronPort-AV: E=Sophos;i="5.90,163,1643702400"; d="scan'208";a="553320484" Received: from mjmartin-desk2.amr.corp.intel.com (HELO mjmartin-desk2.intel.com) ([10.212.192.43]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2022 12:44:44 -0800 From: Mat Martineau To: netdev@vger.kernel.org Cc: Matthieu Baerts , davem@davemloft.net, kuba@kernel.org, mptcp@lists.linux.dev, Mat Martineau Subject: [PATCH net-next 3/9] selftests: mptcp: join: allow running -cCi Date: Mon, 7 Mar 2022 12:44:33 -0800 Message-Id: <20220307204439.65164-4-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307204439.65164-1-mathew.j.martineau@linux.intel.com> References: <20220307204439.65164-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: Matthieu Baerts Without this patch, no tests would be ran when launching: mptcp_join.sh -cCi In any order or a combination with 2 of these letters. The recommended way with getopt is first parse all options and then act. This allows to do some actions in priority, e.g. display the help menu and stop. But also some global variables changing the behaviour of this selftests -- like the ones behind -cCi options -- can be set before running the different tests. By doing that, we can also avoid long and unreadable regex. Signed-off-by: Matthieu Baerts Signed-off-by: Mat Martineau --- .../testing/selftests/net/mptcp/mptcp_join.sh | 67 ++++++++----------- 1 file changed, 28 insertions(+), 39 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 45c6e5f06916..309d06781ae7 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -16,7 +16,6 @@ capture=3D0 checksum=3D0 ip_mptcp=3D0 check_invert=3D0 -do_all_tests=3D1 init=3D0 =20 TEST_COUNT=3D0 @@ -2293,84 +2292,66 @@ usage() exit ${ret} } =20 -for arg in "$@"; do - # check for "capture/checksum" args before launching tests - if [[ "${arg}" =3D~ ^"-"[0-9a-zA-Z]*"c"[0-9a-zA-Z]*$ ]]; then - capture=3D1 - fi - if [[ "${arg}" =3D~ ^"-"[0-9a-zA-Z]*"C"[0-9a-zA-Z]*$ ]]; then - checksum=3D1 - fi - if [[ "${arg}" =3D~ ^"-"[0-9a-zA-Z]*"i"[0-9a-zA-Z]*$ ]]; then - ip_mptcp=3D1 - fi - - # exception for the capture/checksum/ip_mptcp options, the rest means: a = part of the tests - if [ "${arg}" !=3D "-c" ] && [ "${arg}" !=3D "-C" ] && [ "${arg}" !=3D "-= i" ]; then - do_all_tests=3D0 - fi -done - -if [ $do_all_tests -eq 1 ]; then - all_tests - exit $ret -fi =20 +tests=3D() while getopts 'fesltra64bpkdmchzCSi' opt; do case $opt in f) - subflows_tests + tests+=3D(subflows_tests) ;; e) - subflows_error_tests + tests+=3D(subflows_error_tests) ;; s) - signal_address_tests + tests+=3D(signal_address_tests) ;; l) - link_failure_tests + tests+=3D(link_failure_tests) ;; t) - add_addr_timeout_tests + tests+=3D(add_addr_timeout_tests) ;; r) - remove_tests + tests+=3D(remove_tests) ;; a) - add_tests + tests+=3D(add_tests) ;; 6) - ipv6_tests + tests+=3D(ipv6_tests) ;; 4) - v4mapped_tests + tests+=3D(v4mapped_tests) ;; b) - backup_tests + tests+=3D(backup_tests) ;; p) - add_addr_ports_tests + tests+=3D(add_addr_ports_tests) ;; k) - syncookies_tests + tests+=3D(syncookies_tests) ;; S) - checksum_tests + tests+=3D(checksum_tests) ;; d) - deny_join_id0_tests + tests+=3D(deny_join_id0_tests) ;; m) - fullmesh_tests + tests+=3D(fullmesh_tests) ;; z) - fastclose_tests + tests+=3D(fastclose_tests) ;; c) + capture=3D1 ;; C) + checksum=3D1 ;; i) + ip_mptcp=3D1 ;; h) usage @@ -2381,4 +2362,12 @@ while getopts 'fesltra64bpkdmchzCSi' opt; do esac done =20 +if [ ${#tests[@]} -eq 0 ]; then + all_tests +else + for subtests in "${tests[@]}"; do + "${subtests}" + done +fi + exit $ret --=20 2.35.1