From patchwork Mon Mar 25 17:29:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13602569 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2046.outbound.protection.outlook.com [40.107.212.46]) (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 CC9E112FF71 for ; Mon, 25 Mar 2024 17:32:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387942; cv=fail; b=Uk6X4qyaUNuxd93P2eAvHmApcxp3UuHl92HH19lHlxyjwKPOIwC08AwYG48B6gaNStgNKYrprGdlfw35A1ZWtnV8h+EFhc8TfpvAKTNmRKfuAJKTB5kwzROROtmCffTwAPls2l/MRFGPEYA9UKPzs9JZMqEJXIfJgk+MKHEd43c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387942; c=relaxed/simple; bh=8v9FNUijUG7xwsUH31jckIZPoH1RDSaL9/RZEHgFc58=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=L4ah+YFIPsTGZkNE45dbeXWd0zq0P25B/KUN/5MD+q4YtIs/fgBvNSg+HlyWN7oAPC8gvzeiouuM0h1+t0s3j0a8Ql0pXPnxMtKCDqyVMMghhtLEttsK/ZW+QgPR4Vl/L3VrKcXvPDS44j+mJllHrLN5uJaymFyKfLzbJVZz4sg= 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=fHeHiTK5; arc=fail smtp.client-ip=40.107.212.46 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="fHeHiTK5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kYo+52WdkKfdjU2C5dcaNyQzraGkBP+zftsdvd/nYzhM8NAjG5bLciujUkSpmApUUPEcZFGz9bPvHMuWnow4hXT7magy05iQu5RT99huRI/eBEe7H83ZQaprhB8rJgmFTwoTQb7h2dmnDMPI9aK8uFRHm6fqLy76muS3EtoaGDnR1GaOKCq9hGHFoAq6KoxUZpiEQG14J98cRdPL5DFdHELQWD/FBjp6VqIdJifLl1ryqUEIJJvI4Qev2SsX31idESdjaq3IDHFcJzBOTaT0CWJHA1CVZfWPoJzREloeBDxZY1kHo18vwdnfYIt0nFBCLYrk9rBGD4JYvUBgGY4Dmg== 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=XBMxXz1OYCoZI/oPPK3ji/4P8ZZ5mi26swdC6MBfeGXBlwSmvGXHFqkaG7meyy6Vw+n0Ce14MZew6Nao/agBfpXRWysIiS/hZhWB8bdYuZrWowJj+EOQkWPTNaXuVYSaU/lAObpYuIVclIwCoAtcp6vawizkfsQFD6q+yeK+y0ExwpsWW5xh0g+4H43/bP3Xxq1Lpw4DsKt0QdFN7gesoG9qiLUZkujlhwAEDD03G/pECl8NchH5pf809UJ59wamq9ze4SPk0IWPc2xpbekzd0mLF+KWbOwzZ9PgGPvEsozOMmZ34N6t3yNbGjvLRpY3fCCVV6KACDsdfV67P8PDtQ== 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=fHeHiTK5yK1eqWLP+JLSMNs9O5j5EHrRQmFaa24QfzQNnXUYVZ4EEx/6erqWZi2dzXSEHtnpEAS/D7h5//FBZCpEgoJxJ0DNRzkW+Yprd4sDVfxdpGM/vMFQbtiyz7meM6we9x/PbSSEsXz/BaxrXlUBw0owgKwPeX1VeTbYzhCbblbxyZbU9VBDB1Wh6gnAPdKxG/eeKoM7ByUKoZ11US6OTe7y94kAGW+jV10ka2cmlTMxajXfpawDADR/FsdzJUXq+CLPNriO7bHPGR74boMn36AIF0D3fzEhG3BnSg7/Vm5Ks3tpq5bnh9KCj3qlNWWKsipVLPEIoUdiPLbMKA== Received: from BYAPR21CA0014.namprd21.prod.outlook.com (2603:10b6:a03:114::24) by CH2PR12MB4280.namprd12.prod.outlook.com (2603:10b6:610:ac::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Mon, 25 Mar 2024 17:32:17 +0000 Received: from SN1PEPF0002BA4E.namprd03.prod.outlook.com (2603:10b6:a03:114:cafe::b5) by BYAPR21CA0014.outlook.office365.com (2603:10b6:a03:114::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Mon, 25 Mar 2024 17:32:16 +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 SN1PEPF0002BA4E.mail.protection.outlook.com (10.167.242.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Mon, 25 Mar 2024 17:32:16 +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; Mon, 25 Mar 2024 10:32:00 -0700 Received: from localhost.localdomain (10.126.231.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; Mon, 25 Mar 2024 10:31:54 -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: [RFC PATCH net-next mlxsw 01/14] selftests: net: libs: Change variable fallback syntax Date: Mon, 25 Mar 2024 18:29:08 +0100 Message-ID: <1890ddc58420c2c0d5ba3154c87ecc6d9faf6947.1711385795.git.petrm@nvidia.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002BA4E:EE_|CH2PR12MB4280:EE_ X-MS-Office365-Filtering-Correlation-Id: 53a858cb-04a3-4ec1-3165-08dc4cf183ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JBci0XxTJXY8PET0g+9s5Dn4+C0FgQBc3BTgAItHnt3VUmMdo837A/oD/v0PXte3ZlGTVMnKIxi1RXiBMrFI7PlIM8/mv+6t6KaOTByXT5cf+8uFolrEObWqcFTsLBfLjU+mDtNjeRzob2fyfewQg6VbxlYK0furCpGW9BT2M2UO7wRhaitQUNUmsi+uHrOC2wlMEgEvJGZbxNVkmeoxfLy47FeiNbSIKixXZLyA0U+n6uwK+RUkxrAQKsIQR2S4hB14wcZE2BvWDEgloMFW7x5Lm0NVHzcLav2UizieQUbpX3mjIub4FRXmou4yjSE3cemPRtUHv3oY11CK8kLNk/ivuqEw0L2ekw72Q9Fjbe1iCAYtrdU2DXmUrLF00zDnwtw4lemrsnGr7xNlHUxVYKG82xaPWDGQpL7efX5bAaAGWLbwUboa/PdQuV9YNVkxtaGl5jwA8udXkWlOMBc23uubBK64N2NBMeNCFrKVaGIzwbraLTot202+9soofEdRdcn78XmZ3hHOcl2dDuMqK3yBe0PWw4e4e7+4J8fwplOWfKMNxwA/50B/osH6RJETEPR/Jj33EBlSnoEZjlaJenOqzq7N0LICENYIncmy1eCHZIiQKqG5rSBs2wOY+45krDYREGLluHt3baqiFsHjBDcO7IrAUX6SdbuV9yonjh4vnBflBz+JNNI7WhUQ0+RZSRKIA4ZWwFykiAtA7HB18N26fMzvUSgNNIqi98ntk+Z99rU18RL07+dgBpCoh/+Y 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)(376005)(82310400014)(36860700004)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2024 17:32:16.2354 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 53a858cb-04a3-4ec1-3165-08dc4cf183ea 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: SN1PEPF0002BA4E.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4280 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 Mon Mar 25 17:29:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13602570 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2088.outbound.protection.outlook.com [40.107.244.88]) (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 C362812FF71 for ; Mon, 25 Mar 2024 17:32:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387950; cv=fail; b=HwmaW18oQi8knAGNNQ1UAgRiqCkxOAQRzBTUj1J7gAAJG4wKq2PWQoPdQmbtkM/hzyQtLBxrZgEpL6Fncm/7MPgOuEvsUjAYMpiBbKbYm7WGTfD6cgjGeA+XZEJtiothK+iUMJ0CEk1LN9+PsWZz3232MxxVsoFIJhMTDTfSOKY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387950; c=relaxed/simple; bh=mTPwOqJNG2Ubgo1VbL8KBG94pbeO7Ct69PxV4ztwl3A=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rbDzAfJOiym55HqVCs1lEImIdwV2jc9NuvHCdujfp2TNkT0DAIqCECJ4uEXKaJUkK15gfzGoAPZejyYA+OdtMfxbXmaCuTsWjRCMIFOxHBl3vyRMtYQKGqll4BI86i+rd3EN6w+022BErR2rZtk5nMB2UGVgKUR7cVePL/BEETY= 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=hCs1ch8D; arc=fail smtp.client-ip=40.107.244.88 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="hCs1ch8D" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m7Lxq68ZFXXjVBgVEkSvIVEIOsU/FDtJToOz2GlCRErnDldgfS7NPcFJQyvgZ1zXCp9u2yGd1TH8x9iKvWjW0nQk9XmJkWYLDbP+LkFm/6cwmLTDsAVZls8KwTMCFQ06sbqPR+OeyTXTN/7aV2ovFSFODLvJbnRjcoR3nqiI5mrch6BK3kZSWPpdX1wBxvZ3nSXJgo6g9vmb/wV/+ETpQaHU7gzLmyOQgGpMHsSDtyYDzVzMuQugdoZYZUYsOLcDVeM5ojllQ1UiuOK9LoDZbD35NlZ8iDaEhukCi91ks0d0JFqOyFCz5y6R+OaUUXOCL+sN8yRB1ROAJhApd4jHyg== 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=F+aW75zWwxW0G5GI3jT+fPfaRxhR1gUPvuqrR8+uzWJB/emC7sCK3bzy96N7qzjVtRKi7s+NUh2qtuhC+SDz+RgsCE00chjxZAs5IeLAx9hAnyJ8AUS0owfLfhqzPozEFN67+n/pqMk7QcZrbpcZjDQ+3b/xEO1I2dXGS0bClR2kGCHarZaBX5AaEoJmDLu92DmiSaxQdmE6ltH0FK3SU0ZM0/E3t2YXBkInTMNd3DOUZxxWlljOLJReSKUL5Jl7zfOQp7TqKatf4QVnu7jjwKI0NE/cZWUVmfjoBOsVcliXy+jtGZaUGEvfhiOIo7i+GVbK4+PtUdH/oArTkJ2k4w== 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=hCs1ch8DVt1TnJEam0l6ARlH6ATeFPTskUFt1oRwFt6DPylzTjo6e5iPzWziDwZOiDzMpDxT65UiCn5OO2TZYyoJqmEGA2CDt5ou8Z6xSVnjNnWjGr393Sw+4jUvtjxycjrZ1maUwSfXHQYWrjgNMMrq8d4m5P4MzFdo7kA+30kGJfinc69pX/Q2uh8MPmecl+RlNXRuWGY/aP9g+J4OF07N1DLST2cBlGicDgCmebEs9uPfzEucEn4N5istMtoKBaGZuMN/UAiqGwbYvMC7TI8lUlakZMlYenKymnqGBHBI5pJ4Xu5+swYs/Oil30QRJ5I2sIkGHdTVs2ZG9TOXgQ== Received: from BYAPR21CA0025.namprd21.prod.outlook.com (2603:10b6:a03:114::35) by SA3PR12MB9158.namprd12.prod.outlook.com (2603:10b6:806:380::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.32; Mon, 25 Mar 2024 17:32:26 +0000 Received: from SN1PEPF0002BA4E.namprd03.prod.outlook.com (2603:10b6:a03:114:cafe::e9) by BYAPR21CA0025.outlook.office365.com (2603:10b6:a03:114::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Mon, 25 Mar 2024 17:32: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 SN1PEPF0002BA4E.mail.protection.outlook.com (10.167.242.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Mon, 25 Mar 2024 17:32:25 +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; Mon, 25 Mar 2024 10:32:05 -0700 Received: from localhost.localdomain (10.126.231.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; Mon, 25 Mar 2024 10:31:59 -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: [RFC PATCH net-next mlxsw 02/14] selftests: forwarding.config.sample: Move overrides to lib.sh Date: Mon, 25 Mar 2024 18:29:09 +0100 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002BA4E:EE_|SA3PR12MB9158:EE_ X-MS-Office365-Filtering-Correlation-Id: c5818c46-c698-4f06-a15e-08dc4cf189ab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BsEkWBvxwCI72d0jFdoRIZMfgBOwTM7f5Et7c4dU29TppNyJp3Rw7+encGAu11aYvVayvSv4h6DC+RfiTa8z6+FmG3tyhE6lmYPzc/jC3XdzOc8S98TJIhKeK/4h3iaeJJibXWoWrAwqEsxBjKZ9HQl06JP/vkeqouWcDRKQCNr/sUaN1rxeiC3nUBXxddkcCmD23cOOrMalDIyX7XykKIicntarbvoRuWSgtZhSMq/KP0PIFBcG8qdJyqeLZtdNjm/YvCeBGQl3UjlaEp7fJNrSGgLMlvbDUdarFffnrY0wfiuGBR5ZFZg6vThkw4J9Org4RIBsB/2bhvXKI1seZRPnYF6LoCb4pMdWTgOAaKyFj9u41696Dg4t9f7HYehm3pBgnleQFyJwy0MTqn/PBe4M9LI/dsDHJ+IzIH7sYeswFk5j9AqjbZVH66WJRBd8fo5q0bJhtjhW2nNX86ihOhRfVu0EQTvZexUrI2SmD3eFCvM6TMKpCzWibkdNg8Bt6h2Our2Nm8Rdj7NMULG0X7QjWYWdMr68sz6lA4kNya3tCxVYWV5US0xZ9pIU2qDYTq3vlwP0rcBrC8IZUPTt0pLuHVTZ4nvawJL5g7WeMXI7FBKQ90LNsWVs6BjeLQLr+/FxbMSzgfCnY0TlKM0GjsOqDnFABan1U0z4jvzpIDY3Ai4nuJykQI/yQttRqA5ACqPPs1SbGScubVJuIWdAnHAflI+XVzG1Yl9/ob+2bTWRIEtZSf9Ls7xLX6KuQ2kE 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);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2024 17:32:25.9073 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c5818c46-c698-4f06-a15e-08dc4cf189ab 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: SN1PEPF0002BA4E.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB9158 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 Mon Mar 25 17:29:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13602571 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2073.outbound.protection.outlook.com [40.107.93.73]) (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 71EF412FF93 for ; Mon, 25 Mar 2024 17:32:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387960; cv=fail; b=pLMHnZqHgry4XIn6pYU21yz2+q7a4O8DI2s/5LASRyLesK0hREvH3FWMrR4RppQtZxCUrZ798K18MXKJNWX0Yaun86oXa3V4/tr4o4XtqYAISj1hIaCoC2RtJ0qBHenlQU/9RlbLYydv1j4baLVK9qBK6zJ5ygvpu5ifKwA2GIg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387960; c=relaxed/simple; bh=uywpYYN0x0iP/lSNbJlCJe574vl43rsJel1ltb+my3k=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FFwXYdrFje/T2lBn9YbkX5GwLgA2BtLuNyvWEXiY4AfqZf9HM2yitz+NUZOXfAI17EPou4aF6usTBX4cR2xsIb0FxFxcUFBhYqxjfduNEa35lFqVMCMBh1GmJWEj+N05j8630OoBJOLskSunWdutrcg/AFWDVLwlNZ3Vkj1ADts= 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=e3FiRxAI; arc=fail smtp.client-ip=40.107.93.73 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="e3FiRxAI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GLqwLyvTEXLursld2eQwkZAOd9Yo11wjkAKhIzQ9C4LsiSOE5A5XxXfrFcXJaCaxTglt2HrmPyCJAImkDreAAeXeK4Cy4+0ycEl6NifqjkMTeK76JBRbww5vn4oui0TGmN+vSkOLunQQTLdazHI1l3rRz+jHV/WEDWI3aMrtN72CUNvtJ8fGUelLWVfcWaUPJnb1lBHOGxZwksAEkyaGEzaYqbv77IsZLHp44GF88rq8TcMjSMdLXWgRLBU5kySB4r5BV/ZYklEiWB6knQ/r7CYA2UloFitAbw8ki9j/xk9RGAcOVMbE3OLPyDy//Guoaq1UQz1Q0e3lGImtUsiHKA== 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=OvmXW0V7zrWj2Yvnvzdo/e5UHYRIHtF5dQkHZ35THDGTt0a5YiYpnNsZgoI9XutktUInw//CFhm0dyYZBfD6IJys2EeDkYUkMlrFm3mgHp/qsKhuRHqzFyX665JmLi4/o43Lshvk4MOoONxsPNLsEqjrHQJyYcI2OX7kky9aOhKinZzJ0Mxx4zAGuS2qXzKFMWJYKiYOXpB3I3ghN0bqvFK55hAvHMbDVqNUIWCGgV57BZsu2IpK624lv95tBlAkjBOHkP/daAV1HK6LRe1750tBF/6HjWdtbzAl/Xf3IJ+3SX3/V1dghkrJh71drJWwg2dLBSY3ttLlPhwyV/JVNg== 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=e3FiRxAI1EGPBT4wmc6GJlGVsgSdSZLCRqrN2qlN/Uw1yb/blCwWcYykG2lzADewVy8MSyKI4vYbt+VnCMYuTo12VX4HJlX7ErGYDnNukwHnSpRkqY37xdWyDq7ThA3EfSsgQB2RWaeJCN3n9PM5WZk3ETtL0iI/IHRlmHHQqNhSnnv6LCvF8etNPuRPAhEVeTRTl1MF3f+2GrIy/jOUr5fEvCycP0QUWWZuQjAhQXV2u2U14K/VCjXcJxsVrwDj0mUDI3hnZKWfQZp7wtpP+4FQVsZsmec32F6mgQErqnsYRY4gSm1cu3D/cp+FVIJzWGeZ5O8NZHNF8Hut7zJpjA== Received: from BYAPR21CA0001.namprd21.prod.outlook.com (2603:10b6:a03:114::11) by PH0PR12MB5647.namprd12.prod.outlook.com (2603:10b6:510:144::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Mon, 25 Mar 2024 17:32:32 +0000 Received: from SN1PEPF0002BA4E.namprd03.prod.outlook.com (2603:10b6:a03:114:cafe::89) by BYAPR21CA0001.outlook.office365.com (2603:10b6:a03:114::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.12 via Frontend Transport; Mon, 25 Mar 2024 17:32:31 +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 SN1PEPF0002BA4E.mail.protection.outlook.com (10.167.242.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Mon, 25 Mar 2024 17:32:31 +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; Mon, 25 Mar 2024 10:32:11 -0700 Received: from localhost.localdomain (10.126.231.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; Mon, 25 Mar 2024 10:32:05 -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: [RFC PATCH net-next mlxsw 03/14] selftests: forwarding: README: Document customization Date: Mon, 25 Mar 2024 18:29:10 +0100 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002BA4E:EE_|PH0PR12MB5647:EE_ X-MS-Office365-Filtering-Correlation-Id: 2fa004a2-a31e-44a6-f040-08dc4cf18d24 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XNQid8SWuHWh+pany9R9lA09TlOf+7GGFRlWA6buVOebkU/VOKhgcRgainJACE8f+wV37u6EUsIrLKhnGBaUXY3ajr3gp5+IE3auOvj+DHWcBouqcMi5S9n8NM9WP+xLBDeKBU/J6I65HSDpmcpj2J0hlGCIhbv1Kq2NpUMJnvhb+m/ZJEntZxU1dv5HVGSsGHsp7Fq1YV6VclYA7DAqYUPE7/yFJabq+RG3uwWb6zlJGhTZh5YAYoojOCA7edDAi3+Ada9PgIk13cFDbHOEw+q3kwbtYajmYp0YF8fgfxsmdHEsLZeexeBUQCLxEBBR0SpOe5iRhnwwGWBQzyWIyso/dQneE08LuKweazwhvNCO+m8gIqNVjqjPAFguNJA3LFDos5wLpVrzXFLrYf/31Z8YV9is2GsCy1FOIVCzGAMlWTKonFU1VxjTD2UGtpFmRY+2m4GfS+hKjKWMjFmvfhPTVpfIFgKbS/A/cY7SmaA82AlrlmvioC/bBg10k+1HK/zmFLbauBTCfPjImIAzOyc9yrWZCvLZaY44Xj2s9VCLfcYVl1v0ZXjBZIj2gYwNrZ3TrpggqJxZgBSiCoNGpLmGwYBeIrtbGSMUTgyPx+zW0yOUH/jI4LsPRXPxLxXz0f2YQED3NdneQ7yyNrArtixBav0kihTOHYuOIuQz9b5QHolQZ/8GHs8/Gqffeu/id49UnlIkg6zHalOJCRHKH2V/JOHSRggGCQTkkvjF5ZLyU45ISfTbftOZaQJM/vYR 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)(376005)(36860700004)(82310400014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2024 17:32:31.7199 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2fa004a2-a31e-44a6-f040-08dc4cf18d24 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: SN1PEPF0002BA4E.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5647 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 Mon Mar 25 17:29:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13602572 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2068.outbound.protection.outlook.com [40.107.96.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 7C93E12FF93 for ; Mon, 25 Mar 2024 17:32:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387966; cv=fail; b=Bov+kBVLI2moaHYLOBXS+FlYVS3D8SCFEnHJ6v6+If/yIlqD0e517yxmiuWRDDsaWJmLcG3XslwTvlVY3DTEdYEbovJCsR9Atmgyg8nzd+9zeZt/90upu5ILZOQ2fYGpVMcBDEOkd7LeMvqXvlUaW8JCCe1AerYJFhsHSGCze4E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387966; c=relaxed/simple; bh=U6IDXaxfmqSNGryMzeBJlZXsnDiUp5VBG59deIGI2Mg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=n4Szt92SfmJ+KVkiboguRQogjRzv0nB8GLelt2Z9wwRDBCqHHYGWsKMXEy/D+4JI80/hsajiq2jBDKTDWXhUnDvcndBQrfXP/Z1vQL262Y2m9XQhlUNaRnEirNyRTmOBtooHUiVtd/yRQJGmbKRck6AaDDSS3kkcK5irheFYZLM= 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=smwZbz/T; arc=fail smtp.client-ip=40.107.96.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="smwZbz/T" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i0TY8jS1a0pWi0DUofe0zOFY0EsR0OxVmbqlyP/MfwfVlgWCNRfvmxG1aQZnEO0Vyieexl+2BhU4SXhAiRExyZPJGfYqullQUUBunOqzfHrCcNfbzxUQOAXdniLK1pctT85Q8tWALed+KeeRrdPNqVj4bc99639HwF+exbdoFPHjqCQ2Out//ii4XsIR9XWWEPeA0Z+gGrPA2yt7VwRk9LEGenSNNMMZqDvXu7Ac2EwyrKp0EElatt88J+fcihMclnccZHzWCB2Z60MZA3dx8muIEbpCo8efnarg/OU9UWkP5MBAwLy++dJ6euekr53DpXkDp7AxCh+1aNj6wsufBg== 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=YLgZhNOyruojhqQmqgcejVxxWWoVazssxRTT/yLO1WWVqJYOkuo5GHcyKiO7KjnM4McmksxFqydcHZAoUG/pJxUKWbBjOO51eeQ5ozDJ7CyB+bw5J08rM7xio/ZCnn/wUwiJkS0mu9K9HxO0ZsvAgHzBe7j4+K37rnonWsJI7RMteQhEYcaT4r36B4OVBeJ9gD4lcFOOoA++bWN+xkdh0Qo3fb+j9HSFRVjnh13iW5sCIxubtGAt+Kp1eboRi3l6lWqUcjTVB2Dlwg+oIaGKR2Ot3EPJsvwd3sotR9OUJncZZ48OLE9b4s0/IZOfYTspdjOuCyZovqNzj0sxRMe5Cg== 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=eZbHvSGkaPZIc+jXFrBUJrlxuSi9YeZoD9csuGvfi0w=; b=smwZbz/TX+eRbgCxJvRcldXxJKH+Vp0MlZ4ZHOuM579EBxl6q3GSAiCsDcGrKtukudAtyAh7Aa7CaY3gUylWtSRdvmR7ZkoClWX9F5Cy9hxt3Q4otK/ooUB077tVNgYcPMuLPd4/GV7fRgHlSqdheJlzAZOAFigE4mrj4JoUvf7MGPjAYZcGfNrrV5EenWnTgh8BXvBQhw/nL9j+f+RBEV9F3aiPQCqy1hWTOBkZ/sOYsmVY35CnXBRPhOwCAfzGzc9x7aUPbojS9RE5VF2p/GbfaHxmDVyOdqmCO88RPqxv5oFJ/Z9SEveulha7QrRuDCKDb3RuXlNA7OWswez+ig== Received: from SN6PR08CA0007.namprd08.prod.outlook.com (2603:10b6:805:66::20) by BL1PR12MB5971.namprd12.prod.outlook.com (2603:10b6:208:39a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Mon, 25 Mar 2024 17:32:41 +0000 Received: from SN1PEPF0002BA4C.namprd03.prod.outlook.com (2603:10b6:805:66:cafe::ba) by SN6PR08CA0007.outlook.office365.com (2603:10b6:805:66::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Mon, 25 Mar 2024 17:32: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 SN1PEPF0002BA4C.mail.protection.outlook.com (10.167.242.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Mon, 25 Mar 2024 17:32:40 +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; Mon, 25 Mar 2024 10:32:17 -0700 Received: from localhost.localdomain (10.126.231.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; Mon, 25 Mar 2024 10:32:11 -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: [RFC PATCH net-next mlxsw 04/14] selftests: forwarding: ipip_lib: Do not import lib.sh Date: Mon, 25 Mar 2024 18:29:11 +0100 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002BA4C:EE_|BL1PR12MB5971:EE_ X-MS-Office365-Filtering-Correlation-Id: 37cf1f06-25a2-4557-6f3f-08dc4cf1925c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: K979Qq2RhHot5+DvzrVwF1+s0ZO2DaFBenswHmh0POaPhDlaRo+CwEFyKt1gS0VTYWoJZwTaImdkNotmakn1caJrUlWf6iIG8NVV79YhRZCsBMIrxUGpd+0EqctScNoZNV5ehSs1VhgE2YU/xiDmJtk6OMu/Ix8aNRQ/iuNMG8Zj75KSlwevucRrcHiiNHAcmewdyryZ30/gyyoFVpHmZnQM9VXpIb6c9/l7nGK9fvsbeHcS6aB13mkvR25ZpZqmcToJ0L7isXEn/PWhdcnsKOsPrGImiexVXQylGMwv9Kja0DP6ZbLhmR1rrMJUvZnG/LTvpGz49qAV91VpNbtdF2CQd/zx5/Wy4/hqPQR0lbGI+oEXcg1VXCevK/BQfe0F3TBKHznzqXUGI/U+g3bvn5TIcDhK1PwmoY2ZZRArYaPSzxZh/0lOktsmEs6EW05Kbq0YCYIAZygB2d6MYvHN2JJ9NzkgTJ1tyXpGe26VPA10A9LBAGt/nd2ZNPHhx7CCZoRBAPGK2uJPxLnDSAhAj2CPa4ipBPRSRswXW8BzFqyDDw4SGgCjpS/SjR+bCwjmesAZcSqx1Q3ELR179xaLF42uIssWU8IQwRYdxHNW7WkUB0xGEzLkFH0JkWdhy+z8onyS8rqvelDBsrXGRJd2mqPYQvgGZGonTszin16jRo0bYxhAMcZANaaBEsXWlT0JCpwwgesKQ9PpsX7Q2hP+GQh/oleYTYFcumL9LuYc98W7bu9yWl8o1fXRNhkW3c94 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)(376005)(36860700004)(82310400014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2024 17:32:40.4722 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 37cf1f06-25a2-4557-6f3f-08dc4cf1925c 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: SN1PEPF0002BA4C.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5971 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 Mon Mar 25 17:29:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13602573 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2064.outbound.protection.outlook.com [40.107.212.64]) (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 D01C512FF71 for ; Mon, 25 Mar 2024 17:32:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387968; cv=fail; b=COTGnSOi1YPnr2cvvSuziJ8FS3EZ3JvVZwyDkbLoULIAFv5sNE5DIZtWnouGbzf4HWCSlH/ZdfpPLSCAg+t8jkqjGSrQhrFcSxGnwzIdVFZAlHuPmcpFyKKyvfQibnzQv7kW+jfguzGbBRUYpaSJq0veGfbEj/nuxzTkn90sPic= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387968; c=relaxed/simple; bh=eD6MQvEub5I3N8qgmWskGamI76El+pptE4/SO3GYmAc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QWkPtLPIH7Op1JiXuqLc3ENQNulYp+WXob0Sr46oy38XHK7s5Tw0LzRTTeVGFZdh6Da9CUdQvyuJrVH7G17t9/vrlzXrV5PRPDAAMcBGrTgP3ZQ0fc01BHNFK8ph7ERKUsni0V5h7+HtinJEN8Jl1P6Ge7AEK3pylaMgEaDwYg8= 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=sp7P+Nbh; arc=fail smtp.client-ip=40.107.212.64 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="sp7P+Nbh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aoJTPbJOf8GBcbqtxiOHlujpVuxY2VVzwL9qga9o2DPnB3+nXFlaAalmMdx8OcicXnCF+LZC9a5SZKHJ7Tr+BhKYv+rx4vCBoTKIDVVg1SiwP1TRh3BKgQy/yR76F0dtTq6cZintXTAqSiZVmujP1fIMLWgC3r0WhQ0kQpDsAj+CRiltYtTwJsLM0zNmQvTMOcJUF9CFFZRC6va8vAJfPRaKYH8K1SNQSyxaWbUn5nHgIhD3euUK+QcxFW6wxOMWO4adXXt8nJmqxBy8c/jGWvlZCaTFNoL+PxRpC99UGkgvACntdHqdZwn8aQLJjlq3nJPePxFWK1ZmR9WP4OCIOg== 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=V1uPyxpcfIUAZFUkfd/PJLKUFJPjRLL4SrbBa7Yffp+Oa1uyiWK4FwG8FC+yR3JR/uewQJDSbGWiZsOJ4tk2wwWImIRJRRrIizyN9btHpdOETmXW453QrmtFEmfkbEXe5UsTlG3trJ4Xrf4NEZsp7V0jpgPb4nJlv2PRdrbQn4fgkyLgXddSqx34TLJQ7UsDX2D9+FdXm34zVNa+N+2Pu5+w1xOx0ApC12acM5UvTSq8q9KVowHOxPo8dxSX6FIt+hV0nosNjfkk3HlI6TftRvaiBVIc3OygeTZLcGO0tEmcuJ2PHk/b6jC8P0ShnIjdZKgDDaJnDjEMFFok0zvEFQ== 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=sp7P+NbhxgbIuS9GSHRH/n+1CDDuD+I0LxvRFrKPrseEYv4nCi51EQmBTr+UgW9wuivXP8SnSvLpkPUZZsmUkhJHjaii47EgsywifupUR2FvJNCmjMe4PXN+3FvGLD/WgdXyMBL6/YdrSqez4Qh13HELoZpWfmltrra/fI326LzGtbYPp08Jcfwe7VoxUMwsNTHtSDTHvvgSxNsC/uJWcgLB93n2xaNrY5TisFkbyf8UTcZGeboyuWS16jKzTXMdWFhH46wmAHDGgmru5RfKuq6cUBoIIhRyGrnnyb4OZwTrEZ98PE8HI0U1a35lG1Ni7OTSmFFJBEhlYvR33XJNQw== Received: from SJ0PR13CA0097.namprd13.prod.outlook.com (2603:10b6:a03:2c5::12) by DM6PR12MB4155.namprd12.prod.outlook.com (2603:10b6:5:221::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Mon, 25 Mar 2024 17:32:36 +0000 Received: from SJ5PEPF000001C9.namprd05.prod.outlook.com (2603:10b6:a03:2c5:cafe::e0) by SJ0PR13CA0097.outlook.office365.com (2603:10b6:a03:2c5::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.11 via Frontend Transport; Mon, 25 Mar 2024 17:32:36 +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 SJ5PEPF000001C9.mail.protection.outlook.com (10.167.242.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; Mon, 25 Mar 2024 17:32:35 +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; Mon, 25 Mar 2024 10:32:24 -0700 Received: from localhost.localdomain (10.126.231.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; Mon, 25 Mar 2024 10:32:17 -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: [RFC PATCH net-next mlxsw 05/14] selftests: forwarding: Move several selftests Date: Mon, 25 Mar 2024 18:29:12 +0100 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001C9:EE_|DM6PR12MB4155:EE_ X-MS-Office365-Filtering-Correlation-Id: aa134955-9e9a-4172-fc73-08dc4cf18f9b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +2dpjnNIrLr8eEKqC+Rhs3efPfFy6/70XcYvq6oLGM4LSPAtwBZTpWZoKVmtWDoJ4WOAjqqJzXW4rRpmAgqaHhIvXywd6dIM+Py6fJ5eE+YlnR17fvTRwu8eQDgTx1HJW9OOsTasKn8LnhedICK1F4LkZOWWdijXokoHc4rfTWiPoiXVWVebf6qAg5OKgrUVQUejzcQgMDpHSBsSEivNv9SU81YHJ6UDxp788hBbUfCUF69UTJ4aAosRNuHAPs/h8/xFOauK7n9vNbUiO765lWOTMtiE/UsVMdoo75lSirJjHka9eJbj5abpKIkdYmQDOO/bVyV4oAqnx+N10BD3igoX4WOwd5I0FmWFODi2ADgmSlDBdn3N7n6r5r47vZZ5V8sBXeoksOdSKbzJCky/tyQf12eK7eeVBh+7g9zbg6U8RNIXc0rWdmu5iRg6ZwiLoU9qFaBTYZGvilkjuGz5bre/O1gxvrnzIIsAfkblf5QSgBDgQ8LRYPNIN8q8kYHLJuzcORGVA4g2Mff+kleT/loeO9ZgRxPU++mz+3odBuAzRZifct4mlYFRZlJAndQqeQPG5Nhtbn2IoaWGP3NIkt9dt+l8pEdsHWkFqKRTf682ma7p0QCIr60PtlULHtX+CogmetOycTxE1ovu0ezdSFnEb3yqAHtxOsYorbIWquQUTaUNriBq5F5atOY+Fybwjwp4Kl70YgYethB+pqOfuBydCDib8xHsuWKU4nrJlYdcLHRlJJIXEl6CwI0v8ibx 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)(7416005)(376005)(82310400014)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2024 17:32:35.9649 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aa134955-9e9a-4172-fc73-08dc4cf18f9b 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: SJ5PEPF000001C9.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4155 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 Mon Mar 25 17:29:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13602574 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2045.outbound.protection.outlook.com [40.107.223.45]) (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 70944131BD8 for ; Mon, 25 Mar 2024 17:32:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387969; cv=fail; b=mNYdIRvB2kSx2q8cwLQOdHc4YSsLK2Idz46/JVuW/aF/CNfxzfJDxhN8CtC9MVaETVnljVxVI1Olxa8NXaawHcC2ar59PBMfoPKmPu9XA7dpuY/ZpIuLt/+AVliBdBF24k96xzNCY9Akg3gatIzBm0Gc0cI0+07EXl5aGYVjf2A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387969; c=relaxed/simple; bh=AZUSMPjiXcvxzVlj7PylF6NCcBvM5lAT79psV9iJqgU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=vE+6T3wdp6udUpL6iR5UQsnIjHR1cUbUxgu3FIPYKcxvcGEgycqEzx/888pYjkfBAf4NcxoI54pVFT5+JuzYZP+MvMUPdPpzMq+XbhJwlamT/6atlZhcWlAdjLAB5H4gSllMZLFPc1ckJtd5fE/ymouvL0jLRQEsK5n/KzTj7sw= 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=JZxPNFdv; arc=fail smtp.client-ip=40.107.223.45 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="JZxPNFdv" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GHhtdx7wJWhswCP5nWpJdpeNNKe8UQIeuu0Yd/L7PZrY/lWQrQslM7qp0zKxPEwXYGzVpeie+W6UG5SOJdVuyYRtj5thbGhjPMrMBEaUocQKDg2qMo1bJiNDoSfg4z0nHI//XRWHOI3bvvwqHjS0DHkBfXx0Fds0vuv5UxK2mNlimtOA/K8oHESEJzJ/dzqB40KeOXItIc+fLpO20M8wTXv9erRcl6E8gFNyxjFAGWsGBpkJMKBcS7BHO/i3i0y384tRL9DNBw+HUnQLTKaw42STlNf8RMRhnraGPs2lgPN9onstEoWmIsEAyAFlIrNp3aeDAEQr7JR7XAz8kieqZw== 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=fGNsnof0koRUaSnONvC94iYeNdIcCpBcTF23TaPKavFHeiU0Sfqx6z85gWpekuATFYbqcdtHEcnd1YY9WMfXFkisbu3LIJ49QjMXn6Nb69Np/MnmNk7R3HoQgzueyBT45KC6ZVSecHCd1qObt967kjuICXDs/4Coo8i6dhBtgdK1trZih9q9Qpol5rBCtCpk+XL0GkktkynRItSBvk+WIgWGujPB8NA0wW8PKIQop0B3XhrgoOg+yO4KtGlSByE1k3hVipuN1JuzZOUk2rkXfDvtF41CLIaW6dvb9dNAn2et372gztJ7A/6qBRW/DS3SdGU9Flf77wgN5uDPKw2qmg== 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=JZxPNFdvOKkBVCqEE5houq+wif/LYxwUMJ/Aeg7wF2GYSnh/Jz3kaf5y5mJODFvYcPspPz1KkUuVIamP5GkMssVWby+1TT9jRBe3tAiTMj49GXEot4t+eA71JmfMCCcybeOjtfyq0TU+62bm+bbgxz7kn42ILLhgKDYFasdj1JyfxqYMh03e4W9sqXozCXkoAfQhJNmBNUpGttLJWt/6AnMqpgfL8C2zLHOrdFcKvLB52ivmMEmaAbXtaBAcVpGh8ISS/+KQ3MvWlqMt/6ErlKiebbV3N8PyR6fHX3KMx5kwXuyb0d3ECXvYVOpIoo/Ektx0qljL8Uk3+Y5Bc5uWcA== Received: from BYAPR05CA0036.namprd05.prod.outlook.com (2603:10b6:a03:c0::49) by PH7PR12MB8777.namprd12.prod.outlook.com (2603:10b6:510:26b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.26; Mon, 25 Mar 2024 17:32:43 +0000 Received: from SJ5PEPF000001CD.namprd05.prod.outlook.com (2603:10b6:a03:c0:cafe::7f) by BYAPR05CA0036.outlook.office365.com (2603:10b6:a03:c0::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.12 via Frontend Transport; Mon, 25 Mar 2024 17:32:43 +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 SJ5PEPF000001CD.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Mon, 25 Mar 2024 17:32:43 +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; Mon, 25 Mar 2024 10:32:31 -0700 Received: from localhost.localdomain (10.126.231.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; Mon, 25 Mar 2024 10:32:24 -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: [RFC PATCH net-next mlxsw 06/14] selftests: forwarding: Ditch skip_on_veth() Date: Mon, 25 Mar 2024 18:29:13 +0100 Message-ID: <63b470e10d65270571ee7de709b31672ce314872.1711385795.git.petrm@nvidia.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001CD:EE_|PH7PR12MB8777:EE_ X-MS-Office365-Filtering-Correlation-Id: 257da132-da58-4607-7fec-08dc4cf193ec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WRhJgxAwqT4dq5fAAlg5QPko9RHKOPRm4IUZbZIqW0M+3FRTG+kLRSbp51rPn8HhqkXDbW4d4LMHnNwXvC7AA9Tri1B8PMJ+amxDwQWwUpDHw5aNMgXEmFAB4fqawMXDwf7K9tZFAUluk6ygziE1Af15JOooEDQZTyXTprqZUDWKKzdwf/Yd/AOPaioLhMNNRIH4jFx50Ku85gEnTZc/z5nzT+ZY3f4/L/Z7018Cks7DtUpN1T2aILm6Vb/wb+ol9BiaWwxv08Cxvx3x57QOLZIRJPG9lWa8oJGFPoTdiXpY/o9HyI6auuYkuMgruP0J0x0Tj1tAOakf0ohjvMrhIPQ6Dt+dRvxlimTp4qOmBozLdjahpfLXoxTps/VXUOk0JlIiAWiZma1X2WO6O8tMtray0+oQfR4qldNMIK1QF1/w6q/uBzw7kVc0GDRpqWg8R2JHfbA+sYNxFP9j5LBG8l8j/+7cxy+z9PwbVsJkwEceKqHln6yRzrcltXAxsKUcAI5KvUx/Hy5n/HoniCbLmxDyr1Rw7RHtLpFsZM2WAusm1zUUBawo7vD0jWKzelwAFihyKxCndd+nztAtlMkKKbf2uBJWiY9IzajEiftBspJVtM+Srx7zmntkDm40UcM1rwwFkiB/TaRgzn7ZUMXl+AZIBhBsK7h7wqWm1qqMleGiVQT1vHSA1tKmvAMy+3PLLUf0spf2DueRTG/TLXWLsdc1BHTko3gdzB+atZErsnLTC/vciK/uIvCNZB0omfF7 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)(36860700004)(82310400014);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2024 17:32:43.1878 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 257da132-da58-4607-7fec-08dc4cf193ec 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: SJ5PEPF000001CD.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8777 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 Mon Mar 25 17:29:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13602575 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2077.outbound.protection.outlook.com [40.107.94.77]) (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 5A62D762FF for ; Mon, 25 Mar 2024 17:32:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387981; cv=fail; b=QqUUSovUAlaZaha+XG8byjkusg0xQS3X0FSbb9JMywvgcWPeeOFhFiVprpWVxU0QF6zntBlXlZntt+iQ3Ar6bLYh8NKSY1SpxPrC9KI3RGNtIhYL4uWPFQaz1ZPDYDxPIGtY0OVobTxeg1iZD/dMaIS+MaIOwEs3NDU6lIzPiXo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387981; c=relaxed/simple; bh=MxJe5u4kKh1gF0M8vK+ZVWbNyh5kNSewZOLFJ5VB0m0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uV6nfw3Z7GTGNHsQ4BwP+QkG97pFlm96ozwsnlU3KLcvfIumtZ5eQKNhpbEMqObSwvcwJKxUKNNjfAW2Z+DNw6SY1iiYf95STAKdYWmBVlVBlVepEfpRExcHu5JlcdnH6NoglyLvCJbexpy77rEp/RHFMZTEGKqQOAQ8paljy9I= 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=lrJN6UiS; arc=fail smtp.client-ip=40.107.94.77 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="lrJN6UiS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZN77hI8bF8UutKUlrGtsfaXADfmT4V83M9l6aGdHfNauK/r2toyn0J2sKepHCtswrpvJ0zyVizZwjv0FxvkhIxGYvIjkw+Vb+0ZY80iB4dEcWvJMOfq7TPh+Hb9/YDcFimbV9BWXC3j3AJTlUvlfNyOuEn0NFKu6gJN7MA2wEu6APqyb12k3lRCwtZ2OfvjwGQpys2WQn8bp/Xv0kvPW7gEMbNm/mXMT/0jlrGwg8LT4XGAk7cVJaAi3lALgLoRJ94VJR4AHys+BbL19QhylFwfjzHzbvnnovWzY/SihBuq8ib5mu+gZugFCTl4c2/yvWkpchWbHPSTBT8AnJmgbhg== 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=KKrfcfKRyIX1LbwjlM4hFvvJ6U+/oaseQhl90xOvQAKi3KLOQlOptnKw9hm+HJZFcjGPg8goZdg0ILTWl6zQiVhXebVoKya3jj+Nf5eScohRv/wAiFWn/vs8gM/a+5sAlSxVS3H+sF9KFl6u1nrWie+Jq0vl3d3Q4PvKeM4+a/HdPOMpWDap7bsS7SJdDlXOMRCnusKSxqYZIMnbUjZtvrA3WUUORa8cBiScJ/Fb21xlK5+JSvWWBnHszJkkCzJmvKR9sBVuHXaAdUsu/jthBHcjr3eaAhNRrvzHbBYJRAWbnqli9aHWctL8edlcj09QWqc+pBmqg5r4ZcbWBPzLnA== 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=lrJN6UiSHEcPqtz9LGetakYQ1RfbxK8Ex3vzK3SVSTyEGr0xSyU0cntfleI0Limex62xLukyh23rB0SOAUSeCgl4dr/YwtHKpCXtDQ4udD0lKHNHn0MF1LKcrduFl7kaBG8OPgtGYqJuHooXS/oJdpMlw+HheCMyLkNKlF7Ek0ertEM2PqZMzrULIpDuRshT9VUl8bq+lC+Zmp1cBvHueSkEiBQ233XwCjbOgMAeMBjYnHouzaSNBazFU4TEwkN2C7kFsAq8mY8Bz0dDp4kujd5NebwPGLNIiTjpjZlP99rYIwZWwJ+u2AoKTWcd0XiUVubhDep9aBeMZ3KcDBI3Vg== Received: from SA9PR13CA0020.namprd13.prod.outlook.com (2603:10b6:806:21::25) by DS7PR12MB5862.namprd12.prod.outlook.com (2603:10b6:8:79::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.32; Mon, 25 Mar 2024 17:32:55 +0000 Received: from SN1PEPF0002BA4D.namprd03.prod.outlook.com (2603:10b6:806:21:cafe::c4) by SA9PR13CA0020.outlook.office365.com (2603:10b6:806:21::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.12 via Frontend Transport; Mon, 25 Mar 2024 17:32:55 +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 SN1PEPF0002BA4D.mail.protection.outlook.com (10.167.242.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Mon, 25 Mar 2024 17:32:55 +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; Mon, 25 Mar 2024 10:32:36 -0700 Received: from localhost.localdomain (10.126.231.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; Mon, 25 Mar 2024 10:32:30 -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: [RFC PATCH net-next mlxsw 07/14] selftests: forwarding: Change inappropriate log_test_skip() calls Date: Mon, 25 Mar 2024 18:29:14 +0100 Message-ID: <3d668d8fb6fa0d9eeb47ce6d9e54114348c7c179.1711385796.git.petrm@nvidia.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002BA4D:EE_|DS7PR12MB5862:EE_ X-MS-Office365-Filtering-Correlation-Id: 867eaab2-f05f-4bb6-9023-08dc4cf19b3b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dGJXKSG1j5fKm/p+C8W5IXbhCnVIH68PFXVDm2vr1h09Qyn1DQ7lwGwdRrXVbKkIuysEl+wCQ74wklJn5WSNE6+Nub+kLNfwM+TmgMcH6HIQI6D7jf0Vrcyo0yHlQ1huw1jG7zAznhzpRnA3vabUYxj5fJ0Hr4mfTpukcNaaz4JtqA1zjLd/i2QaeSMBK3CR68EtMGVVCECMszBWxbzcY9c6D+LfdgsA2OV8ucSWJdDGuCX53Gk0JhSuCpGov7wHV45CFvye2AcAg3aGnMqrFUdhgk3apnLgzhuKUQf+hbq7gS+iGRYGWBIvVEZR9WHe/LrkSlPZoxfAKhl4djynlniH7AKZbl7RDZZeBWJLg/D9zhnWnBVEK9dq4CSM3/RyXZng+C3ohf0ME+WYcyPZcQd+s0LeiCz2kkwR8MQG33oPirkYF1E6PS+pvJ5/ugThinKjrB0njJfc7HTHJStJg3hkSeI5BAlgufiwnBwpDrOhkCJFi9VlN7DnbJWKlWdCK86cYnuiR5OLC06ANuH4dI+7kNCO29lOzg2PJ3RVLO4u17eCflGPCr1gRdTAg1uS4gwFLZIQpyl0PoNJtEHpcp20ZAXaa0I6jyVTY6748Bo1ttdKn87N7YMCX/QqoH6Yl9ZIVpSIb2G3FOGPc8g+IXh8BUnchExYgmyrxQ/njWR5RdVo4Y8heapdpZ+2CRpd8WvdcNIg3CdnAf555dj+u793oyrVNhHeGIhOVHfMoy97xMB0uVkjQH9FQiA2R30p 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)(82310400014)(376005)(7416005)(36860700004)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2024 17:32:55.3562 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 867eaab2-f05f-4bb6-9023-08dc4cf19b3b 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: SN1PEPF0002BA4D.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5862 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 Mon Mar 25 17:29:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13602576 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2040.outbound.protection.outlook.com [40.107.102.40]) (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 CE2D4131BD8 for ; Mon, 25 Mar 2024 17:33:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387992; cv=fail; b=d9e0WWwK6imIFRDfPqUPGoVmsXCD7+LyPkZPFNnu/ASqyApcL+rAw0d0b9snyD1ktU1C0YNaAivnYKhDjrnZ4kGBmd77bGepipoaW3aBJRnhrHiTltgcovkzQtkAeEMFvWGb29k8RDE1DL7LUWXWB04sG9CvSr/IQiW2gTBC46A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387992; c=relaxed/simple; bh=HDf28ffDoLt2OzHE5NC0EZDQjL9LK9TeToUEyEt1fpg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PJvIDGVTGAAeJdeIA0vaJui/bsmtnoq1vMRVUOJds19jgwN6iKzSvghlGvnpk0+rMMcGD/l3BhN7y3LE3eqwhh9LWS7JYXrH3dNors2RFjFXRlDV0DoHq5Zltrqjt+N+KBXU9pGsIY7qe8aNsKb3mLlfKQRP8+5RYhiu8dGXZ/s= 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=pojy8MmW; arc=fail smtp.client-ip=40.107.102.40 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="pojy8MmW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VvqF0DIk0Cq59XTE361sNDfxukPQ+B2WGJ3EXJmgCIluRzEkKHhND/csTTuaphlBTGqrtwe4cUm+ug24pyfisp846rcDWw8CBsiHuMBWOyqbtickuVpVe8nCfCnIyCLfE7smkanutiDU3I2kDtDrns20rElbyCd1pc8Dm4kmvX/PlAXMG4Y2W/8r3u92Jbfqw11zmxAwW6BXF1GOsXIieyEADVVDkdozg46aXBNKceYMmJ9VPkHUyMGqs61KwmeOd2reGMi6+Djq648Wl9IxwLo6mEBGx0S7G85BiOSlfUYsrWwx+E09NIiOquUavrFNe8KFdVkQrSI40NkyWXLxEQ== 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=Mdx2r9XdodD+fC0UK7XwhwP3Dzb7DLw0LAJFs/fN5p9B7gHLhYQ/jJGIRAtFohg7dzljAaQQrArLOVqOEuCoQ7g700uh4RmFMfYAguK36w1OWLl4vElhjXdFEBdZ+bBPTCTI+y5aKksYUy0bxURhTMp8yqmQcxVdxW4IWEZtvZUcmOHQhcgJS2ZLskQXchmOlOTJW9LrA+jlAWTu4pc/sFjO+lsxBJzIxXnSOJKtFdzASQb5ogyrHdPMBgNzGH2CJJyZbwr4366h0lErhxIt8jHyuLpkoe3sfakRSAbNsenyfDhhQkFaclPrTaOENMeM64J5qM/X0+8J1uMbhyVNUw== 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=pojy8MmWF8eopH6QlCuuzL0WciVzB+AY+jSPalc8ZDBkXYO4R5IEb+BRfwexLd3LDE9jtFg7bD3wbdMN064eFtf27qye2w7USsFTJTk/3kNfZMbWMoXk8BL+vhLV9WD6BJ+rjswG1bNfi7BZ1u6AN0omdsQLIQOGNtvT/l99XYftG2GnQWjrLPEQks+HEfvPMtoggE1N1gn1iw/edmu9W7RM6EEuK9Jp/mUuFaJTUgeaJU0P67BNccW0k5y6J9OiIar1v9J64jfKxr9Gy8BCaSgrcsd7Mj7Is0jwvxC5Dd0n8ipxwVcFa+Y8vUvWqFQIRclpxsze9+OYJpgYXijTQw== Received: from PH8PR07CA0027.namprd07.prod.outlook.com (2603:10b6:510:2cf::25) by SA1PR12MB6751.namprd12.prod.outlook.com (2603:10b6:806:258::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Mon, 25 Mar 2024 17:33:07 +0000 Received: from SN1PEPF0002BA4B.namprd03.prod.outlook.com (2603:10b6:510:2cf:cafe::6d) by PH8PR07CA0027.outlook.office365.com (2603:10b6:510:2cf::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Mon, 25 Mar 2024 17:33:07 +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 SN1PEPF0002BA4B.mail.protection.outlook.com (10.167.242.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Mon, 25 Mar 2024 17:33:06 +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; Mon, 25 Mar 2024 10:32:42 -0700 Received: from localhost.localdomain (10.126.231.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; Mon, 25 Mar 2024 10:32: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 , "Davide Caratti" Subject: [RFC PATCH net-next mlxsw 08/14] selftests: lib: Define more kselftest exit codes Date: Mon, 25 Mar 2024 18:29:15 +0100 Message-ID: <545a03046c7aca0628a51a389a9b81949ab288ce.1711385796.git.petrm@nvidia.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002BA4B:EE_|SA1PR12MB6751:EE_ X-MS-Office365-Filtering-Correlation-Id: cd7012dd-b4f8-4929-e29e-08dc4cf1a200 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /z9iExj3YSVLEu8Xz6gHdwDO9CNIo5znoiLUfXlvG/cWREPgqj6+qqg9ZYjel9zMFTp7lwM7FFhP6I17PTD5maJTICfuCyMz0bJu4Lkm4fpfHOadHrr0X70oz8TlMMe+j0niXHFFQ1SIdal1EDISlN4z9IHwflgj9hli4JvOfsx86o7RQt7VH96XvLjst+QleasgH4BNlSqF/sl7GDlcM+mJSZ0RurEsFfE+pA3bRM1WHsoC0yKNOzgzPU8fTEuUiN5EYBcRfhWqQi6azwBhY5g+dfQYIuaeyV0wc8GF4BfF1V3P9JnNp0/24AcBv4QxGdFOQi9P5sD8WeTtbxDe8Zfwu1ffpJZtrNSgT6AB8wpGeGW2lt/72Vyc9jr05Cqrldod8G7P7OmkwJZ2bG/DrjrpCfGB+dWKVqEtF0Tqy8xiC86D/s4WcYKaHLTgyLBiOEyUkXe5QnHuivwmpjNcrDNyKSGB0mBYmvj9vk5iXShGIIKqcftRkEF5poKTDoYFnujtqJbRVt/Fp2kDzF3pS/VkHy5XaaXblE/IYVUqaWtYGR7md6gRuPYVicAcY9kklumMThBFLRlLFGFpcY8VqLRWyMGl7fYyTXrzVyQc10oPHN/pIiHV0sXb5r/kUKqNnNLY2c2kfmMMVnqlKyAeF94NJ2dx63qMepuXVdRr8W3WZb6kWwORUEV9lvPA/DpLu/htMsMqebdUfzJ9d9iiChqEgfAeYYHtvGtskEVaoJ9aEE6sg4ox/rOfAhJ2IqAp 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)(7416005)(376005)(82310400014)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2024 17:33:06.7157 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cd7012dd-b4f8-4929-e29e-08dc4cf1a200 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: SN1PEPF0002BA4B.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6751 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 Mon Mar 25 17:29:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13602577 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2075.outbound.protection.outlook.com [40.107.223.75]) (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 B619512C545 for ; Mon, 25 Mar 2024 17:33:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387993; cv=fail; b=pZNxFqbMqExOekWPgGR+2gn4bZjarLFGFjQ5hDr/8kAn7mQbDf8Jq3um+vMKyXSS4SCMzYKW+VTVqe0ULOwCpp4Q1HTbYX1U9KMryTl0+2WUnVgfqj8dVQcHegH5HYtycmvgWPfC2n8VanedSkf/odoszQdfWwC5IgMu3dcnXRQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387993; c=relaxed/simple; bh=HdLBc7LTJzlez+0pU/02noPPYY1UjQ1+t4Q4/yvFYcs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lBd8x0WSUVgP2TSSkDwFyNuQKMzR1RAzihEDJUn5QZjeSTT2cQh9e/3QfxAGi1xf2TnVN/txcIvBLrKgEg56SEeEaT1bPP/s8bzPm5ozrVMp1NlylL1xUmxEfAEBLqSN9JibEEFxljlH6IunshqICH2MW0TamWYNTLf2lgA7SnY= 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=nnMsm4Ma; arc=fail smtp.client-ip=40.107.223.75 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="nnMsm4Ma" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VRSoiJJXg16olACrrB3m/g9xQjdaftxnGNs4u4HX94VjKcUsW/ybJlr5gTu6AVyVOmBKi0E+k05IROOpiinA6s5CDTnRjIWy4DvYUumAqbLdHExWhCbaoTUXXkgU+t/7xTK5pDta1rhvTvbI/vd+toN9Po1VUaE+kzvyEuyj/hNuIOHGj7XBAKKsGB4KTTWQtZJ2rwgN9VaHFNGPEEILXNfPMF3BD+rxCuoIlTfY8thTd1QFLk7o4D77CRZTthbPfdtW0YCGZ2U9bBhguX4rOIggEn0Pll9b8O+vM7aL2z291c8FjLW1Jn1Yhe+D115AsSoyQL+pQXfIi+zVZOZQWg== 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=3RrFesxMWCipUUd2qwALPiQvXKGIjqkZiMQWbB7nrhk=; b=mif2B3Imlp6GT2uJAf2zJABhEM0ITUxR2klhimqvlGqPB08kkFL1awyTPNtwQ0k3iEcrdrVVh9xkITA0L9dE4TPtZOywxTQSDXUhOYvTzJvwQMz7NEkr4rZ3HzXJQ1j5GKI5ONDu6zdWcxV11ZSLXxkOxMxFcZ+to/ZcpVHVSZlgRDfeOFtR/C70I52Tke8H8o2UYa7m+aM0+9cPqT3hqWZRnbutsumDQFf+XCJbuzd5siKhpyxd/ElBDgK7t3xXdq1EH0Y5Gla7Mmt5NjZ8zel0zOs/brH7mEFC1OfdI0WbBpy40gticdJmD77c0PpJvMqikCYKzVv5zmuDf/3wKA== 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=3RrFesxMWCipUUd2qwALPiQvXKGIjqkZiMQWbB7nrhk=; b=nnMsm4MapMvuEU5YtBV9flPDwGtbGeJT43FU4ZuWwtp1YEcPqG09xOzVjHpOU4oi2SoZ7/dZcyLljxKUD+N9e6lFHfCJOWrVvHmt1/SewmO3S68ERx1FeFeWNDR+MeCplT8K307rUNi+hFHOgGUjNiR+338D181ceSG39WWDsE9fR4XVnXVwEnl3h3dguwpiyw7wttvz3Y29hwMkyut0JONpMF4oJgChIGaQpz+SH0LJo6gLNyXYZEEZ8BFHbgakVGhxJSHRJURKrZSt557+rT7u1qAu/u9FZHrdLcv/QFCMw5rp/wlaXQpATytqso9xl/kR1wmv4svGmmDuJ6aO9w== Received: from SJ0PR03CA0201.namprd03.prod.outlook.com (2603:10b6:a03:2ef::26) by PH8PR12MB7301.namprd12.prod.outlook.com (2603:10b6:510:222::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.24; Mon, 25 Mar 2024 17:33:07 +0000 Received: from SJ5PEPF000001CF.namprd05.prod.outlook.com (2603:10b6:a03:2ef:cafe::cf) by SJ0PR03CA0201.outlook.office365.com (2603:10b6:a03:2ef::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.32 via Frontend Transport; Mon, 25 Mar 2024 17:33: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 SJ5PEPF000001CF.mail.protection.outlook.com (10.167.242.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; Mon, 25 Mar 2024 17:33:06 +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; Mon, 25 Mar 2024 10:32:48 -0700 Received: from localhost.localdomain (10.126.231.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; Mon, 25 Mar 2024 10:32:42 -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: [RFC PATCH net-next mlxsw 09/14] selftests: forwarding: Have RET track kselftest framework constants Date: Mon, 25 Mar 2024 18:29:16 +0100 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001CF:EE_|PH8PR12MB7301:EE_ X-MS-Office365-Filtering-Correlation-Id: cc865e05-495d-4879-d1e2-08dc4cf1a1e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: u3GwReVuIj1qBvyrLHO43yGUcoeRhvSIil/I8BGII3KOn1+qjQjyKP/8qZpUDjf48L0W1YJwQvMEjm4BzX6mf/dFCqfr2/xpcO8btKZTyaG9Q+4t6S6nCcT6wESkVWoRxMGhd8iwRINHQtlIW6sX3WdZ0z//IEEeG6BhNvI4Y4yUeFAIz95LYevVaxb8yXog4p3392UqPHqRuP9BPlE6sBkixNgHAT0CYukSwPDk1gqC83BnvPjd1hV63S9nPT7hEK5mGb7pQ3kDOxPSa4hy0K6Z/VeZOn9R+94V0j9lFipgQW8ofT4kG9v3ZEzwsjHxkkzDP8pCIXPdE0O7DV1Dr7ueZcS2AzPCcxexHS7YI7NlZeXyxYvk6KdPHhfoULPzF48ui90wYU1XqK+BuqCAOUjqy27n5oELjLrEzgucq9SGo+23IH4kMh2XLIP1O/c1eT3lkZzKZRE24becH3lgrTfa92G1EhH5qmNXwmQFLjJpjgJcllNWlyJcpmSRJkwdpVwT3D8Yu0WGS042NwxMY3M0OnBYEPau5xM0VKbrY0ZgkxvZfQ0hfp35qDH49SzdXNVMVVzydK/EHpbgvbQJt1BZ1DihAKn1k9NhUGm7h+o0cu1KEZ5Tnn3DPK0v2TewOTuUa5HB2yyvTPQCtE03BTSn5fuMCm7LtSVRwekMOWc/BEIeYI3pYWH8WXuugCeX0wmBadhDNG+XRZd7krYtguBTEvnb9rl10uCEBcTmytoV2YE5PpqbRHSugOqqnvPO 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)(36860700004)(1800799015)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2024 17:33:06.6412 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc865e05-495d-4879-d1e2-08dc4cf1a1e4 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: SJ5PEPF000001CF.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7301 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 --- 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..e72b2370238c 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 +set_ret() +{ + local nret=$1; shift + local msg=$1; shift + + RET=$(ksft_status_merge $RET $nret) + 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 + set_ret $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 Mon Mar 25 17:29:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13602578 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2076.outbound.protection.outlook.com [40.107.95.76]) (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 3225412C545 for ; Mon, 25 Mar 2024 17:33:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387996; cv=fail; b=nbx8QxgU+hpn6lDnWj0Y5EKZU6nUwbhg8quaT+Q4Xa4DVUJPKlKF0VGST/pg6Jk09jnF0Te7V2R44uwiHqpCiDhqeqrXbkizsjbkohFn/eSTOsp4O90rzwqET9JKH9C9/oTMVOR6My5TJgCKM3aq4X/bZ59PwGskow2Cv8Ywa9g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711387996; c=relaxed/simple; bh=Z2UsHHfIZ1dfSYQOicILd9VGYKjI68UbAs5c2qIZLP8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=q2opLdItDkwwxf/StIBdFI8wZS2mZvUvGaME5+F7I66dA5PcbckG3ua4CdNnjUEgwJ7GbUxrHC9zlhpD0uZozNa0InVMCNHtTnTOBbAm0+gV9Sk/VAt/kRhbcQWP4JamxLZ/Lt+mloXqQS3mZCfEnbmEMS3DVB7A5HcKrDxUJvY= 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=fI45JxAE; arc=fail smtp.client-ip=40.107.95.76 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="fI45JxAE" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d7lPHU6PdGFEaareJoC+v3ZsHM2NYvHBop8nYf3+xNnwK9F3ICjOWr7m6XDARNHrQfT1ULCBMhx6gGU2K12mnIUMGrOdCkDoEdN+PcRknKsYpWXo4mVVS9/k9Nd0p/2Q8iowgDadAGz8U0lwlr5WUd2iIf0RAj+1Xy2IU9A2n1A4oK02XYSAUtcs5Wcln482mIgRFOIs122XbkjXmnhG9Nj1cpuwiq5+7XtVVM6UmNEp2eB2zwBX4TGGjeLs2etLz0rHfnE77E21pYySlKYzHaKI/HUhS57i38h+DinyCHSQjv8pQA+qweST+JFxlVc/SlPq0q7fZzQy9wwvHcJZ1A== 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=WaubpYhMibDQ6SdKpL9fTZ9ADyHIA00Zw3380a5t9+c=; b=GQsYGonDIdgzm/d4l8ssIzqFWdcEYxE0TLq16M7EmkAYG8Ppy3JQXklC9tHBhHdm0v7idH4SJVPY42tTP1lZl7gt6B9250rx7R3DXTns/O1+IE50jRjECUfK98YEyMIUc863HIiqlfUv5lrZfDXCFc4cVozdXdpJg5SNANOie1IcdVG2IARE50zO2wdCj5Lio8d39r2cJHNb1DOy7Xelfb+nZTFGP1Z1S5LoS3YUVdNW+IboweQo6KR5OSETBPx64zIbpLIBNVazZ2zn4iZSZkkFsVuMgIkctvEqjBjCu84yuM/z47jt8yDHkmmGNBbJKeFt9hNIAz3Tqi1zRnfwrw== 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=WaubpYhMibDQ6SdKpL9fTZ9ADyHIA00Zw3380a5t9+c=; b=fI45JxAEX8pNfLBUHzUjJqPbOwJyW0otow5USJ96ofLKbu9EHufbwDyiV1AZyncgzHzwnnrbt/BpFfJzKnLsB9pdsGEF1AdHknLiCT1qZgJkeLIcUBHqkvEAKAzPu2l0bJsYxRXTatZemM+jtmkoOVv6wUi9jYqNIwT95NdzpvZfzOgbtXDY82T298ZXbmBc3pCz+ZeJexue4TZ7e2ZKFZbdkTzTj10Clz9qnuZGgZQBgT4cy52GXTOuw7/d/EBQIl3jwlFb3UYk0gqrfE6eQK4tcPxsbHBgM73x7Q58BhJKGsU7gWw+9i/Oc3W2HTrNlJTIowQPSWs8GI060+dbMA== Received: from SJ0PR13CA0030.namprd13.prod.outlook.com (2603:10b6:a03:2c0::35) by CH3PR12MB8354.namprd12.prod.outlook.com (2603:10b6:610:12f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Mon, 25 Mar 2024 17:33:12 +0000 Received: from SJ5PEPF000001CC.namprd05.prod.outlook.com (2603:10b6:a03:2c0:cafe::10) by SJ0PR13CA0030.outlook.office365.com (2603:10b6:a03:2c0::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.11 via Frontend Transport; Mon, 25 Mar 2024 17:33:11 +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 SJ5PEPF000001CC.mail.protection.outlook.com (10.167.242.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; Mon, 25 Mar 2024 17:33: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; Mon, 25 Mar 2024 10:32:53 -0700 Received: from localhost.localdomain (10.126.231.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; Mon, 25 Mar 2024 10:32:48 -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: [RFC PATCH net-next mlxsw 10/14] selftests: forwarding: Convert log_test() to recognize RET values Date: Mon, 25 Mar 2024 18:29:17 +0100 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001CC:EE_|CH3PR12MB8354:EE_ X-MS-Office365-Filtering-Correlation-Id: cc7e2494-04d8-4f76-59f3-08dc4cf1a4b5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +9CWir7KpHTg2HBCbpz0N3VyaN+gSTZXaPkqJqtUxRhDC+5YJjZKiqcbI1/RGlm8AC3qLO1dZRVSPMfv5KUiTKleFe5WLXICTJjCp5nTQ6dqKJZED78pEss+sG2wZnHZ73yQFSnfSRTaEGET/Mb3WYpMCn5cRWBaS9QSynasMF9L97j2B8Dzfmdcy0Qtrigr6E0xC6lO0MTRfzmhvt/TUYKiiiDYptFLeuQAYjCtOxoeAw74wt6lFZA+7kBeR7O7/pD2/BQFz6Rfh5WfxcB65RK4W5ljdZM80XLovGYlHfw5dS22aXy/knWa1G3lgNnG5sGhHtA6qroRPxhz2vXMokqdSOMGuXMyUml1m1Hlw/eDN1gF2pbEoxCeex7rR4h0AP9+DuVs0s48Hx6l+Fo4yVgboM5ol+7dP9kad4GKDlVks0IptYunAgL7HYi1cbCcSXlySYIaVbfP/A2G7U1I5lePD4zCsA6A3+6Ep1fuOrTJFmgRDNUaHx+CH509bsOK8rvy3L9JJln75gkHMLp63EW/6289pAqxeNGMAMerE/HSTE5UfSA6Zcd5KxELY8IIIjzH9dRpsGO5OuiMkMbw4fJkIjFYgnXb89JBc+uKI+FW8mFe6NV/T4i66mGPD+3TiFutyaN1vi48FIqL0WduwAksT4tqQjuhwiWE9kuPWlvIsKKwMCohqyILUq1i08iJhE4TyVkHCC47pEcrpKmEL2uN32yf2/Fcjw0mxnJWqDeePuGX4CMMQiiDgfePVDJf 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)(36860700004)(376005)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2024 17:33:11.3476 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc7e2494-04d8-4f76-59f3-08dc4cf1a4b5 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: SJ5PEPF000001CC.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8354 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 e72b2370238c..942f38988941 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 Mon Mar 25 17:29:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13602579 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2062.outbound.protection.outlook.com [40.107.244.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 893D2811FE for ; Mon, 25 Mar 2024 17:33:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711388003; cv=fail; b=BHE2HrsqI+CPwtwmoIt/jrM5VEWlfWn2mb26ijEyH4L72a35mmGBbhE7P+WmwJGjSY/SHOP1X9RZU3OZ2z6reVlbmSZOPj1wNOo+eXd9Qx4Qxn6tqgGfG13iG0GHQYDBn7F9YvrLcoxTfHKh+8EJrVLUNrg3iQsHKuTgRKjILJk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711388003; c=relaxed/simple; bh=J3Dh0PhxUws7O0cLcSHKwVOtL3i4Eee9MIIZJY4ZG8g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Tt9uzpEJhmgO07I+D3XgqhZf+SomLop2CW6WIOu95KIC7CrR5oHxSBVAhi5FriYROsqsd4S5RQRK9YaeeWqVOm1uAhHV9AwJtfk6K+oCe1Lx9Yp1KQdivLPjuF4IxTeJBQss79cG4koPeayDPtxo1r+MFjHIc7Vp5WkzCURpevo= 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=SKO+/WCs; arc=fail smtp.client-ip=40.107.244.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="SKO+/WCs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TI7SUcdjpoFvUfCUZeTyJcb0Q8T9Imrd3KmPYK5ZdCwGfBjJCgLm3SDxX8bVhMfWt/Bl89GPn76UBCpA3glK2FvGaoL3RhyiVtUBNRyrSSYEe5FoG2F7A4cDWyBB5xn7r2ThXnJ2NvJhKv41O0wJKdO7sFywbv0UHHZLYUXGiRYhKfC4SqhS82KGDMU2czh88yfEMKId68fnQ26v7m4ETwckqdCg5t3UVxWn5coBWfBg+6p+da5sDxBQka0yR1v4tKtLtRTZWzH/h0i/3rqAr9Rz9loKSUAu+iXVlXAc8wQHAPx/yzlDrY96bpMHvCzYdGWG/+wnPawkXUmp/V4TVA== 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=v1lpwxUQhTwCR1THjSFR+evqi5WzOvVdmKlLVv/moGQ=; b=Esb/vviNqAHD1N2gFS5s7YndKfokGGzu/PfxY6TnPlCjRC0JpOGGBdpfmHBuj4UkwmfW0LGr6/Hr03sn5IIbJ/Vr+FDcjqjIO8FP+xdRziUwP5FZistiRGMIvTfZO7zbSxjgl0NWBPV+kVE9ldNl80RLJmLUSruk7x8WtaqjDmTzzgDyb9L8NsH5yyrZaAN8t7mWW5i7tlbmwhvTP33F0DsxoppRDG9O0O3QXpD0cy+xaVj5cwEW7c7tQifwdamNfTvMpEdHbv7Qqr2uR04OzDJC7bRs2TXqN2OhtFTQY04ZRN8bkj7Efr7xBtzhHErm6nLOM6x42k4P6Q9fPkyi2Q== 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=v1lpwxUQhTwCR1THjSFR+evqi5WzOvVdmKlLVv/moGQ=; b=SKO+/WCsyenOqPdVv4SUMOUVEc37Hk1xXJPYtq7SO/AZlWEPB/2i6rzohoqmiODtcKPCubSWBfH6nlzcCSLc5h2lmpwnOa+pDzygeF1e8/4OhVjjLoSx+P201cdTgu7IOg2UVBedPrUorI6mY8rbQTTTAWLInpWQZdT33FAATQ8UbQUcCVBoCGGh/AmucC2ysIeIouv4R19KdCWn+IrBHDMgjaDIRNV05tEOnEx+XNt6XGaIbktXJEqtAl3rWrUp6SVS66ER0wA6TDifsVJ9ave9aUpRE9dyfUDtaiow40u+MztP7csuIrkc1lA6mt6t3FwTzuPUJaB3MknvJGtnAQ== Received: from BYAPR05CA0030.namprd05.prod.outlook.com (2603:10b6:a03:c0::43) by PH8PR12MB6940.namprd12.prod.outlook.com (2603:10b6:510:1bf::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Mon, 25 Mar 2024 17:33:18 +0000 Received: from SJ5PEPF000001CD.namprd05.prod.outlook.com (2603:10b6:a03:c0:cafe::83) by BYAPR05CA0030.outlook.office365.com (2603:10b6:a03:c0::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.11 via Frontend Transport; Mon, 25 Mar 2024 17:33:18 +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 SJ5PEPF000001CD.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Mon, 25 Mar 2024 17:33:18 +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; Mon, 25 Mar 2024 10:32:59 -0700 Received: from localhost.localdomain (10.126.231.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; Mon, 25 Mar 2024 10:32:53 -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: [RFC PATCH net-next mlxsw 11/14] selftests: forwarding: Support for performance sensitive tests Date: Mon, 25 Mar 2024 18:29:18 +0100 Message-ID: <3d29f0f344f8cb2984440f8d34ceaa94d2b54019.1711385796.git.petrm@nvidia.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001CD:EE_|PH8PR12MB6940:EE_ X-MS-Office365-Filtering-Correlation-Id: 64ebee14-9073-4069-2be8-08dc4cf1a8bd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JQNB3wkXcScH14qbggw/91nawJy8dPpBfU2dSHHG0djBlj+g8evYzXgvyGpL1W0c9PO6lW6o+4Dp367E83TaQ4CEGNr5Szxsu3Fk+HZlq8ojK9oMi6Xw04ZYm+ybTtp1yM9bNd96n9IdX7i4E4FuII98VV0lcLy4Si56FTj0rSh2eRLq/flqesvuOZ2loucrptKlb/snzpRsUzBeHh9iIKSP7Us/2YzWWlC0znNDdsEtlptVmn6JfUyOMimrgjNl639yXDSxxhoQiXJPsdITWsnJUBfDlIRO8+RJEf97Kh63Z/VzHaGHpBAFApIlcDTZ3c3jIvt6piSOrriyCrZkhO16NC+1mQCGJQGKbvAHBIekZDPUMC/tYwcYpN9ObGYEFjgYU0s6ZDGSONgee6DubYDZ6uUoJL6CoZw1MSjyq4Y3tKgarXB8qI6YWRJpmjtdvnm5pffk/EqhtcQ2kJhv5/Su839S1QO9ib0dQE77PnpdPJQ98Vm4W/BWyKDlTM1RVFsCE46czZIDTJAJpUoMWKcORG4/f6zIZ1d+sIViuuDnlir+MxaOUpuaDFihjrZOUcuc0QaDmmimpLMl3qVytEQL5Y2oT6hlPswBczIXXlGmyJG/8VE393K08lgSiT+mlKstKXslB9++jHHrXCMs/1kdnyQCpRHCD+40AykuRr5fL6cMDf3TsMwAIJCtLxOBSBWwOjKGd+vg4Msehj0zP33W2koYF5u5z691Y8TLFmW1NWjG1/MIK/pJvKRAmM68 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)(1800799015)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2024 17:33:18.1098 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 64ebee14-9073-4069-2be8-08dc4cf1a8bd 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: SJ5PEPF000001CD.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6940 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 942f38988941..cc32bf11739b 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 @@ set_ret() fi } +# Whether FAILs should be interpreted as XFAILs. Internal. +FAIL_TO_XFAIL= + check_err() { local err=$1 local msg=$2 if ((err)); then - set_ret $ksft_fail "$msg" + if [[ $FAIL_TO_XFAIL = yes ]]; then + set_ret $ksft_xfail "$msg" + else + set_ret $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 Mon Mar 25 17:29:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13602580 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2064.outbound.protection.outlook.com [40.107.94.64]) (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 3D45D130ADF for ; Mon, 25 Mar 2024 17:33:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711388011; cv=fail; b=UCNeBbVk+fvwDSGFJbPYBKY/lTgM/c64YSHZpIbIVGyu5BgPVUuUj96IluNTormq0eRtySkB8VePQMCh6GGj6QRlyBxz2kRV5UAVm7Jttyut3I7l6uWAQwksomWRv52LxOZaAwcwAc0abry0H+U8zbA70EwoK4enLeeqM9wFdZM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711388011; c=relaxed/simple; bh=sSYwjOrOgKy6m8wve4tKsRPt+gTovOReL5XmBXqY8s4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Zc+1azNo1ioDII+Uibz0Tjd+/QoxrSfleWfGf3hhPF89z4ScwXaSer+7UTyxANWgkYiaYDkfOBjdHcJpJhsEp9CHaQw7KMB0+Phy5+wHZCsmCzVZ9x6W88F6S2vnqtj8yAnEKUBTEJOsi/cF0FRDkL9fjxz2gBEw5kJSmwPIKDU= 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=iYnb6iFq; arc=fail smtp.client-ip=40.107.94.64 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="iYnb6iFq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bd/B+HCeMqx96dg4jAvWE/Kb2OzKRKLT1XpaGxy6YWRq6NTW7ecaFgXyV/DkxIi7VqO4gofXSu7m4WzsPHgX9ODQun8rZ466FfyB5Vverc77qTj+OnyPLneiXexCPrek40HHRgVjBaWN62aGQUeceMUzRxXZLGfQgzV3gi6mOFuMT9cI6zmofkTwAMuwAipp7i6WpDpjBmDb9lJ22el5DsHrLJizKOD+kQei2ag24TtqSAMHvFrfAbAqGbdcEW0Pvu4tJ7hTWLB/wwiXjtLaHlMJhY7FpGipHJQb3BLfkl4wLIpBkEVT3pO/dPQz9JguqRCQyZfPmo8hfcf53xdDSA== 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=QIWFlcnwx/5jr0RHqh7iHsXBhQ3t66kuyRqp/cWKwYTudRdFl893jCPeLOOsdznOc3DlkDVcBpDIC/U3Q/DM22R/5zegLLjEO/ZK5SZh8brvdjT25rTH7UHrhjZyIkXj+iRYPPwBh4CxCNtrdAek0SbjwB2tMDf32uWvxCUUWLQ+YFza1+50nrDzl+gbYASMut3pZWJ5bVwEnwk4txJ+iZkWfABoUPWaf7LACy8IuCtYTk9TiKCGY2v2AxxhvmC5zSKk0ZH99E3KhEBIcjBG2j/+f+PPww3itN3f4TPoEqTiwvCETMuAtJcHf89e5hA5PAGAo9Cd60ET5on/kwvuuw== 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=iYnb6iFqp89sl24bHav/EZYS/Cb6RopvFVVTBFiGm/37Molm9eGfFGxEMud+iH6U3GKnuZsjJ5z1dKG35At1jEvsJR/D4Y+lcEjQHIy4JOFqmHVInjVQteAcqVgtqXSXX1n+HiKkHrhrB1t/dbdGFoc4W2kOfDNScBBYk/3qYbs1cGyq4Bg5a2xJoE9n9akArHxuS/6XOmSxU6qax09hK1Kp9HmnZDjsEJY9e6dEkZwHKuOxgV7aNT8PKxDIlDTZU3uEMF+IWBl+JMqDob88Y059l0CSzLU14872QtbpveY5ix8S3IsyMM8nsQHA8k6iedV9PtHU3DvBJovz67M4kA== Received: from BY5PR04CA0020.namprd04.prod.outlook.com (2603:10b6:a03:1d0::30) by DS7PR12MB6288.namprd12.prod.outlook.com (2603:10b6:8:93::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Mon, 25 Mar 2024 17:33:24 +0000 Received: from SJ5PEPF000001C8.namprd05.prod.outlook.com (2603:10b6:a03:1d0:cafe::2c) by BY5PR04CA0020.outlook.office365.com (2603:10b6:a03:1d0::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Mon, 25 Mar 2024 17:33:24 +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 SJ5PEPF000001C8.mail.protection.outlook.com (10.167.242.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; Mon, 25 Mar 2024 17:33:23 +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; Mon, 25 Mar 2024 10:33:05 -0700 Received: from localhost.localdomain (10.126.231.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; Mon, 25 Mar 2024 10:32:59 -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: [RFC PATCH net-next mlxsw 12/14] selftests: forwarding: Mark performance-sensitive tests Date: Mon, 25 Mar 2024 18:29:19 +0100 Message-ID: <7d32cc650373af8e477c193d77b7748913bb5594.1711385796.git.petrm@nvidia.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001C8:EE_|DS7PR12MB6288:EE_ X-MS-Office365-Filtering-Correlation-Id: 811f4efc-3215-423c-8c53-08dc4cf1ac29 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NoRezW23hTxO+N4waBeWfCjOACQ4qPzB/IW8k/RWlC01X388b/HSS9mW0ixOk1wss7A3Goh3cBMV/9avxMe2GUnT6iaqMHldn0uAG1SXxqf0ewqzIHv+RxxWIeyWmTioX+1GX/WqykJklptsHhfoN85IceXDL67FsH2zjJxVRMeYfOitQIDFsVNgrVsKJsSZ3RvnxTUby7S/8bxYnfs1uSJfIgBYAOhgjhh9YvvimwmgjyLrRjGr0yTu2KpZx1ZPlADsQplWXiNb3dDmRzyxFW+hNzAYvR7lQ22NgGtl5CBVZ1HFW6NaiJ2m5i/CiTderY3o82ekyMmOGfyQSOx3OJkSN95yDnn9AH7rUPlNYrQstk8sRSqnAbh3lAJ7SQ/GR9+MnrNzfLBrVsvRvkYPXfcHAF4fbM0gqrvfbOALyASBw1gS7hbtWeR3502kvoPww2yzb2N5XJ5BZl3Oj3eAuh7FcWkqZb8kNaA58IBEoici2hKG47ctNLfytfve7C0nWzIPm6RDsWckcEV0AsAFJAvyPLSEddzDga4iap1azOBaAsjC6ZehhADUefoOYluzhic5Tm3t9RQk5Igd+DkKh1pcCGEQTqveg/TBn6E+ZYBvZQiw2OOq9WOGele0OCTqEeYXbebKDY88R9veu3vKKP1ohzVgcfGegZzIinkxFKdFuu1rQwH8zQPWH/KatOJVGV7PlHctXEgTFdFI573/zBG75fm+OJcqpIPKn1VHVngfRAayUgSbGvCxC17d8829 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)(82310400014)(376005)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2024 17:33:23.8688 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 811f4efc-3215-423c-8c53-08dc4cf1ac29 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: SJ5PEPF000001C8.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6288 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 Mon Mar 25 17:29:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13602581 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 B4126131BD8 for ; Mon, 25 Mar 2024 17:33:30 +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=1711388012; cv=fail; b=h+fO5ZirQ+YqM7DfA9N66jjl9bdal3ZQ9rXPwDwTUJugLb9lDYcNMa2FaWVeIKVNGMxHM6cfwQM7Ht18QJOMRosjAIyilse23DmnSRu12MGHkeS8My036GU3Q46Y1U/v30wsMRsW+S1kvKvNgTYE5cM4g0EJoXc7mjs3Ey7mYU4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711388012; c=relaxed/simple; bh=tN077XpbLAOCl7+6y1PdN3Jr14rGpvOOfr/KKZ/A1SY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=o1ImMBa921MvAkn2lCjqXlUshgDNUMS1SbzrXjhTpXRMh0lmda8HeWkx7cspM2rItB45QEFNg+BR0xJ3StMdyLoXLybjsOJ9Hqh3rcX7bxaYcuSLcUKMb+d/OS0PDKktqZQxjkWfXjsWSXBOEhajnYKSrQhL0aES8DNaq62NWSU= 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=ZFgtqkHu; 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="ZFgtqkHu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bqfn0PqGVDMqp85bU1lZOzpToS4BVw1hV/YdI67PP5bZ3EQInt2UuzX7iKF0VhBOKewojvMjz8vj/K/R2ZL2f5v5rtGejgEgWUHdV1o/qWumKu+WsGEBUHc0avl3cKoh5zhuzFWRlVfr6wUmLQEXqfQpWKwKTl166kXqFlvju1n7dHrnzGk5hKZ7SpW1t5zuUOdfZ2CPlNhmMkQ8gcRW2TqOJ3edevYEbDV9SviIF5Lk57RVVsRVqh/FgLQXeD1+vtg3NH9FNqALjmczEZXxBK0hCi6cHelQ3A2zQwXswA/y2qs+Tfqt8ML+tXSjxUP8g585h1kt0V4ElBnSN5UheA== 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=ta5/s9/vAt+a2rmB7J9pW1L9/gDNzKRZJ+DkAUkDZBM=; b=mjcKFqIv6n/pUHgMnwHeoJYEnsi2/luMxDUpIVFAO+lu61wPOamqf83DBc5zPzVtfEvR613FYcyUfZ5w2aOZfhuO9SZXUJtUPWL6IbJJmozPmRFF/wh+NJKk6zjJwSSQG4/eDFGDZf/AhnJgYSIJdHCKkikIKOlGNf2SHEAdLZjOKJ/ZaDah0JgdzZAWmvvMqbQghzyOJx4EM6sUID/g2TBK/1rxUIwi1SM7hT1yt4W0UQICUuQeWbV0Igw8Csj/u+5SxnRYSYaQgiq1eSOFUsDzjFwooD7M4YXQhHs9jYFamTNj9G1gqi61TQODej+2UkEabw+RvXmkFaR3zicVWg== 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=ta5/s9/vAt+a2rmB7J9pW1L9/gDNzKRZJ+DkAUkDZBM=; b=ZFgtqkHuWTZpRqMgpMHpNVjAXuRUjvCwAcSv2tW8Xctz/vgawvWBR6HpOR+ny44phPrQg7DwTakmUACFTM0ozExNIoFDqiZxHIjzl6vU75uLYgl/EsEsrCjy4MQEkBfesn34VdYdeRp4oyHzoapfMdRCLgh1HEEFDKHsJi5vIV20XAt2XxBmqgP96t5FSfaimVAbj3YheA1hy3J72c5gLnerEO9VegqZdQV3pWNrm9K1Wb+jj58KqVi1hMV/AMwot9Zrb7B2PoJMq9JipFPl8ZJLx9ENJTpPXIPNTZKehn19fKZiGYJ0QawUoDQfVXUHzvzYL72y+NFMzeApkQSGRg== Received: from SJ0PR03CA0209.namprd03.prod.outlook.com (2603:10b6:a03:2ef::34) by PH8PR12MB6748.namprd12.prod.outlook.com (2603:10b6:510:1c4::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.32; Mon, 25 Mar 2024 17:33:26 +0000 Received: from SJ5PEPF000001CF.namprd05.prod.outlook.com (2603:10b6:a03:2ef:cafe::82) by SJ0PR03CA0209.outlook.office365.com (2603:10b6:a03:2ef::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.37 via Frontend Transport; Mon, 25 Mar 2024 17:33:26 +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 SJ5PEPF000001CF.mail.protection.outlook.com (10.167.242.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; Mon, 25 Mar 2024 17:33:26 +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; Mon, 25 Mar 2024 10:33:11 -0700 Received: from localhost.localdomain (10.126.231.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; Mon, 25 Mar 2024 10:33:05 -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: [RFC PATCH net-next mlxsw 13/14] selftests: forwarding: router_mpath_nh_lib: Don't skip, xfail on veth Date: Mon, 25 Mar 2024 18:29:20 +0100 Message-ID: <85c7ef7f4f5d796c0ec8ce0a9f1dfdbca2c0d279.1711385796.git.petrm@nvidia.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001CF:EE_|PH8PR12MB6748:EE_ X-MS-Office365-Filtering-Correlation-Id: ee09b38d-7447-4446-f76a-08dc4cf1add2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VDQiyYUUo7u0ZiyEj/VuZYET7h3BcdaLupfIVvQUVKslCFuEfpLV11HPBRTbn2OJol/2rXvdg91/WESuC0Iqpgaihb6j2YgcAGS2MUh3qg46mxdeUKKChARmRcT2jhA65F3jlQtgLzIISG70+Xxdx5cNb8i1MtH2WZpDwaejcOooFcFCa/8FA0aeJifd9DjbppikR5eC9nCnW75pIlDDFYI1QzV8m6bTMYc1+rwn9AiajAufNfVETQOv3a2O+dcynk4n10kgsFLmGydSPSfdKDNo35P1vpybplJJ7hidrsLW9n+J2mHRssh62Bi2Wd7kYIHNurRgrcl6vx2VCgOG1Xnwz0fR+wV/yhsIzZDdMGd9/KhbzoE8QKKDpwqUABOIijzcxfZ9i4hbb+FvRWtN4kcSMnhtB3ld/FEdB2TBvilymoLNSDZuOHXnGWix5j5Ox9lnoEpeYTYqu6+vSy972e5eBxc6s7xrP8nU3XJv+in7r0PakB6eY4Eh3aYvdUTvR7hTJvXFkoMFKg1ZmWQ69RMa72XyrCmzdIw64/fJjNQjU/3VJG8W3vbmA6iLDg0VD0t3xgNUhnnZTgJsEPhHKZawZd04SzC7x9HLHm5MugR10rB+I0oQFQXCPYJx1tT/Is5hFEteLgzoeRoBu0xx5ZHIWikIXIdZPqESYpWl76KT4L1HSQfpsGOepltiqOxMgEbvMMVKaE8Wi35pfz3B3tzltXfCWYF7qthQVqZ8ScaZfOHGzStdrVI+FFJ9E2nE 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)(82310400014)(376005)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2024 17:33:26.6568 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ee09b38d-7447-4446-f76a-08dc4cf1add2 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: SJ5PEPF000001CF.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6748 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 cc32bf11739b..6291723580d7 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 Mon Mar 25 17:29:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 13602582 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2053.outbound.protection.outlook.com [40.107.237.53]) (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 5A9F4131BD8 for ; Mon, 25 Mar 2024 17:33:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711388020; cv=fail; b=giTwsR2+zvfPoE9AFD6CHHBAije8y2mklZ4gjlfifvPN5jwpj6raue6hQa6mwqa83cnlSm6SR3GgOqh1LMzLgrvr/j7tzUPKWiaZX+bbwBcZBsAea6vg8x2sGPkc5imzVAYwrEEyfaammGcI+s9c/GxbLWIUNPVSs7MhUrSJGV0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711388020; c=relaxed/simple; bh=zv0E10TEsyjia4g06g9x0yDea/8AoDOWrXuHKci5zM0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lyHHgxp9YwXH8kNPCGguF/Q3MlcrUGOSkA3umdengsfyMUmmaK5jbe65BGnx/05BgMq5D8SyNP1lvvwEGY6f3n+FGlvWvG3/d2xip0eSLZrYba/4/55BAVA0wMZukkN9yKD6LE/XwH58BLGIRaiwhZHZU9dQzQJ/5j+S3RMrykQ= 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=lrsii+6/; arc=fail smtp.client-ip=40.107.237.53 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="lrsii+6/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b4DDcH64BVoCsCRykCi9lXZA7VAqMJ4XgM4FcECnn86FSOmbnxZm1h2gOXukscRPZYMHHf+M4/JaqE3B71KBOB7RP8+WbNLbnaO2NOIHovuhBsHCnWCtelRTQza8GRQ7GLGirO6F0rG2B+a+3dX2b5EVjkJ1kafA+C9d2anc32midVZ+2jgQXKzcbvgF0mvZMpnwDAAlzaRpiHkTWa5Az/sJufnQUTl/wm/3NlNf+T5VB2E7Hye1dKbs1Qi0WSoFV2wyrGPj19ZmvBdGj+m4zbvdz2Lbx09dIkWnNDndIms8sXeWbmu/rZMS3OWweXo+0L8EXue6zcpJ5LfITpAAVw== 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=BIV6PXVYSj9GKI9uicUNkG7y7PWMJXXYH13k39S1ekshGN88T0K31pReCaYzIRIMQd4SNOoXx6JIJoZxBdJWWAfndOPoB2KwTHc5/YZjWzJ+07tjP8jeRaVp/9iU3ONRk2FxCWNJCeCDelbS02Nrc9/VeaB5OGRJREJonDYMKb7X4tOWmcSwOpBKLcnclkt/g+YdF7h52ttkHQ0bx0iSHxB7stVqIJfcJknitqFPvA+vjsBfAUW8EHwFy8qbqmQOMCnAICKqcMqbQTMJdIiMosfc/8ooNOSPpFyyiI11uRR0ZMFUOSEq+Uc1VeWqICfohYkbBeSgbK4yxpvzwG00sQ== 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=RJRtP0KreHhnjKzBTAkDh7Y+kc+/mjYoR2koFRvwwCY=; b=lrsii+6/wsMWPfMz9g/ZcaXi2Ub/9YDbaYJ6I9HCZ8XnTq0svzsGeHbZ1w9NQkCoMi9+4FQJW/VO+rHaX21OWaCeuF5/jBlj9kC/5G8wkX5VDRbpd04L+E7datlxdtaJQT0eJ4DL/ECQxD8cCFLWGA6B7fK+ytss7B1796Pp6EYezf0Pa9OfjmOSezdpSIFZXyLtfk2UERzVDf8Uu8HFQdiGeJ7R9HLpRDkh73jtQleGCPACmmElCH8oMdw19GZHZlj80oigE/rQKMCPHReLzqw6DvVKWyNnGQU2QiV6FPmYH4wnqR70gEvVAp1SOKl333d6dl0BYUebcXjWw/J/5w== Received: from PH8PR07CA0027.namprd07.prod.outlook.com (2603:10b6:510:2cf::25) by BY5PR12MB4259.namprd12.prod.outlook.com (2603:10b6:a03:202::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Mon, 25 Mar 2024 17:33:34 +0000 Received: from SN1PEPF0002BA4B.namprd03.prod.outlook.com (2603:10b6:510:2cf:cafe::39) by PH8PR07CA0027.outlook.office365.com (2603:10b6:510:2cf::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Mon, 25 Mar 2024 17:33:34 +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 SN1PEPF0002BA4B.mail.protection.outlook.com (10.167.242.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.10 via Frontend Transport; Mon, 25 Mar 2024 17:33:34 +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; Mon, 25 Mar 2024 10:33:16 -0700 Received: from localhost.localdomain (10.126.231.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; Mon, 25 Mar 2024 10:33:10 -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: [RFC PATCH net-next mlxsw 14/14] selftests: forwarding: Add a test for testing lib.sh functionality Date: Mon, 25 Mar 2024 18:29:21 +0100 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002BA4B:EE_|BY5PR12MB4259:EE_ X-MS-Office365-Filtering-Correlation-Id: f61c3e10-4673-45bb-f738-08dc4cf1b251 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lzxffjydJdFSIm/+LqQTIcLq+1j2EtUoqcrz+1iDHXkNYwnsQW+pp3ObhoOBBRapdcQNeuMlpA8jcXRy6Dovv1s9692LLy98HiEtsXjfR8uqbhAD09F6V9sP9vR32lYJWmzppT/0ED1uzTYuujN1stQqszdPTZ3do1GdxL59zIo8XLYJM2+nO9oyIIybV+YVpEmR+2ouf2XOCNRgOZDwJ8e4ggE72VhqWeSEioGUYY5J0PBuaIkJRpZ1pw9GUQDNi5RC8EvKFxXiSGcA9V+gaq3OXXZTeUMxaRwRpRw9hV811zpjPm4BGPJpDFfMARkJ6F1Wht8JVYiY54nS8cHOc0/u/RatRWFrAdI+xS0OMeZuaZM8zEeEUJoHJ9FvS/Mt5w+cvLHUG9caSXmoognZqvQh/BMxw5uPK58pzO7V+xZMhR9vqgtNTK+w2hoE+3dfPyANPk+TjYk96BtP5ckDCKqw7+PekYcWa6Rtcwq9TMLds6EYV5RnAboYp1ahhpcl1uaM4OlEBW8JLraiZjlZMU1efCDFai+dPo6mFbOKIgOmuqBMO6du2LD6d1cc1TcCnANotDJ6tqlLOlbnnGKiZW8SYBhhq3zDw3R+tQNGpHq5QFmFmIaTkUb/cDI+GWijZSCZkEGOF2UyNL1eCjXucFyJu2cCh+WAw3abGWtfMMHYt/1nJ0lCWKP3F78F3TThsehsieE8M7G9pWrf/NTg5tS/nMHVVhO71xq64/hr2+rXam2ReaUZH8Svkksx8n4U 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)(82310400014)(36860700004)(1800799015)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2024 17:33:34.0907 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f61c3e10-4673-45bb-f738-08dc4cf1b251 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: SN1PEPF0002BA4B.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4259 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