From nobody Mon Feb 9 02:28:39 2026 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6402:2547:0:0:0:0 with SMTP id l7csp459138edb; Wed, 9 Mar 2022 11:16:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJwrBLy2AKOhbMM5vjHg5hTT3AJyZlkVHVzcpzShrLlc2eWKUTxI2kBL5naPBLmNdCkuxi3c X-Received: by 2002:a63:8441:0:b0:380:625b:bbb5 with SMTP id k62-20020a638441000000b00380625bbbb5mr1009806pgd.472.1646853412946; Wed, 09 Mar 2022 11:16:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646853412; cv=none; d=google.com; s=arc-20160816; b=bu/twEGnorfwmHFVDOeBCUE7T4ji+dJ3cpU4vPMcL+d+0RrcFyUa408sGYZU2nqMdi zjav6odxI0BVY0ZfntM0pIOm/lvcVZ0b/731xxhxei990n40Rd1S8aW3E1Y1U+80jpiO SUR+JynLy6iaGUO82REKcck+c/dWh/YmyXPNQABm87JEntWxI7EZ+630LWWTzFi9CuLB +E55dBa5WRj/G+rvllEfCPyvbr/BfpXF7F7yO0iP0dphPeVmF1nuvQzjTIlWJ92qAYZa nNWTXcYCZebEosBshT0eJlih7V4FQgPtHyKfI+E4rbS6H+fD8u3B+4bcIcS8iaGHROty a3XA== 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=jr+eBwBXAUayBhjXisNWvRBEBA8K3rrJBKa5AGWH0ao=; b=sotW17LdmFc13Ikv+uWJXtZiet8W0DWREIMCw+VO2Z0zv2xLhRb5f7V4AWMnFhoruR 6F7iYK1Un+pfroOvgNFc1Va6u4z9nOzweH2Xk5AdYvW3SScITtfI9C2MXnlxdH8W6b3c zMwoe7WunOubhAkw1Q1hfjJHrsgsmcXvdBtw0Xb5EkwYNsvPGd+LXLBiggVwNn4wVDiF ppkfT35vihEuBuEWnCmGfKz8Xm0+5Kva4VqsCT13nMXIAX6EBKzwleGKMGVKTmczBPx9 33E5G61rj+i7lbOG3jfm0bvqBHIsfM4fSaKF0vgUJ3CLFcLQC5+paO4KrThEn/Q+SWUu NnXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MnadPY3Z; spf=pass (google.com: domain of mptcp+bounces-4191-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-4191-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [2604:1380:1000:8100::1]) by mx.google.com with ESMTPS id v10-20020a63610a000000b0037ffc0ad388si2564712pgb.252.2022.03.09.11.16.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Mar 2022 11:16:52 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-4191-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) client-ip=2604:1380:1000:8100::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MnadPY3Z; spf=pass (google.com: domain of mptcp+bounces-4191-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-4191-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 sjc.edge.kernel.org (Postfix) with ESMTPS id 756483E0EC7 for ; Wed, 9 Mar 2022 19:16:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6AE76511A; Wed, 9 Mar 2022 19:16:50 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 03A105107 for ; Wed, 9 Mar 2022 19:16:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646853408; x=1678389408; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=e1t+Jz+5OGZSeGtd0kR9Wcxg+MZK1NVvBjKN3QGmv2w=; b=MnadPY3ZgiIm9PO+gh7eHV2otRJ5RG7TiWuHABkKlI5pr5EDIjGGMkUu suxbjZP2u4brN6ft5I0XSnZJCMckUjtJ6KKmMXyziKNBXHgDZg4CAwG63 F1HOKKqt1qR5KOBhp+x6eWqXFSbt6mYG63G2wvh6VXP0qlhrxwq6EEvDJ NmBhWv8aPmh07fi0dF/qN5R/I2FEtVxgzZe/XvI9WmOZoY47h0uYZvwm8 +0AMayvJH7PTii75EyeAfmr/8ueYB3WZxb3jQayl01/RBeovLO9LCjfv2 X1QpPxJQLXcUWVfAGj+jsLWpPDjdb2DRqcs/aH6YXCJNI+HBzc9Qm6f5Q w==; X-IronPort-AV: E=McAfee;i="6200,9189,10281"; a="255011974" X-IronPort-AV: E=Sophos;i="5.90,168,1643702400"; d="scan'208";a="255011974" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 11:16:46 -0800 X-IronPort-AV: E=Sophos;i="5.90,168,1643702400"; d="scan'208";a="495957053" Received: from mjmartin-desk2.amr.corp.intel.com (HELO mjmartin-desk2.intel.com) ([10.212.194.198]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 11:16:46 -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 02/10] selftests: mptcp: join: define tests groups once Date: Wed, 9 Mar 2022 11:16:28 -0800 Message-Id: <20220309191636.258232-3-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220309191636.258232-1-mathew.j.martineau@linux.intel.com> References: <20220309191636.258232-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 When adding a new tests group, it has to be defined in multiple places: - in the all_tests() function - in the 'usage()' function - in the getopts: short option + what to do when the option is used Because it is easy to forget one of them, it is useful to have to define them only once. Note: only using an associative array would simplify the code but the entries are stored in a hashtable and iterating over the different items doesn't give the same order as the one used in the declaration of this array. Because we want to run these tests in the same order as before, a "simple" array is used first. Signed-off-by: Matthieu Baerts Signed-off-by: Mat Martineau --- .../testing/selftests/net/mptcp/mptcp_join.sh | 141 ++++++------------ 1 file changed, 47 insertions(+), 94 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 194c4420220e..8dc50b480152 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -19,6 +19,7 @@ check_invert=3D0 validate_checksum=3D0 init=3D0 =20 +declare -A all_tests TEST_COUNT=3D0 nr_blank=3D40 =20 @@ -2380,27 +2381,6 @@ implicit_tests() wait } =20 -all_tests() -{ - subflows_tests - subflows_error_tests - signal_address_tests - link_failure_tests - add_addr_timeout_tests - remove_tests - add_tests - ipv6_tests - v4mapped_tests - backup_tests - add_addr_ports_tests - syncookies_tests - checksum_tests - deny_join_id0_tests - fullmesh_tests - fastclose_tests - implicit_tests -} - # [$1: error message] usage() { @@ -2410,23 +2390,12 @@ usage() fi =20 echo "mptcp_join usage:" - echo " -f subflows_tests" - echo " -e subflows_error_tests" - echo " -s signal_address_tests" - echo " -l link_failure_tests" - echo " -t add_addr_timeout_tests" - echo " -r remove_tests" - echo " -a add_tests" - echo " -6 ipv6_tests" - echo " -4 v4mapped_tests" - echo " -b backup_tests" - echo " -p add_addr_ports_tests" - echo " -k syncookies_tests" - echo " -S checksum_tests" - echo " -d deny_join_id0_tests" - echo " -m fullmesh_tests" - echo " -z fastclose_tests" - echo " -I implicit_tests" + + local key + for key in "${!all_tests[@]}"; do + echo " -${key} ${all_tests[${key}]}" + done + echo " -c capture pcap files" echo " -C enable data checksum" echo " -i use ip mptcp" @@ -2436,59 +2405,43 @@ usage() } =20 =20 +# Use a "simple" array to force an specific order we cannot have with an a= ssociative one +all_tests_sorted=3D( + f@subflows_tests + e@subflows_error_tests + s@signal_address_tests + l@link_failure_tests + t@add_addr_timeout_tests + r@remove_tests + a@add_tests + 6@ipv6_tests + 4@v4mapped_tests + b@backup_tests + p@add_addr_ports_tests + k@syncookies_tests + S@checksum_tests + d@deny_join_id0_tests + m@fullmesh_tests + z@fastclose_tests + I@implicit_tests +) + +all_tests_args=3D"" +all_tests_names=3D() +for subtests in "${all_tests_sorted[@]}"; do + key=3D"${subtests%@*}" + value=3D"${subtests#*@}" + + all_tests_args+=3D"${key}" + all_tests_names+=3D("${value}") + all_tests[${key}]=3D"${value}" +done + tests=3D() -while getopts 'fesltra64bpkdmchzICSi' opt; do +while getopts "${all_tests_args}cCih" opt; do case $opt in - f) - tests+=3D(subflows_tests) - ;; - e) - tests+=3D(subflows_error_tests) - ;; - s) - tests+=3D(signal_address_tests) - ;; - l) - tests+=3D(link_failure_tests) - ;; - t) - tests+=3D(add_addr_timeout_tests) - ;; - r) - tests+=3D(remove_tests) - ;; - a) - tests+=3D(add_tests) - ;; - 6) - tests+=3D(ipv6_tests) - ;; - 4) - tests+=3D(v4mapped_tests) - ;; - b) - tests+=3D(backup_tests) - ;; - p) - tests+=3D(add_addr_ports_tests) - ;; - k) - tests+=3D(syncookies_tests) - ;; - S) - tests+=3D(checksum_tests) - ;; - d) - tests+=3D(deny_join_id0_tests) - ;; - m) - tests+=3D(fullmesh_tests) - ;; - z) - tests+=3D(fastclose_tests) - ;; - I) - tests+=3D(implicit_tests) + ["${all_tests_args}"]) + tests+=3D("${all_tests[${opt}]}") ;; c) capture=3D1 @@ -2509,11 +2462,11 @@ while getopts 'fesltra64bpkdmchzICSi' opt; do done =20 if [ ${#tests[@]} -eq 0 ]; then - all_tests -else - for subtests in "${tests[@]}"; do - "${subtests}" - done + tests=3D("${all_tests_names[@]}") fi =20 +for subtests in "${tests[@]}"; do + "${subtests}" +done + exit $ret --=20 2.35.1