Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp865466lqc; Fri, 8 Mar 2024 14:12:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXUX5CJnWtjqaOZ7YgrC4iGcvCGRVCIU/sQ2SCjr9qMXAEP0K1TKIlPgPtY/jsaYg3Pa5aeYiYAh0ghzvafDpNJrZLpZBGbI3/rlkHMOg== X-Google-Smtp-Source: AGHT+IHBlpyKPWebNKqtdknoXtGDav/LhPjFoKxzv/7D4J0gZFIZ38KXr5Qmg8ZS2ltcIzR8VnXc X-Received: by 2002:a05:622a:cf:b0:42e:db06:a35b with SMTP id p15-20020a05622a00cf00b0042edb06a35bmr574609qtw.17.1709935967667; Fri, 08 Mar 2024 14:12:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709935967; cv=pass; d=google.com; s=arc-20160816; b=skAGnYUlda9DrMqaMEKtT1b75ww3FtqNDi/HWEJNPLELJb/0+GrkUcbQYhNq9h7x5j 8VjfGcVOz7wQxUYPRW+ZbHbWSa8trErDjhisE2dUhtWc+I8BCxb+FRSXvzDJe5dLDG73 OyBof2TuDKeoqQEZwVR9cZbH4TJ67d2mdiOsvhDXPLNg9qmHVpK1N5ato6p5qUatvO00 1ZQrFv/dZ51Hfx3e9xk7b1usB6r5JcPanxGJmxEAuNsb09Wf8Ta7ybffT8Hdh2tftUtk FlIgS6p+4bE9z7ioG7F5EMCchiTw6IU0SZTUw3crbWYD1jQl8KIu2IydIuvUhyMNevFL K8OA== 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=zjx+nxBbcYm5qEx7eRIHSx8Jeiwd9OuoleHf5KquZio=; fh=2dk07KolaZJL0JeqFGRxwJVwvAyA78FaKBXVM6bwbyU=; b=UH5bYrCKWpl+OpGBKyQpNiGY6Ph8a4o5PL11dT/+HBPdQER+HGt7qdFarDxaSiUHI9 aFNjG8fihwG3nijeMMmsyzNDTscvTSeAThvMChqSECyNJ0YxCVA+g6Wy2IHOmwJs2Ce9 TZlF7V6yVxMvcWxrx30NOXKurfC4qqnSvTDaQ6O3mYRAHIjZwC66600gxfaDefX6MfBD L8+smoM0tjmF4EUecSFANvMa1BLETWkmfD+8IbMM23PgsoYAzO09C1OsXN0UF/JPqjNy MXp6tI2rwKNf0dqrwgh4ww2EE6Hemb78mfFHU5QzpIG0QEpWd7Uj+1McL/dVBStLXfFt 5YQA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A8tnEfSB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-97632-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97632-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 u3-20020ac858c3000000b0042f20f2c840si425124qta.704.2024.03.08.14.12.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 14:12:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97632-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=A8tnEfSB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-97632-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97632-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 5387E1C219F6 for ; Fri, 8 Mar 2024 22:12:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A0B01612D0; Fri, 8 Mar 2024 22:10:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="A8tnEfSB" 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 AD07860EEA; Fri, 8 Mar 2024 22:10:43 +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=1709935843; cv=none; b=WZekmwdYMDeOxouZFVGEEoAMb07Gec2BYiifRzsC0x4KDXoX/WuLtCnlscrwiT8aWy4bGDyOTUVgKoSHeCoEINjrccgQNslKoAEgT5NDOU7gHhGZiwLKXeg4pgBVLqFhNucAzMq196mK3R8ng5dJp28SzVOCbHTLXgzM/4ZDa7k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709935843; c=relaxed/simple; bh=5iHWN71u8FnrK4su6Pxr/Ce0MriuDLNYlOjgzzlB7lY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TvkFS63HS3tnI4Dc1eJBrDBuwP3GaPHKFsaaejzurxCHxvmuy7xe2nJt4529MydQmpLzvmynGjXdSjXbqzLEZt7aSPZfJVHOhnXG8Lt88Uu+jHZuV+D15HTLq1Rct3gh+SKuZMXxgEVIXD+vZjXISm5JQeEuRb5ovShmvx5HtbE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=A8tnEfSB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68607C43330; Fri, 8 Mar 2024 22:10:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709935843; bh=5iHWN71u8FnrK4su6Pxr/Ce0MriuDLNYlOjgzzlB7lY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=A8tnEfSBg8Kwq1Y/Bs+IixZI7dw75NMN2yuJMbs1erozPbmNPLm5uY9nDXuAw4k27 yEZXINuJrOA+py4fi7c/jH8tFiuR3D91OVB/d3Gvgk/XTBJmtmCqrCjD27MdfvWn4F z7AKInBBFmHliTCo1AFwIHSnje580W7djsUTHTS/8+qokOdUV8rDfjwfwRLP2New63 HptGNPcRo05X10BMwr6QkRF0X0xJN8NSzUhK1r2Pxsqvxh7mxWsYaxv1YoMcHmc+qE 9jI2HlFxyQEBx4zMdRmnLtBvVBzoY8YNGDtdGuEV9Ynm3c8tWsDCFhThsjWqzr4fk+ 59/JJogKpf64w== From: "Matthieu Baerts (NGI0)" Date: Fri, 08 Mar 2024 23:10:13 +0100 Subject: [PATCH net-next 06/15] selftests: mptcp: add print_title in mptcp_lib 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-6-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=3139; i=matttbe@kernel.org; h=from:subject:message-id; bh=c/Oh+VCrsNdpQsgZKz9EFklI8GqtmsKHi5z+kv2litY=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl64zJD7ExCtlDuWREcVMp9xcn1281k9X5EM/ZN RQenMrK32aJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeuMyQAKCRD2t4JPQmmg c2YPD/93Ko4cF68+Bg5GbARE8tDdFC9mUXn89IYoFs2ySwe4Id1kAycSKI+pGQMtyizyfFGoA1/ +FoSD+46RnrFapRBWFduTd6J5TGqmefRfBOaVNSnnjmVGyggBGV7HpTY1m5dOCXYkiDC8oOJFq5 m6YvZZg1L33n+TfduX+XiI+yCD+B4/AhMMYEUQXT186BLIHWMNkAyl8f68GCQVBJ53DrgoC4tPB W1gDwJg/k5D35KIDuisENjmPEKWmVN7eypvaN5UHBG84w52VqkZr26vOPF6jvXgD9X3YkgG/UdB 7K3g+YDJ7uKEvqcNLRPsBnRV14S73O10gm3J9/wy1Jeigj+vqXXfUPdulilMh9WdePXzDA6Oohw hfV29Q4ohPAJDmnUpSdVXQewt6cU7hjIrYY6YmYDyma4kt7gMGpzlgrxWo6oQLyi+fDEG7PC2T1 rko+K7Z52WXvQjTXryV/Dr0s2ngrgAt1mO8Syx6uecql23x0Cc5r5hdxsfmYQcEzaa8WR6pszJ1 AiA83X9ebf+axkzNkGw5fDUYgodfvSpKbin3wMj/cFejMyKeKJKxXf37C+1I78VCZ35Rob2oIGd KoypXulzQZPv5ZCdrz5z8s9nv1BJGbXisEMQOYd7NQgcnW2FMSkUZwDuIKOpT7sSzp44wNb63WM BOpu51YrUEERyOg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang This patch adds a new variable MPTCP_LIB_TEST_FORMAT as the test title printing format. Also add a helper mptcp_lib_print_title() to use this format to print the test title with test counters. They are used in mptcp_join.sh first. Each MPTCP selftest is having subtests, and it helps to give them a number to quickly identify them. This can be managed by mptcp_lib.sh, reusing what has been done here. The following commit will use these new helpers in the other tests. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 13 ++++--------- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 10 +++++++++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 4ef0d5ae9dae..2f34e2b9a1c4 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -48,6 +48,7 @@ declare -A all_tests declare -a only_tests_ids declare -a only_tests_names declare -A failed_tests +MPTCP_LIB_TEST_FORMAT="%03u %s\n" TEST_NAME="" nr_blank=6 @@ -169,11 +170,6 @@ cleanup() cleanup_partial } -print_title() -{ - printf "%03u %s\n" "${MPTCP_LIB_TEST_COUNTER}" "${TEST_NAME}" -} - print_check() { printf "%-${nr_blank}s%-36s" " " "${*}" @@ -232,7 +228,7 @@ skip_test() local i for i in "${only_tests_ids[@]}"; do - if [ "${MPTCP_LIB_TEST_COUNTER}" -eq "${i}" ]; then + if [ "$((MPTCP_LIB_TEST_COUNTER+1))" -eq "${i}" ]; then return 1 fi done @@ -267,14 +263,13 @@ reset() TEST_NAME="${1}" - MPTCP_LIB_TEST_COUNTER=$((MPTCP_LIB_TEST_COUNTER+1)) - if skip_test; then + MPTCP_LIB_TEST_COUNTER=$((MPTCP_LIB_TEST_COUNTER+1)) last_test_ignored=1 return 1 fi - print_title + mptcp_lib_print_title "${TEST_NAME}" if [ "${init}" != "1" ]; then init diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh index 63abf4431993..eb740a2f7898 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -10,8 +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 +MPTCP_LIB_TEST_FORMAT="%02u %-50s" # only if supported (or forced) and not disabled, see no-color.org if { [ -t 1 ] || [ "${SELFTESTS_MPTCP_LIB_COLOR_FORCE:-}" = "1" ]; } && @@ -412,3 +412,11 @@ mptcp_lib_events() { ip netns exec "${ns}" ./pm_nl_ctl events >> "${evts}" 2>&1 & pid=$! } + +mptcp_lib_print_title() { + : "${MPTCP_LIB_TEST_COUNTER:?}" + : "${MPTCP_LIB_TEST_FORMAT:?}" + + # shellcheck disable=SC2059 # the format is in a variable + printf "${MPTCP_LIB_TEST_FORMAT}" "$((++MPTCP_LIB_TEST_COUNTER))" "${*}" +} -- 2.43.0