Message ID | 20230609-upstream-net-20230610-mptcp-selftests-support-old-kernels-part-3-v1-1-2896fe2ee8a3@tessares.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1625615vqr; Sat, 10 Jun 2023 09:13:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ63x+dnjhOgRG1GdMLH5l5TL6uGwA3DN3gFuxgLrz7cchzHAsUsX4JmQpv7OT8jCaBz+8XS X-Received: by 2002:a17:907:5cc:b0:96a:9467:1dc7 with SMTP id wg12-20020a17090705cc00b0096a94671dc7mr4214842ejb.25.1686413617897; Sat, 10 Jun 2023 09:13:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686413617; cv=none; d=google.com; s=arc-20160816; b=IHS9igK4rM1Lt/7CEfY8qZa6FQmUMi2EfmLltpybYCp30Oqt6IYrEjSMfQyIN7bxcG aJf6FgwUS7UxVKYOzZcMdl6sYd257RMNcBTuaQi2ArlzhMczUpPDH66AFcU4OSeb+Nsg Cxd9GdWi6yHtY6T0w4CpZSk6IvypS2ybOEpRI3OssmEMcztNw2U5jOlpGtNEeihsTztX /9OG72dgrlEoQzK7y424U1dCL4+aqv+bGqqaDpGDo7z7MBBNqrFhv/ki9W6nPuhhHRcR lExFEvq5yPA9IGAEfmnWfbkvKXj3wcMWeBNyJyvtV5Djb9BCNn2nPSr6TqWf7irW6l7S 1yMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=J9ydP1eQsAqgHsLKHcUQ2BwON2NYDSPWGMYtQ1Ca9t4=; b=X4le2fRvHEKFVPtfEof3NUWX5U0koFFvn3Lo7vn4neOJI2TmU3g3AtHyt0TobA/FVI xpOmwmgNMwd+wKxHZDC2K2XKe/KGFcF9RIMXTL0hlnL/mathG4TjPJv74oDjrtXSSm+8 XMX9iH/T1SqGWp31cLHVQTmrp8DpO9wiH4QotSd/bI7dQ68TeChcfYjHO+MKi7adSO6D rhqcLCrH/A+yEGqcr7psAeG+27Kp4iPiGFRcxuEtLEHuh/OZevDIA4q96f0XXrGriGJ1 XT+8DCQ5u8uHUCAZhwGcvLoM3ZRk+edYobuvUBAoow09Nj1U2YgHisLP1kdjSSfrAprS xvEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=oA+qbYnS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=tessares.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h22-20020a170906855600b00977da6c1d30si2851125ejy.943.2023.06.10.09.13.12; Sat, 10 Jun 2023 09:13:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=oA+qbYnS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=tessares.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229640AbjFJQL6 (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Sat, 10 Jun 2023 12:11:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbjFJQLv (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 10 Jun 2023 12:11:51 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F11D30F1 for <linux-kernel@vger.kernel.org>; Sat, 10 Jun 2023 09:11:48 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-30c4c1fd511so2555683f8f.1 for <linux-kernel@vger.kernel.org>; Sat, 10 Jun 2023 09:11:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; t=1686413506; x=1689005506; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=J9ydP1eQsAqgHsLKHcUQ2BwON2NYDSPWGMYtQ1Ca9t4=; b=oA+qbYnSebfwGIytxIm+hAbAgpQmiSR0y7k7IwZvHWVHfcLyNdq/7Pe2bydOMr89w6 rJ+TP7C9DoUEqOufkKGuncKcceubQLoBSMvncnzeDUvt8EPTO5pnri7JdfsPzLF4wban +Fj3rj7/Nb619BgsxGSeab1J6d7td01y51KIgiMe5GHNZmpGkIDkg2YDEIe6I+NXbRmK rmxi+ZZd5guFeBolfgG/eotiF0latXDUar1+o28j3DFyaOkrR6zbMqrogVsVgwMzE3X5 AtHlBjXjy77F5P5egKZ9pPZ8OMresqeBvjE5xCOLuDe0Lx4qPwphM1PM4ChLLs9kcNXT 9IKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686413506; x=1689005506; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J9ydP1eQsAqgHsLKHcUQ2BwON2NYDSPWGMYtQ1Ca9t4=; b=gJUJKJxUEiFXugYgFQHGZbJXoUEsuRi6rGoV7pM9G8GpuapkgNPZQwhSivxYpzzSQW cgv0raek2z/YmbURBe8cX8YP+1ZBj6okzfqo2DpoOdQjDbvuMXsAQrlvsYIrlxRkmb5d GF5FYn6ikP1eE9yAOBHUz4Bf+w2DcIozOKpIukvf5D7HaQjg/VNwQ01EvCSOHQTFm0xn ygtBezZIRkzCzEC0Xly9KjFKBPRVqrvmSpb6UTk3pUyvP3s7mxKhJwuT7+O2qiWu0Vkt jLjS03sVMfrOyKnnt98pPV9J9QAVSqzf46p1twZicw69eM1ijbPLn2YQfK/KdUlqVofP daPg== X-Gm-Message-State: AC+VfDyLZpZtD/k5gqqpCeVDx0OQvG61HcaCv52r0vdNQxdQZ27PbSA0 o6n7xY9tlLcgBUSgt0CsJ5prXA== X-Received: by 2002:a5d:474e:0:b0:30e:57e0:a0c1 with SMTP id o14-20020a5d474e000000b0030e57e0a0c1mr1499029wrs.65.1686413506385; Sat, 10 Jun 2023 09:11:46 -0700 (PDT) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id u9-20020a5d4349000000b003079c402762sm7431145wrr.19.2023.06.10.09.11.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Jun 2023 09:11:45 -0700 (PDT) From: Matthieu Baerts <matthieu.baerts@tessares.net> Date: Sat, 10 Jun 2023 18:11:36 +0200 Subject: [PATCH net 01/17] selftests: mptcp: lib: skip if not below kernel version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230609-upstream-net-20230610-mptcp-selftests-support-old-kernels-part-3-v1-1-2896fe2ee8a3@tessares.net> References: <20230609-upstream-net-20230610-mptcp-selftests-support-old-kernels-part-3-v1-0-2896fe2ee8a3@tessares.net> In-Reply-To: <20230609-upstream-net-20230610-mptcp-selftests-support-old-kernels-part-3-v1-0-2896fe2ee8a3@tessares.net> To: mptcp@lists.linux.dev, Mat Martineau <martineau@kernel.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Shuah Khan <shuah@kernel.org>, Florian Westphal <fw@strlen.de>, Davide Caratti <dcaratti@redhat.com>, Christoph Paasch <cpaasch@apple.com>, Geliang Tang <geliangtang@gmail.com>, Geliang Tang <geliang.tang@suse.com> Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Matthieu Baerts <matthieu.baerts@tessares.net>, stable@vger.kernel.org X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2806; i=matthieu.baerts@tessares.net; h=from:subject:message-id; bh=Q8eml6N8B8SHqHUyo58PbB8e7k7W1vtr1TjWM9dwoo4=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBkhKC9JRSHzNnZd6ZUPuZjmNO0nqMQC/ojooypf JOnOuLDuUeJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZISgvQAKCRD2t4JPQmmg c4T7D/wOvWXoyVAs+hN2WciF7uslyfB9gavueCBHNFbzl01dFsN1JywDZ9zIpZoP3ByzGjk8NiY 7YTSYn4Yczt+idBlGi2hxR8s0QicXm2W5VVCTIb3flrnLBqcYJDoBLHzKkwgXLLkgw+Gmi2d8bt 2EeKlmb7ZMs7nWm3rK9jNH3I2ictUSATF/V9InFMGjTegciIDqKHPrU/YIGmfHP78pRzGL+RNEi POKMrxCElw8nsFK1cKIxREna2mJzNnXzgTZsU8AWLr2bUVn1Bl5cCXc8qgxChvrbcr4wSmZqh2d jQ6i/xV21a2Gruz7k0E0CchMHhf6SD4yr2xrazIfHSTHMnEyBIYLx9RzqlypubTWqRIp/eqNNKq BtrMcxb4EMqVePVeV+3l4A9/2RasvK61CjILdKAbtTuGSXatFI04MykeyXh4LCCAB/Z2BYk2KjE AnCLmtLxhtKhxc7vX4ulxttpPc2XNMQrhRfAxDgBmZz2xEtKmbFUA08MNqEjtTxfk5Zmrcpw4NX ZEyOxcjt6aFLVM1dYIBze1fFsuLDMNlsaRlPhItzCmbRogvwCJUYs07yLJXvnfDHN4GDzkyy647 YLORR3HiMWsJammnWTvsH0V/a7O5z/NN1GwWj7vzeTzuxx/bggHLx21X2YG31DDVU043HD44WSw I4h+qrvGWX7OtsA== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768332845595381285?= X-GMAIL-MSGID: =?utf-8?q?1768332845595381285?= |
Series |
[net,01/17] selftests: mptcp: lib: skip if not below kernel version
|
|
Commit Message
Matthieu Baerts
June 10, 2023, 4:11 p.m. UTC
Selftests are supposed to run on any kernels, including the old ones not
supporting all MPTCP features.
A new function is now available to easily detect if a feature is
missing by looking at the kernel version. That's clearly not ideal and
this kind of check should be avoided as soon as possible. But sometimes,
there are no external sign that a "feature" is available or not:
internal behaviours can change without modifying the uAPI and these
selftests are verifying the internal behaviours. Sometimes, the only
(easy) way to verify if the feature is present is to run the test but
then the validation cannot determine if there is a failure with the
feature or if the feature is missing. Then it looks better to check the
kernel version instead of having tests that can never fail. In any case,
we need a solution not to have a whole selftest being marked as failed
just because one sub-test has failed.
Note that this env var car be set to 1 not to do such check and run the
linked sub-test: SELFTESTS_MPTCP_LIB_NO_KVERSION_CHECK.
This new helper is going to be used in the following commits. In order
to ease the backport of such future patches, it would be good if this
patch is backported up to the introduction of MPTCP selftests, hence the
Fixes tag below: this type of check was supposed to be done from the
beginning.
Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368
Fixes: 048d19d444be ("mptcp: add basic kselftest for mptcp")
Cc: stable@vger.kernel.org
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
tools/testing/selftests/net/mptcp/mptcp_lib.sh | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
Comments
Hello: This series was applied to netdev/net.git (main) by Jakub Kicinski <kuba@kernel.org>: On Sat, 10 Jun 2023 18:11:36 +0200 you wrote: > Selftests are supposed to run on any kernels, including the old ones not > supporting all MPTCP features. > > A new function is now available to easily detect if a feature is > missing by looking at the kernel version. That's clearly not ideal and > this kind of check should be avoided as soon as possible. But sometimes, > there are no external sign that a "feature" is available or not: > internal behaviours can change without modifying the uAPI and these > selftests are verifying the internal behaviours. Sometimes, the only > (easy) way to verify if the feature is present is to run the test but > then the validation cannot determine if there is a failure with the > feature or if the feature is missing. Then it looks better to check the > kernel version instead of having tests that can never fail. In any case, > we need a solution not to have a whole selftest being marked as failed > just because one sub-test has failed. > > [...] Here is the summary with links: - [net,01/17] selftests: mptcp: lib: skip if not below kernel version https://git.kernel.org/netdev/net/c/b1a6a38ab8a6 - [net,02/17] selftests: mptcp: join: use 'iptables-legacy' if available https://git.kernel.org/netdev/net/c/0c4cd3f86a40 - [net,03/17] selftests: mptcp: join: helpers to skip tests https://git.kernel.org/netdev/net/c/cdb50525345c - [net,04/17] selftests: mptcp: join: skip check if MIB counter not supported (no matching commit) - [net,05/17] selftests: mptcp: join: skip test if iptables/tc cmds fail https://git.kernel.org/netdev/net/c/4a0b866a3f7d - [net,06/17] selftests: mptcp: join: support local endpoint being tracked or not https://git.kernel.org/netdev/net/c/d4c81bbb8600 - [net,07/17] selftests: mptcp: join: skip Fastclose tests if not supported https://git.kernel.org/netdev/net/c/ae947bb2c253 - [net,08/17] selftests: mptcp: join: support RM_ADDR for used endpoints or not https://git.kernel.org/netdev/net/c/425ba803124b - [net,09/17] selftests: mptcp: join: skip implicit tests if not supported https://git.kernel.org/netdev/net/c/36c4127ae8dd - [net,10/17] selftests: mptcp: join: skip backup if set flag on ID not supported https://git.kernel.org/netdev/net/c/07216a3c5d92 - [net,11/17] selftests: mptcp: join: skip fullmesh flag tests if not supported https://git.kernel.org/netdev/net/c/9db34c4294af - [net,12/17] selftests: mptcp: join: skip userspace PM tests if not supported https://git.kernel.org/netdev/net/c/f2b492b04a16 - [net,13/17] selftests: mptcp: join: skip fail tests if not supported https://git.kernel.org/netdev/net/c/ff8897b51894 - [net,14/17] selftests: mptcp: join: skip MPC backups tests if not supported https://git.kernel.org/netdev/net/c/632978f0a961 - [net,15/17] selftests: mptcp: join: skip PM listener tests if not supported https://git.kernel.org/netdev/net/c/0471bb479af0 - [net,16/17] selftests: mptcp: join: uniform listener tests https://git.kernel.org/netdev/net/c/96b84195df61 - [net,17/17] selftests: mptcp: join: skip mixed tests if not supported https://git.kernel.org/netdev/net/c/6673851be0fc You are awesome, thank you!
diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh index 29b65f4b73b2..f32045b23b89 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -76,3 +76,29 @@ mptcp_lib_kallsyms_doesnt_have() { mptcp_lib_fail_if_expected_feature "${sym} symbol has been found" } + +# !!!AVOID USING THIS!!! +# Features might not land in the expected version and features can be backported +# +# $1: kernel version, e.g. 6.3 +mptcp_lib_kversion_ge() { + local exp_maj="${1%.*}" + local exp_min="${1#*.}" + local v maj min + + # If the kernel has backported features, set this env var to 1: + if [ "${SELFTESTS_MPTCP_LIB_NO_KVERSION_CHECK:-}" = "1" ]; then + return 0 + fi + + v=$(uname -r | cut -d'.' -f1,2) + maj=${v%.*} + min=${v#*.} + + if [ "${maj}" -gt "${exp_maj}" ] || + { [ "${maj}" -eq "${exp_maj}" ] && [ "${min}" -ge "${exp_min}" ]; }; then + return 0 + fi + + mptcp_lib_fail_if_expected_feature "kernel version ${1} lower than ${v}" +}