From patchwork Tue Oct 22 14:50: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: 13845761 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2055.outbound.protection.outlook.com [40.107.237.55]) (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 C15B31A257D; Tue, 22 Oct 2024 14:51:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729608707; cv=fail; b=qb1QY5iOjDYbNwSKVgxlPsKzkkOmcDBu4Fyr6wKE2BV7HcGywbUyNRIwQLMcxelsR01UAO/QwOH05pv8RHF/IT6d6rntfp9/+RVndXqDhOBDS930VugXFRWIaKqE1RvDiQISAQZTuTV7pIxPSipLUsp1TJm++n2Wxm25yFBCwiM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729608707; c=relaxed/simple; bh=rgxDZOEsXWWOkGKIzm90NApYTnvFBiFzFItqLgea9n0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Kkn0lMMC8q0VYGrW1zRB/AiUdLitRCzQPgiSN7Hpi4Yr089tIQd9voak9aDbGBplJ/bHH3KmJ5whlDVLLSwXjCPMw0Aul4HJya9xKBwuYe9pzykNPhHQ30rPJKcwl5E/jSfMNmfCPWFWAZPuf+1zau9JW0zOTInHsZ5HdSJX6ys= 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=q7pgm604; arc=fail smtp.client-ip=40.107.237.55 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="q7pgm604" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ITaGo2fZbcWH96tDUWwCcxHtu6KOlgQK0f7i2WwRTwiqNuVXrwK5btyvwAywC9Cvg0+LtQodOoqOb1d1L2zQXc0jWJLldKaIdEmVwmZDX70WYY1YMLB0ZQ7y2UuJA745uagveDd+79oXnogZPwgEaC5V72IGtFc530stvdbhIewArek7M6Y4rLskNzKntkE7r06GCVe6g3GPdbIf6osl9KEnxqLRsjESmUyL/KHyJBMpThKUJaSzjArYgXelByLxTcsU7iq4UurB0GRHuQ7mwkxKKTfYYJBFQ4CKiy0yTGDHwWBkmUy249F2nx5BMlB8NRUgCeBwD6V/thmNKmuzdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=GdO3rPdlb8EFNfFy+do5y+79s97PNpR/Z4h8OJIgKOY=; b=U8px+dpZ1vNIBNIeKcZH3f8jqRc9BAvJpXfTyqlaCNPGo834eXd762GuS9knvCh0mPM/YVQl9SrFW+QMi/FCwHm09ZPMlZLqL7231rrwPLtmLXt4JZX4dL6U+Zhqp6kSh7xg0vRAmiRNKWjnWRO4kvODBe4JfmB6Ue+S2vvq66U03B3peONrYkMydIIKawiS0qJotDD8Nqnvcm9V5lMMCkm1Ke+2m1m0B/FUrCSzYBEoM3KNFhlg5EzdafIIAIXe849Y4cHq75S1cRK9Gc7ggQCwfTKIXD7pXmH7QaHbKXrOryaAa1TWv2fFOI+HhaGgOwW0bPoRkTqxi6lGB2cEOg== 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=GdO3rPdlb8EFNfFy+do5y+79s97PNpR/Z4h8OJIgKOY=; b=q7pgm604JEHrOGRZ0yw8J+AbPXLrD4/wBG6+zgm1UNnQBYpFvIyW43r3nCpYR2WObVoQ0vTV1BRblwjpIVtsOWnywc1GJkZIEfZlgE4LMrSMvs855c1DwUm20JJlsS/0HjYYEFRo1Av99Ne979WL4c2M5lNRaL71xrwzOLmHt92pp4Jsdq8lSJFp4MUN62RC8Yo+xmIB/rTEf7KFtrxTuyEV1gmGnSbJSQMDWZlRWY3L/ZfUXIB7Gru430TZGqmIap/td7lGq/ZcHNvGjbcKHvSXU1NuYxL2ROYFUC98oHRsUoMDwlcEBUPjW5Wtal+gnH3auTQRFeuxg6yM8cPh7g== Received: from SJ0PR13CA0064.namprd13.prod.outlook.com (2603:10b6:a03:2c4::9) by PH7PR12MB9254.namprd12.prod.outlook.com (2603:10b6:510:308::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Tue, 22 Oct 2024 14:51:42 +0000 Received: from SJ1PEPF000023D6.namprd21.prod.outlook.com (2603:10b6:a03:2c4:cafe::d4) by SJ0PR13CA0064.outlook.office365.com (2603:10b6:a03:2c4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16 via Frontend Transport; Tue, 22 Oct 2024 14:51:42 +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 SJ1PEPF000023D6.mail.protection.outlook.com (10.167.244.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.2 via Frontend Transport; Tue, 22 Oct 2024 14:51:41 +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.1544.4; Tue, 22 Oct 2024 07:51:26 -0700 Received: from fedora.mtl.com (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.1544.4; Tue, 22 Oct 2024 07:51:20 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Ido Schimmel , Petr Machata , "Amit Cohen" , Vladimir Oltean , , Shuah Khan , Benjamin Poirier , Hangbin Liu , , Jiri Pirko Subject: [PATCH net-next 4/8] selftests: net: lib: Move logging from forwarding/lib.sh here Date: Tue, 22 Oct 2024 16:50:15 +0200 Message-ID: <4421094dd36be3714eeea70d577ff761454de3b3.1729607879.git.petrm@nvidia.com> X-Mailer: git-send-email 2.47.0 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: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D6:EE_|PH7PR12MB9254:EE_ X-MS-Office365-Filtering-Correlation-Id: 79916a8d-d432-4916-7d05-08dcf2a90a9c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|36860700013|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: XLWG1+5bM1Kbv/JczZRKV1FnE5x6FlbBUuq+aUDXVIRk3tBU/YqhjjaixGawW+k4M26/+IIQMhAWFEHgTIHm2gzVNkHMwbkiVUv3MjQaP4nzMszf+watxHMc5gXDCjh+LV7eDiAW4XEU68M8ZWRvX9AUKvlljXcPOglEBYTNgtm9Pus1S933iSGN+B7oX0bz8YTR3zt1mkgpJhoeXLWLP3vDwpV2oWjL1kHxdeK2RZI1+pZXE0dC6GKyV1tNvcxQhkrnBYsqh7rRcDtW40V9pVrGJpY0UR3Idqid/AtSjeX1KfFh5pHspeWyt0MIwP+AH4mJDv7yg3Lke8zqOwUJgcHxRxfKu1qNsg9WEcuvUjy/GfOXjkhySEQRqcS5BBKCux3Ds33dhHdZo9iWNI1dgmApf1i5v7SPma/gQJy2+JD9ApjVFncMV8EDsEqdWSlBTUeCe5QQMq3s6XTromu9OjvcpUdMsPXL3mvGV4qaWcd8gahx5TqVEGmaIhTP+s+mXjpUA48ckvf9b9PmkngJ9T835NDeGbKgNMcojqZZK0z56/YS0I1q/BOUV2tCzcpwB+CzGojkjmTDbMKB7HsXGspIDfREtrCtpgxgncagkc3+mRX4fIN9bANK1N4XE9lcdEyPxneLmcvKJW7YcK3MYDZIxGxLDJKHNwyn/0uklygRC1nipgFqPh5ITxSlBjCl9XxyIcrHe3x+mPayXUntGqxdMBNituKIeOQ5UohL2Buch0gN3Pps/8HwXVby9U7J/I/iXFhvrLtKujkXyZJTBtolgQLEqK8/rDlqNOdgrJgMHwP1osxe9c9BSA//yphqw2jDHk4zz64EThfgMi5ewE2jindQ5iukn20sjJzvCXFwDJHv9piTE7zu1QUM+6pgkvVPv2mmpmel78jAgftng/VsMxGyQXsMUuYXM5hNoT36FGc84pzBUgASpfTWZsb33T6kEZmcujcjgf+aKF+MCEQIMNd5KSoL7OWUQxGrEy+V7cjBvZbthnhSWzCLIqUZGpKei+thE7Tp473d49ZfZDiLT/Em1UkaFWX4ZT7hy22YfT83CwAqlb25qieWPn2fdANvnvui5qojz/aScDa0YgaXtlSR3mdhRNQ6Pq8oXVnvBJE9VSRWKGcCdMiE9+lGgSS2r2yDLU5IOl/Ci/NZeNRR/6VVmQF1GIz3LLn+AgBGMr69jGjlLZDzR7PB0kVjYj3wVcfK6xO/wBhxgJw19NCW+G3n8KmbbvpMPfTRkTzEfX36me/JDR/SsnRcU+0E8pk9Cmc1pcFSKMoBuiUG7YRGwNDhMhnqR7V/q3kStIHGAFCOBepMPgYsOgjA7kTWUzR64lH0sYNVOMmGtqR3bLuTPC6/UrS84BV1IVc0jAglywOLFR1fJk37Y90DPll7vUlF7Bs5uWVpkEK6DInUmw== 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:(13230040)(7416014)(36860700013)(376014)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 14:51:41.9940 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 79916a8d-d432-4916-7d05-08dcf2a90a9c 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: SJ1PEPF000023D6.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB9254 Many net selftests invent their own logging helpers. These really should be in a library sourced by these tests. Currently forwarding/lib.sh has a suite of perfectly fine logging helpers, but sourcing a forwarding/ library from a higher-level directory smells of layering violation. In this patch, move the logging helpers to net/lib.sh so that every net test can use them. Together with the logging helpers, it's also necessary to move pause_on_fail(), and EXIT_STATUS and RET. Existing lib.sh users might be using these same names for their functions or variables. However lib.sh is always sourced near the top of the file (checked), and whatever new definitions will simply override the ones provided by lib.sh. Signed-off-by: Petr Machata Reviewed-by: Amit Cohen Acked-by: Shuah Khan --- CC: Shuah Khan CC: Benjamin Poirier CC: Hangbin Liu CC: linux-kselftest@vger.kernel.org CC: Jiri Pirko --- tools/testing/selftests/net/forwarding/lib.sh | 113 ----------------- tools/testing/selftests/net/lib.sh | 115 ++++++++++++++++++ 2 files changed, 115 insertions(+), 113 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 89c25f72b10c..41dd14c42c48 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -48,7 +48,6 @@ declare -A NETIFS=( : "${WAIT_TIME:=5}" # Whether to pause on, respectively, after a failure and before cleanup. -: "${PAUSE_ON_FAIL:=no}" : "${PAUSE_ON_CLEANUP:=no}" # Whether to create virtual interfaces, and what netdevice type they should be. @@ -446,22 +445,6 @@ done ############################################################################## # Helpers -# Exit status to return at the end. Set in case one of the tests fails. -EXIT_STATUS=0 -# Per-test return value. Clear at the beginning of each test. -RET=0 - -ret_set_ksft_status() -{ - local ksft_status=$1; shift - local msg=$1; shift - - RET=$(ksft_status_merge $RET $ksft_status) - if (( $? )); then - retmsg=$msg - fi -} - # Whether FAILs should be interpreted as XFAILs. Internal. FAIL_TO_XFAIL= @@ -535,102 +518,6 @@ xfail_on_veth() 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 - local opt_str=$2 - - if [[ $# -eq 2 ]]; then - opt_str="($opt_str)" - fi - - 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 - - EXIT_STATUS=$(ksft_exit_status_merge $EXIT_STATUS $RET) - return $RET -} - -log_test_skip() -{ - RET=$ksft_skip retmsg= log_test "$@" -} - -log_test_xfail() -{ - RET=$ksft_xfail retmsg= log_test "$@" -} - -log_info() -{ - local msg=$1 - - echo "INFO: $msg" -} - not() { "$@" diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh index c8991cc6bf28..691318b1ec55 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -9,6 +9,9 @@ source "$net_dir/lib/sh/defer.sh" : "${WAIT_TIMEOUT:=20}" +# Whether to pause on after a failure. +: "${PAUSE_ON_FAIL:=no}" + BUSYWAIT_TIMEOUT=$((WAIT_TIMEOUT * 1000)) # ms # Kselftest framework constants. @@ -20,6 +23,11 @@ ksft_skip=4 # namespace list created by setup_ns NS_LIST=() +# Exit status to return at the end. Set in case one of the tests fails. +EXIT_STATUS=0 +# Per-test return value. Clear at the beginning of each test. +RET=0 + ############################################################################## # Helpers @@ -236,3 +244,110 @@ tc_rule_handle_stats_get() | jq ".[] | select(.options.handle == $handle) | \ .options.actions[0].stats$selector" } + +ret_set_ksft_status() +{ + local ksft_status=$1; shift + local msg=$1; shift + + RET=$(ksft_status_merge $RET $ksft_status) + if (( $? )); then + retmsg=$msg + fi +} + +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 + local opt_str=$2 + + if [[ $# -eq 2 ]]; then + opt_str="($opt_str)" + fi + + 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 + + EXIT_STATUS=$(ksft_exit_status_merge $EXIT_STATUS $RET) + return $RET +} + +log_test_skip() +{ + RET=$ksft_skip retmsg= log_test "$@" +} + +log_test_xfail() +{ + RET=$ksft_xfail retmsg= log_test "$@" +} + +log_info() +{ + local msg=$1 + + echo "INFO: $msg" +} From patchwork Tue Oct 22 14:50: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: 13845762 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2050.outbound.protection.outlook.com [40.107.93.50]) (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 5F06B1A073F; Tue, 22 Oct 2024 14:51:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729608715; cv=fail; b=HD2pTdUiuReaRHUwDR5+kVNkNDpwMvWtDq2OCI2uvd0nX+lIEmN1MVpWQWw01zXnbhoDmTU+uLaojD+VeotBOBUEU256acnCRs5aejZucJ/YapkQv4A/HRu6wHmTaImI1eyNzRsQZC+koMJb+Yx8AOneCdiDdRhl0UxIFjISY0M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729608715; c=relaxed/simple; bh=J6pK3Sb0SVXqEZLC42T2wglyQJehaTywZH1sRUV3PZo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tAhvm+VRI8nTA/FxM/XgyZE+pndNX9RR9RAL3nOFa5QIhO/9ICnBqjhx8K9m0gMgCATnEOQDPmZzcnrsu9r3yIyuad+NoEgv2fY+rJ9VWSBwj5s/VNd/gTXL+s3wEeOMn6iuapuZVb4Tlf/SriWTAwK+NoQA6Y8Ej+G34I/MDHg= 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=FdF9GQ65; arc=fail smtp.client-ip=40.107.93.50 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="FdF9GQ65" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rvuyuCYSbkNa3OEJzATJZ57raemCeQ/XfRvSWcc5vP50yFtQ9ireJts139tiv+jBCZHWLUylxY1RhvztIr6Nl45tPxj6LuupiF3nhATowxF6Lwo3x5vmSFXmvNI4XBwaIyMdDJbDU37AUOHrr4ND3If6G25rSq3b04ja5CX+BAtwoEAnScyc3vix7/lxsmlzW+zyzbSO5ksnT2n6UMzg3zPoMbvD6pzgteLVe9WOepOODJfT5yzrX5k82K8XqqxYUuexHWChwDxwCiThx7Dj6nZ7meud0YAuhH5WVBr1Pg9/lT67tyB7DjHif4dHciYUmqpAzyo33yVvPO6eVu2wYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=gNEu9x7CzHjUNmeuDiF9oLnqg8UZqvMjFIJzIzwDFlM=; b=UyZhJpUKKiZMEFSdHRPK9Fv+kJV2gXn7yMas/VVeBphgGksuzPIJbX6Gfb0ORP3fql0leGBwRrJ9gjjsGB67+F/n1VQufxN2rZtBZ1u/7wL5VqMM/0TqZaYU0bpQoIFzXSXo+xfCbK76OxofP8y/YzLMPCvVMKO4HdUKBBjrjj4rcFyD/FHv9SZyVynJ2m5kXOGJJbbrOZ1PULgupLtx3zjrvhC9FUekAEJYYuMmVByKuohZFd9EGwHvzeEgsz8QVYAfNELu6QAd9+l89lROcGZJ4+gz51TNdm7hRSU7HNhXZTSZ5pyWK6Rl2MEtkXB/KVWHcAfEIhF8pVn/Joag8w== 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=gNEu9x7CzHjUNmeuDiF9oLnqg8UZqvMjFIJzIzwDFlM=; b=FdF9GQ65cLpOvcm/WjOImkztdZxTWjVR2RSgfVbA2y5zPXj4PBSAFxHvlYoBgCJhNY6treb3TOTtH7ySbfB1j1/RKV85p6R4ADX1EVdnJTTD/Q/FSEiMCVEMOTNx8UpfuuKdcS/CVHKQRRX5yqz9bl4GalCa2jBv09VymL5j/+/xho6S9FyZy4VXLNJJ38QzjvrEWRnAn5mKCu1H0Omsbd1yOItx05nLTFLx4BHMEieEJ0+wRxijnQ0knly2QgEoyYRibOTB5WFmJuFeOHSHEwk+LiZ0BgIK0knFOffg9Cy+pmyZ7aPNGR5pJbv1qV/KpuJt7JUixIMWZxhXZyW0Og== Received: from SJ0PR13CA0069.namprd13.prod.outlook.com (2603:10b6:a03:2c4::14) by PH7PR12MB5973.namprd12.prod.outlook.com (2603:10b6:510:1d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.26; Tue, 22 Oct 2024 14:51:47 +0000 Received: from SJ1PEPF000023D6.namprd21.prod.outlook.com (2603:10b6:a03:2c4:cafe::ca) by SJ0PR13CA0069.outlook.office365.com (2603:10b6:a03:2c4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17 via Frontend Transport; Tue, 22 Oct 2024 14:51:47 +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 SJ1PEPF000023D6.mail.protection.outlook.com (10.167.244.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.2 via Frontend Transport; Tue, 22 Oct 2024 14:51:47 +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.1544.4; Tue, 22 Oct 2024 07:51:32 -0700 Received: from fedora.mtl.com (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.1544.4; Tue, 22 Oct 2024 07:51:26 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Ido Schimmel , Petr Machata , "Amit Cohen" , Vladimir Oltean , , Shuah Khan , Benjamin Poirier , Hangbin Liu , , Jiri Pirko Subject: [PATCH net-next 5/8] selftests: net: lib: Move tests_run from forwarding/lib.sh here Date: Tue, 22 Oct 2024 16:50:16 +0200 Message-ID: X-Mailer: git-send-email 2.47.0 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: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D6:EE_|PH7PR12MB5973:EE_ X-MS-Office365-Filtering-Correlation-Id: 8cc9e793-5bf9-4455-e5c4-08dcf2a90dac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|7416014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: 9w7QsbTsD3UxeksQl7ZlhbPfICbeIX6jazGLkLyTCT8kQBKhFvr5rIOEoim8mmbWmGOI1glaVTqdsFTHUpXIynPcsihpADIoM8zz6a258frKeMR/llKJ6LuR5Q85WVhslQuuSUy9SPhkinFEqBmlywX9Clos/2tPwIlamzhClru8LGZWUQuhc+fJTZTxB5ZH1SqwJD19J9o/+Nmngt7J+sYbbJRKuwi7i9PWahlm2IszayBAl1+0M8b7OLCwL6vNPltXFHdCTOpX8CMg5AiKhHyw/lrN48xWgHiAGihhWohmUf9z1kUzD28OeSytMET96bI3t5DNJWQMwaoumuShB1RWLUvgRiJci/nsPItWny/Old8pevY53DtPjXVQ8lLYGJ56ldJzLe7Plr+CoebgTW0ikbmEMxZ2Gx+B6Hpn7nqngdFTS4TUXCqgguuxQGp17YfTuI/UHfH77NVQO4RyWMpQv8rECd5KR2iQCeKytybQEAuy9mZDvWqLfTfry7F9xm51H+u/9FmvuI2STbZ3ZuHLzDlYw4+6WaCuEBqTt6rqoJm2zz0XTJbXQEKc5y0nXWRHH72UMWTdUochj1pSQx6HoCIWM/BimdyJ42ROQwlTmkYvyyzQOk9Kl6XQ6uZpEnsDd3PCCzvJCfNDWawgrpzEoHvvcoxijQCl3/9sK4MyBd46KEvZ7Z/Re6JR+XRt/6ITUn7uo2st0z6mpE3ytVHL44VAMfPtD0sWb8b0LHRtw1A1NoxlpfLED8VAXxWhmlJi+1KAk9FscDcOJ742KVYcUxRec9gV3DjjY0rlSOV63rWPDcsfOAnqJcPMUgfdoZk4HGdKpFMDY466o+++/xoe+c6KtZEf91TlRSJlo3k5yOG3I94d1gSvBeSbGdI4oDtikkAxrgKbr2XLX29HWpS4Zra3zbYYftDIkzQcgueXnG/k5ietD9WL+kcrDr3XIfRJud1fBWah9XQylqord902ubsAF+iXbeCDnUvA97xo/nBR0C65D291w0S5EiKSOrfcphABTagwqz/lCIlObX29pato72N3C1BEmhLmWhhWzqzNS7/xZwYuGXnpF7pltl3JBYqxE+6qBhxIp52r8umt3IdRPkgvfQACnKTB8PYjE8hwE3VaAGhys02qbfM3ATN4OD2E553u/Jt9pSqxqvmgxNC+H+xATL3lplRQ/Vy1TDnKabLwtshghkRcu/jInPFoMiGFXdgXBIuiuJhEUDntAb1XlY5/bqA+laS9d1/abNpEkkZmvS0xI6vBMOy+7fLFDZl4sW5t4kWlFpM3mMsfr4Ocju6axlT0Aa1r6Jn6oQJEUtHOCkk2+dCnIZCvtrOlwvE5q7MpiVckqJpmLlfchMMaKbarccaMRI+x0jo6znK/LUy6aU2oR4qJTcqbEvtu7deYV9LT5mOSmta98g== 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:(13230040)(36860700013)(376014)(7416014)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 14:51:47.1191 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8cc9e793-5bf9-4455-e5c4-08dcf2a90dac 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: SJ1PEPF000023D6.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5973 It would be good to use the same mechanism for scheduling and dispatching general net tests as the many forwarding tests already use. To that end, move the logging helpers to net/lib.sh so that every net test can use them. Existing lib.sh users might be using the name themselves. However lib.sh is always sourced near the top of the file (checked), and whatever new definition will simply override the one provided by lib.sh. Signed-off-by: Petr Machata Reviewed-by: Amit Cohen --- CC: Shuah Khan CC: Benjamin Poirier CC: Hangbin Liu CC: linux-kselftest@vger.kernel.org CC: Jiri Pirko --- tools/testing/selftests/net/forwarding/lib.sh | 10 ---------- tools/testing/selftests/net/lib.sh | 10 ++++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 41dd14c42c48..d28dbf27c1f0 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -1285,16 +1285,6 @@ matchall_sink_create() action drop } -tests_run() -{ - local current_test - - for current_test in ${TESTS:-$ALL_TESTS}; do - in_defer_scope \ - $current_test - done -} - cleanup() { pre_cleanup diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh index 691318b1ec55..4f52b8e48a3a 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -351,3 +351,13 @@ log_info() echo "INFO: $msg" } + +tests_run() +{ + local current_test + + for current_test in ${TESTS:-$ALL_TESTS}; do + in_defer_scope \ + $current_test + done +} From patchwork Tue Oct 22 14:50: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: 13845791 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2070.outbound.protection.outlook.com [40.107.236.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45F2F19EED4; Tue, 22 Oct 2024 14:52:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729608740; cv=fail; b=OeBa+Zs9aUinK0Hp5wVS1o62fkUYO/xRagq/+5XU2/RQrYuSgqjE0VkFGhon1m4LKzqpCbOibxA6E8LUtLOFXEVf70LAHd4XXcxhz9FiLZO+hnxu+SLkiFY7v2p6xJwlydKyXtdKXIqep1rr4p5+QK37hBZ2ciT0CjFVU6TWeJA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729608740; c=relaxed/simple; bh=UJmnmlTfL7DKpX0epTT+DWDmctUFH/S0+XoPbo1yvgI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sYEEK3d4K/BGs0hxpj8n2TT0vCGuoRa/CqKqXuFUpeYcoB2B9suH1Xt2liuSWSTIDRAEFrxGZixyciwAXJywF4fI26108TKdnzTC4bMKFTPVy1HKTc+gynr3N1Zb76PKAMvY68ftyH56YXa/lvlOssIIsWslB20s20SGxERcTuA= 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=Cbyu1Q0w; arc=fail smtp.client-ip=40.107.236.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Cbyu1Q0w" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XUliAKWwWB+Ewv5+Ld/PyhyJ2qxAGOliH3vgGKt2NXk/AqDv+25zc7OII1Xty9Fc1mHnEeA7hpxHPOPSfMXoMWyB7h66kGY4dvBgnKpSy0AAQwA+WPJlsYgaBTfaZeLN8+DDf7p3eh/gOMa40M6SiG+tnJfzDEE2geHnASMAA1Hqu74OJrumN3MrSsohZ8qRj/7xJgG7FZSo5n5bOrDz9zQPJx+Apg/BiIyUnyt/9HxpY0BRKuLNTDff/6elGrtaDXXSBYSacgRSgR7ZEXi+ikk/S00CnUNEYm74s/aUcitfkY+X4mms3Sh89yUXDnZSXU+7Pjiqx/UE8o7SHxbUPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=r6xOfbvduhWp3r2ZbJXG/bT3O79FynaTkLVDmv++o1M=; b=rtqyWAGJCjZRZvvolxn649cqsUc9TfwcW/QJHl8buanID2zu5Z1665oBe+ZXA19t549AogMSd/fgrLKmP6piWoYIIrMlGhegyEw+ZmHlWCt9pkf9yc8u/rWhKgmK+bQ7Sdj7KBxlOKA/UsyUDXAghJH0OgIl09s4BXHqwMSq1A3VR+5hTtrd4n05Yk6QdKktKgkzaG02HOLv0op97fWDfu8wGOAVN69XYGE4qgTJx+7bt0lIcwSAyEaqAe8qhSMopsXH1zjV/pwCeEWJTkmbQDSlrU/3vIBxsLKIedcaMjtz8QtW0HFT5yRJQDB7X4I5+MOPANXHnVP3uhNsPu39JQ== 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=r6xOfbvduhWp3r2ZbJXG/bT3O79FynaTkLVDmv++o1M=; b=Cbyu1Q0wDdqC2ex7svnLpEno7ExPUKU8WtCKuucqNqTH8HAskUOAJ/4HO2cZdxe0BNx4Y5q8FmPkrhw4VB64rNAzz00f3CFlzS7TNvjxolSGtLjhnTBhh4ldclx/NeqrhIQW5OsEhFlY5ySJTc8MgkeKaHsfiZGls65QhrC/S9smYNZ4hMtYxdVbYG0fwpCk696RbDsP+jd8eo6s7ts/YxnOnhp32A31XUh0jkpBzT5/tga4EKqLdxsvMXLyix9FCs4zfe0tAluonSG73K5SHLIJLgoa9AsGJbQ7rnZpRcum7yIusRtUhjXYPuuFjw5bPLrVVxJJWMpNFND45cC+LQ== Received: from CH0PR03CA0351.namprd03.prod.outlook.com (2603:10b6:610:11a::13) by SJ0PR12MB6688.namprd12.prod.outlook.com (2603:10b6:a03:47d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 14:51:59 +0000 Received: from DS3PEPF0000C381.namprd04.prod.outlook.com (2603:10b6:610:11a:cafe::27) by CH0PR03CA0351.outlook.office365.com (2603:10b6:610:11a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16 via Frontend Transport; Tue, 22 Oct 2024 14:51:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS3PEPF0000C381.mail.protection.outlook.com (10.167.23.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.14 via Frontend Transport; Tue, 22 Oct 2024 14:51:58 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 22 Oct 2024 07:51:39 -0700 Received: from fedora.mtl.com (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.1544.4; Tue, 22 Oct 2024 07:51:33 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Ido Schimmel , Petr Machata , "Amit Cohen" , Vladimir Oltean , , Shuah Khan , Benjamin Poirier , Hangbin Liu , , Jiri Pirko Subject: [PATCH net-next 6/8] selftests: net: lib: Move checks from forwarding/lib.sh here Date: Tue, 22 Oct 2024 16:50:17 +0200 Message-ID: <6e337cad958bf489d0dba5446cc01e90d2d9ac02.1729607879.git.petrm@nvidia.com> X-Mailer: git-send-email 2.47.0 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: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C381:EE_|SJ0PR12MB6688:EE_ X-MS-Office365-Filtering-Correlation-Id: bb211a50-7efb-4dcb-8300-08dcf2a914a8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|7416014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: syduBq444RUWzg/IHfaiiy5ukLEKEQG0Lz0+MpwnB2lLcGi7JyIOEh/MN+4PX/sv4AQPbYBVycIBx6nn4BmQ4YstOKZVV+79Ie0zSYlJgNiPiI2iISPMgLAIeviINTqsJN1WmzAVohCkHOlWMySBGBebsVaHOxc6KvbpeyjX4OWzNhbAFILjZWxgIcFWhSQFb6UJNJzRxWHDVd9r5+5kUR9ALqjHOgkW2jALVK1B1Jok7vscO9i6LcBQZUVRCAoWUc1z54KeoVD6hKDRA/K2il4zFeiV07qRn/ZPzehPbAa9a3rnCzsneE3cSSUksFhZE4rbeenqoz1ov7b/h9whHuS0Ez8/x2Hm/2NoFD5gpMWi0uarP0EH/9ricezNusEMrzcu245/e1EemvAhfE4rthU2DHwO6GX1baK/gP1Jn+XZ+QrLviZtQex11wRJFNtIbwIpQDAw5b9CfmGqttGxXiY/iVL+J/zIJSUQRGHuK3gJChBgnIa1ZbZI5hv9hECDqyVdkHbMIjtG+3hCxgyIi2WXq0XRB+0vpHc2G++lYKU1FI5xDHFZjzrJqyc0GfFJ3WWFfvDsiF/3m/tDhw+C2OP7jmFBWPrgUzjJWLi0zZpkdnGud2Gy2jmMU3jw6gAAj3vD9D98/S1vptMDRH7oz3vw7ER/r4OFE6mznu6jcQkNwr4Rp30VpYb0DjgsPCPd3LNejjd1PPYhYGw6B24zQ78PjShooKC5pqkKX5EFz/VGYdi3BEwfJabfc78rTJrCVPW6NlurlCw3D1vJkSOt6PaCwXVufeK3gQpCS3wmO5S5CrHq+6bvSsrSoIrUGASAyBzADPTTbxG4Q1hZZMxKbc/Zu/TJ+XlPmctxrwBzOFoood2gy6lEFofBV2xb38lUvgIqQiJxH0WVzhaDQTF0t6XC24Y0eWc/vQZUuOwgjDL7SMVp8p/1pgAf/X41a+m7GvIw4sD6n+pKeoHDW1uB3Ue7UnF7JuIjkX26y3q95USEKt5jMMSdfzEzoWa83BtJhd7SOjXl6DOo8dlFb6Vg0mhflfyG23OobFKUsZQk7xfu+kejbCAxsW8CgnoMZRK2ogQaNzG0ISktIv74TEtstohEbRFO7km2isHyUBbaKgSR6LF9DQWXokOxKJsYliliY977Z6AuoTAKTQXRnH3AWyfVuDLUXZhntPKSnATCe2RNxv20ijhyqmaclB7HAJbcd/HfCckj4cYq8bxmcOEK0q7SDtjqFOAHXX3xJ9eSfo9ZqFC77MfEb0b2L2DSKGSKpS1EeVSN3FLIXdUFqhr2KbEv4Cl2UJFYifAw8nHbd6FctgwR2Q6ZldSQOPAwZRh8k861n01HalAVXCX4jkJIPX8GDhAcUOI0taKSMTVlypjXqnN7V8VDnPzi/M0v9VQYKC4P6cOAsdkOYl9h6oaRfw== 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:(13230040)(82310400026)(376014)(7416014)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 14:51:58.8188 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bb211a50-7efb-4dcb-8300-08dcf2a914a8 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: DS3PEPF0000C381.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6688 For logging to be useful, something has to set RET and retmsg by calling ret_set_ksft_status(). There is a suite of functions to that end in forwarding/lib: check_err, check_fail et.al. Move them to net/lib.sh so that every net test can use them. Existing lib.sh users might be using these same names for their functions. However lib.sh is always sourced near the top of the file (checked), and whatever new definitions will simply override the ones provided by lib.sh. Signed-off-by: Petr Machata Reviewed-by: Amit Cohen --- CC: Shuah Khan CC: Benjamin Poirier CC: Hangbin Liu CC: linux-kselftest@vger.kernel.org CC: Jiri Pirko --- tools/testing/selftests/net/forwarding/lib.sh | 73 ------------------- tools/testing/selftests/net/lib.sh | 73 +++++++++++++++++++ 2 files changed, 73 insertions(+), 73 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index d28dbf27c1f0..8625e3c99f55 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -445,79 +445,6 @@ done ############################################################################## # Helpers -# Whether FAILs should be interpreted as XFAILs. Internal. -FAIL_TO_XFAIL= - -check_err() -{ - local err=$1 - local msg=$2 - - if ((err)); then - if [[ $FAIL_TO_XFAIL = yes ]]; then - ret_set_ksft_status $ksft_xfail "$msg" - else - ret_set_ksft_status $ksft_fail "$msg" - fi - fi -} - -check_fail() -{ - local err=$1 - local msg=$2 - - check_err $((!err)) "$msg" -} - -check_err_fail() -{ - local should_fail=$1; shift - local err=$1; shift - local what=$1; shift - - if ((should_fail)); then - check_fail $err "$what succeeded, but should have failed" - else - check_err $err "$what failed" - fi -} - -xfail() -{ - FAIL_TO_XFAIL=yes "$@" -} - -xfail_on_slow() -{ - if [[ $KSFT_MACHINE_SLOW = yes ]]; then - FAIL_TO_XFAIL=yes "$@" - else - "$@" - fi -} - -omit_on_slow() -{ - if [[ $KSFT_MACHINE_SLOW != yes ]]; then - "$@" - 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 -} - not() { "$@" diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh index 4f52b8e48a3a..6bcf5d13879d 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -361,3 +361,76 @@ tests_run() $current_test done } + +# Whether FAILs should be interpreted as XFAILs. Internal. +FAIL_TO_XFAIL= + +check_err() +{ + local err=$1 + local msg=$2 + + if ((err)); then + if [[ $FAIL_TO_XFAIL = yes ]]; then + ret_set_ksft_status $ksft_xfail "$msg" + else + ret_set_ksft_status $ksft_fail "$msg" + fi + fi +} + +check_fail() +{ + local err=$1 + local msg=$2 + + check_err $((!err)) "$msg" +} + +check_err_fail() +{ + local should_fail=$1; shift + local err=$1; shift + local what=$1; shift + + if ((should_fail)); then + check_fail $err "$what succeeded, but should have failed" + else + check_err $err "$what failed" + fi +} + +xfail() +{ + FAIL_TO_XFAIL=yes "$@" +} + +xfail_on_slow() +{ + if [[ $KSFT_MACHINE_SLOW = yes ]]; then + FAIL_TO_XFAIL=yes "$@" + else + "$@" + fi +} + +omit_on_slow() +{ + if [[ $KSFT_MACHINE_SLOW != yes ]]; then + "$@" + 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 +} From patchwork Tue Oct 22 14:50: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: 13845763 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2085.outbound.protection.outlook.com [40.107.92.85]) (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 36D871A0BE0; Tue, 22 Oct 2024 14:52:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729608727; cv=fail; b=K/lF5FSr4uernpvplyxpJ/gyWLThO95SfGqDFzR4Z2igKDlc9h4Ve0C2cIAJSxmtnt4fI8BWgpeRy88CvQTVEd/uVPWGo0/u2vp6SVFhXYHwkhPef2RPORLuz+Tfynjzs/wyMvAbe11bj/JjW6cbAdP7CM6nyH4Y2UvEYZuCVgE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729608727; c=relaxed/simple; bh=w6vLrNc06EtXLU0weol+DYdC4k1JkQaPnfFHKrgNuj0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jDoYaiHNuOIVAdENCJAsyFJUATng3oVAHQtFASVy6wORD2C8xoia16AaCfHmUwzsIJfuoCdrWdVWceL75t9P3Fe9Kf/5NtbHQfYg7Es9JPytQIVjIEeqW6Ph7hAw6CiESQigudyfs0GtMW7wiAQYYhb15ThNynLbi5cgaITf5ww= 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=rZta4UsD; arc=fail smtp.client-ip=40.107.92.85 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="rZta4UsD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zKjtbDN/qlKt7reKNei9Yi1LCnXy3yy/in3+3B76jCDKu+MVYT+mHyPWHmZ8jHfVrS7fVIOUbMKqugZInFsmbE8S8dv9/lOn6ZPNsBbHU1Dgl++Ofih4gsDhA6iiCzfhuyod/RaZThsOfn3epfD8dwejnLjU6I4jEexefH4nWOzeMfZpkN3upkVdTE5PI6A2XVcuLzOXjJIzE8Gx267mBI3S0RswOGgY9nUafoA++8Uz1f5CguBDEOc5dJA8lQzd4hkyQiIntR2xBDENo/BycSmAr3m3eKieNAxerJETRadknFlCpCn2gDsoSwClMLitcERJwpt58IM8ADGXMY7qbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=9yO46m1wrD3vR22LA5vKZnXRrx/Xfxf/OgkDidzy+B4=; b=mQCCx8dV2TNpqEh/47bbYJqvVmM+RqM0EW8gD1O0olnH5ly41P3uN2Ax+QY+XIFQj8Ieq+IgH0dcWkO3HzCzwXwPLEUGFCsYFlVew5OKNy+5R5jhT/JPOa+Jr3wFFABzvm11W1o9lvFoJ9GL0Vi5L1GQVXze1NSEUKAzH3Wn33iLAL/QY/fYLnYYlU8rKMgL1sf3dzQjQmn52CBeV5aY5HWe5+AgqXKhrEMXP3iqm8cZZy6N5oXaPFJmvpiul8WsRujNco8OTgFdPipHIjNEveCWcnW59soQxABDz8zbNyUZqC5l+M/uaj7aHjZfrTrJt3V2XW+/hOBAogg64KYv/Q== 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=9yO46m1wrD3vR22LA5vKZnXRrx/Xfxf/OgkDidzy+B4=; b=rZta4UsDtqzkcEsGAWMq6WXBGD8R1uKcFW2bEhQG1KMJJIkgKeuB/+38ZFpbixjI5LJvpQIagx77/T9fCEhGUmzBQz0Sf1aZ0hqlijycqQqU10XQScPMCxQOLALnWPOGsUGi8+GtSTSX0zldqDytxPJFttClAvSy4K9Ij1tzpKIuC6C1WrtluQlX2d8yVg2ER2fXQAP3S5J93Fwc4fvA/0mkhIYpLfFybuh52FmOHjPzx+KATLGr1LvLd9CCZ9GPUNBfS4dPb9hX0SukncL1YYCfCI3XKvI1REMdkQr/HiHhlSYQEE7Hr+MojryYklzSjo9eHJrgncsyjtj4og/8VA== Received: from BYAPR08CA0063.namprd08.prod.outlook.com (2603:10b6:a03:117::40) by SA1PR12MB8698.namprd12.prod.outlook.com (2603:10b6:806:38b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 14:52:00 +0000 Received: from SJ1PEPF000023D8.namprd21.prod.outlook.com (2603:10b6:a03:117:cafe::7e) by BYAPR08CA0063.outlook.office365.com (2603:10b6:a03:117::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Tue, 22 Oct 2024 14:52:00 +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 SJ1PEPF000023D8.mail.protection.outlook.com (10.167.244.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.2 via Frontend Transport; Tue, 22 Oct 2024 14:51:59 +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.1544.4; Tue, 22 Oct 2024 07:51:46 -0700 Received: from fedora.mtl.com (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.1544.4; Tue, 22 Oct 2024 07:51:39 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Ido Schimmel , Petr Machata , "Amit Cohen" , Vladimir Oltean , , Shuah Khan , Benjamin Poirier , Hangbin Liu , , Jiri Pirko , Andrew Lunn Subject: [PATCH net-next 7/8] selftests: net: lib: Add kill_process Date: Tue, 22 Oct 2024 16:50:18 +0200 Message-ID: <53b69a578d52e69c5cecb897140523560a72a514.1729607879.git.petrm@nvidia.com> X-Mailer: git-send-email 2.47.0 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: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023D8:EE_|SA1PR12MB8698:EE_ X-MS-Office365-Filtering-Correlation-Id: d2660e60-f5ba-4afb-a9d3-08dcf2a91541 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|7416014|1800799024; X-Microsoft-Antispam-Message-Info: 2HCEf/NhrCSR4TUR8+/BipjGO9s0LI5EuZihLnp8gFpMEGkmklYyK3rFIjoGs/QEwLU3yw5iySsIsav8XQSrIev15R0ICMQpPnTl9DnAihzampUDhJcH2ShZNHr6c6FTGePkRv+WMdLiE8OF6NECOOeNOGOHhMPScM747OxcDTJGMe0Xk44v3ngYhzW3Q1QdNHkiZuEl44ZRNQ9/Dk6Xq/3RAqM6mSa90JKOL3HZSyE89PNDeuL/4Z4CYC1eGZ7ESPRYzv1ChE4A4ZUT8JomxC3TPEGiefX0mb3DsoU1ceEGBpgobhr93BRs9Unq6tPebHQq9ToFKgFNdplLgv1bd/ff2RhoUDQEGAUMZQN0nDopoayNS41ICCVljPNZNuiHng5v155Q2M5KIFvKBQB6rXh/ISV71MFuCh1Y6I82IEcjG2Z8x6P16prqcZQEGn/R1ETfo0qER/i1gTxRNvnWotOiH/H9VrS0hFUqWnW6fKG8INQpltXBcIgZps/6pkd7kwfJflEclz0PjKHnspjiVUsXGlxyTNPyr5q7rgmpJ2FnmnxW4vigIbKI3WXkhI34ADrddCeZW34n/ty1pfgn1+owaygpYO3fEC7UgYc7MLBveP1MtMS8sLDnc/K79pOStVxInyWbGfmf2P+h1s27wS0SgOnoxtidph0ma4j8D3RY4TRg8VwJ4It5z4tnqZhjjLhEye6+HHS+MgGZnXvx6Kcfv9HNwEU8OBGB2Dbo6NZEM+i433YPw8LWwV4VBLEpwbz6TCYCUA6akdqgZ7eur/CQeP+PhA71P60724PJdRdJT3us5bt7P/sy57CuMSjSgJE0cf6Mj1dOtO8ulGcU+wuIFG1R4xvuwIpJGwD98M/Rv+ptR8RZhPYK1SFn0CBx15B3pILmh9CVkuTTVoPlpB+mRp7s0YR6Ykuxcu+Q/DTjb9XnUbySziYUWIJ9n8QY4ZCsvdLWe1aAxIDUfB07yCqSAVAGMEmYrt7/Bup9SCIOZSo6mR6hVB9OdKy8tbhMClcfwtEWY5E4NS6QcIT7zUgm4qgtDAoNLbXqwC0Gq/LPYSV26AKjMhGSQNEH6VvAAFpSwQnUliSMHrZmi/26bMCiwF2e05pKWyr8Ema5jBKpKL19Cix1y86YTt7L7HtS1QE/qeXjxU63mGTJ5PTB/NeHUI1NhbdZoTjGzhTpAJxTfweZcOYwuJlQDItBls00MVIXjIZh7qGOlCgqHFwbEDLYYpyfiCicTOdEFmCRJOLpzE2LiCKQ8ZQRH54JHme+JGG6ZdtGqtqPHWr3mEylQ/c00f3/KiJikChsAZS8Ligk0sb0g0VIK0RT3MLikh01sl9kX73IqAbhWh3GbNB9GYDYhdCrbPqwwebKYQX2cVrVGJM+Qd72VlUbTnIY2381WIZGZJef6S9DFNPVQWlhcA== 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:(13230040)(82310400026)(36860700013)(376014)(7416014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 14:51:59.8381 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d2660e60-f5ba-4afb-a9d3-08dcf2a91541 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: SJ1PEPF000023D8.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8698 A number of selftests run processes in the background and need to kill them afterwards. Instead for everyone to open-code the kill / wait / redirect mantra, add a helper in net/lib.sh. Convert existing open-code sites. Signed-off-by: Petr Machata Reviewed-by: Amit Cohen --- CC: Shuah Khan CC: Benjamin Poirier CC: Hangbin Liu CC: linux-kselftest@vger.kernel.org CC: Jiri Pirko CC: Andrew Lunn --- .../selftests/drivers/net/mlxsw/devlink_trap.sh | 2 +- .../drivers/net/mlxsw/devlink_trap_l3_drops.sh | 4 ++-- .../drivers/net/mlxsw/devlink_trap_l3_exceptions.sh | 12 ++++++------ .../drivers/net/mlxsw/devlink_trap_tunnel_ipip.sh | 4 ++-- .../drivers/net/mlxsw/devlink_trap_tunnel_ipip6.sh | 4 ++-- .../drivers/net/mlxsw/devlink_trap_tunnel_vxlan.sh | 4 ++-- .../net/mlxsw/devlink_trap_tunnel_vxlan_ipv6.sh | 4 ++-- .../testing/selftests/drivers/net/mlxsw/tc_sample.sh | 4 ++-- .../drivers/net/netdevsim/fib_notifications.sh | 6 +++--- tools/testing/selftests/net/drop_monitor_tests.sh | 2 +- tools/testing/selftests/net/fib_tests.sh | 8 ++++---- .../testing/selftests/net/forwarding/devlink_lib.sh | 2 +- tools/testing/selftests/net/forwarding/lib.sh | 3 +-- tools/testing/selftests/net/forwarding/tc_police.sh | 8 ++++---- tools/testing/selftests/net/lib.sh | 8 ++++++++ 15 files changed, 41 insertions(+), 34 deletions(-) diff --git a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap.sh b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap.sh index 89b55e946eed..36055279ba92 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap.sh @@ -116,7 +116,7 @@ dev_del_test() log_test "Device delete" - kill $mz_pid && wait $mz_pid &> /dev/null + kill_process $mz_pid } trap cleanup EXIT diff --git a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l3_drops.sh b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l3_drops.sh index 160891dcb4bc..db5806d189bb 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l3_drops.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l3_drops.sh @@ -595,7 +595,7 @@ irif_disabled_test() log_test "Ingress RIF disabled" - kill $mz_pid && wait $mz_pid &> /dev/null + kill_process $mz_pid ip link set dev $rp1 nomaster __addr_add_del $rp1 add 192.0.2.2/24 2001:db8:1::2/64 ip link del dev br0 type bridge @@ -645,7 +645,7 @@ erif_disabled_test() log_test "Egress RIF disabled" - kill $mz_pid && wait $mz_pid &> /dev/null + kill_process $mz_pid __addr_add_del $rp1 add 192.0.2.2/24 2001:db8:1::2/64 ip link del dev br0 type bridge devlink_trap_action_set $trap_name "drop" diff --git a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l3_exceptions.sh b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l3_exceptions.sh index 190c1b6b5365..5d6d88b600f0 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l3_exceptions.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_l3_exceptions.sh @@ -202,7 +202,7 @@ mtu_value_is_too_small_test() mtu_restore $rp2 - kill $mz_pid && wait $mz_pid &> /dev/null + kill_process $mz_pid tc filter del dev $h1 ingress protocol ip pref 1 handle 101 flower } @@ -235,7 +235,7 @@ __ttl_value_is_too_small_test() log_test "TTL value is too small: TTL=$ttl_val" - kill $mz_pid && wait $mz_pid &> /dev/null + kill_process $mz_pid tc filter del dev $h1 ingress protocol ip pref 1 handle 101 flower } @@ -299,7 +299,7 @@ __mc_reverse_path_forwarding_test() log_test "Multicast reverse path forwarding: $desc" - kill $mz_pid && wait $mz_pid &> /dev/null + kill_process $mz_pid tc filter del dev $rp2 egress protocol $proto pref 1 handle 101 flower } @@ -347,7 +347,7 @@ __reject_route_test() log_test "Reject route: $desc" - kill $mz_pid && wait $mz_pid &> /dev/null + kill_process $mz_pid ip route del unreachable $unreachable tc filter del dev $h1 ingress protocol $proto pref 1 handle 101 flower } @@ -542,7 +542,7 @@ ipv4_lpm_miss_test() log_test "LPM miss: IPv4" - kill $mz_pid && wait $mz_pid &> /dev/null + kill_process $mz_pid vrf_without_routes_destroy } @@ -569,7 +569,7 @@ ipv6_lpm_miss_test() log_test "LPM miss: IPv6" - kill $mz_pid && wait $mz_pid &> /dev/null + kill_process $mz_pid vrf_without_routes_destroy } diff --git a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_tunnel_ipip.sh b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_tunnel_ipip.sh index e9a82cae8c9a..4ac1dae92d0f 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_tunnel_ipip.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_tunnel_ipip.sh @@ -176,7 +176,7 @@ ecn_decap_test() log_test "$desc: Inner ECN is not ECT and outer is $ecn_desc" - kill $mz_pid && wait $mz_pid &> /dev/null + kill_process $mz_pid tc filter del dev $swp1 egress protocol ip pref 1 handle 101 flower } @@ -207,7 +207,7 @@ no_matching_tunnel_test() log_test "$desc" - kill $mz_pid && wait $mz_pid &> /dev/null + kill_process $mz_pid tc filter del dev $swp1 egress protocol ip pref 1 handle 101 flower } diff --git a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_tunnel_ipip6.sh b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_tunnel_ipip6.sh index 878125041fc3..fce885184404 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_tunnel_ipip6.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_tunnel_ipip6.sh @@ -176,7 +176,7 @@ ecn_decap_test() log_test "$desc: Inner ECN is not ECT and outer is $ecn_desc" - kill $mz_pid && wait $mz_pid &> /dev/null + kill_process $mz_pid tc filter del dev $swp1 egress protocol ipv6 pref 1 handle 101 flower } @@ -207,7 +207,7 @@ no_matching_tunnel_test() log_test "$desc" - kill $mz_pid && wait $mz_pid &> /dev/null + kill_process $mz_pid tc filter del dev $swp1 egress protocol ipv6 pref 1 handle 101 flower } diff --git a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_tunnel_vxlan.sh b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_tunnel_vxlan.sh index 5f6eb965cfd1..7aca8e5922cf 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_tunnel_vxlan.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_tunnel_vxlan.sh @@ -183,7 +183,7 @@ ecn_decap_test() log_test "$desc: Inner ECN is not ECT and outer is $ecn_desc" - kill $mz_pid && wait $mz_pid &> /dev/null + kill_process $mz_pid tc filter del dev $swp1 egress protocol ip pref 1 handle 101 flower } @@ -253,7 +253,7 @@ corrupted_packet_test() log_test "$desc" - kill $mz_pid && wait $mz_pid &> /dev/null + kill_process $mz_pid tc filter del dev $swp1 egress protocol ip pref 1 handle 101 flower } diff --git a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_tunnel_vxlan_ipv6.sh b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_tunnel_vxlan_ipv6.sh index f6c16cbb6cf7..4599c331240b 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_tunnel_vxlan_ipv6.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/devlink_trap_tunnel_vxlan_ipv6.sh @@ -188,7 +188,7 @@ ecn_decap_test() log_test "$desc: Inner ECN is not ECT and outer is $ecn_desc" - kill $mz_pid && wait $mz_pid &> /dev/null + kill_process $mz_pid tc filter del dev $swp1 egress protocol ipv6 pref 1 handle 101 flower } @@ -262,7 +262,7 @@ corrupted_packet_test() log_test "$desc" - kill $mz_pid && wait $mz_pid &> /dev/null + kill_process $mz_pid tc filter del dev $swp1 egress protocol ipv6 pref 1 handle 101 flower } diff --git a/tools/testing/selftests/drivers/net/mlxsw/tc_sample.sh b/tools/testing/selftests/drivers/net/mlxsw/tc_sample.sh index 83a0210e7544..bc7ea2df49fb 100755 --- a/tools/testing/selftests/drivers/net/mlxsw/tc_sample.sh +++ b/tools/testing/selftests/drivers/net/mlxsw/tc_sample.sh @@ -218,7 +218,7 @@ psample_capture_start() psample_capture_stop() { - { kill %% && wait %%; } 2>/dev/null + kill_process %% } __tc_sample_rate_test() @@ -499,7 +499,7 @@ tc_sample_md_out_tc_occ_test() backlog=$(tc -j -p -s qdisc show dev $rp2 | jq '.[0]["backlog"]') # Kill mausezahn. - { kill %% && wait %%; } 2>/dev/null + kill_process %% psample_capture_stop diff --git a/tools/testing/selftests/drivers/net/netdevsim/fib_notifications.sh b/tools/testing/selftests/drivers/net/netdevsim/fib_notifications.sh index 8d91191a098c..9896580c3d85 100755 --- a/tools/testing/selftests/drivers/net/netdevsim/fib_notifications.sh +++ b/tools/testing/selftests/drivers/net/netdevsim/fib_notifications.sh @@ -94,7 +94,7 @@ route_addition_check() sleep 1 $IP route add $route dev dummy1 sleep 1 - kill %% && wait %% &> /dev/null + kill_process %% route_notify_check $outfile $expected_num_notifications $offload_failed rm -f $outfile @@ -148,7 +148,7 @@ route_deletion_check() sleep 1 $IP route del $route dev dummy1 sleep 1 - kill %% && wait %% &> /dev/null + kill_process %% route_notify_check $outfile $expected_num_notifications rm -f $outfile @@ -191,7 +191,7 @@ route_replacement_check() sleep 1 $IP route replace $route dev dummy2 sleep 1 - kill %% && wait %% &> /dev/null + kill_process %% route_notify_check $outfile $expected_num_notifications rm -f $outfile diff --git a/tools/testing/selftests/net/drop_monitor_tests.sh b/tools/testing/selftests/net/drop_monitor_tests.sh index 7c4818c971fc..507d0a82f5f0 100755 --- a/tools/testing/selftests/net/drop_monitor_tests.sh +++ b/tools/testing/selftests/net/drop_monitor_tests.sh @@ -77,7 +77,7 @@ sw_drops_test() rm ${dir}/packets.pcap - { kill %% && wait %%; } 2>/dev/null + kill_process %% timeout 5 dwdump -o sw -w ${dir}/packets.pcap (( $(tshark -r ${dir}/packets.pcap \ -Y 'ip.dst == 192.0.2.10' 2> /dev/null | wc -l) == 0)) diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh index 5f3c28fc8624..3ea6f886a210 100755 --- a/tools/testing/selftests/net/fib_tests.sh +++ b/tools/testing/selftests/net/fib_tests.sh @@ -689,7 +689,7 @@ fib6_notify_test() log_test $ret 0 "ipv6 route add notify" - { kill %% && wait %%; } 2>/dev/null + kill_process %% #rm errors.txt @@ -736,7 +736,7 @@ fib_notify_test() log_test $ret 0 "ipv4 route add notify" - { kill %% && wait %%; } 2>/dev/null + kill_process %% rm errors.txt @@ -2328,7 +2328,7 @@ ipv4_mangle_test() $IP route del table 123 172.16.101.0/24 dev veth1 $IP rule del pref 100 - { kill %% && wait %%; } 2>/dev/null + kill_process %% rm $tmp_file route_cleanup @@ -2386,7 +2386,7 @@ ipv6_mangle_test() $IP -6 route del table 123 2001:db8:101::/64 dev veth1 $IP -6 rule del pref 100 - { kill %% && wait %%; } 2>/dev/null + kill_process %% rm $tmp_file route_cleanup diff --git a/tools/testing/selftests/net/forwarding/devlink_lib.sh b/tools/testing/selftests/net/forwarding/devlink_lib.sh index 62a05bca1e82..18afa89ebbcc 100644 --- a/tools/testing/selftests/net/forwarding/devlink_lib.sh +++ b/tools/testing/selftests/net/forwarding/devlink_lib.sh @@ -501,7 +501,7 @@ devlink_trap_drop_cleanup() local pref=$1; shift local handle=$1; shift - kill $mz_pid && wait $mz_pid &> /dev/null + kill_process $mz_pid tc filter del dev $dev egress protocol $proto pref $pref handle $handle flower } diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 8625e3c99f55..7337f398f9cc 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -1574,8 +1574,7 @@ stop_traffic() { local pid=${1-%%}; shift - # Suppress noise from killing mausezahn. - { kill $pid && wait $pid; } 2>/dev/null + kill_process "$pid" } declare -A cappid diff --git a/tools/testing/selftests/net/forwarding/tc_police.sh b/tools/testing/selftests/net/forwarding/tc_police.sh index 5103f64a71d6..509fdedfcfa1 100755 --- a/tools/testing/selftests/net/forwarding/tc_police.sh +++ b/tools/testing/selftests/net/forwarding/tc_police.sh @@ -148,7 +148,7 @@ police_common_test() log_test "$test_name" - { kill %% && wait %%; } 2>/dev/null + kill_process %% tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower } @@ -198,7 +198,7 @@ police_shared_common_test() log_test "$test_name" - { kill %% && wait %%; } 2>/dev/null + kill_process %% } police_shared_test() @@ -278,7 +278,7 @@ police_mirror_common_test() log_test "$test_name" - { kill %% && wait %%; } 2>/dev/null + kill_process %% tc filter del dev $pol_if $dir protocol ip pref 1 handle 101 flower tc filter del dev $h3 ingress protocol ip pref 1 handle 101 flower tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower @@ -320,7 +320,7 @@ police_pps_common_test() log_test "$test_name" - { kill %% && wait %%; } 2>/dev/null + kill_process %% tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower } diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh index 6bcf5d13879d..24f63e45735d 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -434,3 +434,11 @@ xfail_on_veth() "$@" fi } + +kill_process() +{ + local pid=$1; shift + + # Suppress noise from killing the process. + { kill $pid && wait $pid; } 2>/dev/null +} From patchwork Tue Oct 22 14:50: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: 13845790 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2085.outbound.protection.outlook.com [40.107.243.85]) (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 B1D6E1A0BE0; Tue, 22 Oct 2024 14:52:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729608738; cv=fail; b=AopMYLwR+vdrEozMw/yDtBZ3R/hGb79g+XkbC04pacYCwslcwFijqCXxlwfQTrGKJHXTlWpbY5hFWR8EoWVfjNnmBrdQBplFPOmSB0nRiSmw4uat0uK3tEowPuszagToWkn/YAepzODODY9yVPbB7iCpJhttS9CJGa3E1BksYZI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729608738; c=relaxed/simple; bh=lZQvmwDNeH5pMg0XXLgJCG73AbB+ZHDBicthcAv/nLM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eP5FlLJNIdEeibaKD3JfM5MoEsugeWOL9FaL0EWtS7TvC2Z6pOffYIrj7FiWk7XILoVJ2KVPv1WlWZy6K5XBgpruMGbPQjYreSaxpmYrJ1Tp4PZmoQXYvdJAqh0d1/hd/JcyqERNDGO/GrqC6/9Zv1ZTzy1HRzxS2XNNoq5PUR4= 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=dp8ddWAp; arc=fail smtp.client-ip=40.107.243.85 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="dp8ddWAp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dCddP0QOnh3B96x7/ORX/BY6D70YdKX/AXP4l6nhSsOIFhg+NMx/Ye+vLVZ4DGzxZ7ZtVtdxBx9CB8+wrY0DwJbB+s6+joX6sv9TC4luv3suwrIIeOW9Gzm8jrpzyEV71zAlJkYUzvhEPReO517ZJ+m46RgLZdfkJnfJJxFCOsoOJXU6XwZyHBmNwXH4sVrZQ4I9dj17aIpJpQUoYuJa/D5IP//mvsEqBlDbmARFNV2xGXPIQyoAZ7JR3YTRMEyViMzH2ZNxuA4Ks3KsBA6rwuoK6eeFP7tSZFjP5czWom/QpMx645RNf/SJ9w1qfoGfSu93fQwB022JPUQTGBERGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=RdTsgNe6H3Wuwwt715kdN/GAzD2TfTrGDPddrZWV6a0=; b=NRYy7h8swxBbgs+oLWi1ERJ4Tlu7zXwJmeT1PaQha8SSwiX+W/OBghf0c93ihiigSLaGGOeEsreQbt9A10WbRCLJOHTOvFCNQ0DtY4B7vgPsx8wCc4C4e/1+bZxFYU/ytFf6Po80VzgYpf+GtHPSCQ+omNg+9DNYaAVxyXNk4yxHwOoSVzdIYU+JNFPl0xCzt16uEl33gW1Fie0uvDQhBPDL5Y0eUvd/c4NI0cjGSHwAlwkkBrJDuTbgtyoScYgIXGfx+V5KZZCqP1xkOqlKS7xTb/UX6we0TGrTJ4EJBv85L0SCvl7f9pOrr1u8jQInohjAEBF4FIY0Ra0UrCA4Gg== 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=RdTsgNe6H3Wuwwt715kdN/GAzD2TfTrGDPddrZWV6a0=; b=dp8ddWApkfz+eCzh8Baxb+i877jdcGMT/OHRcKnz4Kyi4WhmQdXS9fwzExM/S0Wxn4R7aSPqFek0N3xjA9mibKL7wzinwFub52/hDPSRazuSSkU3MzXut+34XnSiB6XVdKbiLe4438SqEXrN9P6LvBhPbCLUa1sYfdngbWajVmx8/Lu0cZkXE02rU46EjsuU+eZZLAwZNZEZ85YYDWbFQuHn0mcV8WOmzenrqx7+rSSljk2cSdNBSkux4RxmLBRG9/e7/9JVv6aHXLqR3XMnpteEx74SBI2AwzRME26vtOYrFwNypq9Ts66uGzuG2d54YuvhiRQXnvkuBkFC8yDPrw== Received: from DS7PR06CA0034.namprd06.prod.outlook.com (2603:10b6:8:54::18) by SA1PR12MB8700.namprd12.prod.outlook.com (2603:10b6:806:388::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 14:52:09 +0000 Received: from DS3PEPF0000C37A.namprd04.prod.outlook.com (2603:10b6:8:54:cafe::1c) by DS7PR06CA0034.outlook.office365.com (2603:10b6:8:54::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Tue, 22 Oct 2024 14:52:09 +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 DS3PEPF0000C37A.mail.protection.outlook.com (10.167.23.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.14 via Frontend Transport; Tue, 22 Oct 2024 14:52:08 +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.1544.4; Tue, 22 Oct 2024 07:51:52 -0700 Received: from fedora.mtl.com (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.1544.4; Tue, 22 Oct 2024 07:51:46 -0700 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , CC: Ido Schimmel , Petr Machata , "Amit Cohen" , Vladimir Oltean , , Shuah Khan , Benjamin Poirier , Hangbin Liu , , Jiri Pirko Subject: [PATCH net-next 8/8] selftests: net: fdb_notify: Add a test for FDB notifications Date: Tue, 22 Oct 2024 16:50:19 +0200 Message-ID: X-Mailer: git-send-email 2.47.0 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: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37A:EE_|SA1PR12MB8700:EE_ X-MS-Office365-Filtering-Correlation-Id: c0381f4f-74d2-46a4-3000-08dcf2a91ab3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|82310400026|7416014|1800799024; X-Microsoft-Antispam-Message-Info: gCgSwJaya0RMkAWaKE8ddIHQM93CjQ3pHcSN4Fe7y1ACz+D7/e8+kXSNvqILKweFRaQa07Q0dNyV3q6zHA69qlAwwNc1dfU8NQqLtyHg7k1PVBy9QlP5USjjk3hSKFTcYv3/iyd/8Ly/fyfosA4Tlh1BMTgDnQDMm9J07CHLx5Plxb2rHR3Tnfn5kS4d0hA8ZJOoeznSau0Sp2uriV4dPfw/WeFdEv8LSgGVXkggQkm/f2BkrbTypZtPonduE8fvwiZRAPyFKwSh87BnZ41ZA7cpsN2ZJ89ByBDSb5Zz42hJdCichU2d8TeFqDuTB7sERk8x3WQY3sZaP+W+l2KJX5OiHQOfB2r79jrI4bp4txkDeNKIqFJC2YjRy/gI5jTBcta3XJsxtPodFktf4lQidkdOl36QzYHmAHOL0CFY2Y+/GSXlAdX6oKgAuV+ymxNrp5caaoPcy3itKeGAy/DlNIUfBxgOho7YnEfhwiW9R+EvIHA2QF+NDwj2yLJPQZZ7m5VEMmtAnnIVpPW1igT/tNKX3mZ7ysvAbhmzYKR0o5Og1G38/Q7yabrIFnew17cwuv5dkSTxecrjbRb6lVQsXGVIVi36znjIB6oDg4iyluTHpemI6D+p6weUTd9uZW+5s60ypIYPvtvQZqEh+/tXTlJlj8JubhJi2PPspN22pFEa0F02xy5Dbo377gCv5LRTQHXkunIig6MnXmtoaw3ymJ50mu4fib+uJFB/kGWBudMxeL5qv8o8FH2lPF6JJ/e//mvho2LsWxrtH3IILLuN7XHOEobYpl2/Qs7DqvkZAJwrUZmPSxDyNU88l//Mhf15iNdohU0uqh0RFI+nDug4PS9EmLg/Bq06PSp0sZG2oVKQbLCalc7cmYcTCRQocFOnPQxRgDf6HRLpyo1gB5STgk0z2C0sHgYMS9WuOJV0hwE2H8P/C4s1gA5RhjOutEMaaDgn3x07DdkcxVSjj8Sf9cL4wNB56mRne0DYWwwgmAFzf2DapmWBWU7/3ovp8bUGkn081+y8IsBjeyOxFKsdtESYVU05VwFz9C+iIvzBtUAf2eKtEozQDUmYoIZqhv+iHp7aT4uzM61idBaXPz/LR/ifzXgQGVYLqKnIeAEgKquEkD5ugO5aJA2SSmtS9TuL5Qct2sTpnmjKIERQdbetqcd/6DIwLSwP0GpnnfHegN8xfKjf2slYhwLgYUL3TLHsVcDzYl4a9D+hsUCe20+rJXd8OBqP7yetLc/v5qycwCF3dt+3vI4q/M3qEWqKfFmylYPveQfCTVsZ1UXOAyZq9McL+Np46dNtWJWrWkoQs0wwLJds5texhKlt1BklWdHSYpYXYFyVhFRdAbvSDbO0haIw+oiDGm0IPparIDeUe0edS8KwTxGB18pGI02/BYdn68rp6JZ/DeU6apwz9yqsow== 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:(13230040)(376014)(36860700013)(82310400026)(7416014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 14:52:08.9550 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c0381f4f-74d2-46a4-3000-08dcf2a91ab3 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: DS3PEPF0000C37A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8700 Check that only one notification is produced for various FDB edit operations. Regarding the ip_link_add() and ip_link_master() helpers. This pattern of action plus corresponding defer is bound to come up often, and a dedicated vocabulary to capture it will be handy. tunnel_create() and vlan_create() from forwarding/lib.sh are somewhat opaque and perhaps too kitchen-sinky, so I tried to go in the opposite direction with these ones, and wrapped only the bare minimum to schedule a corresponding cleanup. Signed-off-by: Petr Machata Reviewed-by: Amit Cohen --- CC: Shuah Khan CC: Benjamin Poirier CC: Hangbin Liu CC: linux-kselftest@vger.kernel.org CC: Jiri Pirko --- tools/testing/selftests/net/Makefile | 2 +- tools/testing/selftests/net/fdb_notify.sh | 95 +++++++++++++++++++++++ tools/testing/selftests/net/lib.sh | 17 ++++ 3 files changed, 113 insertions(+), 1 deletion(-) create mode 100755 tools/testing/selftests/net/fdb_notify.sh diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile index 26a4883a65c9..ab0e8f30bfe7 100644 --- a/tools/testing/selftests/net/Makefile +++ b/tools/testing/selftests/net/Makefile @@ -92,7 +92,7 @@ TEST_PROGS += test_vxlan_mdb.sh TEST_PROGS += test_bridge_neigh_suppress.sh TEST_PROGS += test_vxlan_nolocalbypass.sh TEST_PROGS += test_bridge_backup_port.sh -TEST_PROGS += fdb_flush.sh +TEST_PROGS += fdb_flush.sh fdb_notify.sh TEST_PROGS += fq_band_pktlimit.sh TEST_PROGS += vlan_hw_filter.sh TEST_PROGS += bpf_offload.py diff --git a/tools/testing/selftests/net/fdb_notify.sh b/tools/testing/selftests/net/fdb_notify.sh new file mode 100755 index 000000000000..a98047361988 --- /dev/null +++ b/tools/testing/selftests/net/fdb_notify.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +source lib.sh + +ALL_TESTS=" + test_dup_bridge + test_dup_vxlan_self + test_dup_vxlan_master + test_dup_macvlan_self + test_dup_macvlan_master +" + +do_test_dup() +{ + local op=$1; shift + local what=$1; shift + local tmpf + + RET=0 + + tmpf=$(mktemp) + defer rm "$tmpf" + + defer_scope_push + bridge monitor fdb &> "$tmpf" & + defer kill_process $! + + bridge fdb "$op" 00:11:22:33:44:55 vlan 1 "$@" + sleep 0.2 + defer_scope_pop + + local count=$(grep -c -e 00:11:22:33:44:55 $tmpf) + ((count == 1)) + check_err $? "Got $count notifications, expected 1" + + log_test "$what $op: Duplicate notifications" +} + +test_dup_bridge() +{ + ip_link_add br up type bridge vlan_filtering 1 + do_test_dup add "bridge" dev br self + do_test_dup del "bridge" dev br self +} + +test_dup_vxlan_self() +{ + ip_link_add br up type bridge vlan_filtering 1 + ip_link_add vx up type vxlan id 2000 dstport 4789 + ip_link_master vx br + + do_test_dup add "vxlan" dev vx self dst 192.0.2.1 + do_test_dup del "vxlan" dev vx self dst 192.0.2.1 +} + +test_dup_vxlan_master() +{ + ip_link_add br up type bridge vlan_filtering 1 + ip_link_add vx up type vxlan id 2000 dstport 4789 + ip_link_master vx br + + do_test_dup add "vxlan master" dev vx master + do_test_dup del "vxlan master" dev vx master +} + +test_dup_macvlan_self() +{ + ip_link_add dd up type dummy + ip_link_add mv up link dd type macvlan mode passthru + + do_test_dup add "macvlan self" dev mv self + do_test_dup del "macvlan self" dev mv self +} + +test_dup_macvlan_master() +{ + ip_link_add br up type bridge vlan_filtering 1 + ip_link_add dd up type dummy + ip_link_add mv up link dd type macvlan mode passthru + ip_link_master mv br + + do_test_dup add "macvlan master" dev mv self + do_test_dup del "macvlan master" dev mv self +} + +cleanup() +{ + defer_scopes_cleanup +} + +trap cleanup EXIT +tests_run + +exit $EXIT_STATUS diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh index 24f63e45735d..8994fec1c38f 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -442,3 +442,20 @@ kill_process() # Suppress noise from killing the process. { kill $pid && wait $pid; } 2>/dev/null } + +ip_link_add() +{ + local name=$1; shift + + ip link add name "$name" "$@" + defer ip link del dev "$name" +} + +ip_link_master() +{ + local member=$1; shift + local master=$1; shift + + ip link set dev "$member" master "$master" + defer ip link set dev "$member" nomaster +}