Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp865323lqc; Fri, 8 Mar 2024 14:12:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXggz3rvqTaZzAC/3JRax8H4Efu63sSO9DlZhS4jRQThZ5OexyweAs6hpgZvZnKr6wFhsg1gzbVRH1QEm5ReU+0Cfj0Jluf+m7IcX/7Yw== X-Google-Smtp-Source: AGHT+IEx0Va8/KNY/pdiS4Wfhxrk2p5fkYt1ZVZXxkUoHFnkTH/lHEk7cc+g5uSLYSmoYlEWXGZ7 X-Received: by 2002:a0c:f611:0:b0:690:913b:1496 with SMTP id r17-20020a0cf611000000b00690913b1496mr416961qvm.9.1709935948969; Fri, 08 Mar 2024 14:12:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709935948; cv=pass; d=google.com; s=arc-20160816; b=ZuODNMXTpcChsx3oW9n1M5mldXX7sB7JAJyYQnRvN0bye29sC/PYn1FJ55SazdM16d WEPH96aMGkOGefYtWEQatSbC94CNE42eMsmfrWWnmrvWdvZqmifuNdqB8thfmaeOkvyR pNBpYbJrmAzpWfJHVy+PtrE7xUy2e4doS3cHlX8FmHQKow+I3r+aM2E1ZfTlh4gBQ1Yw ZgCkrDVk1LHAjlEivTS2/LFVe7UPnhvDtHoUIKL/HR61U0wYeLgJupnZbRtOjXkfWWp0 maGufHT7l692CV75h8/CoJq5GBACi6GJvN5TfghuGUpZ6jULXiZu88UHojnW+KuNPE1F Os1A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=w7Q1FdIULoUkufEYO9qBDcRMsC4gwHsCoNaliZoDgi0=; fh=2dk07KolaZJL0JeqFGRxwJVwvAyA78FaKBXVM6bwbyU=; b=X/vi8yPMtrLxk0n0/Tujqkeh5L7kq5t64weArOtdh51vOUSNBmOEDfeFAtph9XkISg igal7qt+PI+h+Iv3UfHydD/B8Tox1W+5PELg5hIMP8Iv10cHnUjhN85LLuMN8gopp7qJ 1eY1a4UrjPaDksnav5RHOBA1RtqTZsfcatk43QKw7MkXLLK6oVl7YN/IXbm4/oFqKVo4 ev/2F6+kjW9NMMuQgMKqbBlNkUEiRZTJZGtcDHxfxJIhbKMIrhiX0Asm/0Y7ysyyjPQB b1FTEHPrNcGCn/D4QynV/zfvJtdeXty9EjaLAnH764VWVGY6NC//G7w05K9kSeyahM1A qRiQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XBHI8nwF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-97631-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97631-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 8-20020a05621420a800b0068f654b037dsi349032qvd.610.2024.03.08.14.12.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 14:12:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97631-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XBHI8nwF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-97631-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97631-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A3E621C219DE for ; Fri, 8 Mar 2024 22:12:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 80A5E60ED8; Fri, 8 Mar 2024 22:10:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XBHI8nwF" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 60FE260DFF; Fri, 8 Mar 2024 22:10:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709935840; cv=none; b=rsCOexgAsH8HXIYkH9xNrLPCB9VeZlKLTpm8McdOpTQSpDLPDx45Ll+tZppZc6YBFDPQAYqnRTgw0K7dTkRXMvlKPkApTRpN9UALQnZIocQtcdIEJyzWFr07Z9W4udZiPRbR2niWOfPZ44m5T6oPeuHrUng9gyVgE6Gl6MfVyFw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709935840; c=relaxed/simple; bh=WCm5fVeBx2RidgxLFnn5lWB43KtM3GQHbIliD1YqVU8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iZVpTcQ0VWsgPzi8PMMwMvXfBNl7dkD5ouuyrsRFNV+Jbb7+nCEbJyYgtSf4YdC1e/eViZwP1OTVwZWZdeisNtwoDoMzNlayWXmtrpR3SKXg7P+k+Xz1jeN7W7k0h5oX2e8YONnPtr7pdXvAVRJd2e4DQbQiWpZPae8tO9KnnB0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XBHI8nwF; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE099C43142; Fri, 8 Mar 2024 22:10:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709935839; bh=WCm5fVeBx2RidgxLFnn5lWB43KtM3GQHbIliD1YqVU8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=XBHI8nwFQndMIUM6NjYZ0MHgfo37727nk+NWK9l2SQlSveTi1VtIjLd/m87SITQgY W5b7kGpmQXklMGEkalapevHdzKd5m/I2w+f9gPEjUvfYOIwxRfOdLSL1ltik9wkfdt TEV9uNKDjqPpPNTCU3jOQ785ohPO+w9pk82QLY0f9xZWTzEm4TlSHl9gTqeyU1Gzx2 dxfk5sYYTUXG0xUkR2R7g+KLw/7TnWv1AbqQrN/FBSrGPll/fyXxmqlfKFx+hT8Ssa Zn4OZqkk4gFwZI3JwGIyVDBob6a3WOJ7yLbGF76mNuNAfxsLQEq6o21dPp7IffEQT1 hfrukVONWhz7A== From: "Matthieu Baerts (NGI0)" Date: Fri, 08 Mar 2024 23:10:12 +0100 Subject: [PATCH net-next 05/15] selftests: mptcp: export TEST_COUNTER variable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240308-upstream-net-next-20240308-selftests-mptcp-unification-v1-5-4f42c347b653@kernel.org> References: <20240308-upstream-net-next-20240308-selftests-mptcp-unification-v1-0-4f42c347b653@kernel.org> In-Reply-To: <20240308-upstream-net-next-20240308-selftests-mptcp-unification-v1-0-4f42c347b653@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5783; i=matttbe@kernel.org; h=from:subject:message-id; bh=yurptwHKr74ItMKbFqhWWBfncz+etA7RPQk0wFWUt/I=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl64zJ+Q4f/pWAZHoygOW8iInggyXcavOWjDfCb jdNfpmYXrWJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeuMyQAKCRD2t4JPQmmg cy+oD/9cmJ5MwO5GH8hc6s1Q4nnmwRo/Bz8E4z/Kp+24qWsnFvKMBv8fWcPQ8vmw38R6W8JO3Sf mbkw5nhafYlok9dUoZfqTUwmaHp30bo2Di0f8FwvzsF6ihKWYHYkmW3lNvBEG5X65s5qH9/44tC Z3K+YSDyryv+ntoy1X9Y575agkjl4RDMZM4kjeHiTNUL/EG0YFOzVe+UjvzeyFjaABd7eEo+HKy cr6N+CtQ7S1xhGPJwQMdFQJZaMTCkOBY392YBEMi2GDTfWQw3SwLTDBovnZLsKo1kvHmdpcujv/ l59WGAjmURcq4i2wQpZepAg1YFMy0h7Oq7goSEevdpvPORXNl4lbDMRBr+bACRrnQEm1Bunt7C2 8tg7PldRNf2Hzq2rk+LKA8gDXSkGC4tfBPoYWSdYgLJe8oJ4oMDIG5KJ3mpFfsttJRoEL3s8NM4 /ibI7yfYESGf448D7HQEC7Attsfo+36yLodipUtvIi/PtJyLF9XSssou3mQMvhusrs5hHDw1yo3 GsvGboE1WJszao0zDi9uUv/WfL5FoZEm6EkDIMc08xLUD0omTfsNl2CPOnJcGdSpuL0g977DrSU TsYycSMY10j2+VeqbcMX2fwT+6iS6V/17lkSOSo+obrm8+JLz0rgVEivjHszIpDo/cW7SA3d/eo Gx1TU41R/zhRKmQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang Variable TEST_COUNT are used in mptcp_connect.sh and mptcp_join.sh as test counters, which are initialized to 0, while variable test_cnt are used in diag.sh and simult_flows.sh, which are initialized to 1. To maintain consistency, this patch renames them all as MPTCP_LIB_TEST_COUNTER, initializes it to 1, and exports it into mptcp_lib.sh. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/diag.sh | 5 ++--- tools/testing/selftests/net/mptcp/mptcp_connect.sh | 3 +-- tools/testing/selftests/net/mptcp/mptcp_join.sh | 15 +++++++-------- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 2 ++ tools/testing/selftests/net/mptcp/simult_flows.sh | 5 ++--- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh index afe862895946..b63510ce2327 100755 --- a/tools/testing/selftests/net/mptcp/diag.sh +++ b/tools/testing/selftests/net/mptcp/diag.sh @@ -9,7 +9,6 @@ . "$(dirname "${0}")/mptcp_lib.sh" ns="" -test_cnt=1 timeout_poll=30 timeout_test=$((timeout_poll * 2 + 1)) ret=0 @@ -69,7 +68,7 @@ __chk_nr() echo "[ ok ]" mptcp_lib_result_pass "${msg}" fi - test_cnt=$((test_cnt+1)) + MPTCP_LIB_TEST_COUNTER=$((MPTCP_LIB_TEST_COUNTER+1)) } __chk_msk_nr() @@ -127,7 +126,7 @@ wait_msk_nr() echo "[ ok ]" mptcp_lib_result_pass "${msg}" fi - test_cnt=$((test_cnt+1)) + MPTCP_LIB_TEST_COUNTER=$((MPTCP_LIB_TEST_COUNTER+1)) } chk_msk_fallback_nr() diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh index ce9342b241cd..915faee77e25 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh @@ -131,7 +131,6 @@ ns2="" ns3="" ns4="" -TEST_COUNT=0 TEST_GROUP="" # This function is used in the cleanup trap @@ -321,7 +320,7 @@ do_transfer() local extra_args="$7" port=$((port + 1)) - TEST_COUNT=$((TEST_COUNT+1)) + MPTCP_LIB_TEST_COUNTER=$((MPTCP_LIB_TEST_COUNTER+1)) if [ "$rcvbuf" -gt 0 ]; then extra_args="$extra_args -R $rcvbuf" diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 1df2d24979a0..4ef0d5ae9dae 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -48,7 +48,6 @@ declare -A all_tests declare -a only_tests_ids declare -a only_tests_names declare -A failed_tests -TEST_COUNT=0 TEST_NAME="" nr_blank=6 @@ -172,7 +171,7 @@ cleanup() print_title() { - printf "%03u %s\n" "${TEST_COUNT}" "${TEST_NAME}" + printf "%03u %s\n" "${MPTCP_LIB_TEST_COUNTER}" "${TEST_NAME}" } print_check() @@ -233,7 +232,7 @@ skip_test() local i for i in "${only_tests_ids[@]}"; do - if [ "${TEST_COUNT}" -eq "${i}" ]; then + if [ "${MPTCP_LIB_TEST_COUNTER}" -eq "${i}" ]; then return 1 fi done @@ -268,7 +267,7 @@ reset() TEST_NAME="${1}" - TEST_COUNT=$((TEST_COUNT+1)) + MPTCP_LIB_TEST_COUNTER=$((MPTCP_LIB_TEST_COUNTER+1)) if skip_test; then last_test_ignored=1 @@ -462,7 +461,7 @@ fail_test() # just in case a test is marked twice as failed if [ ${last_test_failed} -eq 0 ]; then - failed_tests[${TEST_COUNT}]="${TEST_NAME}" + failed_tests[${MPTCP_LIB_TEST_COUNTER}]="${TEST_NAME}" dump_stats last_test_failed=1 fi @@ -973,7 +972,7 @@ do_transfer() local srv_proto="$4" local connect_addr="$5" - local port=$((10000 + TEST_COUNT - 1)) + local port=$((10000 + MPTCP_LIB_TEST_COUNTER - 1)) local cappid local FAILING_LINKS=${FAILING_LINKS:-""} local fastclose=${fastclose:-""} @@ -991,9 +990,9 @@ do_transfer() capuser="-Z $SUDO_USER" fi - capfile=$(printf "mp_join-%02u-%s.pcap" "$TEST_COUNT" "${listener_ns}") + capfile=$(printf "mp_join-%02u-%s.pcap" "$MPTCP_LIB_TEST_COUNTER" "${listener_ns}") - echo "Capturing traffic for test $TEST_COUNT into $capfile" + echo "Capturing traffic for test $MPTCP_LIB_TEST_COUNTER into $capfile" ip netns exec ${listener_ns} tcpdump -i any -s 65535 -B 32768 $capuser -w $capfile > "$capout" 2>&1 & cappid=$! diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh index 5d071b6eb780..63abf4431993 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -10,6 +10,8 @@ readonly KSFT_TEST="${MPTCP_LIB_KSFT_TEST:-$(basename "${0}" .sh)}" MPTCP_LIB_SUBTESTS=() MPTCP_LIB_SUBTESTS_DUPLICATED=0 +# shellcheck disable=SC2034 # unused at this moment +MPTCP_LIB_TEST_COUNTER=0 # only if supported (or forced) and not disabled, see no-color.org if { [ -t 1 ] || [ "${SELFTESTS_MPTCP_LIB_COLOR_FORCE:-}" = "1" ]; } && diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh index 365fb3d6ef55..3ad663e38c42 100755 --- a/tools/testing/selftests/net/mptcp/simult_flows.sh +++ b/tools/testing/selftests/net/mptcp/simult_flows.sh @@ -14,7 +14,6 @@ ns3="" capture=false timeout_poll=30 timeout_test=$((timeout_poll * 2 + 1)) -test_cnt=1 ret=0 bail=0 slack=50 @@ -126,8 +125,8 @@ do_transfer() local sin=$2 local max_time=$3 local port - port=$((10000+test_cnt)) - test_cnt=$((test_cnt+1)) + port=$((10000+MPTCP_LIB_TEST_COUNTER)) + MPTCP_LIB_TEST_COUNTER=$((MPTCP_LIB_TEST_COUNTER+1)) :> "$cout" :> "$sout" -- 2.43.0