From nobody Mon Feb 9 23:03:56 2026 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6638:bd2:0:0:0:0 with SMTP id g18csp668326jad; Thu, 17 Feb 2022 09:43:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJw9zVRV45epALW3DFVOtZpxGHL55wOc2VpeZqNIBJSlnPkOhU2j3k/J2wPba/5nLZimvszD X-Received: by 2002:a17:90a:5a04:b0:1b9:575e:fbdb with SMTP id b4-20020a17090a5a0400b001b9575efbdbmr8395204pjd.4.1645119833451; Thu, 17 Feb 2022 09:43:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645119833; cv=none; d=google.com; s=arc-20160816; b=DqoaeML6/SOV5bHoS+GaEdFQM+thRfcS2Zk+dJJ6d/Jvpb6jBmKyJSD2aqfCPW06cF Yta8vN3bzizUFYNIrf0BkIXjZsLR63aCf5RJIlXQ1YPLHdjGuLraRDmlZfS7ZtW760on IPX3yQhtR40hpdBKjqff3eTCjxtVDwBPdKByqYwpUjv6UJ5dE1kyeu0LfYrL+JVM/h5b XTDoyHjsMpf8pM30TfC3lhgb3cOXJ24lsbYe5P5ThJRvWGEynHXKd36q0/zmAqvwqTUq xJZRDJSmoIIbiAoSqft9i4gpQvPx17YqB+FOVf4pCXZwJkvI74jDa8f1t5rCOP1cVGeG o+1Q== 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=mcPQk60y1wnComOsrwBV7cevVzWVwvGsoZkxSvr9jnA=; b=vqK/b8nulZIXSaN19GJwT8AHArE1QgoPZB8K7hjr2F1xd7vzjJunyBR4VumQRbvXm+ t4+2habc2z+vsaV6EeHvpleD4BK2EOgYE9Gvb7LR6Kry+TbROHJS0sF7hub4nljXm/4z jy6DsRGE5e0kgK1x9ejRWxIV0gMciWTpAIXhZ18CfNeU2Y8NGkRq/CHwp4QMg614RPLT l/5XmuVMsXv1XUMesj4emDsZEYvCMunl+hJJMPsEfsBFtW6SQ/03jJkExITdHBVleIyT 6720zkzEIoOXGKAdsMhwSgN8504j8D3XP1CzjaZovPbZufZn0gqT7oGbcs4raNX1sHUQ Lddw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=hVGLukYR; spf=pass (google.com: domain of mptcp+bounces-3807-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-3807-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [2604:1380:1000:8100::1]) by mx.google.com with ESMTPS id u11si9593974pgp.652.2022.02.17.09.43.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Feb 2022 09:43:53 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-3807-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=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=hVGLukYR; spf=pass (google.com: domain of mptcp+bounces-3807-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1000:8100::1 as permitted sender) smtp.mailfrom="mptcp+bounces-3807-wpasupplicant.patchew=gmail.com@lists.linux.dev" 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 8913A3E0F70 for ; Thu, 17 Feb 2022 17:43:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B664436D; Thu, 17 Feb 2022 17:43:50 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF38D3B28 for ; Thu, 17 Feb 2022 17:43:48 +0000 (UTC) Received: by mail-wr1-f50.google.com with SMTP id e3so10409565wra.0 for ; Thu, 17 Feb 2022 09:43:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares-net.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mcPQk60y1wnComOsrwBV7cevVzWVwvGsoZkxSvr9jnA=; b=hVGLukYR3HREwz7FRC16mX4t5UgqGg/7xbuG4VVZ78qKtbx2oQUckJxbfKr5zh51zR bOyAMvMLyH01UtH4SfRloHJxwhJLbAQvaiYM0f8AK9k1Iw640Kj+z0stHzG1L7shYPhE RnrlnkKB6+C7azMTVg0hvk9P0cBdIUYTb+6OAlQSx1B7LlXybRuRcJeYUNzYkm8lpf1w Ut/tkWVCpdCFCsO4rsaYdHjjs/0N2CDYRTRa4NSxTs3RXid5SIt6DSuEe5vQ1RUk72Lg TzvxgP9Dav+w/n04/rDEWi6VBmwCbAqhDNdx1gZWRwC9DVJ+t5b7hkw1xevwYt2HDbBv g9ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mcPQk60y1wnComOsrwBV7cevVzWVwvGsoZkxSvr9jnA=; b=kvQ6tAWF/SSQ84SVnPwDNOuNgzSsAjSf8BiXQxVhFNmg8IPyZx8vJpJboaBZdtbrVb /4pLki9C1PzlLFv2tb2Q/51Eug7btXrnMJPBefTlFPXS72eLi+E8ONxer2Xt3tMZWYXZ X/zk8vx4TMqTIQR/j8eRpUUrT8x8qvlQzGZzih8/oUC9FtSl0sULEFt7uiClDbro+62u 61TcehNl0TU9Z+hcLCola3q7SmhRObNkq+Sa0TZoXnyrOHLOC1WGztiKMQNVWEqDcWJD r5DFN04gkl+sch7wcW7vZRDIafz1hAPUVIEdkVcZON9SwWBs5h31ZyK6Sle9owonwEup IScg== X-Gm-Message-State: AOAM532G2PiUtwI1WczWF6IMNggK087/ndVvgDGYf4uElMpFlouAmlGa plG5gaCtf4bsUyOh0qBLHpRyQFmnYuur3sIR X-Received: by 2002:adf:e185:0:b0:1e2:6421:f2d0 with SMTP id az5-20020adfe185000000b001e26421f2d0mr3193408wrb.703.1645119826982; Thu, 17 Feb 2022 09:43:46 -0800 (PST) Received: from tsr-vdi-mbaerts.nix.tessares.net (static.23.216.130.94.clients.your-server.de. [94.130.216.23]) by smtp.gmail.com with ESMTPSA id 7sm23060203wrb.43.2022.02.17.09.43.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 09:43:46 -0800 (PST) From: Matthieu Baerts To: mptcp@lists.linux.dev Cc: Matthieu Baerts Subject: [PATCH mptcp-next v2 2/9] selftests: mptcp: join: define tests groups once Date: Thu, 17 Feb 2022 18:43:22 +0100 Message-Id: <20220217174329.826430-3-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220217174329.826430-1-matthieu.baerts@tessares.net> References: <20220217174329.826430-1-matthieu.baerts@tessares.net> 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" When defining a new tests group, it has to be define 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 --- .../testing/selftests/net/mptcp/mptcp_join.sh | 135 ++++++------------ 1 file changed, 46 insertions(+), 89 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 13f78d4434d2..747dd6d887ea 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -19,6 +19,7 @@ ip_mptcp=3D0 check_invert=3D0 init=3D0 =20 +declare -A all_tests TEST_COUNT=3D0 nr_blank=3D40 =20 @@ -2202,26 +2203,6 @@ userspace_tests() chk_rm_nr 0 0 } =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 - userspace_tests -} - # [$1: error message] usage() { @@ -2231,22 +2212,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 " -u userspace_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" @@ -2256,56 +2227,42 @@ 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 + u@userspace_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 'fesltra64bpkdmuchCSi' 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) - ;; - u) - tests+=3D(userspace_tests) + ["${all_tests_args}"]) + tests+=3D("${all_tests[${opt}]}") ;; c) capture=3D1 @@ -2326,11 +2283,11 @@ while getopts 'fesltra64bpkdmuchCSi' 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.34.1