From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B65DB43FAC; Sun, 5 May 2024 09:43:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 34339402DC; Sun, 5 May 2024 09:43:37 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2052.outbound.protection.outlook.com [40.107.6.52]) by mails.dpdk.org (Postfix) with ESMTP id D434D4025D for ; Sun, 5 May 2024 09:43:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZHb82ZjgexmFXvOantSXizdIbSZ1vXAfGZeYbXTwuif+cWaabAm62/B+/FgOeieOMVwvyvbuI1ZNHp0gQWZqwEJjazcqpTmemeEkv/1WMCWg3FMSSdEd3akfUjYTBxgTpbfLAi9kmx5PzDpU8u8un1hXIzhAXCyAgjHtRein+EOGFDdY/vpPJKI25fsvVXqkCIFzIfjTMQJfnvFsoZvpZRaUUFAtYOSVds9ZREaDYh6ofdIVgA+h/AmpPKbni3ARN7diGtvc5yfII9qWbUbpwco3vkZO/vyb65CtML53nYVVz4cqQO5ysx6HKVa8NgdnmwAI28LxJgZM7ttBDN12dg== 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=pgqb9JEA77f9APhXHTEjz7+NixtL0Wc7nymsW0DjEkk=; b=GSdjQ8sdPblcrVgbhBF400LjatpgKcTnpNzxcyYe5rGCetx08iHYyY5kWVeXhSoFf86w6vyYTW+kHEd3dHOeICmMI2s7rATfAo1wBSfuhytktGT3aa8rfJsbM0w642+ppCeHhwFrIOVZqrj0Op/zmxju8vyqMengrOYO8N4GRak31dsjn59Q+/PB/E5Evy4n93YEWtbrLRqWaqUHhxhL88MX3E6IuNTpJvxlhKo+n2VYpnj+1Ic1wcHW+ieYfkYYf/o3odJSNmUpJce7fPBOmTh3Tk9gYD8wIu5wtdCWzxkj0h9+Wmjr86gIaQgk8SbF/RuekLGDwjYyJeri8gDUcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=dpdk.org smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pgqb9JEA77f9APhXHTEjz7+NixtL0Wc7nymsW0DjEkk=; b=W6U9e6kDv5ThERgJz+Rc0qcD88ciu5N2rBC92Qe3BimSNgE0b2qgqofSx3nB/RjPtIBmFGYJigBvdlrMNmtcSjIywXeSg7pz8J5SqJmnqjyUCjDwCSRac5DeyDGac8Z0W63hUNbXb8thRKxb04JMgPtOzy++CfmdiZVlqO5UNAzrPsbyyqFgBxlQaDlVmhLyv+L2vLVFll3a1v0tHADv6oYVyLIDG5p71B0Z1l6NNMAwUbtepciLWjCrHaByIf1JCw2nhNwJamFAKnne2CT2rOWYC2KsRV/Umjvcdso3iHB8two+1GV3SGQl5hF1S02wEb+71LpY28IMas87jakm6Q== Received: from AM6PR04CA0029.eurprd04.prod.outlook.com (2603:10a6:20b:92::42) by AM9PR07MB7938.eurprd07.prod.outlook.com (2603:10a6:20b:2fc::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.39; Sun, 5 May 2024 07:43:34 +0000 Received: from AM2PEPF0001C717.eurprd05.prod.outlook.com (2603:10a6:20b:92:cafe::a5) by AM6PR04CA0029.outlook.office365.com (2603:10a6:20b:92::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.39 via Frontend Transport; Sun, 5 May 2024 07:43:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; pr=C Received: from oa.msg.ericsson.com (192.176.1.74) by AM2PEPF0001C717.mail.protection.outlook.com (10.167.16.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Sun, 5 May 2024 07:43:34 +0000 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.60) with Microsoft SMTP Server id 15.2.1544.9; Sun, 5 May 2024 09:43:34 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id EE86738007A; Sun, 5 May 2024 09:43:33 +0200 (CEST) From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= To: CC: , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Tyler Retzlaff , Stephen Hemminger , Harry van Haaren , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Subject: [RFC v5 4/6] eal: add unit tests for atomic bitset operations Date: Sun, 5 May 2024 09:33:11 +0200 Message-ID: <20240505073313.118515-4-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240505073313.118515-1-mattias.ronnblom@ericsson.com> References: <20240216102348.480407-1-mattias.ronnblom@ericsson.com> <20240505073313.118515-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C717:EE_|AM9PR07MB7938:EE_ X-MS-Office365-Filtering-Correlation-Id: 42a7bea7-e7af-4ad2-a86b-08dc6cd71177 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|36860700004|1800799015|376005; X-Microsoft-Antispam-Message-Info: =?utf-8?B?OHNRRTU3b0pxYUs3eHZPN2t4cmJxb0VuaFhpYzRNeXEzQ1RRZ250eHZPZEZU?= =?utf-8?B?SUhlQ2RvcW1iMVNtS0Z2NUt6OVVDaktUZGRRL2k0TjlaMDZla0owVW1COEUv?= =?utf-8?B?UENkblFoalkyR29XM21yelNIc0FsWFUzTTNvMC9VREg4VGJJUzhxSVlOa3dY?= =?utf-8?B?Wm1JV0JKYXhpdGsxbG8wUnhaR0xUYnk2Rk9EYW0xRGNNOE91bWxVY3FZMTdN?= =?utf-8?B?ZWg5S0dzd0VXYkd2RmRPSVEyYU16THFQOTFQeC8zZ3BvTTgya1NhWkNDeDRY?= =?utf-8?B?ZE5rZGdWQW9ZTUluUFdhTlVnNldnb2NsZEtUQ21JZHpWYW55K2l3WmlqbXJq?= =?utf-8?B?ZzhUcmFNOW9nZlA5dEdtak10S25RSHZyckJZaDVDYklrQXhNKy8vSEJ1SVV0?= =?utf-8?B?d1M1ajhscEROY2hqdnZJSGl1MG9aR3hTd2lLcEdqWVEzUDVRTDc0LzBJSlo4?= =?utf-8?B?c001aGthLzR4MTJWekt4d3Q3akE1enBHY3BnMHZHVnlCQ0tlUlNDc1RsMFV6?= =?utf-8?B?N0gzbWtGcFN6NG9iMUN4a3psc3RBNlB4R294dFVSUkQvSDY2Z3cxN3ErVzN5?= =?utf-8?B?SE51bXgvODFQV1c3YnlsRC9sMX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=?utf-8?B?dFRCWDZrQWF2Zk1UY2FnUEJ3OEVqNWZ6RjRlL29aNDkzaGZWQnlBcjgvL3NG?= =?utf-8?B?ajBoVDJmYTZ5a1NqY3NLVXNlVG1FNUVTRkNBSVpXT1gycFFBczgwWTZVZTZj?= =?utf-8?B?bU5jSmZtVHJ5WGh5Z2lOR0laZ3pOczVnNUNHeTd2SnJHNVNhSjduR1U2VkFG?= =?utf-8?B?Y1VBYkFJSlM2NEM3MlVuRXZnRkU2bXNuNU9pMVc4cDgrdkw5K0hESEJ4VjhM?= =?utf-8?B?c1FYUTR0T2tpU0djQ1BsQ21JaTFZN2sxeXpSVm56dElmaWRiaHRnTmsrWWtv?= =?utf-8?Q?pCVSiXsLDgWPbDFTD+fAPSTp4q4dB8Xv7UsVc=3D?= X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230031)(82310400017)(36860700004)(1800799015)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2024 07:43:34.5653 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 42a7bea7-e7af-4ad2-a86b-08dc6cd71177 X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-AuthSource: AM2PEPF0001C717.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR07MB7938 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Extend bitset tests to cover the basic operation of the rte_bitset_atomic_*() family of functions. Signed-off-by: Mattias Rönnblom --- app/test/test_bitset.c | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/app/test/test_bitset.c b/app/test/test_bitset.c index b3496df1c0..32224a1eee 100644 --- a/app/test/test_bitset.c +++ b/app/test/test_bitset.c @@ -222,6 +222,52 @@ test_flip(void) rte_bitset_flip); } +static bool +bitset_atomic_test(const uint64_t *bitset, size_t bit_num) +{ + return rte_bitset_atomic_test(bitset, bit_num, + rte_memory_order_relaxed); +} + +static void +bitset_atomic_set(uint64_t *bitset, size_t bit_num) +{ + rte_bitset_atomic_set(bitset, bit_num, rte_memory_order_relaxed); +} + +static void +bitset_atomic_clear(uint64_t *bitset, size_t bit_num) +{ + rte_bitset_atomic_clear(bitset, bit_num, rte_memory_order_relaxed); +} + +static void +bitset_atomic_flip(uint64_t *bitset, size_t bit_num) +{ + rte_bitset_atomic_flip(bitset, bit_num, rte_memory_order_relaxed); +} + +static void +bitset_atomic_assign(uint64_t *bitset, size_t bit_num, bool bit_value) +{ + rte_bitset_atomic_assign(bitset, bit_num, bit_value, + rte_memory_order_relaxed); +} + +static int +test_atomic_set_clear(void) +{ + return test_set_clear_fun(bitset_atomic_test, bitset_atomic_set, + bitset_atomic_clear); +} + +static int +test_atomic_flip(void) +{ + return test_flip_fun(bitset_atomic_test, bitset_atomic_assign, + bitset_atomic_flip); +} + static ssize_t find(const bool *ary, size_t num_bools, size_t start, size_t len, bool set) { @@ -868,6 +914,8 @@ static struct unit_test_suite bitset_tests = { .unit_test_cases = { TEST_CASE_ST(NULL, NULL, test_set_clear), TEST_CASE_ST(NULL, NULL, test_flip), + TEST_CASE_ST(NULL, NULL, test_atomic_set_clear), + TEST_CASE_ST(NULL, NULL, test_atomic_flip), TEST_CASE_ST(NULL, NULL, test_find), TEST_CASE_ST(NULL, NULL, test_foreach), TEST_CASE_ST(NULL, NULL, test_count), -- 2.34.1