From patchwork Tue Mar 26 16:54:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13604721 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2074.outbound.protection.outlook.com [40.107.94.74]) (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 A4D5B13D500; Tue, 26 Mar 2024 17:00:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472434; cv=fail; b=pejeKD//E6HjTU4QYDeOWsHhLygisAgs5W8mSmAd7L1PnXkK0LXaZnMVMZtIigUTX45N+dkW0wUkjTRq793n/ZOgfZyAl4Xm4dHRAmywaBkjqdTcXMWOHVbvvNP5EuJaUBoEnqF59uxwZ+V+ugpn+hQrYXcbWRQBnmdJyddor5Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472434; c=relaxed/simple; bh=8v9FNUijUG7xwsUH31jckIZPoH1RDSaL9/RZEHgFc58=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Yh2byJtObTLwBZsVxuLgl2OpBy+geGQXq7Hhrhf1HkneoWU0SpOpdnEMlH8QbwFfCER1kWeQNAn3hdwiS4DDgw+zZj9CsbJgMOu6iU22+wovo1w/oRGwcfDj+5ofS7Nppv3MrEKfVR7OQgMYooJ96t2wD+8FQF5PGyQYIm+BuWM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=lJpay9RO; arc=fail smtp.client-ip=40.107.94.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="lJpay9RO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bcYUQlDWQagC0C71VxJEDg8CyO6dwTejub2/1jZFu/yfmEE6MPRhKPLYWotVpnh+Lojk2nfKWu47aDOg0vtcZci6NSxUjHUzXM+fICYizjYnBuuRksWZplbK6thpPQ6WTfyNaLXJILKqR6CPv0uFwFxC1YMfTX2g6d1e1UImewsPrpOqbpcxIKIkX/ILyTpBYpXyhxctFu6qaT+2u65xNJTFIAOoqevCHyDgYCSQoAIi7yK3Z9KdcMkqhgRIY9FPzDHvWScNy1e1mFTegWbS3nBuKrTmtEfDzttTYQyjpwV1SVQvsN8TPteg553GL79m1xyHIxcyf/5wVgIGoFVFsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Oevsx6VRQR1iRkez0iT6MBubXdmcpIs/siOpkqu1w+c=; b=mrIbKZz49+Pi73INbFWuQZgoMqJ7pLG7xETyjVD3XW2PwhS9UZeXHmGqsNWiCzffsBrk+vldZDMeGroMnOdoJtZkVewxftuGpCT+eJDe5f6GkplgNspJ18TaHnJi1Wm4UJKXKfz+hXZTRH0TtBwxLybws7rsNRMlpndB3PvL9I8vaGY9rhL5D87K/XS+bFlGKXuVAea2e+eCanIW53gmv+NuJ3Z0cm8Yr6H9S4+59DnXeNaYwooOWwOlGHQhLvWJDm9PJ2T1r8mes09e6hv6s5l3bZkFtrDHH1lgRQCwChI/XOtXkHam/ng2STEgpKlNQoKwAZikN3aJ8v/Fje6PuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Oevsx6VRQR1iRkez0iT6MBubXdmcpIs/siOpkqu1w+c=; b=lJpay9RO6epM8t09ZmaiyrWV7BH4efBQekE2rYm6F4E3MAV0EqUIHygE/ID0KtogKA8PtHpq1kzOU2Kk4zChiW1Ku9Bxneuhr76qA5pgR3HRXul30q++3aW6O72ZDi/RDM+HTnPwL+/zbwvMgzBZ7+Z8F828yomXnxGlXIW9mhWa42IUmo9TbBP66/sVciugxNe+iMEpdKcOz1LHKeD4zMEkuUZ4ODE2yvjnmu3j8glaaMDRuerxolJHWmN2UIwr7guq4GHtTw/au1xwzylqKcDe/pKm5YeAa6s5ifa6EvAHi+4jXONeJxAAVcMXx9VHJvEQAhpDDsv7V/f23p3XsA== Received: from BN9PR03CA0605.namprd03.prod.outlook.com (2603:10b6:408:106::10) by DS7PR12MB6190.namprd12.prod.outlook.com (2603:10b6:8:99::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Tue, 26 Mar 2024 17:00:25 +0000 Received: from BN1PEPF0000467F.namprd03.prod.outlook.com (2603:10b6:408:106:cafe::34) by BN9PR03CA0605.outlook.office365.com (2603:10b6:408:106::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Tue, 26 Mar 2024 17:00:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN1PEPF0000467F.mail.protection.outlook.com (10.167.243.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 17:00:24 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 26 Mar 2024 10:00:09 -0700 Received: from localhost.localdomain (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 26 Mar 2024 10:00:03 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Shuah Khan , Nikolay Aleksandrov , Hangbin Liu , Vladimir Oltean , Benjamin Poirier , "Ido Schimmel" , Jiri Pirko , , Petr Machata , Subject: [PATCH net-next 01/14] selftests: net: libs: Change variable fallback syntax Date: Tue, 26 Mar 2024 17:54:28 +0100 Message-ID: <1890ddc58420c2c0d5ba3154c87ecc6d9faf6947.1711464583.git.petrm@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF0000467F:EE_|DS7PR12MB6190:EE_ X-MS-Office365-Filtering-Correlation-Id: fa61be54-bcb7-4ec9-82cb-08dc4db63ab2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /+LlmOMBSgq4QQcxw13GRxbuB4eueXZif0weEUMl3qHljOpMA6cP9mACegAbZuRElPa3DOOiWgMpIIbhMQVzCouzmrRjK0OP4qd9qLFRpuuQ+xwMC4oqT297VKn19snjna3u4j5qSmbaQjEqTN4IpYiU3DCCw2SYq3Ik69apPncrfUp/L4JSHlwAKdOvWmNIsUOkJUebKLs92ac7Apq0G60Guxncf6LzqlRMHCu4u+qKUraFlG0Cy1njKiCWvWFiK85w7bA+OsN4AZGmyG/jVemaQSUnFmx9tfwmBeO6Z76ZabOJCSak9sABrVD4X6OJHkFMN4h5Pqzm0XKbaUvQXYGR462o1/V+djIHJCwPT8RN8N0DDS8hH5ZosJ5HWITJIZZ8p3z5G2cdTO9gAe3su/hLvLPuBN1qn28Tk60Mx2k5SwtfFOtEqb2v2aXw3Apiz5AEInjTa1T10C2CH2P+SV8v9J7nWFEnoF1AvgmlIb6cJ3pXkgeBbQRAEuMgAfhjOtYeDEL40QXz+bhuJ6XsGfqIxHwHvrFUuz1b7qxDkQldfTsADTObWM+X9rP9PZw9E37x0+IJs7+lQt1JxS2CatDL9F/uIn4LeufdtNeeq1ZTXV4RIzh78ByRF3dpC/lV4CYE6O1YQbgIwV5asT/ovK+FDAIUhunuKK0aElbmHWaM+8zPFOjrIW+mTanB73Dj7c8Py2FO2M+q6yy1lWm0D4N/Qh286Ovrp9fXo6NT7UzaU+0xhQIgUSWHtl7mkghB X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(1800799015)(36860700004)(376005)(7416005)(82310400014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 17:00:24.1744 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fa61be54-bcb7-4ec9-82cb-08dc4db63ab2 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF0000467F.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6190 X-Patchwork-Delegate: kuba@kernel.org The current syntax of X=${X:=X} first evaluates the ${X:=Y} expression, which either uses the existing value of $X if there is one, or uses the value of "Y" as a fallback, and assigns it to X. The expression is then replaced with the now-current value of $X. Assigning that value to X once more is meaningless. So avoid the outer X=... bit, and instead express the same idea though the do-nothing ":" built-in as : "${X:=Y}". This also cleans up the block nicely and makes it more readable. Signed-off-by: Petr Machata Reviewed-by: Benjamin Poirier --- tools/testing/selftests/net/forwarding/lib.sh | 48 +++++++++---------- .../selftests/net/forwarding/tc_common.sh | 2 +- tools/testing/selftests/net/lib.sh | 3 +- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index e579c2e0c462..ee48c4603ff0 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -5,30 +5,30 @@ # Defines # Can be overridden by the configuration file. -PING=${PING:=ping} -PING6=${PING6:=ping6} -MZ=${MZ:=mausezahn} -MZ_DELAY=${MZ_DELAY:=0} -ARPING=${ARPING:=arping} -TEAMD=${TEAMD:=teamd} -WAIT_TIME=${WAIT_TIME:=5} -PAUSE_ON_FAIL=${PAUSE_ON_FAIL:=no} -PAUSE_ON_CLEANUP=${PAUSE_ON_CLEANUP:=no} -NETIF_TYPE=${NETIF_TYPE:=veth} -NETIF_CREATE=${NETIF_CREATE:=yes} -MCD=${MCD:=smcrouted} -MC_CLI=${MC_CLI:=smcroutectl} -PING_COUNT=${PING_COUNT:=10} -PING_TIMEOUT=${PING_TIMEOUT:=5} -WAIT_TIMEOUT=${WAIT_TIMEOUT:=20} -INTERFACE_TIMEOUT=${INTERFACE_TIMEOUT:=600} -LOW_AGEING_TIME=${LOW_AGEING_TIME:=1000} -REQUIRE_JQ=${REQUIRE_JQ:=yes} -REQUIRE_MZ=${REQUIRE_MZ:=yes} -REQUIRE_MTOOLS=${REQUIRE_MTOOLS:=no} -STABLE_MAC_ADDRS=${STABLE_MAC_ADDRS:=no} -TCPDUMP_EXTRA_FLAGS=${TCPDUMP_EXTRA_FLAGS:=} -TROUTE6=${TROUTE6:=traceroute6} +: "${PING:=ping}" +: "${PING6:=ping6}" +: "${MZ:=mausezahn}" +: "${MZ_DELAY:=0}" +: "${ARPING:=arping}" +: "${TEAMD:=teamd}" +: "${WAIT_TIME:=5}" +: "${PAUSE_ON_FAIL:=no}" +: "${PAUSE_ON_CLEANUP:=no}" +: "${NETIF_TYPE:=veth}" +: "${NETIF_CREATE:=yes}" +: "${MCD:=smcrouted}" +: "${MC_CLI:=smcroutectl}" +: "${PING_COUNT:=10}" +: "${PING_TIMEOUT:=5}" +: "${WAIT_TIMEOUT:=20}" +: "${INTERFACE_TIMEOUT:=600}" +: "${LOW_AGEING_TIME:=1000}" +: "${REQUIRE_JQ:=yes}" +: "${REQUIRE_MZ:=yes}" +: "${REQUIRE_MTOOLS:=no}" +: "${STABLE_MAC_ADDRS:=no}" +: "${TCPDUMP_EXTRA_FLAGS:=}" +: "${TROUTE6:=traceroute6}" net_forwarding_dir=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")") diff --git a/tools/testing/selftests/net/forwarding/tc_common.sh b/tools/testing/selftests/net/forwarding/tc_common.sh index bce8bb8d2b6f..2e3326edfa9a 100644 --- a/tools/testing/selftests/net/forwarding/tc_common.sh +++ b/tools/testing/selftests/net/forwarding/tc_common.sh @@ -4,7 +4,7 @@ CHECK_TC="yes" # Can be overridden by the configuration file. See lib.sh -TC_HIT_TIMEOUT=${TC_HIT_TIMEOUT:=1000} # ms +: "${TC_HIT_TIMEOUT:=1000}" # ms tc_check_packets() { diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh index f9fe182dfbd4..5b366cc4fc43 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -4,7 +4,8 @@ ############################################################################## # Defines -WAIT_TIMEOUT=${WAIT_TIMEOUT:=20} +: "${WAIT_TIMEOUT:=20}" + BUSYWAIT_TIMEOUT=$((WAIT_TIMEOUT * 1000)) # ms # Kselftest framework requirement - SKIP code is 4. From patchwork Tue Mar 26 16:54:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13604722 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2062.outbound.protection.outlook.com [40.107.100.62]) (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 C8E6E12B169; Tue, 26 Mar 2024 17:00:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472446; cv=fail; b=hDEZMuwfX4e1LRVu6QuhcFbsyCEI+jVtJuYX3RrBApbIgKuuw3rya4aL33w344mzag3oTMZ2HhxsDEgAdDSuEKuyQPSx+b6wSTs7cyq7DH/u9638A2RyII+7XmDoB6kQdX1TTK8HSxGfXho/rCBXwQ3JfzFWq57OJYLSFMMYVVc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472446; c=relaxed/simple; bh=mTPwOqJNG2Ubgo1VbL8KBG94pbeO7Ct69PxV4ztwl3A=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Y7Op97esYH0x1P7G2FM0EpDaaPwigfbEdxsMIlNzJAnj3SNP0sC21DXzNcs8xUuVkY8/zuCm7UzBY4E/py9mUkCxqevgccPFe9acD+W3Z/GRudboiJYjZY4t3RoMM2Tj0cDNzQ20t29U7NEkQg+PjVKWXliN6IPUHKawxJcTo3Q= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=RTWsRCNq; arc=fail smtp.client-ip=40.107.100.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="RTWsRCNq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D5bsmHI9w17xj3i1Edcph4JQal+K/u5Ih5PdaXwxnjGivS4QzV3XqVq6EIkDGECz7Dohpo/wre2arEDPVzLLPssgKa1DZSHJjkzswJodgGYYMrkLZzQw1ycErW8wmabRYWK395Ckrue7+8Mt6z0NEvcwM8P3fmDWpB0Jim4fJ7iO0kYZjvxcSHYC6GFwXpfNvxVVm6WVUCk1H1+6kAaivliJmaTH+X3z9L5Hk4sR+mROO0Wz4hRXIXvuK2Sh67bN4zqkuiY/gySySXeGwqd8KBYc8ChWg5GmxRHJgdUtXRVHuRoHThvCMC65RbfEHJdmALR8G2YyX5WxwDd6JMKspQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=e2xhSPmedJ8u8jI4x4AuYT4tsV3hpK7epS01tm6pQDc=; b=fnNw7MgWdYWm4FCeBqXA1bBi9K49OJiTOgf1APIVI31pUtYsKlMg+O31qxiU1fklf1NTgcVNE6i78AV+W9NXxNGPJMvU4tIJBuEcW3EpoRP9q75Ao32vpB5sbj6D+ZxYmswZ7KZtNN3YsdNg1g8WS0FlvatWwCmhPMMzLo1HRG0ucULxoutMJINl/LiIVbsXPsXFBzTsepf4OUWa5U7qZZ3Dj4TAm3sqvODMDeDF3NWky4xDWyHqMQaf6McNrZNVeIz3Wd8who0/CI6+9bbZryFngJVIvollu/O+MMEFiyS/VXi00R1pmihUXaGN6gDmAoSyU+ava/QkvyC6yuO98w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e2xhSPmedJ8u8jI4x4AuYT4tsV3hpK7epS01tm6pQDc=; b=RTWsRCNqJzkYwMU1KZvNPZKLweTYH/SpBX/hIDaQ5n1jxZbkpRr7icEuu6DWIdBPnRMH0mcV4BOSV76RE76SYfNVzan816t4kNmeAveWoCOevSCTaCp6A3ypMovgiTmS079MUshbFqwiKHhyb2c5qyLVBS9AW60LVcWr72IhHQt1SG1UiEEh7bhgNh5QlX3iNoVC7USEPPKGc33Yy3ubufhUuJdRIfVZlVcfSbo0Dj/9KHEc0HHjjLldJYUth4ZW6pGaXIABzj7ae1niGldKvcGaCt9sdZ9gnFXW18hkzYjYavngQjzuja3O3iIiscex9mtTNx2Es3hkEeSyBCr0/A== Received: from BN0PR04CA0114.namprd04.prod.outlook.com (2603:10b6:408:ec::29) by SA3PR12MB8046.namprd12.prod.outlook.com (2603:10b6:806:304::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.32; Tue, 26 Mar 2024 17:00:40 +0000 Received: from BN1PEPF00004680.namprd03.prod.outlook.com (2603:10b6:408:ec:cafe::b) by BN0PR04CA0114.outlook.office365.com (2603:10b6:408:ec::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Tue, 26 Mar 2024 17:00:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN1PEPF00004680.mail.protection.outlook.com (10.167.243.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 17:00:39 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 26 Mar 2024 10:00:16 -0700 Received: from localhost.localdomain (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 26 Mar 2024 10:00:09 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Shuah Khan , Nikolay Aleksandrov , Hangbin Liu , Vladimir Oltean , Benjamin Poirier , "Ido Schimmel" , Jiri Pirko , , Petr Machata , Subject: [PATCH net-next 02/14] selftests: forwarding.config.sample: Move overrides to lib.sh Date: Tue, 26 Mar 2024 17:54:29 +0100 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004680:EE_|SA3PR12MB8046:EE_ X-MS-Office365-Filtering-Correlation-Id: 005d341a-93df-4540-4101-08dc4db643de X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YcPtb7cPQ5i6iFLmLu5gS/11xCGyYxR/VpcYAG/TANzMi2IRaosu3dE6zs0kC+UYq46S/lV6giUoQZOyTwB3xa0I2y6J1JO54jHKBupZFtCwpjfFY4ijfJ5WAE6+sQIeEl3SxdYknhIO94zB4GG1dkSmiUcV6n2NcB/f5C7jz5PAxgZbGHE0qQiVro9YyURw/2p+izW712wOrYulSxiF1IlqOPYtf9U5cobu8slJ4U7tyW17P87As3tqfIbC5ILtcBAJaCf7LbFuzXjZIH6s+yT8Jz+/au9h6QmgSEkQRx1teT0tKwSaG69nv7GGx1ZgaX6oZBm9xo8CH6z1aYZ/dwyiE691Gopzi92xcpBs/VCtgnTDojTLWoCbXcDP7aTrbLyn+ma/yMYGrGmjQJ0K6BtGiGjwzkhqGUl22Yp38KxB4/DReBEKcPulF9saUlK8tXvTXS3mOFRiHOmDU7kjw/xd5GHDGyhk2mfqjGmxjFN9hIv1p3SyOGpWFVA0//qb73/CujWoAwjsZBEt/L1NzD9YTqc6I/udm3vwffcBc+uz1d/mNrw0BMAEwvXsrvnkuCVuQ4jyZcK6btQ4RqQyPAoVQnlbIwEZlPXHuzjBU2zNm8Lw48PIHUvrwFYByjaoHIJLI1mHzqjukPMC1gx2GNEJapcyFjxfXJnnuV2S269532hF9z38AQoM0hiZZEDufu/dQ3DZqayzpu2Ok1+fwpE/QYi6b1AglY5MWRjQyB9iU95XPa6AXojI0EkBJTpM X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(1800799015)(7416005)(36860700004)(82310400014)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 17:00:39.5918 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 005d341a-93df-4540-4101-08dc4db643de X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00004680.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8046 X-Patchwork-Delegate: kuba@kernel.org forwarding.config.sample, net/lib.sh and net/forwarding/lib.sh contain definitions and redefinitions of some of the same variables. The overlap between net/forwarding/lib.sh and forwarding.config.sample is especially large. This duplication is a potential source of confusion and problems. It would be overall less error prone if each variable were defined in one place only. In this patch set, that place is the library itself. Therefore move all comments from forwarding.config.sample to net/forwarding/lib.sh. Move over also a definition of TC_FLAG, which was missing from lib.sh entirely. Additionally, add to lib.sh a default definition of the topology variables. The logic behind this is that forgetting to specify forwarding.config was a frequent source of frustration for the selftest users. But really, most of the time the default veth based topology is just fine. We considered just sourcing forwarding.config.sample instead if forwarding.config is not available, but this is a cleaner solution. That means the syntax of the forwarding.config.sample override has to change to an array assignment, so that the whole variable is overwritten, not just individual keys, which could leave the value of some keys unchanged. Do the same in lib.sh for any cut'n'pasters out there. The config file is then given a sort of carte blanche to redefine whatever variables it sees fit from the libraries. This is described in a comment in the file. Only a handful of variables are left behind, to illustrate the customization. The fact that the variables are now missing from forwarding.config.sample, and therefore would miss from forwarding.config derived from that file as well, should not change anything. This is just the sample file. Users that keep their own forwarding.config would retain it as before. The only observable change is introduction of TC_FLAG to lib.sh, because now the filters would not be attempted to install to HW datapath. For veth pairs this does not change anything. For HW deployments, users presumably have forwarding.config with this value overridden. Signed-off-by: Petr Machata Reviewed-by: Benjamin Poirier --- .../net/forwarding/forwarding.config.sample | 53 ++++---------- tools/testing/selftests/net/forwarding/lib.sh | 69 ++++++++++++++++--- 2 files changed, 74 insertions(+), 48 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/forwarding.config.sample b/tools/testing/selftests/net/forwarding/forwarding.config.sample index 1fc4f0242fc5..f1ca95e79a65 100644 --- a/tools/testing/selftests/net/forwarding/forwarding.config.sample +++ b/tools/testing/selftests/net/forwarding/forwarding.config.sample @@ -3,51 +3,28 @@ ############################################################################## # Topology description. p1 looped back to p2, p3 to p4 and so on. -declare -A NETIFS -NETIFS[p1]=veth0 -NETIFS[p2]=veth1 -NETIFS[p3]=veth2 -NETIFS[p4]=veth3 -NETIFS[p5]=veth4 -NETIFS[p6]=veth5 -NETIFS[p7]=veth6 -NETIFS[p8]=veth7 -NETIFS[p9]=veth8 -NETIFS[p10]=veth9 +NETIFS=( + [p1]=veth0 + [p2]=veth1 + [p3]=veth2 + [p4]=veth3 + [p5]=veth4 + [p6]=veth5 + [p7]=veth6 + [p8]=veth7 + [p9]=veth8 + [p10]=veth9 +) # Port that does not have a cable connected. NETIF_NO_CABLE=eth8 ############################################################################## -# Defines +# In addition to the topology-related variables, it is also possible to override +# in this file other variables that net/lib.sh, net/forwarding/lib.sh or other +# libraries or selftests use. E.g.: -# IPv4 ping utility name -PING=ping -# IPv6 ping utility name. Some distributions use 'ping' for IPv6. PING6=ping6 -# Packet generator. Some distributions use 'mz'. MZ=mausezahn -# mausezahn delay between transmissions in microseconds. -MZ_DELAY=0 -# Time to wait after interfaces participating in the test are all UP WAIT_TIME=5 -# Whether to pause on failure or not. -PAUSE_ON_FAIL=no -# Whether to pause on cleanup or not. -PAUSE_ON_CLEANUP=no -# Type of network interface to create -NETIF_TYPE=veth -# Whether to create virtual interfaces (veth) or not -NETIF_CREATE=yes -# Timeout (in seconds) before ping exits regardless of how many packets have -# been sent or received -PING_TIMEOUT=5 -# Minimum ageing_time (in centiseconds) supported by hardware -LOW_AGEING_TIME=1000 -# Flag for tc match, supposed to be skip_sw/skip_hw which means do not process -# filter by software/hardware -TC_FLAG=skip_hw -# IPv6 traceroute utility name. -TROUTE6=traceroute6 - diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index ee48c4603ff0..dbd4348f85b8 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -1,34 +1,83 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 +############################################################################## +# Topology description. p1 looped back to p2, p3 to p4 and so on. + +declare -A NETIFS=( + [p1]=veth0 + [p2]=veth1 + [p3]=veth2 + [p4]=veth3 + [p5]=veth4 + [p6]=veth5 + [p7]=veth6 + [p8]=veth7 + [p9]=veth8 + [p10]=veth9 +) + +# Port that does not have a cable connected. +: "${NETIF_NO_CABLE:=eth8}" + ############################################################################## # Defines -# Can be overridden by the configuration file. +# Networking utilities. : "${PING:=ping}" -: "${PING6:=ping6}" -: "${MZ:=mausezahn}" -: "${MZ_DELAY:=0}" +: "${PING6:=ping6}" # Some distros just use ping. : "${ARPING:=arping}" +: "${TROUTE6:=traceroute6}" + +# Packet generator. +: "${MZ:=mausezahn}" # Some distributions use 'mz'. +: "${MZ_DELAY:=0}" + +# Host configuration tools. : "${TEAMD:=teamd}" +: "${MCD:=smcrouted}" +: "${MC_CLI:=smcroutectl}" + +# Constants for netdevice bring-up: +# Default time in seconds to wait for an interface to come up before giving up +# and bailing out. Used during initial setup. +: "${INTERFACE_TIMEOUT:=600}" +# Like INTERFACE_TIMEOUT, but default for ad-hoc waiting in testing scripts. +: "${WAIT_TIMEOUT:=20}" +# Time to wait after interfaces participating in the test are all UP. : "${WAIT_TIME:=5}" + +# Whether to pause on, respectively, after a failure and before cleanup. : "${PAUSE_ON_FAIL:=no}" : "${PAUSE_ON_CLEANUP:=no}" -: "${NETIF_TYPE:=veth}" + +# Whether to create virtual interfaces, and what netdevice type they should be. : "${NETIF_CREATE:=yes}" -: "${MCD:=smcrouted}" -: "${MC_CLI:=smcroutectl}" +: "${NETIF_TYPE:=veth}" + +# Constants for ping tests: +# How many packets should be sent. : "${PING_COUNT:=10}" +# Timeout (in seconds) before ping exits regardless of how many packets have +# been sent or received : "${PING_TIMEOUT:=5}" -: "${WAIT_TIMEOUT:=20}" -: "${INTERFACE_TIMEOUT:=600}" + +# Minimum ageing_time (in centiseconds) supported by hardware : "${LOW_AGEING_TIME:=1000}" + +# Whether to check for availability of certain tools. : "${REQUIRE_JQ:=yes}" : "${REQUIRE_MZ:=yes}" : "${REQUIRE_MTOOLS:=no}" + +# Whether to override MAC addresses on interfaces participating in the test. : "${STABLE_MAC_ADDRS:=no}" + +# Flags for tcpdump : "${TCPDUMP_EXTRA_FLAGS:=}" -: "${TROUTE6:=traceroute6}" + +# Flags for TC filters. +: "${TC_FLAG:=skip_hw}" net_forwarding_dir=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")") From patchwork Tue Mar 26 16:54:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13604723 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2058.outbound.protection.outlook.com [40.107.94.58]) (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 19A6B13D63F; Tue, 26 Mar 2024 17:01:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472464; cv=fail; b=eKfrGEq5ckZrxvulJpwsGcj3jhUmADfHJJgPec7IhRjex/qBmykTxLPOfXDutNgQhV53VAz0cMUi3IueIcnT27qxWGVwIzSRbkvmDEkdjE8jE+TyBekPgFBuhtw7ofXNg4HCGZfZmcbPNWUYOhphdToAqQ3olN0A3nT6FXXg8Qo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472464; c=relaxed/simple; bh=uywpYYN0x0iP/lSNbJlCJe574vl43rsJel1ltb+my3k=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tZZk/3uDOxsP47wplWRE3NpWZ4rSJ2Nv1sM7arYHWLHjaSOc5yffOHviAH72/pbth/bwPYTZDY39ekk6DphiTduLJpb1if3QnJPoac7l7ZnWHyVB8tm5eJhI438VtO19DLgQbJS6DGsqcvvPRpOvBiM5kFN3d2rGwwqGfM/u1Kc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=OjLaLQ98; arc=fail smtp.client-ip=40.107.94.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="OjLaLQ98" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jc8/fGMBy7BYl5ZbUykq2ycEhPZ8rkc16fE4vuIG+Cp5zQdVb+YMa1Va9wIk4+qClFrj5g8P+UdFA72VBLa+n1skSkQEhE4XxpNIwoUjx8AWFiZVTIB1FL9whBx7ukljDktvydSeDkFu/YSvSpuA+n9TH8D7gH/4WslCwsH0uHLFJ/fmlRT/+ZIDKS7wNi5uCcwshmj/7XwHIh0V3lp+BO2kLetys4pxgtTOXA9GHAi/ZkyaCz7dYX9UGhMmUXNBhhAzUQP0cVVEJcF13wuWtPS8whkdpdXasfzk44jpXLhFp8Bdlp5mNR3rcInhqSaJ9nyE64kGCj8QLyUNpnJYOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R/26YhJhoq8oquNMJnrPirMlKkhfMwfNCKw0NnHLDcY=; b=NED2glLbhFI4unU53ZIg0GsPMV68W9iGVo/8kjc9fjMC0Ce5l9shV+zxlYvm7awHShc22GN1Jr71tD3B3m5AczuWSMcnQ8G8CN0tkG1L07N8KBYw+6TLL5B5u70zCja6UC+8L71l+IPO/PZK0iqVs98yzlAH9oZqMSV1W7J7GrROOTvt1x4D5Y/p/uMv3csA0sCd0jBI6vPiVl3c/myH+ql8KCYgwtraGpg/V2fPKAlw9LwTZtl3jmT3Rv9xlgR0GIkqXQHBX0W0oPgCLOljYT4xIZ1X48eWZFcySeUZcsCpnfQlaQTTp6axIdpjB+Skv1zrKEwViaEvpK0cU+eHIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R/26YhJhoq8oquNMJnrPirMlKkhfMwfNCKw0NnHLDcY=; b=OjLaLQ98AhqvKxhSNxXFGCHPx3g/taR3ojHwHOa348E3qt9b10/jcRW0Gtlh+VUO04FOSB/LpdwCkOfsaHySENEbyJC/Pg4KDcUxDY5jQMC2czeldtM4lTm3dtCN6Q/nOAKGrsb5VLDfDlWajM49IISSij9HI5TbamnidcYNnDf19gk6LSJ8Ny8+K/qLw7RPeOuopVCQr2AuBxzShyHwpsuHOO91LhGljWiJhP/Y3o1jJMfSoqx1CAXEWD1Ie9D2A18SxijVT0KQ+/ZZnklgMyYp26mVer5PYSRGFRfgfUp+0sz7MmFEWhd78k7CzFIaau7TyvqFajEijCT/Iz0BkQ== Received: from BN9PR03CA0281.namprd03.prod.outlook.com (2603:10b6:408:f5::16) by PH8PR12MB7376.namprd12.prod.outlook.com (2603:10b6:510:214::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.32; Tue, 26 Mar 2024 17:00:55 +0000 Received: from BN1PEPF00004681.namprd03.prod.outlook.com (2603:10b6:408:f5:cafe::a7) by BN9PR03CA0281.outlook.office365.com (2603:10b6:408:f5::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Tue, 26 Mar 2024 17:00:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN1PEPF00004681.mail.protection.outlook.com (10.167.243.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 17:00:54 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 26 Mar 2024 10:00:22 -0700 Received: from localhost.localdomain (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 26 Mar 2024 10:00:16 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Shuah Khan , Nikolay Aleksandrov , Hangbin Liu , Vladimir Oltean , Benjamin Poirier , "Ido Schimmel" , Jiri Pirko , , Petr Machata , Subject: [PATCH net-next 03/14] selftests: forwarding: README: Document customization Date: Tue, 26 Mar 2024 17:54:30 +0100 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004681:EE_|PH8PR12MB7376:EE_ X-MS-Office365-Filtering-Correlation-Id: fe26dd51-97d5-4211-ffb9-08dc4db64cb3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n7GxrDBR3gAfLEZNzrVRabWrl2Jfys9S39PJX+54tTmPqfs98fbacBf7CYtjJJtcY0DInq5E2MAm1eMat/Z8+mMZAEbx5D4LISaGDNvUXqe1rPbioFuhXhIvnjt3UUs3OFAUEN2AD3Vs1yh6nKa7z2edSg2wFJA3RuN6Vk05dMyjdYgoj1Z+9+GFr5oEIMTk3e/4s/VsqwO7o2hkZ/BSmwXsHMg6RmUQ+UEt2yGvN2y0kSj2Okzt4Trhg9LRLkX+5xtNAQ1Xe+7q8imlNyXqMGSlJpyFy3nhNu7BkBlIrSglv4kUNj08WE+j5Z/pzY0cyX2WdQmUUxPxLLTcW+Q8oL5MS7UihqTe+5+tm2ysfBXbm0x0SCFnB2037t0u0WqPvWo8Gbdh/7qEAA/NQdEzNlj97rZwMUof/fSYl6sIFG/hwZpkKitrCI6+ESMjal4Kt02JHHH3KSLJYVAUE3hKnKuRMkHiTcFkts50X5tMF8ZWwr0UHNYjXqMeIkIMiaKopVdNIGvo9qgKrQoBzMNAxkhENzpRwCDdgwG9rZWHO+X9gX2ZmvoYVzx/vMMaIe/R7J5CB9KDLttwg66N0obcD/h9ceEwEhyk594jyOO0SOeaWnjjA2hrMIn2fom8r52M4ja0nyN3Na7QNQos8xCBkeh8tI+66jO4nrqTDvhwnCVJ5pTrtsUGyxLHgeDCyZl+e23a+Kj9YVgESZv0/AVk33bP88S9JK2NmPghx2+KYf32csHM3w5hssm6/DVQMjg7 X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(36860700004)(82310400014)(376005)(7416005)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 17:00:54.3987 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fe26dd51-97d5-4211-ffb9-08dc4db64cb3 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00004681.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7376 X-Patchwork-Delegate: kuba@kernel.org That any sort of customization is possible at all, let alone how it should be done, is currently not at all clear. Document the whats and hows in README. Signed-off-by: Petr Machata Reviewed-by: Benjamin Poirier --- tools/testing/selftests/net/forwarding/README | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tools/testing/selftests/net/forwarding/README b/tools/testing/selftests/net/forwarding/README index b8a2af8fcfb7..7fdb6a9ca543 100644 --- a/tools/testing/selftests/net/forwarding/README +++ b/tools/testing/selftests/net/forwarding/README @@ -56,3 +56,36 @@ o Checks shall be added to lib.sh for any external dependencies. o Code shall be checked using ShellCheck [1] prior to submission. 1. https://www.shellcheck.net/ + +Customization +============= + +The forwarding selftests framework uses a number of variables that +influence its behavior and tools it invokes, and how it invokes them, in +various ways. A number of these variables can be overridden. The way these +overridable variables are specified is typically one of the following two +syntaxes: + + : "${VARIABLE:=default_value}" + VARIABLE=${VARIABLE:=default_value} + +Any of these variables can be overridden. Notably net/forwarding/lib.sh and +net/lib.sh contain a number of overridable variables. + +One way of overriding these variables is through the environment: + + PAUSE_ON_FAIL=yes ./some_test.sh + +The variable NETIFS is special. Since it is an array variable, there is no +way to pass it through the environment. Its value can instead be given as +consecutive arguments to the selftest: + + ./some_test.sh swp{1..8} + +A way to customize variables in a persistent fashion is to create a file +named forwarding.config in this directory. lib.sh sources the file if +present, so it can contain any shell code. Typically it will contain +assignments of variables whose value should be overridden. + +forwarding.config.sample is available in the directory as an example of +how forwarding.config might look. From patchwork Tue Mar 26 16:54:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13604724 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2069.outbound.protection.outlook.com [40.107.237.69]) (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 EDA1213D2BA; Tue, 26 Mar 2024 17:01:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472464; cv=fail; b=UkvYlHDHXmYOfgkjqwl3mKMmN773F58lsipnYGKLeDY1J93kAIwsu6b0MoBrLTIEUONdJ59Aia/Fo5+Aifo9kefRixLLC+OrDqGqRCSsomHhOvbMZCrctbQAbqX30uXqu1N1UD5J+bH7Ej6w2IDRSNrtuX3LhTTQ09vrWVLVEz0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472464; c=relaxed/simple; bh=U6IDXaxfmqSNGryMzeBJlZXsnDiUp5VBG59deIGI2Mg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CC2tnbZCgkwAfPySMEv+zpC+iHCO0GZ0ZMB4lKFcogHgLg7I6n+F4oA3R+8ZaX0NdNzxTwTon3xH0//FD9o9P40EQBwXPbRhxy0aTQmJsEwZJ4KIgzbDVqHS/QH29/YF3pMUpxtoiiESBJZngSUcmXlV/x5p23BQ2YwcxMWLCyE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=pHvKjGkb; arc=fail smtp.client-ip=40.107.237.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="pHvKjGkb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T5mx4JInploP4RO8DKattI9aQw0W8BkidXLPmQMNQBSQyrMUH0PKA6yhqTbaqDylsX63sT2N4PUY/VJnZrUEsPA2UxqYULuuKxLDCYXWZnZ38o2UBfe4wWVh4OBWt089uaCAM5kOrfc4u+IvqyidteL8v8ib3XB33IEAF5Ro0kYxiSuU3mfPharKlk2guKt+fmS10IlwxNwinshWup98shgwLXTeSo6e3/26D5Jthd4HTP6TE9yan1OHYICM2gJq+27b+hDm1iG413WQDYZB2gAM/DprYP0SvVprrIdYBOs6FMWjqHFKjVFvwxGw3AkGj1HlmnvAGIN15sQt3eNHow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eZbHvSGkaPZIc+jXFrBUJrlxuSi9YeZoD9csuGvfi0w=; b=CXMqE4hkisQ3T2ebyMCjT6XWQ24xIo3F7jcHk2O50YcQ4QCmH7dumz13eP5qM4FOURlk7jSszGJ6ffBecV4n66bh4DyVayYUCytaI04ugndllZcdqisIecO6jFqixwksBnCnWvbTANw70qCqsVt8g+LmQQJtim5dXUsydNyqBiHUV06Sl8h43RDp2BsEllBCBZXceK30Vas3nCRG+KLdLo7uiMalV1GYm2snPOnj6xJNikmSMi/rXTYcuxPTTWm+xEaVCsUPWziYmQtvkV97METdO938CEn9VjuxIo2AVqAyWcYio3Mo6FiEpGBPk+yyoYSxY0Cm8QDmE8I5KeDOGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eZbHvSGkaPZIc+jXFrBUJrlxuSi9YeZoD9csuGvfi0w=; b=pHvKjGkbIq0RxPt7xJ9PJSGfy/CQAQ4f22oEmU8Ou13e+I6UUdORN9398zA26IlYg+Ng05+n9/TBnoqgeuW//KuHxXb05rVy4iamPsNLlS20slos/aLuw/COR378jj1otSMIv42qp5qURzRQZJ6+b9opn3i7e7sml2f4i3aKRS9RaL8Dg6QxD/LOlHhqKRvwNKL5U/jhlTmDnuA0cXw6JVFevUxS74k6EnahbI2V9rnjPM1xKdy+V5kM87jU8iQKjWiFpTAI+FF2uEY7YdMpeNG7/8VOR9uCNf6VYnsmF8UpQtZfG1UsE469RzUbp7PKk/CXv/IOcAXtST32QYRadA== Received: from CH2PR16CA0020.namprd16.prod.outlook.com (2603:10b6:610:50::30) by SJ0PR12MB6709.namprd12.prod.outlook.com (2603:10b6:a03:44a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Tue, 26 Mar 2024 17:00:56 +0000 Received: from CH3PEPF00000010.namprd04.prod.outlook.com (2603:10b6:610:50:cafe::55) by CH2PR16CA0020.outlook.office365.com (2603:10b6:610:50::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36 via Frontend Transport; Tue, 26 Mar 2024 17:00:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CH3PEPF00000010.mail.protection.outlook.com (10.167.244.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 17:00:55 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 26 Mar 2024 10:00:28 -0700 Received: from localhost.localdomain (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 26 Mar 2024 10:00:22 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Shuah Khan , Nikolay Aleksandrov , Hangbin Liu , Vladimir Oltean , Benjamin Poirier , "Ido Schimmel" , Jiri Pirko , , Petr Machata , Subject: [PATCH net-next 04/14] selftests: forwarding: ipip_lib: Do not import lib.sh Date: Tue, 26 Mar 2024 17:54:31 +0100 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000010:EE_|SJ0PR12MB6709:EE_ X-MS-Office365-Filtering-Correlation-Id: 5fdc6959-a48d-4b95-546d-08dc4db64d35 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dpqTmtCbjazW6inoJ1ItaoUFHejatWhaseijWDbwRb0LCF/Y1EM7R+QiYDzAECudeBzV4OqPFDtfqf1JYXvIpYLJjasm3NcU+yFR6lrWQ2dczM+zDsed1EfhZgqC6RMcd6rLXEOcfb84bq3FrlcdFRysuasq5i4xQQWjLiCJAYg7mnUocrEJ2oifwgqCV5t/Esr3S+FfkVG/3qi16EE7D9dMNoq2Qv1sDAKUVBrqf36XWe+HNaTNS1II1KABwJkcY3WA3m7NdnTe9NRojvV6GhhXytY949XLRfAVmWT9LrTg59ox8LU4hnSDabhAqooN0NXy5IRJwgW3P4yfw/mmHs/U+6hSWlSMwB3pr2M1Q/lmrF6lS5My1D+SOAsueW5Hbxa2E/AYTFbAj3l+mn0QmigPR5LzNel+dsfxJzjoOtlrSzXum/D1oH2VAME7NX+BHW0BXnE+7mrXbkVjQod7+CvU3siDsZGZeXcYfMYXbjfLFY0eQFTYKcNYw3Kp6q/Iz0gucZGG5H7nk6wzst4dRXqkpytmDuXZEPNAglQQOp5l4TyzUL0704TEYTFWH/yh+B38QDzgjycb68y4xiUVRwFqzNPJQlomFG73Ih5Oqwy17TToSkQ/n7cdo7VqWT8ExXgp8kcC+SnNO+aehDXKV/BglNACKXKFBGnS8aa+/5Tr/kkfeBO0xUPTAHTOy1ZS4o8ptiPwm2EL1c8O7hsnsSZ7pTAq7ufXEZzQW5t8JqWPO/BAPqMjBcPD0Qwem4yL X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(7416005)(376005)(82310400014)(36860700004)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 17:00:55.2932 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5fdc6959-a48d-4b95-546d-08dc4db64d35 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH3PEPF00000010.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6709 X-Patchwork-Delegate: kuba@kernel.org This library is always sourced in the context where lib.sh has already been sourced as well. Therefore drop the explicit sourcing and expect the client to already have done it. This will simplify moving some of the clients to a different directory. Signed-off-by: Petr Machata --- tools/testing/selftests/net/forwarding/ipip_lib.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/ipip_lib.sh b/tools/testing/selftests/net/forwarding/ipip_lib.sh index 30f36a57bae6..01e62c4ac94d 100644 --- a/tools/testing/selftests/net/forwarding/ipip_lib.sh +++ b/tools/testing/selftests/net/forwarding/ipip_lib.sh @@ -141,7 +141,6 @@ # | $h2 + | # | 192.0.2.18/28 | # +---------------------------+ -source lib.sh h1_create() { From patchwork Tue Mar 26 16:54:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13604725 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2087.outbound.protection.outlook.com [40.107.93.87]) (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 8F9BC12BF04; Tue, 26 Mar 2024 17:01:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472473; cv=fail; b=iXrwv8/cAI1yaM0PyUw7wWANdNIbnBeM3cw7v/jCaRPox81zs2rp0vHPKsrfIkC35ONR+XQWCrcU1spWqrB3jO/+Iy/viBOSz0yCUanCY+L/9eX0gpLGeSjjQjtxQzcPEyt8FqOEMjHgRctetvX52F4CdZEBhZtHw+AD21xa3Oc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472473; c=relaxed/simple; bh=eD6MQvEub5I3N8qgmWskGamI76El+pptE4/SO3GYmAc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XGw/ARqVQu6LpVSAKw9Ie6cyuUuk2ITimKGJIvGWaOtNRbP6Rb2LJIKdVQZLjfkADSppfnXpJRLzFdk09WKzwAuXogLaWQ6DMwiZKIdr4MS0ybVMpglBYgPoIl1eeYEjJ1oPnSEVofWO7XDE2kyHEnZLsXNSfEGFBDjG2kltmC4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=FGUoHAQx; arc=fail smtp.client-ip=40.107.93.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="FGUoHAQx" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GFNHG9gmMsTh+9x+RpnJP7esIgmq2KhuzJal0BXNrWmk1EJog9oHFnkC2KVqltU1NUqbpMGvSk7V4FAGbV/qfhYhO/keNoOE5B6gcMlCmMJtZXn0NMb3Eyp5V0qoDV2hkqHpAgF2c4OCJuYOp1z9llweIUfYN8pkzlRid4XxlgY63why1pXJYWyAO5yvS2NT6dju0n7gBSfL2cRgIMCbXGugG18FkipQiulA2pvcjcKYLLaZo3JLCVHeoDULk94mhDK6mCwyakkaLlpML+3t9ev9MddGHFFT0c4o3bETnbTw2s/BJivVUWrizF/JJBef+Iox5eGBt11Df0P6oeIepg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Vm4AEV0COAMI/J5B99PfrbdjczRcNJUhS3S7M0nKwEk=; b=QG/8DjoyZjYoJm86lG4n9NTUzdPe02sKBwpXo6eXUs5/SnM9WGI5lWjv9jzlzYPP5q9YKEsvRs1OxZrlfkLdy+gImMtWTPUpGzf9owiedKPEpQWGwtyygOm9T2UQsylHW+ridy/1U39RS6ef+QW25kFbfkIlkoUgFYbzq1BA57vmsRvZ+gPDGerG3JvTGmYB6vLl3GsQMSu7hTsQqyas2u0FEjAjNHqk5X++L7MpxmntmGgwXfZ+RTvtqV1/ayixwoZlfpA09gkhQx4GgEuzCzEmwDTmb3k77btok+8CQgxHfeFWhkJDRoWNb0cfRPP2EguGOb+Ug9UdOM9OI/nv4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Vm4AEV0COAMI/J5B99PfrbdjczRcNJUhS3S7M0nKwEk=; b=FGUoHAQxjl7s39sbaBOaiatgYuLpxix66Gfv0aSk3jOYVkCaddtDoeQr2ifrPG56qpemArVKUEcf4SF4dBC/18xoP4WqEuMqqkPKIbIpIplubMmDcddFkE90oh0RUY57nSmL3ZYPVVe4pPn24NWnfhreBRivzCbrt9SKvoQi2GDYdg1LX3gdPkQje0sKUtQpxFMSqA0iwwV7xvAWPSSn1XlH4VUs5XlME7J4jPkWGbGYqzE4rYOOXRcNu/gHx6Ine4asf1jFHnYPIQyvNaUxO7BSDIQBJrQUmwwETVqC7p5tIRXCqZ0tEZyzRnDJg4UBDiOCTeE3W8VQySQyGzGlYQ== Received: from CH2PR16CA0025.namprd16.prod.outlook.com (2603:10b6:610:50::35) by IA1PR12MB8334.namprd12.prod.outlook.com (2603:10b6:208:3ff::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Tue, 26 Mar 2024 17:01:02 +0000 Received: from CH3PEPF00000010.namprd04.prod.outlook.com (2603:10b6:610:50:cafe::cd) by CH2PR16CA0025.outlook.office365.com (2603:10b6:610:50::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36 via Frontend Transport; Tue, 26 Mar 2024 17:01:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CH3PEPF00000010.mail.protection.outlook.com (10.167.244.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 17:01:01 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 26 Mar 2024 10:00:35 -0700 Received: from localhost.localdomain (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 26 Mar 2024 10:00:28 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Shuah Khan , Nikolay Aleksandrov , Hangbin Liu , Vladimir Oltean , Benjamin Poirier , "Ido Schimmel" , Jiri Pirko , , Petr Machata , , Roger Quadros , Tobias Waldekranz , Danielle Ratson , "Davide Caratti" , Johannes Nixdorf Subject: [PATCH net-next 05/14] selftests: forwarding: Move several selftests Date: Tue, 26 Mar 2024 17:54:32 +0100 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000010:EE_|IA1PR12MB8334:EE_ X-MS-Office365-Filtering-Correlation-Id: d8e7b03f-a773-40a5-5e11-08dc4db6512f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iGc3kWxOST7S5/pUve71G+5dWB3m5M+fcX7PyYyLoZdL7Aww//0rj/lZAIRWhzCfS6P/foenygAKnfyEXf7jYdh1ZZLH3ikRk0gBhcODbcJw3NvLrcDxyulOCX68yGQttquTPpjcVZDwWqnKbKzAh3L1MjbDy+o3mHyrlWQzq8qxT2mA/YRig2EcOiCQq4MjHVTFB118ndm7hWe7GsTKCFfmGw+rLLdwpUJ6MsbDVXBytmcte/QIWLlinjfGIh3upAIzeJFE5FQ5AWG4Al2/wOGEGBw9kKDRQDxpLLsul2/+bOZNWiLYgpmjIkmYxW78cfEMc828R+7f2277dhM2STp8CfpkwCt7cplh5mjXLev/sV6ZWzSiFyDbNrgIBj5OxhIa6t+1sgUSBClOyhGYyu1aYTx4Un/aOS4SAI4192UOM1RVSm3I/fyWGlq6dY5uDHca2eFhZUsOIgmLjb+/KhrPa/5cflNYVfBJFZGhBKXMqNfG/kp8aAB5X1/3bjo0tLnvxYE95urnKYaWHVYbdWktm/oByjWbiBGkywiJ2UrYr96SbVds+zMAqy5WoEimowjDUZT6PJSJvluMOqlg/SdZ727YL0itXh78lzGwrn3gcDrykhAUNbEX8KrFwTMn5deJbbU8m+jte09eqqbsin/rQ+IvyoHbxgAk6wfC5RaCtREGmEmG2b1Iiy5wwQdzT0E+/xsmfS2AvTIZrxPj471NS7vmj3bYHdpODgkXN1aXoBDX9oAgCyWMu67rm1ab X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(7416005)(1800799015)(36860700004)(376005)(82310400014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 17:01:01.9650 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d8e7b03f-a773-40a5-5e11-08dc4db6512f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH3PEPF00000010.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8334 X-Patchwork-Delegate: kuba@kernel.org The tests in net/forwarding are generally expected to be HW-independent. There are however several tests that, while not depending on any HW in particular, nevertheless depend on being used on HW interfaces. Placing these selftests to net/forwarding is confusing, because the selftest will just report it can't be run on veth pairs. At the same time, placing them to a particular driver's selftests subdirectory would be wrong. Instead, add a new directory, drivers/net/hw, where these generic but HW independent selftests should be placed. Move over several such tests including one helper library. Since typically these tests will not be expected to run, omit the directory drivers/net/hw from the TARGETS list in selftests/Makefile. Retain a Makefile in the new directory itself, so that a user can make -C into that directory and act on those tests explicitly. Cc: Roger Quadros Cc: Tobias Waldekranz Cc: Danielle Ratson Cc: Davide Caratti Cc: Johannes Nixdorf Suggested-by: Jakub Kicinski Signed-off-by: Petr Machata --- .../testing/selftests/drivers/net/hw/Makefile | 25 +++++++++++++++++++ .../net/hw}/devlink_port_split.py | 0 .../forwarding => drivers/net/hw}/ethtool.sh | 3 ++- .../net/hw}/ethtool_extended_state.sh | 3 ++- .../net/hw}/ethtool_lib.sh | 0 .../net/hw}/ethtool_mm.sh | 3 ++- .../net/hw}/ethtool_rmon.sh | 3 ++- .../net/hw}/hw_stats_l3.sh | 3 ++- .../net/hw}/hw_stats_l3_gre.sh | 5 ++-- .../forwarding => drivers/net/hw}/loopback.sh | 5 ++-- .../testing/selftests/drivers/net/hw/settings | 1 + tools/testing/selftests/net/Makefile | 1 - .../testing/selftests/net/forwarding/Makefile | 8 ------ 13 files changed, 42 insertions(+), 18 deletions(-) create mode 100644 tools/testing/selftests/drivers/net/hw/Makefile rename tools/testing/selftests/{net => drivers/net/hw}/devlink_port_split.py (100%) rename tools/testing/selftests/{net/forwarding => drivers/net/hw}/ethtool.sh (98%) rename tools/testing/selftests/{net/forwarding => drivers/net/hw}/ethtool_extended_state.sh (96%) rename tools/testing/selftests/{net/forwarding => drivers/net/hw}/ethtool_lib.sh (100%) rename tools/testing/selftests/{net/forwarding => drivers/net/hw}/ethtool_mm.sh (99%) rename tools/testing/selftests/{net/forwarding => drivers/net/hw}/ethtool_rmon.sh (97%) rename tools/testing/selftests/{net/forwarding => drivers/net/hw}/hw_stats_l3.sh (99%) rename tools/testing/selftests/{net/forwarding => drivers/net/hw}/hw_stats_l3_gre.sh (93%) rename tools/testing/selftests/{net/forwarding => drivers/net/hw}/loopback.sh (92%) create mode 100644 tools/testing/selftests/drivers/net/hw/settings diff --git a/tools/testing/selftests/drivers/net/hw/Makefile b/tools/testing/selftests/drivers/net/hw/Makefile new file mode 100644 index 000000000000..2259a39a70ed --- /dev/null +++ b/tools/testing/selftests/drivers/net/hw/Makefile @@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0+ OR MIT + +TEST_PROGS = \ + devlink_port_split.py \ + ethtool.sh \ + ethtool_extended_state.sh \ + ethtool_mm.sh \ + ethtool_rmon.sh \ + hw_stats_l3.sh \ + hw_stats_l3_gre.sh \ + loopback.sh \ + # + +TEST_FILES := \ + ethtool_lib.sh \ + # + +TEST_INCLUDES := \ + ../../../net/lib.sh \ + ../../../net/forwarding/lib.sh \ + ../../../net/forwarding/ipip_lib.sh \ + ../../../net/forwarding/tc_common.sh \ + # + +include ../../../lib.mk diff --git a/tools/testing/selftests/net/devlink_port_split.py b/tools/testing/selftests/drivers/net/hw/devlink_port_split.py similarity index 100% rename from tools/testing/selftests/net/devlink_port_split.py rename to tools/testing/selftests/drivers/net/hw/devlink_port_split.py diff --git a/tools/testing/selftests/net/forwarding/ethtool.sh b/tools/testing/selftests/drivers/net/hw/ethtool.sh similarity index 98% rename from tools/testing/selftests/net/forwarding/ethtool.sh rename to tools/testing/selftests/drivers/net/hw/ethtool.sh index aa2eafb7b243..187429670ee7 100755 --- a/tools/testing/selftests/net/forwarding/ethtool.sh +++ b/tools/testing/selftests/drivers/net/hw/ethtool.sh @@ -10,7 +10,8 @@ ALL_TESTS=" different_speeds_autoneg_on " NUM_NETIFS=2 -source lib.sh +lib_dir=$(dirname "$0") +source "$lib_dir"/../../../net/forwarding/lib.sh source ethtool_lib.sh h1_create() diff --git a/tools/testing/selftests/net/forwarding/ethtool_extended_state.sh b/tools/testing/selftests/drivers/net/hw/ethtool_extended_state.sh similarity index 96% rename from tools/testing/selftests/net/forwarding/ethtool_extended_state.sh rename to tools/testing/selftests/drivers/net/hw/ethtool_extended_state.sh index 17f89c3b7c02..b0f931260a27 100755 --- a/tools/testing/selftests/net/forwarding/ethtool_extended_state.sh +++ b/tools/testing/selftests/drivers/net/hw/ethtool_extended_state.sh @@ -8,7 +8,8 @@ ALL_TESTS=" " NUM_NETIFS=2 -source lib.sh +lib_dir=$(dirname "$0") +source "$lib_dir"/../../../net/forwarding/lib.sh source ethtool_lib.sh TIMEOUT=$((WAIT_TIMEOUT * 1000)) # ms diff --git a/tools/testing/selftests/net/forwarding/ethtool_lib.sh b/tools/testing/selftests/drivers/net/hw/ethtool_lib.sh similarity index 100% rename from tools/testing/selftests/net/forwarding/ethtool_lib.sh rename to tools/testing/selftests/drivers/net/hw/ethtool_lib.sh diff --git a/tools/testing/selftests/net/forwarding/ethtool_mm.sh b/tools/testing/selftests/drivers/net/hw/ethtool_mm.sh similarity index 99% rename from tools/testing/selftests/net/forwarding/ethtool_mm.sh rename to tools/testing/selftests/drivers/net/hw/ethtool_mm.sh index 50d5bfb17ef1..c301e735c8ab 100755 --- a/tools/testing/selftests/net/forwarding/ethtool_mm.sh +++ b/tools/testing/selftests/drivers/net/hw/ethtool_mm.sh @@ -14,7 +14,8 @@ ALL_TESTS=" NUM_NETIFS=2 REQUIRE_MZ=no PREEMPTIBLE_PRIO=0 -source lib.sh +lib_dir=$(dirname "$0") +source "$lib_dir"/../../../net/forwarding/lib.sh traffic_test() { diff --git a/tools/testing/selftests/net/forwarding/ethtool_rmon.sh b/tools/testing/selftests/drivers/net/hw/ethtool_rmon.sh similarity index 97% rename from tools/testing/selftests/net/forwarding/ethtool_rmon.sh rename to tools/testing/selftests/drivers/net/hw/ethtool_rmon.sh index 41a34a61f763..709433a4c886 100755 --- a/tools/testing/selftests/net/forwarding/ethtool_rmon.sh +++ b/tools/testing/selftests/drivers/net/hw/ethtool_rmon.sh @@ -7,7 +7,8 @@ ALL_TESTS=" " NUM_NETIFS=2 -source lib.sh +lib_dir=$(dirname "$0") +source "$lib_dir"/../../../net/forwarding/lib.sh ETH_FCS_LEN=4 ETH_HLEN=$((6+6+2)) diff --git a/tools/testing/selftests/net/forwarding/hw_stats_l3.sh b/tools/testing/selftests/drivers/net/hw/hw_stats_l3.sh similarity index 99% rename from tools/testing/selftests/net/forwarding/hw_stats_l3.sh rename to tools/testing/selftests/drivers/net/hw/hw_stats_l3.sh index 48584a51388f..744760117005 100755 --- a/tools/testing/selftests/net/forwarding/hw_stats_l3.sh +++ b/tools/testing/selftests/drivers/net/hw/hw_stats_l3.sh @@ -48,7 +48,8 @@ ALL_TESTS=" test_double_enable " NUM_NETIFS=4 -source lib.sh +lib_dir=$(dirname "$0") +source "$lib_dir"/../../../net/forwarding/lib.sh h1_create() { diff --git a/tools/testing/selftests/net/forwarding/hw_stats_l3_gre.sh b/tools/testing/selftests/drivers/net/hw/hw_stats_l3_gre.sh similarity index 93% rename from tools/testing/selftests/net/forwarding/hw_stats_l3_gre.sh rename to tools/testing/selftests/drivers/net/hw/hw_stats_l3_gre.sh index 7594bbb49029..354be353455f 100755 --- a/tools/testing/selftests/net/forwarding/hw_stats_l3_gre.sh +++ b/tools/testing/selftests/drivers/net/hw/hw_stats_l3_gre.sh @@ -12,8 +12,9 @@ ALL_TESTS=" test_stats_tx " NUM_NETIFS=6 -source lib.sh -source ipip_lib.sh +lib_dir=$(dirname "$0") +source "$lib_dir"/../../../net/forwarding/lib.sh +source "$lib_dir"/../../../net/forwarding/ipip_lib.sh setup_prepare() { diff --git a/tools/testing/selftests/net/forwarding/loopback.sh b/tools/testing/selftests/drivers/net/hw/loopback.sh similarity index 92% rename from tools/testing/selftests/net/forwarding/loopback.sh rename to tools/testing/selftests/drivers/net/hw/loopback.sh index 8f4057310b5b..5acc3ff820aa 100755 --- a/tools/testing/selftests/net/forwarding/loopback.sh +++ b/tools/testing/selftests/drivers/net/hw/loopback.sh @@ -6,8 +6,9 @@ ksft_skip=4 ALL_TESTS="loopback_test" NUM_NETIFS=2 -source tc_common.sh -source lib.sh +lib_dir=$(dirname "$0") +source "$lib_dir"/../../../net/forwarding/tc_common.sh +source "$lib_dir"/../../../net/forwarding/lib.sh h1_create() { diff --git a/tools/testing/selftests/drivers/net/hw/settings b/tools/testing/selftests/drivers/net/hw/settings new file mode 100644 index 000000000000..e7b9417537fb --- /dev/null +++ b/tools/testing/selftests/drivers/net/hw/settings @@ -0,0 +1 @@ +timeout=0 diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index 7b6918d5f4af..cb418a2346bc 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -20,7 +20,6 @@ TEST_PROGS += reuseaddr_ports_exhausted.sh TEST_PROGS += txtimestamp.sh TEST_PROGS += vrf-xfrm-tests.sh TEST_PROGS += rxtimestamp.sh -TEST_PROGS += devlink_port_split.py TEST_PROGS += drop_monitor_tests.sh TEST_PROGS += vrf_route_leaking.sh TEST_PROGS += bareudp.sh diff --git a/tools/testing/selftests/net/forwarding/Makefile b/tools/testing/selftests/net/forwarding/Makefile index 535865b3d1d6..56e3557ba8a6 100644 --- a/tools/testing/selftests/net/forwarding/Makefile +++ b/tools/testing/selftests/net/forwarding/Makefile @@ -15,18 +15,12 @@ TEST_PROGS = bridge_fdb_learning_limit.sh \ bridge_vlan_unaware.sh \ custom_multipath_hash.sh \ dual_vxlan_bridge.sh \ - ethtool_extended_state.sh \ - ethtool_mm.sh \ - ethtool_rmon.sh \ - ethtool.sh \ gre_custom_multipath_hash.sh \ gre_inner_v4_multipath.sh \ gre_inner_v6_multipath.sh \ gre_multipath_nh_res.sh \ gre_multipath_nh.sh \ gre_multipath.sh \ - hw_stats_l3.sh \ - hw_stats_l3_gre.sh \ ip6_forward_instats_vrf.sh \ ip6gre_custom_multipath_hash.sh \ ip6gre_flat_key.sh \ @@ -44,7 +38,6 @@ TEST_PROGS = bridge_fdb_learning_limit.sh \ ipip_hier_gre_keys.sh \ ipip_hier_gre.sh \ local_termination.sh \ - loopback.sh \ mirror_gre_bound.sh \ mirror_gre_bridge_1d.sh \ mirror_gre_bridge_1d_vlan.sh \ @@ -113,7 +106,6 @@ TEST_PROGS = bridge_fdb_learning_limit.sh \ vxlan_symmetric.sh TEST_FILES := devlink_lib.sh \ - ethtool_lib.sh \ fib_offload_lib.sh \ forwarding.config.sample \ ip6gre_lib.sh \ From patchwork Tue Mar 26 16:54:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13604726 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2068.outbound.protection.outlook.com [40.107.244.68]) (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 DE73913D504; Tue, 26 Mar 2024 17:01:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472479; cv=fail; b=TgupLOcoLC++N6AjqnZgDJs01PejYzCeH6brb+Z+Q4neimXXvznaGVSwI+YS53wPlGN+TUMRZGDsp+J/ipnzk4Gxr1mIcQgjfJEV+9x+3K0na+WZN8vAQzAoDka+hS/vRy+bnm0Z7I8vuDmurc8kRhlEVqrC3u3izXJkAgL1fuQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472479; c=relaxed/simple; bh=AZUSMPjiXcvxzVlj7PylF6NCcBvM5lAT79psV9iJqgU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fj0OWAv55KwYbxP1ob93+NdsNN+77k2c8LGHqaEYIzaN0Nji9zOptIXeH4cq9OxZX6ztSxeucY1cJ0/8tXQtejUdjO7VSx724pTFdqXiquduHWhSpTe20qg/l/wc+bEfom2LZucunnV6V/n18tSWPdORra8FMivZd8LB3+7hdfQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=PFBW3m2B; arc=fail smtp.client-ip=40.107.244.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="PFBW3m2B" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ih7f2dqtEjuMduv0zRkW+9PycnbVgJQatVyf/mxyUTiA77jtpbdP60a1eS7riIexK/l/78N3V0PCwr229YkttHtWYNr/jgbbkEFmKgHEewdtteAYU45p2fkkbKknzzynRmHFtFDMe4Tr/6Ah5TofzS/2JPThJxG5zypcFhT5K+NL+9cGqF1doOw5PFe5MfqJmSOTh0X2mEO4Cc0BRWoH1rrHqG0raA84bVUFz76LiH8mPH8ssun7M9k3C651tcha1djnsRrAZlzerY7XJe2SZF+oLRDOqVQw1SImVr/s/KuBzpJKRDOE2IHiajUVNKWa687ZeI2g3RBPlU+2gShJwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9mCdfpmuRZSleSTsXITlCnaK2+7xoOs+UANN5D6l938=; b=AGLNOJu6wgL2jQqHJRPE9tAtsim3aPlGP/1Awgw7VPjXnDeYBvaVXymyhcPkX7CpC28zBbDkXtFhezHxaV/x0nmlAFQ1ksfGnh8JaKK3rbiDXcVozgfOWb1Kzw7aDOX8QgA/6d/UBoyF+ZLh8lYDVh1r2BqudUbfWz2o0uiDb7smaxjlBZveuLd/IFZLtJmzIaDrIc8FrOg9ETiYE/tLAgA/IKT4LQBLMDhfOMOcqIdR/Ju1kNQ47cvh9MLWqC2eb1ozBTTy/1qjIjLgZ7/k6ijsv3vFW4dF0dTPcRYoOpVCl82Asn3zo3UmTVR9coSZJ+mIc5rimGLvBAzg0VtAsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9mCdfpmuRZSleSTsXITlCnaK2+7xoOs+UANN5D6l938=; b=PFBW3m2BQ7kljUTOGOb1XoYRf/zcwog+Yrm4/jFThPs8uRiuCPkLlk2n9MXy2FKSNuAatYIxsc4xbxC2oAb5FzEGwNaO53AwKBRDm1cApoYPi2Rt7+YmjRzbAMAzGVKybcuXYh2TUs2JijDsMBNkD/CbGi4HaiyMz/Qk9aDRTPVksb3DPjJ1tz62Mi19DavgbiMQ9v9aFbMwOZanTNpo9nbBcwuQ8Uj0SQwo10up1xqdsgt6VYhCcsz5Gh72F40gIxzNmqaCabmriPQIGiTv6/saXP+LDBqK4iSbOTRspnYqq11rnZ5RWAJVcX5O/BUGKtkXNqlqhAHp0blcnzcGbQ== Received: from CH0PR03CA0405.namprd03.prod.outlook.com (2603:10b6:610:11b::15) by SN7PR12MB7300.namprd12.prod.outlook.com (2603:10b6:806:298::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.28; Tue, 26 Mar 2024 17:01:12 +0000 Received: from CH3PEPF0000000D.namprd04.prod.outlook.com (2603:10b6:610:11b:cafe::9c) by CH0PR03CA0405.outlook.office365.com (2603:10b6:610:11b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.20 via Frontend Transport; Tue, 26 Mar 2024 17:01:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CH3PEPF0000000D.mail.protection.outlook.com (10.167.244.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 17:01:11 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 26 Mar 2024 10:00:42 -0700 Received: from localhost.localdomain (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 26 Mar 2024 10:00:36 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Shuah Khan , Nikolay Aleksandrov , Hangbin Liu , Vladimir Oltean , Benjamin Poirier , "Ido Schimmel" , Jiri Pirko , , Petr Machata , , Danielle Ratson Subject: [PATCH net-next 06/14] selftests: forwarding: Ditch skip_on_veth() Date: Tue, 26 Mar 2024 17:54:33 +0100 Message-ID: <63b470e10d65270571ee7de709b31672ce314872.1711464583.git.petrm@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF0000000D:EE_|SN7PR12MB7300:EE_ X-MS-Office365-Filtering-Correlation-Id: 314f0862-be5c-448a-a224-08dc4db656ff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qlh0sQBSdFCn0NcWg0EDlR7TrClsyFwFZdir4PFZ7P4/8RuLPTlh+lyCrmJ9Ce62llsMblVtFayLE7eJjlVMkCKqlrICWJgu8zaGjAJVJTEVjhYW8yr8du9QFuoGma9Owgciebu2LI8Q9uwm2rTBKn8xLB+QxuTqS7Aoi1B6M7arD8yr2HqKrUWsTlFlK2mPs38oo7jZH8t4XLy77yihNq+ta2MZzoTBNiueZufShKGt36id1VTUJndDEyekUkZFEeE4MBdLQ2c69z9DN/5cSG8tHhXrwyULX40DfoIQLztmYpVASpIhVGs6SjJwcPK3CMA3LCNBNuybeg2g2iT1f1GJSXajuB85h/FUmZqiEXYTfsr4eQe5fmXtUX5hFCnxjvX9J3ddNlmn5cw14pHpbJPYtGh0RHj8cpvdNA9bN3rwzVW64E8R+z2mDhsw0sd5CBurzaRVC2uM79Lq3G9y/b1ttWXEuI6NTI+jC01IAjITOapT2o2PrwZCtsHrEiIZnfJCq88MFTsea36G+tAWj/MFigQVbMeIrzsDIDoUVDRYzn6Bj6DXkQOQeuhV3uqxIcjEO+E1htT/9RqiGvBzB+teZmbp2MGSLPPWx/S85fo3iITQreLwvB9YCIYPVsoDEp/k3DE75NeamVteUEVyrp5nAB8uyBD2tv9pVDxb7lzXTCy8IXQRSrFy3+sS93R8uu+SXGkw7jeEIapu0I6VhqEj8ezt8Uypy8XDe4aEGeHpmJFcklLr/63CZ0UzbHp+ X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(1800799015)(376005)(7416005)(82310400014)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 17:01:11.7029 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 314f0862-be5c-448a-a224-08dc4db656ff X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH3PEPF0000000D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7300 X-Patchwork-Delegate: kuba@kernel.org Since the selftests that are not supposed to run on veth pairs are now in their own dedicated directory, the skip_on_veth logic can go away. Drop it from the selftests, and from lib.sh. Cc: Danielle Ratson Signed-off-by: Petr Machata --- .../testing/selftests/drivers/net/hw/ethtool.sh | 2 -- .../drivers/net/hw/ethtool_extended_state.sh | 2 -- .../selftests/drivers/net/hw/hw_stats_l3.sh | 16 ++++------------ .../selftests/drivers/net/hw/hw_stats_l3_gre.sh | 2 -- tools/testing/selftests/net/forwarding/lib.sh | 11 ----------- 5 files changed, 4 insertions(+), 29 deletions(-) diff --git a/tools/testing/selftests/drivers/net/hw/ethtool.sh b/tools/testing/selftests/drivers/net/hw/ethtool.sh index 187429670ee7..bb12d5d70949 100755 --- a/tools/testing/selftests/drivers/net/hw/ethtool.sh +++ b/tools/testing/selftests/drivers/net/hw/ethtool.sh @@ -287,8 +287,6 @@ different_speeds_autoneg_on() ethtool -s $h1 autoneg on } -skip_on_veth - trap cleanup EXIT setup_prepare diff --git a/tools/testing/selftests/drivers/net/hw/ethtool_extended_state.sh b/tools/testing/selftests/drivers/net/hw/ethtool_extended_state.sh index b0f931260a27..a7584448416e 100755 --- a/tools/testing/selftests/drivers/net/hw/ethtool_extended_state.sh +++ b/tools/testing/selftests/drivers/net/hw/ethtool_extended_state.sh @@ -109,8 +109,6 @@ no_cable() ip link set dev $swp3 down } -skip_on_veth - setup_prepare tests_run diff --git a/tools/testing/selftests/drivers/net/hw/hw_stats_l3.sh b/tools/testing/selftests/drivers/net/hw/hw_stats_l3.sh index 744760117005..7dfc50366c99 100755 --- a/tools/testing/selftests/drivers/net/hw/hw_stats_l3.sh +++ b/tools/testing/selftests/drivers/net/hw/hw_stats_l3.sh @@ -325,17 +325,9 @@ setup_wait used=$(ip -j stats show dev $rp1.200 group offload subgroup hw_stats_info | jq '.[].info.l3_stats.used') -kind=$(ip -j -d link show dev $rp1 | - jq -r '.[].linkinfo.info_kind') -if [[ $used != true ]]; then - if [[ $kind == veth ]]; then - log_test_skip "l3_stats not offloaded on veth interface" - EXIT_STATUS=$ksft_skip - else - RET=1 log_test "l3_stats not offloaded" - fi -else - tests_run -fi +[[ $used = true ]] +check_err $? "hw_stats_info.used=$used" +log_test "l3_stats offloaded" +tests_run exit $EXIT_STATUS diff --git a/tools/testing/selftests/drivers/net/hw/hw_stats_l3_gre.sh b/tools/testing/selftests/drivers/net/hw/hw_stats_l3_gre.sh index 354be353455f..ab8d04855af5 100755 --- a/tools/testing/selftests/drivers/net/hw/hw_stats_l3_gre.sh +++ b/tools/testing/selftests/drivers/net/hw/hw_stats_l3_gre.sh @@ -100,8 +100,6 @@ test_stats_rx() test_stats g2a rx } -skip_on_veth - trap cleanup EXIT setup_prepare diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index dbd4348f85b8..ca433ba3612e 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -254,17 +254,6 @@ check_port_mab_support() fi } -skip_on_veth() -{ - local kind=$(ip -j -d link show dev ${NETIFS[p1]} | - jq -r '.[].linkinfo.info_kind') - - if [[ $kind == veth ]]; then - echo "SKIP: Test cannot be run with veth pairs" - exit $ksft_skip - fi -} - if [[ "$(id -u)" -ne 0 ]]; then echo "SKIP: need root privileges" exit $ksft_skip From patchwork Tue Mar 26 16:54:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13604727 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2070.outbound.protection.outlook.com [40.107.223.70]) (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 1CA9713D508; Tue, 26 Mar 2024 17:01:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472490; cv=fail; b=I4gRmfO1Vq1nw4KVTIJUtIsRi5fQYfcK8kxIpHrGPKa0SG44FVLm2rP61w9+t9pov0I+fqcwGy1pVLAAeVMsXZ7S6fegrykR+zoA4HGI/umN4m75wznuD7q4PSmbfGEvYlQsr2n6GqySz6dmN6eJDvXO0pgilw+xDhND5GrfXjI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472490; c=relaxed/simple; bh=MxJe5u4kKh1gF0M8vK+ZVWbNyh5kNSewZOLFJ5VB0m0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ptcH1T1q4gWgLt3zKXKjpiknHDZB4E4jEirhUXfcG89YiCAmTCOq0mEfCMDFznI/Ib1Z2lx3sO76t5Y3weip+Ac/WP1j1YzTGCkItgX774p30q+KS8m5q0GUmC8tD55ufRcxvr9eA8at5VXsb3YE4F5msN7WcM3qDCA9iBl80DQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=dqQ2LYF+; arc=fail smtp.client-ip=40.107.223.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="dqQ2LYF+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VpAPQW2Z/YYnJHq8ZoNCbO5VKJ1Hkv7XuUYNEvT/Mxwd/L9Kdb2QqOWXVJbtXmdCmaH+UmFFEepH53CSmZRb19WyfBEiEET1HcvYascQzbXP9qyaaX6OPI0vYsnGzmxB6SovBLfzlLa3pslTMmktk6brrBrnZ/ryaEQwF/srWAh6tWDlw2etf7iwhMnpwT4UH+pldSS+Wz+u9FtRjQts5Kfjjl+ckfVnHlOOhb7okuRZGl+6AE9Hhz8mZhJSQ5EnNFZb1V6cG06YfejHPJ6KjzivLRns3BqhuWuVQSG7krViWbOBtk3FS2ZUnHeFVbhNsCWXNs3WVGxRSaatlHTf3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GmLUvKFraZqK99YQ3BehQvq+UYAaDsAUcKG2ZujckoI=; b=PziCKnSoxr15hNXsdQZdjvodQmS8IApeaszUHECksaWN8KYtNIP/ZPexXjjI55om0AG/fWOeaL2q+EuNy9RxiYsowmDM7KfYRNNWixhityD+4a/K8BdYUHBT79NNZiJTR7qimuBit7MPWh51mNnaZsHYgIIOAOiUmJSK5l89Vla/d+NCESUurRT0ScIuVI9zBNxQjupBQQbFptcgJ+yCZldpidg7BxTfocsMD4kZPLpYNhAxVhYHpTzv3orNYzSljTosFvzUqSHWemfhuWpJeCWRQqwfRHw869lwgOlV14aOrKMd2PNdJ/lAAay3/Sk90/sQAdVaC6Umi441CpbcRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GmLUvKFraZqK99YQ3BehQvq+UYAaDsAUcKG2ZujckoI=; b=dqQ2LYF+nqUNIPtcGfF20vfT1Lh7tSkPOWPwyIUPaHIOtfhgZQbP5JYo/R3jWtAgTX01SYxzO2WpyVfXnAnq4BtzDiqIAjxB3UxQUriPiH/CYDQ+RW25olqz6D5v44WY9WgzO+79kHH1/pSY8mn6kGtDG0WGC3aV3ApQvY89zR49BHZpZtYtxc5xGFr2MYKg0JJlpiea4koM1pxE8pvVFIA2hwdr9CC85ksSu9MvZPViv/5Mp00sFm3c+Ry0UhpvDzpVFMuUolsI7ph0k4c/MWdLkF+S1w92SREhiC5nz44amE/G5AwovL16oY6x+mwn6w8bo7hGBNZGSGJxygo64w== Received: from BN9PR03CA0112.namprd03.prod.outlook.com (2603:10b6:408:fd::27) by DS0PR12MB9424.namprd12.prod.outlook.com (2603:10b6:8:1b4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.32; Tue, 26 Mar 2024 17:01:21 +0000 Received: from BN1PEPF00004686.namprd03.prod.outlook.com (2603:10b6:408:fd:cafe::c0) by BN9PR03CA0112.outlook.office365.com (2603:10b6:408:fd::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Tue, 26 Mar 2024 17:01:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN1PEPF00004686.mail.protection.outlook.com (10.167.243.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 17:01:20 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 26 Mar 2024 10:00:48 -0700 Received: from localhost.localdomain (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 26 Mar 2024 10:00:43 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Shuah Khan , Nikolay Aleksandrov , Hangbin Liu , Vladimir Oltean , Benjamin Poirier , "Ido Schimmel" , Jiri Pirko , , Petr Machata , , Tobias Waldekranz Subject: [PATCH net-next 07/14] selftests: forwarding: Change inappropriate log_test_skip() calls Date: Tue, 26 Mar 2024 17:54:34 +0100 Message-ID: <3d668d8fb6fa0d9eeb47ce6d9e54114348c7c179.1711464583.git.petrm@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004686:EE_|DS0PR12MB9424:EE_ X-MS-Office365-Filtering-Correlation-Id: d660fcdb-7b9f-4931-703b-08dc4db65c5d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /NBVky3AkCSdQPTy3WCXEjFy5zcG6tTjCmJi8R2NUJz4xR5x0V+P9e2dZHaaEz0S0gkuGp0XfTuEjSZEEa7Io37KHr7vYfMyNC2gzq4IZjtFFcsMNSXZlz6A+CN7niJz0oov9YV/n1B7taJK8o67yEkRn1YntyVDhymhP2eDQS7f0JinG80LeMGgCqA2ldCZBfYsWwDfYE56+hzG7gOgCYGOKrAZSxcxAdBBhmnt+qPIUC+Ynip+V4yzsQXkR5TaK+s7l+mUA/IdivdUqmtiq4dZQi0GlQZ4zHIiMEIy4kGY26wA4xcBMbocc3NqmDuIG8SV6w6EXi28B3iW0sZETuseR2CHWloPalf1P3hnRMy2/GnKVybe6PwEkcxzOqpftJcMqGHpJfaGaEbQ6a64GsoZ1An7ObPNttajSK78WY8epByZ+2wI0RPCFNNWgpFr+pdL1NStJb8n1DjN7Y03CkomVXU34MZBZJ03xgqHR6pk+JFKEqTMbPMYgNR8mbkD2q9DG0zaAGIHisbUHEjBwWTV+8ctKahdnLpb9p4Pafq2xDrnM3bXRI69VqUIuW3AZA/OvOH2dD9aKVN/CHL7b9Iid708aF+4J0f31dpk7dqLUng4mhu4yvbUS4bdDZ66hdUsMCe6xbj8nRnC2allxRrkceV5Y/6924FSIH4ptrFb+587bAKciMwt+I/JOXBr0c7bPiLa3Yppuh5GST58m+eEMXdPHNYL9t0AKDI0bH86Fn1zq3KBCoh3KhI6ZnLY X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(36860700004)(82310400014)(376005)(1800799015)(7416005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 17:01:20.6750 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d660fcdb-7b9f-4931-703b-08dc4db65c5d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00004686.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB9424 X-Patchwork-Delegate: kuba@kernel.org The SKIP return should be used for cases where tooling of the machine under test is lacking. For cases where HW is lacking, the appropriate outcome is XFAIL. This is the case with ethtool_rmon and mlxsw_lib. For these, introduce a new helper, log_test_xfail(). Do the same for router_mpath_nh_lib. Note that it will be fixed using a more reusable way in a following patch. For the two resource_scale selftests, the log should simply not be written, because there is no problem. Cc: Tobias Waldekranz Signed-off-by: Petr Machata --- tools/testing/selftests/drivers/net/hw/ethtool_rmon.sh | 4 ++-- tools/testing/selftests/drivers/net/mlxsw/mlxsw_lib.sh | 2 +- .../drivers/net/mlxsw/spectrum-2/resource_scale.sh | 1 - .../drivers/net/mlxsw/spectrum/resource_scale.sh | 1 - tools/testing/selftests/net/forwarding/lib.sh | 9 +++++++++ .../selftests/net/forwarding/router_mpath_nh_lib.sh | 2 +- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/drivers/net/hw/ethtool_rmon.sh b/tools/testing/selftests/drivers/net/hw/ethtool_rmon.sh index 709433a4c886..e2a1c10d3503 100755 --- a/tools/testing/selftests/drivers/net/hw/ethtool_rmon.sh +++ b/tools/testing/selftests/drivers/net/hw/ethtool_rmon.sh @@ -79,7 +79,7 @@ rmon_histogram() for if in $iface $neigh; do if ! ensure_mtu $if ${bucket[0]}; then - log_test_skip "$if does not support the required MTU for $step" + log_test_xfail "$if does not support the required MTU for $step" return fi done @@ -94,7 +94,7 @@ rmon_histogram() jq -r ".[0].rmon[\"${set}-pktsNtoM\"][]|[.low, .high]|@tsv" 2>/dev/null) if [ $nbuckets -eq 0 ]; then - log_test_skip "$iface does not support $set histogram counters" + log_test_xfail "$iface does not support $set histogram counters" return fi } diff --git a/tools/testing/selftests/drivers/net/mlxsw/mlxsw_lib.sh b/tools/testing/selftests/drivers/net/mlxsw/mlxsw_lib.sh index 6369927e9c37..48395cfd4f95 100644 --- a/tools/testing/selftests/drivers/net/mlxsw/mlxsw_lib.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/mlxsw_lib.sh @@ -42,7 +42,7 @@ __mlxsw_only_on_spectrum() local src=$1; shift if ! mlxsw_on_spectrum "$rev"; then - log_test_skip $src:$caller "(Spectrum-$rev only)" + log_test_xfail $src:$caller "(Spectrum-$rev only)" return 1 fi } diff --git a/tools/testing/selftests/drivers/net/mlxsw/spectrum-2/resource_scale.sh b/tools/testing/selftests/drivers/net/mlxsw/spectrum-2/resource_scale.sh index a88d8a8c85f2..899b6892603f 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/spectrum-2/resource_scale.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/spectrum-2/resource_scale.sh @@ -47,7 +47,6 @@ for current_test in ${TESTS:-$ALL_TESTS}; do RET=0 target=$(${current_test}_get_target "$should_fail") if ((target == 0)); then - log_test_skip "'$current_test' should_fail=$should_fail test" continue fi diff --git a/tools/testing/selftests/drivers/net/mlxsw/spectrum/resource_scale.sh b/tools/testing/selftests/drivers/net/mlxsw/spectrum/resource_scale.sh index f981c957f097..482ebb744eba 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/spectrum/resource_scale.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/spectrum/resource_scale.sh @@ -52,7 +52,6 @@ for current_test in ${TESTS:-$ALL_TESTS}; do RET=0 target=$(${current_test}_get_target "$should_fail") if ((target == 0)); then - log_test_skip "'$current_test' [$profile] should_fail=$should_fail test" continue fi ${current_test}_setup_prepare diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index ca433ba3612e..5415b8d29862 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -467,6 +467,15 @@ log_test_skip() return 0 } +log_test_xfail() +{ + local test_name=$1 + local opt_str=$2 + + printf "TEST: %-60s [XFAIL]\n" "$test_name $opt_str" + return 0 +} + log_info() { local msg=$1 diff --git a/tools/testing/selftests/net/forwarding/router_mpath_nh_lib.sh b/tools/testing/selftests/net/forwarding/router_mpath_nh_lib.sh index 7e7d62161c34..b2d2c6cecc01 100644 --- a/tools/testing/selftests/net/forwarding/router_mpath_nh_lib.sh +++ b/tools/testing/selftests/net/forwarding/router_mpath_nh_lib.sh @@ -69,7 +69,7 @@ nh_stats_test_dispatch_swhw() nh_stats_do_test "HW $what" "$nh1_id" "$nh2_id" "$group_id" \ nh_stats_get_hw "${mz[@]}" elif [[ $kind == veth ]]; then - log_test_skip "HW stats not offloaded on veth topology" + log_test_xfail "HW stats not offloaded on veth topology" fi } From patchwork Tue Mar 26 16:54:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13604729 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2056.outbound.protection.outlook.com [40.107.237.56]) (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 D9BEE1F60A; Tue, 26 Mar 2024 17:01:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472499; cv=fail; b=gF8AMB/4x9Ex+p8Y/Eq3PtRbBV75MUXF+PeJ4hnFAcOa3O8mBJQJXVqVhZdosRtyaaFScj4gp3Rv4fRCEG2wPiBS65WjmaZ5ocpNEXut4APVxDy7nVcAkFVqHryHu5UVVOfWTw9hbA9HpPG7r7oLZ+tgG4CD0b7hOCVVsLCkaIs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472499; c=relaxed/simple; bh=HDf28ffDoLt2OzHE5NC0EZDQjL9LK9TeToUEyEt1fpg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gzZ12isXqJiG3PtZuh+XVoFHFXWX6rbR5wZ0h4gx4x/RCaeoo3cw+m1CQgTOZNFrHQ6yQ/0ytDRfLVgs5XCH0tqZJU7tN6xWIgkCvPckEoddDimZ6F2LWDg+JDB83KvZH74bI5oRIl8Sd4vNS5JFf0rc8LsqJ7/FkJwCvcnjrQw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=mHxuLD/T; arc=fail smtp.client-ip=40.107.237.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="mHxuLD/T" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dpfIEfdccUNdxW7s9V3FQZTjC3pxxMcqVVRgs7U2gX0cm6PEsFOY4vQkWpS/YMPM3w12SlFZyoykRpphHDxontwtLgN46XGA31CMHF4zqxwR54mJGd0R03vEDYwkylvBVEm6I1eAxpAXFIc1DywPcT/R28EQV50vH8nCqhW3PHsvASz9JjYoQXV1qnANm30syPwavA8ZSm9RmlHk1cCuXXt8ZxtxDBegBIJEE44xeq1HYkVnLJILh1p6obP+QQ4iAxae/okawXJQxFEytIAKYJ3NviR++lceJX3ZwV9t7vwyMrN6SFiAzYzaPLq3wOx0Hd0ttktlTPinwa0ZXZRVVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vmFb6laAYMesL6/V0w2y95pwC3ay+pBzgWlmAeKdWro=; b=UuPp8QWyNrnR3uDv0XckyobISmUSjwgU/fNdUqdOC0E39DMIIl8J78E/uG4immZ4AWypkwP2xHWv5MqSvmh40tKZgozRfgicf1HrtugAB2gJcT2pBGB+cYfRUzfSdWLHFcPs8HGo8MQu+OV9Hy5XbZiQuu0DEs/KJlCDoqKiELT0NIcHWcKPNGjeYz1u1BC8qPi5/2gM1veSIhbBjwgE1ibjdN/iKEgyqrJLtFddAqPIxvesMZZicxHMe+VrpoGyGPL25zGpM3XTrSAox8amFkuV82VhQM73Fuyxw0ZboRZasX85DuCuyDZq93RB4N2Sh6s6SgYxCyTwAjGJwwkQow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vmFb6laAYMesL6/V0w2y95pwC3ay+pBzgWlmAeKdWro=; b=mHxuLD/TKC1/ajjIY90TOlZTY6TCJdQCV5eoxgyZ7aSso3wlnSFxb0A6iNWGGfOgg5MCFakqliPJ4sHIl+mf5+3ywYKCAg3wQZ4hhimHBSZKtibklukMdB6bQtIXeSHSe8wYFX2nOeQgf5jOph0hAQ5gGUp5l/ZVpRyO+YgO3zVXeOYhEly+SBMafLeFvrBJ2FH3963HtHuv/B9LEb6bbXLaGcq4lOFivfQZrz9RcNigIvAheQ2RF9AslWIKqF5qr4kjwLeyvqKdG47l9NxYXrgcpuhi1jQS423iSDqbj5z0lhLgNj7n5OVNqFZrcZVBFKOgPNAubPt905J68j2m0Q== Received: from BN9PR03CA0112.namprd03.prod.outlook.com (2603:10b6:408:fd::27) by SA1PR12MB8859.namprd12.prod.outlook.com (2603:10b6:806:37c::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Tue, 26 Mar 2024 17:01:30 +0000 Received: from BN1PEPF00004686.namprd03.prod.outlook.com (2603:10b6:408:fd:cafe::52) by BN9PR03CA0112.outlook.office365.com (2603:10b6:408:fd::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Tue, 26 Mar 2024 17:01:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN1PEPF00004686.mail.protection.outlook.com (10.167.243.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 17:01:26 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 26 Mar 2024 10:00:55 -0700 Received: from localhost.localdomain (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 26 Mar 2024 10:00:49 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Shuah Khan , Nikolay Aleksandrov , Hangbin Liu , Vladimir Oltean , Benjamin Poirier , "Ido Schimmel" , Jiri Pirko , , Petr Machata , , Davide Caratti Subject: [PATCH net-next 08/14] selftests: lib: Define more kselftest exit codes Date: Tue, 26 Mar 2024 17:54:35 +0100 Message-ID: <545a03046c7aca0628a51a389a9b81949ab288ce.1711464583.git.petrm@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004686:EE_|SA1PR12MB8859:EE_ X-MS-Office365-Filtering-Correlation-Id: 24124de0-79ca-4064-bea3-08dc4db65fb7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DhL9lmNro9/vf83zo8HYA+bg5RCzQ+jlnCNTIspTchHZ4uVbXfFM8tvQkFTigTs4XxaxLwmYjF/PrJEV2xiGqDl5FCY1ktLmFWnktilOlLigQiwQv675r586Wny6s+vyM6A2nUJM3AspbKpOAikzYfnub73KqPj/dalrioq7nWEmbybV3kW17dWl1tIX7VlFE/DN+6t+UsSNidTtU2kUldfRUEOTvU4bQOJLIgt/G8Zf7Q5U3BWyliJ54Vf1CJR25Ns+yM2BLcSxfvV6aZGdAaUoB72sOSudpFP0AEH1caHlp2BgwuUzsYWhbRYFsBuPsZQQlf1XwK6lS6G0fKuUmKUlElL7rLhMFfoJpckRO+f497RN514hV4PYoqLtDaQpEG595oIDbfbMlKYg2gciTV6kFMDs9/qrvi80Qv9ORDVumIMJrzEUknyTNWxrkb3fhYCbHfoSv2EskZboRZLEQI6lqypqPCyGnUyl/46k7eSVQ6UFpavPquLHCyemTUbnDwDa0a3C6CVzqPntNcwO1CiWYnHMtsPL7H9Do5FM4rSMSyF9hEGOt8GX7g4T2IHunwa3d7+mv+sf9PNuy4WlOp4o2sQn7YLjlYAzXhqhXZ3LzASOQeKVq/Ev5Du/UnA8DvKQ3YO/l3LGyemyHW5Ge5NUCCdnbdSIezwdrcqYyCIpUABekQkgF5gkAuVbac1185eZsYY1Vd6bRatks5Yq1+ywya3yF+2tVW+WTOig7W3GWo+YPrkugMNz1YR4aiYd X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(36860700004)(1800799015)(82310400014)(376005)(7416005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 17:01:26.3000 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 24124de0-79ca-4064-bea3-08dc4db65fb7 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00004686.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8859 X-Patchwork-Delegate: kuba@kernel.org The following patches will operate with more exit codes besides ksft_skip. Add them here. Additionally, move a duplicated skip exit code definition from forwarding/tc_tunnel_key.sh. Keep a similar duplicate in forwarding/devlink_lib.sh, because even though lib.sh will have been sourced in all cases where devlink_lib is, the inclusion is not visible in the file itself, and relying on it would be confusing. Cc: Davide Caratti Signed-off-by: Petr Machata --- tools/testing/selftests/net/forwarding/tc_tunnel_key.sh | 2 -- tools/testing/selftests/net/lib.sh | 6 +++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/tc_tunnel_key.sh b/tools/testing/selftests/net/forwarding/tc_tunnel_key.sh index 5a5dd9034819..79775b10b99f 100755 --- a/tools/testing/selftests/net/forwarding/tc_tunnel_key.sh +++ b/tools/testing/selftests/net/forwarding/tc_tunnel_key.sh @@ -1,7 +1,5 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 -# Kselftest framework requirement - SKIP code is 4. -ksft_skip=4 ALL_TESTS="tunnel_key_nofrag_test" diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh index 5b366cc4fc43..d9bdf6aa3bf1 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -8,8 +8,12 @@ BUSYWAIT_TIMEOUT=$((WAIT_TIMEOUT * 1000)) # ms -# Kselftest framework requirement - SKIP code is 4. +# Kselftest framework constants. +ksft_pass=0 +ksft_fail=1 +ksft_xfail=2 ksft_skip=4 + # namespace list created by setup_ns NS_LIST="" From patchwork Tue Mar 26 16:54:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13604728 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2071.outbound.protection.outlook.com [40.107.220.71]) (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 0429E13D60A; Tue, 26 Mar 2024 17:01:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472491; cv=fail; b=FpwomCuI71mlhNoEyE65EI24/+tHNq86Y/nVE0tNY8AYxG4lFE+gXgItHWIhiov9F01TKVvOGhUy539cZh3qWA47cTjYzNdiOUXCP8z9L5i005ct/DZXK/afj+/6Xj9B91DxPLamYvJ4TmmFEX4LLKhKzyXyTMidKpeDt79L9SA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472491; c=relaxed/simple; bh=MMbyYpseX8cgtVXFVMcHJEGY4PLUs2oJ3WLF7aeLgwA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oP67jAOOnz1dgkW6MBAnb27yU8tuXHmi+H+ejnLk+4cI9QLZRhpxLCUv8GoGigZfrYoEKTo2O31LkPPe9lLSv4W5Kh7Lq9wTSIZihF13Ef/8JiO9TiuOaggtychQ4ZOdioiqXxATwyYGNceTjZOWF/EczNR8u7zP6uldh5vL7SI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=VZuWkxe6; arc=fail smtp.client-ip=40.107.220.71 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="VZuWkxe6" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JyODqOasLhf9jNdAs+YJvh0LsvRd2g1rUQaPkST+izgukiORiAIHov0DNPxdd++pkfATjTkDWJJi7v6Lh1IzxpKRVxmoliE1pkkW2hI+9f/lZ3EFiS30seJ5SVLZZclCsT5G5m9czDmuUYjJm/JqD8H/3AdI3/uCHGF3dD9jCCB3goxktBzgk+ob6+lrMAuQDae7EjbCc8GTMJLj84YWUelvUBYiKEL+wuSrUE4z6SWIscplVwssdPWT+VYhIpnaS+0/Ru5A3IUhTV2fzfqPHjWcWO2LiCnyteQ/Eu6f5G3uTP1FWVfeyPTQNeRGNXtwMvpo6xudnC+fldbe9LTypQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=us4RBSOFdP01athsgO43cz87CQIT044thZyXhZAmrS4=; b=NYzEo1oR8fp/bPSk3B/KnYvklNXoARuoBjriAQKCNU7PisEprbHnxwChby/eccmi4MQ4oZuEuhIX0V/4UhPpVAfvrfeuh8g1Ns4BEHwIH8QKkW/NMPfBwYWpQcQeXbS8cMguy0lBgyrnFQW7FjXavdmuKoujdzmJJhIAhbht6V2KHecQwbCvetJe84c4GdgsCzq/r6eV88fpSgB4zazx4uYzTw3YymIPtclIL7KCLGOjz+zAWZf6LNzMz44KPX9rY3tbObae+4nyT/6ndAclqPykw0KFT6v3/fomX4ja3ASRZn9uU/nxfudJZ7IZU5hGBnXGPlu/109rlrG0CP8MfA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=us4RBSOFdP01athsgO43cz87CQIT044thZyXhZAmrS4=; b=VZuWkxe61h8BNenyNhQHJerS8PE28k+r3vShKYKsx3jp/GWXyKGE7xG8LtAV3sEdGK3yBSwrdtLCZGC+lx8WYIOypRNLGPC7Xf7vbb4py2I1Ni63N0D0vpAHvRhnLhs8jyjwNUeO4UZnOUoOj+eod6rzB4JaxV6t0Tn+u5uhRnUXPXdvf8nusRNZ/LMVpFXYaOFb4L68RRbbTyNd13W6UXTyEKAROfVoK9TnMvGXZIjymck9KmYLaFgK5kG7TeKEBIt4d2hskDD+0f7meifM/+NFIfRCCALqy7Jk/paSdq/aiORYnLQOp2vOXj7ta3CRJxqsLa6snSsWEPvPf2mdWg== Received: from CH2PR16CA0025.namprd16.prod.outlook.com (2603:10b6:610:50::35) by SJ0PR12MB5611.namprd12.prod.outlook.com (2603:10b6:a03:426::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Tue, 26 Mar 2024 17:01:26 +0000 Received: from CH3PEPF0000000B.namprd04.prod.outlook.com (2603:10b6:610:50:cafe::7d) by CH2PR16CA0025.outlook.office365.com (2603:10b6:610:50::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36 via Frontend Transport; Tue, 26 Mar 2024 17:01:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CH3PEPF0000000B.mail.protection.outlook.com (10.167.244.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 17:01:25 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 26 Mar 2024 10:01:01 -0700 Received: from localhost.localdomain (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 26 Mar 2024 10:00:55 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Shuah Khan , Nikolay Aleksandrov , Hangbin Liu , Vladimir Oltean , Benjamin Poirier , "Ido Schimmel" , Jiri Pirko , , Petr Machata , Subject: [PATCH net-next 09/14] selftests: forwarding: Have RET track kselftest framework constants Date: Tue, 26 Mar 2024 17:54:36 +0100 Message-ID: <7dfff51cc925c7a3ac879b9050a0d6a327c8d21f.1711464583.git.petrm@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF0000000B:EE_|SJ0PR12MB5611:EE_ X-MS-Office365-Filtering-Correlation-Id: f2ebd1f6-d622-40dd-33a4-08dc4db65f28 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tfbAjWqgniG0tRVpEGJMtFZ81wKNXRiim0nSLgt94+Ozo7435jkbVYIpJq+JFDvLiTbbF0rIs2pVBZg8hc9WPoWQGfB4Qx1VmI/LxFtM+hlwl79G3mmIjylzLR+npxlWJJGhoV4JO+jJa35sJ6HGCFMQI/Glebu9lc/r6qgrSPYGp00vDgWZ7zk/jbL0X7SwY5C2TFzezF1anKx2uc2thsnDX6uqpbuQzHa+OxHBK/Lqp/2NB18orUzYINbFRNbGkLqSi4ahzOeGavAdW97RQn9T+XQ6qEphaeDXzjpw/9AQqNMwfKnIt5CUgUKPU40v1EbKG//6zyuQ+FyNHmRleZaNTOXqjGqzse0FMzkxhyLS/cwbveoCSpmK0VkngCjBWrxk+PV3ckJkcXPil/SxDt1pbMbFb7wjA1pfDw5x1/1/HJGerr8vS3vILzh//BOMImz5I/3ezllQccXoMF0fPHUgJ0z9i/RkzfQHKyVxJXO2nLr65Mdxx11gXZa1B/JzJCXohaw2eKtDiY6/ysfkz4uUACsSEmMd5L5AcOE6ejer1EL8ufJ7zZp4YUjg1oWPfoZiM3fwguZ2wiyK2YG4jEAMUuHfsDPFGjEe39Zi/QI27bziemI2T+I1xCBKOyxcFDJmK698+9IPxHVpYzjfbovqz93Mat0TnlqO5ioEp2/EtnZxk7F89hTiIrYV+vBneX462cH+2yaEnLBj01kzEOZtLE8DQZNR+kEVOEgUkPO7NMnSPhV57IL+F3lK3pvl X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(376005)(36860700004)(7416005)(82310400014)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 17:01:25.3909 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f2ebd1f6-d622-40dd-33a4-08dc4db65f28 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH3PEPF0000000B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB5611 X-Patchwork-Delegate: kuba@kernel.org The variable RET keeps track of whether the test under execution has so far failed or not. Currently it works in binary fashion: zero means everything is fine, non-zero means something failed. log_test() then uses the value to given a human-readable message. In order to allow log_test() to report skips and xfails, the semantics of RET need to be more fine-grained. Therefore have RET value be one of kselftest framework constants: $ksft_fail, $ksft_xfail, etc. The current logic in check_err() is such that first non-zero value of RET trumps all those that follow. But that is not right when RET has more fine-grained value semantics. Different outcomes have different weights. The results of PASS and XFAIL are mostly the same: they both communicate a test that did not go wrong. SKIP communicates lack of tooling, which the user should go and try to fix, and as such should not be overridden by the passes. So far, the higher-numbered statuses can be considered weightier. But FAIL should be the weightiest. Add a helper, ksft_status_merge(), which merges two statuses in a way that respects the above conditions. Express it in a generic manner, because exit status merge is subtly different, and we want to reuse the same logic. Use the new helper when setting RET in check_err(). Re-express check_fail() in terms of check_err() to avoid duplication. Signed-off-by: Petr Machata --- Notes: v1: - Clarify intended usage by s/set_ret/ret_set_ksft_status/, s/nret/ksft_status/ tools/testing/selftests/net/forwarding/lib.sh | 21 ++++++++----- tools/testing/selftests/net/lib.sh | 30 +++++++++++++++++++ 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 5415b8d29862..ee8153651b38 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -396,14 +396,24 @@ EXIT_STATUS=0 # Per-test return value. Clear at the beginning of each test. RET=0 +ret_set_ksft_status() +{ + local ksft_status=$1; shift + local msg=$1; shift + + RET=$(ksft_status_merge $RET $ksft_status) + if (( $? )); then + retmsg=$msg + fi +} + check_err() { local err=$1 local msg=$2 - if [[ $RET -eq 0 && $err -ne 0 ]]; then - RET=$err - retmsg=$msg + if ((err)); then + ret_set_ksft_status $ksft_fail "$msg" fi } @@ -412,10 +422,7 @@ check_fail() local err=$1 local msg=$2 - if [[ $RET -eq 0 && $err -eq 0 ]]; then - RET=1 - retmsg=$msg - fi + check_err $((!err)) "$msg" } check_err_fail() diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh index d9bdf6aa3bf1..88f6133ca319 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -19,6 +19,36 @@ NS_LIST="" ############################################################################## # Helpers + +__ksft_status_merge() +{ + local a=$1; shift + local b=$1; shift + local -A weights + local weight=0 + + for i in "$@"; do + weights[$i]=$((weight++)) + done + + if [[ ${weights[$a]} > ${weights[$b]} ]]; then + echo "$a" + return 0 + else + echo "$b" + return 1 + fi +} + +ksft_status_merge() +{ + local a=$1; shift + local b=$1; shift + + __ksft_status_merge "$a" "$b" \ + $ksft_pass $ksft_xfail $ksft_skip $ksft_fail +} + busywait() { local timeout=$1; shift From patchwork Tue Mar 26 16:54:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13604732 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2066.outbound.protection.outlook.com [40.107.96.66]) (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 3ABC61CD11; Tue, 26 Mar 2024 17:02:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472524; cv=fail; b=P3foR8eYqSelhzGkkGg2OlnJi0qY3Y7AiNnimFkkIpZtFZnUyajnSocierMvJQW4q7rW+OpXTmHPBX9hTuiZcFYeXas5X841/+Ur8Y++amDIKLTXIFA8JHdomZlQQNX+0gSyGvmQYmr2G3aIwvIAuGfADsreaIDme507LbeFNOQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472524; c=relaxed/simple; bh=bIdZR29d71wog5DD+7gm3SQN4+IqO7xFShC5Vvpj8tw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=n9/BXGILR/5zdRhMDiDoNv8p8yqWvXoeRjIW306G3atdxCJN3w7vF0PQOtUiGLRnbJzjlF8IqbWsEtIYsXAJAGF56f2CWyPpFeSHdGo2vrQI1rC+c8AfUV0kyN/sYIywGJzWDDlNhoVb5PCq4AYbEXZrrKjC7I8AOIVyAuQOfO8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=Iobb6EHG; arc=fail smtp.client-ip=40.107.96.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Iobb6EHG" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H8pW2wz393tuX8ZVbRUYVZ1N3FRC4PgTHUdIZN93/PirCzWpvFIAMCsqa12oFme5Ax1I5ugRslR3SX20NPeE/U+CdfiMYhx92jBa+4B6LbKxFR6l9y+YUAR1Jb1zNBeI0CbmkhGg/PxcZ5zbfzcBeUHWj2eiWlhldxD8oiOv2DRZ0z4S63O08qNpXq3R2v9mK5XGyf9Zr/DSUOqVuGc0ovrxKkDsl104CSdMjg5D3h6NaIPcXk83ELWN7OBC1pmG6yg33BhxI4UXveInPMIJZ4IY0EV9cxF4NO8YZVZ3In3VemdUImsaB4ym6oimyrxVKoNFfXM85zQ0IL0dWjOchA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=14NYtEbeH0hz72BbkVr5R+v1zHQPqoAs0iuS1ashEos=; b=QvmjTOxZcVbqkzMvhlBcRjLyXRgnWFfaDrvv9ZXR5zL4o/Q8qWvNkxnamnLBflAket4AH7zK+iM4zEV+UFpzBm4xG81H01lfL30o9ZWjGHzN/lZ8yBXh79ymo1fj4pIlop1JGFbMiaWQlrxhYj6kvPAd93kR5GYwWxetKZDohlkutV6FHR0pdvmmljA+tPAt8NgfHFYaYoK/2uI8QSt90NLVkrlBpyW2d5sWl7+3LhEpjtSrwYDJeRF4mmCvSKGktF1Kvy5dq5H2yRU8sxVeokDF6THblJi1mGdzvS+wnp5y7W49IHDNT4cZvVSZNbOt8V5ug3qhDciKe7x4lE+Kow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=14NYtEbeH0hz72BbkVr5R+v1zHQPqoAs0iuS1ashEos=; b=Iobb6EHGPbY8r3ERO8hmSrRsNpQdihQ4S3T+ZQYnFy1cJT0xRC2ER4AdY3BCimAiygUeRQgWCRnFtrVQ12sLaYv13rkGCpMXjsQDeDAXNFtTYYHG9EzEUHh64iCpBpuBwECLc8a8EtGBl/SLeO+sqw5nd0aERyv1945V3NsP6SqybBrfygnu688avMQPovagAQeHjxV3L6mqDc5W5jPB61J4PD0Z7m6LXOm3wAm07tNRQ2wuREF9U36fgkjdiuuJyHdROFtekqPiF8zCTn6UhkgMU7LKXuTeOdDgWmZEVhHHbWG5CgWl4xpG4F/puv3viyaCSj0lYd0fyl1p3P1BxA== Received: from CH0PR03CA0399.namprd03.prod.outlook.com (2603:10b6:610:11b::18) by DM4PR12MB6037.namprd12.prod.outlook.com (2603:10b6:8:b0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.32; Tue, 26 Mar 2024 17:01:40 +0000 Received: from CH3PEPF0000000D.namprd04.prod.outlook.com (2603:10b6:610:11b:cafe::d1) by CH0PR03CA0399.outlook.office365.com (2603:10b6:610:11b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Tue, 26 Mar 2024 17:01:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CH3PEPF0000000D.mail.protection.outlook.com (10.167.244.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 17:01:37 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 26 Mar 2024 10:01:07 -0700 Received: from localhost.localdomain (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 26 Mar 2024 10:01:01 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Shuah Khan , Nikolay Aleksandrov , Hangbin Liu , Vladimir Oltean , Benjamin Poirier , "Ido Schimmel" , Jiri Pirko , , Petr Machata , Subject: [PATCH net-next 10/14] selftests: forwarding: Convert log_test() to recognize RET values Date: Tue, 26 Mar 2024 17:54:37 +0100 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF0000000D:EE_|DM4PR12MB6037:EE_ X-MS-Office365-Filtering-Correlation-Id: 592f3fc5-de39-45f8-fa39-08dc4db66672 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: daB0S9nHk/O6Iqi+YUqqolXK2WTzbyPr0yGchej56548sfQvl8Xj9Iia1qyA95LIXywOfV7zNgmVFGGP9mWr48LLla965xbjPdwmPSr1HOG2onlF7T//hyPrE20RrEWDNwhD0ChE0iliDptmVDmsuVoHzDB8yn3msGzbu9XcW+wjgGfp8yr/W1Qg8lbWYXcyogeqeQCb3NBwbMO1HhSeKObO+j2OjM+cKcfa8T/eYx/txquATa+H12hzAddKt5IhwXCynOAWuqZUB0GcaM0vUO0lBs0kdS8A4LimZRhreP3/3/BrgAKQIezBbtvEtlSULtxiphTp16bZglReBqTE5a4vDRBsLvWe0KEg3eZq5WgevW5RYQEtXMiO4rVwSTv4CuxLmPE9wtddB43alsZ64AHODkiDutXgrTDbh6m0dmExQs2ZXwrx21pnWwN0jAscT2SKAuF8lb1RdG5jPUzWgR+W+V8zXeyzbVUApG7ywnrP45zqrRE7ioUugRvUS7U4IjEo7iSoTtO7tFZFWxU91s9p+lGFp3gSMYZFOACVzswv6BS3Ddi3q5lN7M8qy4jwbKRma1JOyPfxHCuhnLeygFIP21GOINo/AMlzSy1NuL0ot/2qJC6OV+mHmtZcn2xhIbCIUxKiMC889m5G1hn8/boI+nU70+fdg/3TvGKlJGy221pOq6yHI7EXThNS3q2L+7KwbG4qkRx6gNcWsLSDGpPL0H2LF5HZg/WSPQbWYTqvuLa0Ok9mYkwo6Gj39e9o X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(36860700004)(7416005)(82310400014)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 17:01:37.6403 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 592f3fc5-de39-45f8-fa39-08dc4db66672 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH3PEPF0000000D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6037 X-Patchwork-Delegate: kuba@kernel.org In a previous patch, the interpretation of RET value was changed to mean the kselftest framework constant with the test outcome: $ksft_pass, $ksft_xfail, etc. Update log_test() to recognize the various possible RET values. Then have EXIT_STATUS track the RET value of the current test. This differs subtly from the way RET tracks the value: while for RET we want to recognize XFAIL as a separate status, for purposes of exit code, we want to to conflate XFAIL and PASS, because they both communicate non-failure. Thus add a new helper, ksft_exit_status_merge(). With this log_test_skip() and log_test_xfail() can be reexpressed as thin wrappers around log_test. Signed-off-by: Petr Machata --- tools/testing/selftests/net/forwarding/lib.sh | 92 ++++++++++++++----- tools/testing/selftests/net/lib.sh | 9 ++ 2 files changed, 77 insertions(+), 24 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index ee8153651b38..370fc377249b 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -438,6 +438,62 @@ check_err_fail() fi } +log_test_result() +{ + local test_name=$1; shift + local opt_str=$1; shift + local result=$1; shift + local retmsg=$1; shift + + printf "TEST: %-60s [%s]\n" "$test_name $opt_str" "$result" + if [[ $retmsg ]]; then + printf "\t%s\n" "$retmsg" + fi +} + +pause_on_fail() +{ + if [[ $PAUSE_ON_FAIL == yes ]]; then + echo "Hit enter to continue, 'q' to quit" + read a + [[ $a == q ]] && exit 1 + fi +} + +handle_test_result_pass() +{ + local test_name=$1; shift + local opt_str=$1; shift + + log_test_result "$test_name" "$opt_str" " OK " +} + +handle_test_result_fail() +{ + local test_name=$1; shift + local opt_str=$1; shift + + log_test_result "$test_name" "$opt_str" FAIL "$retmsg" + pause_on_fail +} + +handle_test_result_xfail() +{ + local test_name=$1; shift + local opt_str=$1; shift + + log_test_result "$test_name" "$opt_str" XFAIL "$retmsg" + pause_on_fail +} + +handle_test_result_skip() +{ + local test_name=$1; shift + local opt_str=$1; shift + + log_test_result "$test_name" "$opt_str" SKIP "$retmsg" +} + log_test() { local test_name=$1 @@ -447,40 +503,28 @@ log_test() opt_str="($opt_str)" fi - if [[ $RET -ne 0 ]]; then - EXIT_STATUS=1 - printf "TEST: %-60s [FAIL]\n" "$test_name $opt_str" - if [[ ! -z "$retmsg" ]]; then - printf "\t%s\n" "$retmsg" - fi - if [ "${PAUSE_ON_FAIL}" = "yes" ]; then - echo "Hit enter to continue, 'q' to quit" - read a - [ "$a" = "q" ] && exit 1 - fi - return 1 + if ((RET == ksft_pass)); then + handle_test_result_pass "$test_name" "$opt_str" + elif ((RET == ksft_xfail)); then + handle_test_result_xfail "$test_name" "$opt_str" + elif ((RET == ksft_skip)); then + handle_test_result_skip "$test_name" "$opt_str" + else + handle_test_result_fail "$test_name" "$opt_str" fi - printf "TEST: %-60s [ OK ]\n" "$test_name $opt_str" - return 0 + EXIT_STATUS=$(ksft_exit_status_merge $EXIT_STATUS $RET) + return $RET } log_test_skip() { - local test_name=$1 - local opt_str=$2 - - printf "TEST: %-60s [SKIP]\n" "$test_name $opt_str" - return 0 + RET=$ksft_skip retmsg= log_test "$@" } log_test_xfail() { - local test_name=$1 - local opt_str=$2 - - printf "TEST: %-60s [XFAIL]\n" "$test_name $opt_str" - return 0 + RET=$ksft_xfail retmsg= log_test "$@" } log_info() diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh index 88f6133ca319..b7f7b8695165 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -49,6 +49,15 @@ ksft_status_merge() $ksft_pass $ksft_xfail $ksft_skip $ksft_fail } +ksft_exit_status_merge() +{ + local a=$1; shift + local b=$1; shift + + __ksft_status_merge "$a" "$b" \ + $ksft_xfail $ksft_pass $ksft_skip $ksft_fail +} + busywait() { local timeout=$1; shift From patchwork Tue Mar 26 16:54:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13604730 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2074.outbound.protection.outlook.com [40.107.94.74]) (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 9C7D34DA0E; Tue, 26 Mar 2024 17:01:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472513; cv=fail; b=CFbKH/Wqdhs062fs6f96Us7ElrKZgMtey+kSWx/ItPOmdNdR72EN2OLszVlYxn/4aDX7//vewIXTr8AYJJuHZhab3MmxDkaB0v5HuPHWSriHVIwe+HBDZP5+Ie7CtsHEllSd6UPlz86pOyEk/MhA5vhL/D0otX17jhC41p4jiOY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472513; c=relaxed/simple; bh=alPKKQmFZK/MjzQkgYuO5XDPT8deYr5TqtlE/AVOcHA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=H7jPSVLZAlkxZtSNwHfZ//c/ETspWDKigXy7RklM0ePeRiBZxI16dXQCZT5aRHeIcpjnqTQaufU0wnq3VFCko8yyPNyR0KuPkxBhFkkY8xZ/1eLs3QU/RU1wArW89rmmp6Gww7nArJXhVqMeFLB+S3RJBICxWAzH+1MREEF/RHU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=OtWVLH23; arc=fail smtp.client-ip=40.107.94.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="OtWVLH23" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fNVDbr48udadTVrinjGnj7SMzHRS9XG5WC/i5K/wmKzhoD6IUIzga8JVvZUzY3TI6/5BGr/71Z9PoqsZ3gSJu3BaWcgkbpJsrFkw8GpKlVSrmqRhQDQvxqyonwCLHRkA/pJ+8Y3tliMQ9vkS24xz9HqL/AHrwtWdYfDGrurmwKL2UO0LgF/vF+mYqWq9E7jgdLUsGRCvRmo4n+FXsf9sreAgpemLMYmVGYQDGC2vNyAR/EK8l34ojt3EEtovrAJYtABpSJhu6zNDXLeeB7YqsI1HlQwmTQcEJSSJhX8ezJVvvTQGtXWgrWzV4HfX4e4a2hAufBBjNvAe0RmcK5ty7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GeG/StRSGKOdgGrgOT+M6Ke9nKFrPhwQAizDaYFKBvg=; b=RZliXNUOFUq7r5qIRbDXfFBVxxPJKoXck42MXGAIZbrdOfKMM8nAN84OTTTDEM3yWjNAFfiRuTQ1zFwxAs3wrfRlN6CyjUv60o8VQfBKVD3KqP5L2XANRnGbrue0q4SZnOY8zDob2XrLo4z7d7u4nqz6yysE3Jek0daRUIoe6yO8QE3dR39Kh3JaxWHDRgWaQCA6sQbNIV42+vOP3cHq2kcfKUZWuS4ZzXpAtntvUnpGElvU/N1C4LwIRzspI1hd63td5zh5lODRdqzfJnL7822bgZg3dexzIsbiKwFCpQR4xcDDqWDRMZN8dkHw0wT28KU15z0jMssVXwvR+54siQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GeG/StRSGKOdgGrgOT+M6Ke9nKFrPhwQAizDaYFKBvg=; b=OtWVLH231BEQJwqAO4L1c68kuVTbCNZJioM4EDkhV/VIlbG/PxPM4Pi2TGLutSqY5XS6g331twylFiWA8/NiIrid00xHQDA6pMNsRPfN8yQ1V8MfXUjjYh37hYpoxEH9b8FMshOe8tiJplhcY2Zo4hWoXE4V862ZEAamivaUH446QFt6kMj5CibTxLoK86IkFoSBiT60sHjippC6Qjn+sFJEKv0YA24FFuW91YJlUG6x28V5ZYv2lNxYrtxGKKV8JEM6FbklOV71j/Os8plb/lk9wJNEo9XOFmL9l1Dp2RFI/KqPWKh2SC2WZCbxtOmgLoxENPuYa+eFimCry1Afqw== Received: from BN0PR04CA0058.namprd04.prod.outlook.com (2603:10b6:408:e8::33) by SJ0PR12MB6760.namprd12.prod.outlook.com (2603:10b6:a03:44c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Tue, 26 Mar 2024 17:01:48 +0000 Received: from BN1PEPF00004685.namprd03.prod.outlook.com (2603:10b6:408:e8:cafe::ae) by BN0PR04CA0058.outlook.office365.com (2603:10b6:408:e8::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Tue, 26 Mar 2024 17:01:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN1PEPF00004685.mail.protection.outlook.com (10.167.243.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 17:01:47 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 26 Mar 2024 10:01:13 -0700 Received: from localhost.localdomain (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 26 Mar 2024 10:01:07 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Shuah Khan , Nikolay Aleksandrov , Hangbin Liu , Vladimir Oltean , Benjamin Poirier , "Ido Schimmel" , Jiri Pirko , , Petr Machata , Subject: [PATCH net-next 11/14] selftests: forwarding: Support for performance sensitive tests Date: Tue, 26 Mar 2024 17:54:38 +0100 Message-ID: <99a376a2d2ffdaeee7752b1910cb0c3ea5d80fbe.1711464583.git.petrm@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004685:EE_|SJ0PR12MB6760:EE_ X-MS-Office365-Filtering-Correlation-Id: c63ff331-4821-495c-cdee-08dc4db66c62 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ii5yI0xCxMyS7y6qvoaGrXdJgCjmuIMsraQDbfE5KUJ2njubgh8DSNqaYehizwr8X3IeWZuJQj9PzyF2X1iDC8oE0UlkNogJp8T+QDQ+JN/+Gf1eMYOBY6fpPaZiyGyFsROvaP+urIGz7+A1hS89sZoTLIbG9CXsbRnr/MlgEhpPemkfqvfxm39v7UzwclSHhwEkaTs9c5kPj0WDTToUexcKgEp78zkQv4IYjljAB5L809Kc+qcAjcowty+9kXAwkJx9Lwgsm6m6x638JxtYeScZzvn3r91x/H1/vBMUE0/JbfyvgqNqVfBQdHRrcD+QYLdtQmObyQmEZojKpSR5J9z16UJT3/Fcb4n5dNdfXZYY0Gv/WLJFawDyBKNrKEJPhyBF5Gsc54Z85LNNUPVlC/jOZbRvN8XbopUwU3LJ3QbhqruI3ICiePwkd/stsy4o4DFwbz/C6NQGT4vmmKy42pEN1Dcan3SUCKeLxej8wXEPeECRw9R0mhptp1BLvkGFua/PHuiEU7RHNbATdW1PqMrVni5d3pqNLObk4di7MeWPwF7fFwxIi+obaB6/Yc3ySNXaf37SZ/ViTjZLF9BN0u8PSUrRekZrF0vv4x75eb7zcgQfIopR/8Syd2wqUwHUi4OJp81iOIWjqnyrPzhmD5cJIkylqGS7+BTCepV3ky399j+rmbPuqZ8m2yRBEj8rXp62cU5FQ+vxZMIW981AAJqSk2InEU+U3LwDjCQW9JVSfGkhV2f/ZtnCxWO/5f2m X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(36860700004)(82310400014)(376005)(7416005)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 17:01:47.5693 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c63ff331-4821-495c-cdee-08dc4db66c62 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00004685.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6760 X-Patchwork-Delegate: kuba@kernel.org Several tests in the suite use large amounts of traffic to e.g. cause congestion and evaluate RED or shaper performance. These tests will not run well on a slow machine, be it one with heavy debug kernel, or a VM, or e.g. a single-board computer. Allow users to specify an environment variable, KSFT_MACHINE_SLOW=yes, to indicate that the tests are being run on one such machine. Performance sensitive tests can then use a new helper, xfail_on_slow(), to mark parts of the test that are sensitive to low-performance machines. The helper can be used to just mark the whole suite, like so: xfail_on_slow tests_run ... or, on the other side of the granularity spectrum, to override individual checks: xfail_on_slow check_err $? "Expected much, got little." Signed-off-by: Petr Machata --- tools/testing/selftests/net/forwarding/lib.sh | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 370fc377249b..58df57855bff 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -79,6 +79,11 @@ declare -A NETIFS=( # Flags for TC filters. : "${TC_FLAG:=skip_hw}" +# Whether the machine is "slow" -- i.e. might be incapable of running tests +# involving heavy traffic. This might be the case on a debug kernel, a VM, or +# e.g. a low-power board. +: "${KSFT_MACHINE_SLOW:=no}" + net_forwarding_dir=$(dirname "$(readlink -e "${BASH_SOURCE[0]}")") if [[ -f $net_forwarding_dir/forwarding.config ]]; then @@ -407,13 +412,20 @@ ret_set_ksft_status() fi } +# Whether FAILs should be interpreted as XFAILs. Internal. +FAIL_TO_XFAIL= + check_err() { local err=$1 local msg=$2 if ((err)); then - ret_set_ksft_status $ksft_fail "$msg" + if [[ $FAIL_TO_XFAIL = yes ]]; then + ret_set_ksft_status $ksft_xfail "$msg" + else + ret_set_ksft_status $ksft_fail "$msg" + fi fi } @@ -438,6 +450,15 @@ check_err_fail() fi } +xfail_on_slow() +{ + if [[ $KSFT_MACHINE_SLOW = yes ]]; then + FAIL_TO_XFAIL=yes "$@" + else + "$@" + fi +} + log_test_result() { local test_name=$1; shift From patchwork Tue Mar 26 16:54:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13604731 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2084.outbound.protection.outlook.com [40.107.94.84]) (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 A2E2A1CD11; Tue, 26 Mar 2024 17:01:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.84 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472519; cv=fail; b=UiysHZoXzA2M1Oqi0eYL8HJ1lGaXyxILwR7HVSWcy+ZCAPlGECJYpasOK0q42qvtclp9OsWQmT/otq0d/nSxafA2XjbK7bFy/q7DAYd9Jc30JzdBGxMwqAxsOgpKHRHWVVgZd1dtvG6WgbQMNdAjCfELpP729QXZgyt0MHsJn+U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472519; c=relaxed/simple; bh=sSYwjOrOgKy6m8wve4tKsRPt+gTovOReL5XmBXqY8s4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cT8zP3u7qxw3nsDbBr92rymmahfrhv2vmrKU8GjZtXB70q0FnG/pXOkZ2TQ6Xb6rLnbNO5mzmoG4b33wIGB/PegKmVWX/tHSw8mgqFjytHAbV8N05St6Sjnb6zG0K5VB83fmhGiEWrjQbMPYNH4P/czSpTDcYhMxSEcLoWPfq/Y= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=fvfI+kkB; arc=fail smtp.client-ip=40.107.94.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="fvfI+kkB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V+ip01aFAqIWrswrgSDKiSQeMovGdji/9qiZlY95SxxmfotvZb3UcHox3RrgMyZcgsIqiGe7iB69Ht2eUdOa0M1ODEDwsA+s7DUfoo+brVeYg1PYiKEc4WAEYBuFK2TEvgtoKlOPHritZ24wehGrGJJ9bFwIbQ91US91mn3lQeksaX0pSxzd44ikRJPKCETjEnWsRJ60rUVW38cAXOTrVKxjHTU3C045dNCPraVmEqNYWD4V5yh5pW8Zs13dsKwG9oWHCJhgeANCqIxY6opXKWrjORr9HUgiMCpP4r+dvHiW59tjj3Esv72DC0Sy7hVJaunug7zkkSW/JkHYGm26Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/6cJ6yKi8ZqS5c31O3GhLJGCv/2kZHpaea/0vl72qBg=; b=a5qED0A7QZ0j8WWgLVxU+slzdSehtoUr++4FcF7TrOl64Z0Qij6NsuFrmRFRQm7E7wETVn3bKGuVuB5+9/FHIxKUvYcLixYXy5y2DBUCvrXE0qt8Zq7ASXQm5vEISdURIccdWpSC20CGMtw/b1I9CZBfjXxXjlPXK1F+TGe3bgPhl7+dZr+kTydii0DuOl/Th3tgcVBzGWsTb2DCDiH1mHZShsh1BAWt4MCAxNKCLa9TTWgdb6MNxvCPgrizbA0Gg6Uh2fqXsCVYwa1Ll62BaFia6OkCq0fHIKug8hXyM/Id4wcJ7+uw+20gkiAFCw0gIGtodPKM9lqdrY0HRB+sTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/6cJ6yKi8ZqS5c31O3GhLJGCv/2kZHpaea/0vl72qBg=; b=fvfI+kkB9JY8iljXu7M8rnV4GSbJaTjzQM5T1tckUbz7ygBUSCtv1ZisxFujugsZJvzBF05sYmRzcYZtencwMeIcVxHPzSv4ibV+qKPvgIRzl7X1XWIbNqWW1SO/k8VdydUKIrFZThPk/KG4O1VshUZgfg5hqNGv8BQy+lenBfDLhQUeS7emAJhg1ENH/GEYgP3uzQljIeB2hx25+ijVzfoj19bskCK8ipIyOC1PQPvuAJrbd048SC7789wEVwl3cBgEgiN1xRebK77FZDNtoQy3zzAXMADmu78qWDQEfkma143mJsJrEchNJYzOyKI3MIxUTZgT1UbZU4jABrE6yw== Received: from CH0PR04CA0043.namprd04.prod.outlook.com (2603:10b6:610:77::18) by SJ2PR12MB9192.namprd12.prod.outlook.com (2603:10b6:a03:55d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.24; Tue, 26 Mar 2024 17:01:49 +0000 Received: from CH3PEPF00000009.namprd04.prod.outlook.com (2603:10b6:610:77:cafe::6) by CH0PR04CA0043.outlook.office365.com (2603:10b6:610:77::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.27 via Frontend Transport; Tue, 26 Mar 2024 17:01:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CH3PEPF00000009.mail.protection.outlook.com (10.167.244.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 17:01:48 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 26 Mar 2024 10:01:20 -0700 Received: from localhost.localdomain (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 26 Mar 2024 10:01:14 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Shuah Khan , Nikolay Aleksandrov , Hangbin Liu , Vladimir Oltean , Benjamin Poirier , "Ido Schimmel" , Jiri Pirko , , Petr Machata , Subject: [PATCH net-next 12/14] selftests: forwarding: Mark performance-sensitive tests Date: Tue, 26 Mar 2024 17:54:39 +0100 Message-ID: <9a357f8cf34f5ececac08d43a3eb023008996035.1711464583.git.petrm@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF00000009:EE_|SJ2PR12MB9192:EE_ X-MS-Office365-Filtering-Correlation-Id: 1511c3f8-42ac-4f97-50d1-08dc4db66cf9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FmL+CbtpT9TeFKSlRSrs2QpbkYr4AXIXmBhl40/XSIEq6tAqwCoBvuBrqNBDiVIyMLY61c1WnnBsMSEeiMI82ZsqLI61b+5OrzDxtY7YMbJ12pAEtGgmBf00vn5X/GkcmhExw+SN/+vA+qljlSM2DeErsXkpPxnnxuLs6qqzQH4vo3UUO4zzEaHFxUYYSupaLAvreIwq6w8oZ3oMlE2YGqxO3Hjv4DUHS5xZrF94PLPc3EBQh14DR2H4rhoL5ACh3oG2pdY3R1HPJxlAazTbLhQsCq4qY+kn9fBB2NX1nuRMYge5GTT/xGfWDM+e5H0rJwR6mz1Y5A7vMU6FQhQusAz2kNg4Dy6prVExA6E6o04s/fng1r/Syj652lyJ34f4bmcrdFl/fad/IAltB+4/eVPAGBRB34A+nLakZSb8uXy9oT9Q95gz8IH66cheySO2w/wUjQwTHKZwZscVb7kF8mmYdHnvoz5rOW7QcyPHv6YZwDF8UXCV95UW0QvQXMolFuWXSJzovjF88mUIKJIIQN1yJlL7y/kEzcVXGsZ1H9Qc1J2K1vR72CzQpJky3kqcnuBnsxqUaHFHJwJumEeZ8VXG8dxXykZBSJ1ltUQsAkLISamzTMstWfhaLIJ3fRAw1EuGy7RogOCgCMPKHplImqNWMQVAVJtoOK3GjKe6Gu4uy8NPtEi0JVRT+Qft32UxZGa2fi0pm6parCP+bIwK0gzRnychDoi1YXTWxpfMHhXrztWbBNrUWuzt7QeP4NV6 X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(1800799015)(376005)(82310400014)(36860700004)(7416005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 17:01:48.5714 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1511c3f8-42ac-4f97-50d1-08dc4db66cf9 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH3PEPF00000009.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9192 X-Patchwork-Delegate: kuba@kernel.org When run on a slow machine, the scheduler traffic tests can be expected to fail, and should be reported as XFAIL in that case. Therefore run these tests through the perf_sensitive wrapper. Signed-off-by: Petr Machata --- .../selftests/net/forwarding/sch_ets_tests.sh | 19 +++++++++++-------- .../selftests/net/forwarding/sch_red.sh | 10 +++++----- .../selftests/net/forwarding/sch_tbf_core.sh | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/sch_ets_tests.sh b/tools/testing/selftests/net/forwarding/sch_ets_tests.sh index cdf689e99458..f9d26a7911bb 100644 --- a/tools/testing/selftests/net/forwarding/sch_ets_tests.sh +++ b/tools/testing/selftests/net/forwarding/sch_ets_tests.sh @@ -199,25 +199,28 @@ ets_set_dwrr_two_bands() ets_test_strict() { ets_set_strict - ets_dwrr_test_01 - ets_dwrr_test_12 + xfail_on_slow ets_dwrr_test_01 + xfail_on_slow ets_dwrr_test_12 } ets_test_mixed() { ets_set_mixed - ets_dwrr_test_01 - ets_dwrr_test_12 + xfail_on_slow ets_dwrr_test_01 + xfail_on_slow ets_dwrr_test_12 } ets_test_dwrr() { ets_set_dwrr_uniform - ets_dwrr_test_012 + xfail_on_slow ets_dwrr_test_012 + ets_set_dwrr_varying - ets_dwrr_test_012 + xfail_on_slow ets_dwrr_test_012 + ets_change_quantum - ets_dwrr_test_012 + xfail_on_slow ets_dwrr_test_012 + ets_set_dwrr_two_bands - ets_dwrr_test_01 + xfail_on_slow ets_dwrr_test_01 } diff --git a/tools/testing/selftests/net/forwarding/sch_red.sh b/tools/testing/selftests/net/forwarding/sch_red.sh index 81f31179ac88..17f28644568e 100755 --- a/tools/testing/selftests/net/forwarding/sch_red.sh +++ b/tools/testing/selftests/net/forwarding/sch_red.sh @@ -451,35 +451,35 @@ uninstall_qdisc() ecn_test() { install_qdisc ecn - do_ecn_test $BACKLOG + xfail_on_slow do_ecn_test $BACKLOG uninstall_qdisc } ecn_nodrop_test() { install_qdisc ecn nodrop - do_ecn_nodrop_test $BACKLOG + xfail_on_slow do_ecn_nodrop_test $BACKLOG uninstall_qdisc } red_test() { install_qdisc - do_red_test $BACKLOG + xfail_on_slow do_red_test $BACKLOG uninstall_qdisc } red_qevent_test() { install_qdisc qevent early_drop block 10 - do_red_qevent_test $BACKLOG + xfail_on_slow do_red_qevent_test $BACKLOG uninstall_qdisc } ecn_qevent_test() { install_qdisc ecn qevent mark block 10 - do_ecn_qevent_test $BACKLOG + xfail_on_slow do_ecn_qevent_test $BACKLOG uninstall_qdisc } diff --git a/tools/testing/selftests/net/forwarding/sch_tbf_core.sh b/tools/testing/selftests/net/forwarding/sch_tbf_core.sh index d1f26cb7cd73..9cd884d4a5de 100644 --- a/tools/testing/selftests/net/forwarding/sch_tbf_core.sh +++ b/tools/testing/selftests/net/forwarding/sch_tbf_core.sh @@ -227,7 +227,7 @@ do_tbf_test() local nr=$(rate $t2 $t3 10) local nr_pct=$((100 * (nr - er) / er)) ((-5 <= nr_pct && nr_pct <= 5)) - check_err $? "Expected rate $(humanize $er), got $(humanize $nr), which is $nr_pct% off. Required accuracy is +-5%." + xfail_on_slow check_err $? "Expected rate $(humanize $er), got $(humanize $nr), which is $nr_pct% off. Required accuracy is +-5%." log_test "TC $((vlan - 10)): TBF rate ${mbit}Mbit" } From patchwork Tue Mar 26 16:54:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13604733 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2042.outbound.protection.outlook.com [40.107.237.42]) (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 679BF13D519; Tue, 26 Mar 2024 17:02:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472528; cv=fail; b=fooV6T67rcHJPTGRcD22BQzZgEvcRfx0rA823kA30j12gkaZiEQztsFES+mEISHkygVGz0qg446Um6jOUafy0wmt4BnsVPB5a6eG+1L8ZVrteHcKYePERjLLvwYf7Lm9FSvYr1ivbbDsjpiJTayAcgXt/2FmVFVPjkb+yAVX4Gg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472528; c=relaxed/simple; bh=+e09gFd1Ey7yx9/ihKE4m8zZz7PlKXX2DE515T37eBc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EAR0+yaRdDk/xRGVOIXh0ePNrXk60WvA5XcvpRQRW6OMjRawx7p3P3bpCMdiBxfODLoNqoYFhGQzxSXLTbabHOSewX4TFk8dzBpYTEFpec9lJoGxKOJ++Y4GnkPabg8Yrrvw0lSZaAz2MKLfwhhBG0fqdMMEV79IDlsOYWwjZM8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=E7zgNVpM; arc=fail smtp.client-ip=40.107.237.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="E7zgNVpM" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KUu2LjinVDFxej0twGpCL6LIrfz+pi375a9Xep7p1BzVzqSi6k/c4r2tjvv7NA+3CtQOXaOSaQHMCj5rCWy+6OcqylgxxfNMTxL6QH6P7mpcEVW5GNBV7UjBtwDWNJCiqj+psNQX12S4qy7o7EFHYuAiYRAN0SVYwFg1sTTpM0O2tK1z4yNFIw5RG4vlQ0ckb2xYZZMGlj9Gm2uxfJrj4FxBAMpgLFGBTRJE+kTiGylRC2o0IjUsQnLf1D90WJbE0WAJdPJJtszYrjXnO8JEAUpcf2T0r9qVmb2EzVPRD+fKqrq7qz/1nsqW55l6O48/dpRQo1zxKMkJewd09uxTRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=W7sbgzMJiAtzTUrgb5Sbt851ursJ6UfzsRURrAyQZwU=; b=CPggptNxHA/Bme7HNkgRoZMBL/bxiWlLHIh8kKG4lhrF2y1mImdfRqYKfKbeZRw97nZFiNsHl9awCDTSiZkgHWcqOcaLpEgVDF/86t/yFbvQ2OC86b4MzmNVKz9w9vPAC1t2MOvg1HbDqXAYLMAf1on8/skchSwgtnhi1KLleFYtZfqOanPiKDGRghegEBX6bHnF5f6VQCrd6BAXqssL/1gYbagmObMVGJ8VwAx9l1lydu9/GoDFxQ4YQ4noekDaE69midAwqY243Vrp6q7mq7qf15SN2sIImBL02D7lCZAmoOwbtBaR8PVLKJuoaM8IzV/v6rz0Vxho0bjibN/mgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=W7sbgzMJiAtzTUrgb5Sbt851ursJ6UfzsRURrAyQZwU=; b=E7zgNVpM1CbxpN+yQk8DCM5A7DacnxpkHfpDoY1i8Iag2DtCfj7oBhNrLlf2gQLcuelEvSxQWvsUyuZWg7BBbGOhIyTp+U0dKAZ3HcF80nsIdVOgzqqWjaG+lrxhjOcsbmSrq3UEoRy6be8HaMqqqBkCzRlPSEDloC5Jy1icXOhIdzpuV7SGvAE9LmszuUQooNN9EOU40a4NbG10espyFQHM+TKRDL7hDiaCPwjYMTfMZn6514BZ68qoSreMlQmzERkj7eWbWjSAgUQWOR7da3KzxIvLdAAhy2ltcYJXQtwn7GSCZ5W46t4OYLvjZG+NkapZRfj33bUivpS80ogMGw== Received: from BN0PR02CA0029.namprd02.prod.outlook.com (2603:10b6:408:e4::34) by PH7PR12MB5595.namprd12.prod.outlook.com (2603:10b6:510:135::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Tue, 26 Mar 2024 17:01:59 +0000 Received: from BN1PEPF00004681.namprd03.prod.outlook.com (2603:10b6:408:e4:cafe::79) by BN0PR02CA0029.outlook.office365.com (2603:10b6:408:e4::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26 via Frontend Transport; Tue, 26 Mar 2024 17:01:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN1PEPF00004681.mail.protection.outlook.com (10.167.243.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 17:01:58 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 26 Mar 2024 10:01:26 -0700 Received: from localhost.localdomain (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 26 Mar 2024 10:01:20 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Shuah Khan , Nikolay Aleksandrov , Hangbin Liu , Vladimir Oltean , Benjamin Poirier , "Ido Schimmel" , Jiri Pirko , , Petr Machata , Subject: [PATCH net-next 13/14] selftests: forwarding: router_mpath_nh_lib: Don't skip, xfail on veth Date: Tue, 26 Mar 2024 17:54:40 +0100 Message-ID: <15f0ab9637aa0497f164ec30e83c1c8f53d53719.1711464583.git.petrm@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00004681:EE_|PH7PR12MB5595:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a55ff65-c566-4ebf-de51-08dc4db67306 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qHUY+KNp2G3x7VwAz8hhrN7nJdUSOscyrWLCcs4uawTG50LV6ucVyyoiIdTDagHCqUMX17m2FOdFveRHBI/r4wsUC9cxrHXCoyLxsatpzTXRIyuJgQDX45xe4MWLA7uP8Re+NkiwRajOa+bbVuVUoF+/4vVXNL8gG7cPCHoFAbQLJc0Q4vAMJkWDpZ7OY2s5n+4FmgqF0NrVmOmbmsmh9h2SIdHwVBT+pMFSr2JxRL16OG0gP7xA80p3/s8A/3Dtg4MW/F2e7QWx82jmfy/4eaehOagePanmZ7oA1ljpnGcHHSp+SY08fC5OOKyxW1xWtl9RtXL4fyhIzPaaC7cLFrrKZp8HkgKTevkxO6fJbggnZjPROYMni0q4O4RMveMHVCs20Hfl74kWr/QmkuAY5X0PIGM4gJih5iP0mgya9LfxfuYlj6QbOUtBcaxqT2Y9A0Dt/Vzr4b2y/RKWvV0QQ0PS59HqcqYtNV3vWaPaNSGE7yVHbe28JjE0rorfvU9UMmKw5nPpcmHXol/xChRZirqAGvdML3SxUUvICuFIzyTpvwJ8IdlHfQsY4bWSBBtDETOJa6BUokItH/sbmybV/S8fJgDWIlfl6oAhd1Jz3HelRgfVSoSJATSAekA7LX1p97/mdPFuXNfFAB+NxXaR6Q60yaSBbcrsywGNcCaqNnDdmBtvcGNpHV00IHY4s27uGSDMTFfoX41+btmICUhRawxH7Fv8M5lBSt4h1g0dCIRz48JAF6h3g/nub+e+YENd X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(36860700004)(82310400014)(376005)(1800799015)(7416005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 17:01:58.6953 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4a55ff65-c566-4ebf-de51-08dc4db67306 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00004681.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5595 X-Patchwork-Delegate: kuba@kernel.org When the NH group stats tests are currently run on a veth topology, the HW-stats leg of each test is SKIP'ped. But kernel networking CI interprets skips as a sign that tooling is missing, and prompts maintainer investigation. Lack of capability to pass a test should be expressed as XFAIL. Selftests that require HW should normally be put in drivers/net/hw, but doing so for the NH counter selftests would just lead to a lot of duplicity. So instead, introduce a helper, xfail_on_veth(), which can be used to mark selftests that should XFAIL instead of FAILing when run on a veth topology. On non-veth topology, they don't do anything. Use the helper in the HW-stats part of router_mpath_nh_lib selftest. Signed-off-by: Petr Machata --- tools/testing/selftests/net/forwarding/lib.sh | 14 ++++++++++++++ .../net/forwarding/router_mpath_nh_lib.sh | 12 +----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 58df57855bff..4103ed7afcde 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -459,6 +459,20 @@ xfail_on_slow() fi } +xfail_on_veth() +{ + local dev=$1; shift + local kind + + kind=$(ip -j -d link show dev $dev | + jq -r '.[].linkinfo.info_kind') + if [[ $kind = veth ]]; then + FAIL_TO_XFAIL=yes "$@" + else + "$@" + fi +} + log_test_result() { local test_name=$1; shift diff --git a/tools/testing/selftests/net/forwarding/router_mpath_nh_lib.sh b/tools/testing/selftests/net/forwarding/router_mpath_nh_lib.sh index b2d2c6cecc01..2903294d8bca 100644 --- a/tools/testing/selftests/net/forwarding/router_mpath_nh_lib.sh +++ b/tools/testing/selftests/net/forwarding/router_mpath_nh_lib.sh @@ -56,21 +56,12 @@ nh_stats_test_dispatch_swhw() local group_id=$1; shift local mz="$@" - local used - nh_stats_do_test "$what" "$nh1_id" "$nh2_id" "$group_id" \ nh_stats_get "${mz[@]}" - used=$(ip -s -j -d nexthop show id $group_id | - jq '.[].hw_stats.used') - kind=$(ip -j -d link show dev $rp11 | - jq -r '.[].linkinfo.info_kind') - if [[ $used == true ]]; then + xfail_on_veth $rp11 \ nh_stats_do_test "HW $what" "$nh1_id" "$nh2_id" "$group_id" \ nh_stats_get_hw "${mz[@]}" - elif [[ $kind == veth ]]; then - log_test_xfail "HW stats not offloaded on veth topology" - fi } nh_stats_test_dispatch() @@ -83,7 +74,6 @@ nh_stats_test_dispatch() local mz="$@" local enabled - local kind if ! ip nexthop help 2>&1 | grep -q hw_stats; then log_test_skip "NH stats test: ip doesn't support HW stats" From patchwork Tue Mar 26 16:54:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13604734 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) (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 B9D2217BA0; Tue, 26 Mar 2024 17:02:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472532; cv=fail; b=lDeFH7HnaEUqhtIo9VFQhlRJEZKdW1qYXCzBGVLbHNoYn1tKYTg3aSdoKPCxLh5/jhgSBWxvSIuYaRR1CXAtGmelS//7VD9oqIfiXlXpljrZlMAYAwtVSnNpJ3P6oIqYpT6b8m8JnPJkc7PnbvZjJzVEyI2hv2bjXAUr+NnRIMU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711472532; c=relaxed/simple; bh=zv0E10TEsyjia4g06g9x0yDea/8AoDOWrXuHKci5zM0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gBxe49K6ZSxcrGdSUxp5CeW09FfHyAcAGmFJiNqEfKKGOlRKGVDbfgAAx9HXnfBabhY8CmFQ4aerQpMv6cEYXkN34iyAzwh5rCfCHfdZMGOZZsvzK+/ByCQIG5CCDceU3vwwKkE70b/p/UcE+9+ne8NA1be2VbCSZ63n5bS/T04= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=T3FYD8jC; arc=fail smtp.client-ip=40.107.236.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="T3FYD8jC" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VbgHPrSSykmmpNANy8S7uSP83shdt5jAeyLEqLfCIiE9fd5U9lcQIKWu1XgITMdrsTIi5R5bQDrGS/eri+zY+4pq5O68J65xYaqIOTzHZqlUvPzqXSiriNugacIGmsywE4rQscdH3ahGRYeE1Rn3QjzcR3zBYoShYmX/T/f6KC5Y/Kx6XP6EwJu+mnG+S21FJmesVgtzjHxz1AvreOT4V979s7d00XpUDkeYO31HgVeXqXodkm73UsQOTuxmXoChW/g28jnSP5VU3wV7fHRak/eVKIZv4WI9gfpePCetAinSHgTtGGYlIzsTxQZ6t39JMdgGzEkbUktkH9Lz0Bi4rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RJRtP0KreHhnjKzBTAkDh7Y+kc+/mjYoR2koFRvwwCY=; b=nYoP6zqdS7UAutXJsMc9fZTeBAsFm/uM6wfGDdCVm+QDA7ft03LT2jbe8qUMUNdAk/yLnFvPtsqurA+cFTKPAjHQJiEA9myWfaJ4O3KDrW55i7DMAfY886MwJsu9MVNR/zHtgXI5cfqkH72vjyRKWYL8jk4UBJQ3n2+lL2T1efEiSQJpHqYnmNKeeyw9PQjGtjkLVP/1ul33kjL0wqiDBHw1FmbGqKvEWXGT+0iALax1co62TJg0M2EAsNsvFXrLzqs0vF8FxwzuMTxa8KHbTxIDH6gBo//ZiVe8nLFb1vIWDXA6KZI8CVO0Mqb1M9cZkhYIbpDrEl1BKnKDwzmVkg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RJRtP0KreHhnjKzBTAkDh7Y+kc+/mjYoR2koFRvwwCY=; b=T3FYD8jChHId+DbnC6qecflFp0JCo/raYc/dAQS7YI63jf6HRPuyy0Gb2zXBbRenR5C1ihOmORGybvBcT8Ji4xsEmKB3fcrbH9d8GasRq8gDI8NGv26q/FMNXA2yJRzJv143yTeNTAhXYhPt3INqC2riGTEcFfvB69GvzpBTXtjXKI7ATuwgXm4rA3yqBVHbFJlHN+VfsXyNrToXvZmy6/hvcDHJo0bHOmmGNgHfMzgRsPqYvHjjDKXAfaNBdV/hSTiB5seOnFDA6WH1YhdYH5OcEwrgi4dKn5IM2utJwktHUu1ZXCUrdQyID2SQWjTR6oJBuqVFefV68zDdvClxEQ== Received: from CH2PR10CA0030.namprd10.prod.outlook.com (2603:10b6:610:4c::40) by DM6PR12MB4044.namprd12.prod.outlook.com (2603:10b6:5:21d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Tue, 26 Mar 2024 17:02:06 +0000 Received: from CH3PEPF0000000A.namprd04.prod.outlook.com (2603:10b6:610:4c:cafe::8d) by CH2PR10CA0030.outlook.office365.com (2603:10b6:610:4c::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.26 via Frontend Transport; Tue, 26 Mar 2024 17:02:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CH3PEPF0000000A.mail.protection.outlook.com (10.167.244.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 17:02:05 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 26 Mar 2024 10:01:33 -0700 Received: from localhost.localdomain (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 26 Mar 2024 10:01:27 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Shuah Khan , Nikolay Aleksandrov , Hangbin Liu , Vladimir Oltean , Benjamin Poirier , "Ido Schimmel" , Jiri Pirko , , Petr Machata , Subject: [PATCH net-next 14/14] selftests: forwarding: Add a test for testing lib.sh functionality Date: Tue, 26 Mar 2024 17:54:41 +0100 Message-ID: <6d25cedbf2d4b83614944809a34fe023fbe8db38.1711464583.git.petrm@nvidia.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PEPF0000000A:EE_|DM6PR12MB4044:EE_ X-MS-Office365-Filtering-Correlation-Id: db1252ee-5fa5-45d4-fadc-08dc4db67759 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oO67PETlEGgjlI3GylfyM/98WWoyfmnt73ZJIoJN0ne7eDNXnLK/LhCz3cBLLBdZ0gfaS6c2mNZfL2wKXMkc0iQ57ttjgeGqbEdzGuP5mTs3PC3heICuNYQ2kolbxXN4mQwRpOKSporpm5McrO+SHbNUOMHvPH0LwiInt38AxvpEHdtlfbfulUU7WMrxWX9PfK1CTKy3sqd3kaCmKbyummI8srgCgTL3u5+oe9k6V40kkyUwNNkYJc2xnjSdMa4qCG66maQh0Ij+lDhmtTVPcOfghsWNqMzJmAapNVyic7Q7IXM9ydGObjLBbbpLBCxxA0mAnFpHQAaRrVvjm+Rq0r3R80CzltEG1GhuJ06SurJXHmlJ6IlEbH/m7gZ4ducrsTcOzBD6NEuFcSwSbbX445qCRT95Mzc317/UxvU57wBaKHQHnN9bleZ4QUqRxcaEp/BtAfPpKQ+vHSTolSxKSu9UUXSFStnGSPPSQIg0p7MybO4WeeJ5t5qCeh8wMWfXU75V1O2lw+ywE8ffsU/VlvuqLrB4e6vsNlonr8UnW4Fu1wWonNdGrWob0azxaQyShhF15jzCt8CYmx0P5bZb2r1Dq/ufbbUgnakpCdvBdcC9guCSWAbdezUXHVxaKdR7o3SwMQBJpkGtnk8e4UQP2YxkjsFhfn8Tuc4lpocz7e0B6oUhzukSzvv/zX2alpqckYYPIWoZillS0FPxrMBZaVzgZiWdEtZF0Qnh1s1qr9Ll1HlIfNARvaW5tB00eEMQ X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230031)(82310400014)(376005)(7416005)(36860700004)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 17:02:05.9821 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: db1252ee-5fa5-45d4-fadc-08dc4db67759 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH3PEPF0000000A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4044 X-Patchwork-Delegate: kuba@kernel.org Rerunning various scenarios to make sure lib.sh changes do not impact the observable behavior is no fun. Add a selftest at least for the bare basics -- the mechanics of setting RET, retmsg, and EXIT_STATUS. Since the selftest itself uses lib.sh, it would be possible to break lib.sh in such a way that invalidates result of the selftest. Since the metatest only uses the bare basics (just pass/fail), hopefully such fundamental breakages would be noticed. Signed-off-by: Petr Machata --- .../testing/selftests/net/forwarding/Makefile | 1 + .../selftests/net/forwarding/lib_sh_test.sh | 208 ++++++++++++++++++ 2 files changed, 209 insertions(+) create mode 100755 tools/testing/selftests/net/forwarding/lib_sh_test.sh diff --git a/tools/testing/selftests/net/forwarding/Makefile b/tools/testing/selftests/net/forwarding/Makefile index 56e3557ba8a6..fa7b59ff4029 100644 --- a/tools/testing/selftests/net/forwarding/Makefile +++ b/tools/testing/selftests/net/forwarding/Makefile @@ -37,6 +37,7 @@ TEST_PROGS = bridge_fdb_learning_limit.sh \ ipip_hier_gre_key.sh \ ipip_hier_gre_keys.sh \ ipip_hier_gre.sh \ + lib_sh_test.sh \ local_termination.sh \ mirror_gre_bound.sh \ mirror_gre_bridge_1d.sh \ diff --git a/tools/testing/selftests/net/forwarding/lib_sh_test.sh b/tools/testing/selftests/net/forwarding/lib_sh_test.sh new file mode 100755 index 000000000000..ff2accccaf4d --- /dev/null +++ b/tools/testing/selftests/net/forwarding/lib_sh_test.sh @@ -0,0 +1,208 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +# This tests the operation of lib.sh itself. + +ALL_TESTS=" + test_ret + test_exit_status +" +NUM_NETIFS=0 +source lib.sh + +# Simulated checks. + +do_test() +{ + local msg=$1; shift + + "$@" + check_err $? "$msg" +} + +tpass() +{ + do_test "tpass" true +} + +tfail() +{ + do_test "tfail" false +} + +txfail() +{ + FAIL_TO_XFAIL=yes do_test "txfail" false +} + +# Simulated tests. + +pass() +{ + RET=0 + do_test "true" true + log_test "true" +} + +fail() +{ + RET=0 + do_test "false" false + log_test "false" +} + +xfail() +{ + RET=0 + FAIL_TO_XFAIL=yes do_test "xfalse" false + log_test "xfalse" +} + +skip() +{ + RET=0 + log_test_skip "skip" +} + +slow_xfail() +{ + RET=0 + xfail_on_slow do_test "slow_false" false + log_test "slow_false" +} + +# lib.sh tests. + +ret_tests_run() +{ + local t + + RET=0 + retmsg= + for t in "$@"; do + $t + done + echo "$retmsg" + return $RET +} + +ret_subtest() +{ + local expect_ret=$1; shift + local expect_retmsg=$1; shift + local -a tests=( "$@" ) + + local status_names=(pass fail xfail xpass skip) + local ret + local out + + RET=0 + + # Run this in a subshell, so that our environment is intact. + out=$(ret_tests_run "${tests[@]}") + ret=$? + + (( ret == expect_ret )) + check_err $? "RET=$ret expected $expect_ret" + + [[ $out == $expect_retmsg ]] + check_err $? "retmsg=$out expected $expect_retmsg" + + log_test "RET $(echo ${tests[@]}) -> ${status_names[$ret]}" +} + +test_ret() +{ + ret_subtest $ksft_pass "" + + ret_subtest $ksft_pass "" tpass + ret_subtest $ksft_fail "tfail" tfail + ret_subtest $ksft_xfail "txfail" txfail + + ret_subtest $ksft_pass "" tpass tpass + ret_subtest $ksft_fail "tfail" tpass tfail + ret_subtest $ksft_xfail "txfail" tpass txfail + + ret_subtest $ksft_fail "tfail" tfail tpass + ret_subtest $ksft_xfail "txfail" txfail tpass + + ret_subtest $ksft_fail "tfail" tfail tfail + ret_subtest $ksft_fail "tfail" tfail txfail + + ret_subtest $ksft_fail "tfail" txfail tfail + + ret_subtest $ksft_xfail "txfail" txfail txfail +} + +exit_status_tests_run() +{ + EXIT_STATUS=0 + tests_run > /dev/null + return $EXIT_STATUS +} + +exit_status_subtest() +{ + local expect_exit_status=$1; shift + local tests=$1; shift + local what=$1; shift + + local status_names=(pass fail xfail xpass skip) + local exit_status + local out + + RET=0 + + # Run this in a subshell, so that our environment is intact. + out=$(TESTS="$tests" exit_status_tests_run) + exit_status=$? + + (( exit_status == expect_exit_status )) + check_err $? "EXIT_STATUS=$exit_status, expected $expect_exit_status" + + log_test "EXIT_STATUS $tests$what -> ${status_names[$exit_status]}" +} + +test_exit_status() +{ + exit_status_subtest $ksft_pass ":" + + exit_status_subtest $ksft_pass "pass" + exit_status_subtest $ksft_fail "fail" + exit_status_subtest $ksft_pass "xfail" + exit_status_subtest $ksft_skip "skip" + + exit_status_subtest $ksft_pass "pass pass" + exit_status_subtest $ksft_fail "pass fail" + exit_status_subtest $ksft_pass "pass xfail" + exit_status_subtest $ksft_skip "pass skip" + + exit_status_subtest $ksft_fail "fail pass" + exit_status_subtest $ksft_pass "xfail pass" + exit_status_subtest $ksft_skip "skip pass" + + exit_status_subtest $ksft_fail "fail fail" + exit_status_subtest $ksft_fail "fail xfail" + exit_status_subtest $ksft_fail "fail skip" + + exit_status_subtest $ksft_fail "xfail fail" + exit_status_subtest $ksft_fail "skip fail" + + exit_status_subtest $ksft_pass "xfail xfail" + exit_status_subtest $ksft_skip "xfail skip" + exit_status_subtest $ksft_skip "skip xfail" + + exit_status_subtest $ksft_skip "skip skip" + + KSFT_MACHINE_SLOW=yes \ + exit_status_subtest $ksft_pass "slow_xfail" ": slow" + + KSFT_MACHINE_SLOW=no \ + exit_status_subtest $ksft_fail "slow_xfail" ": fast" +} + +trap pre_cleanup EXIT + +tests_run + +exit $EXIT_STATUS