From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id F3148AC1211 for ; Mon, 11 Dec 2023 15:43:53 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=KzuR81+PfGssh3R6MK6EEH3dyiBiNgKXy6cxLsI5HeU=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Received-SPF:From:To:CC:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1702309432; v=1; b=A9ZvjVa7B4HzLvtiVPPkQtzhu2GNV4GimH37DkI1Ux2TMN3G0B6OxsswqUKbUSfo7jf7EBoE F7cop5JWdy7qNNhpqiixmwVV8ENRfl81h/wmz5WYXdPN0X1ORVxoMEGllrd71Son9+dk97Hsr52 Ogx57G06Kf4ymwmByQ+pgJ+8= X-Received: by 127.0.0.2 with SMTP id ROcxYY7687511xNPZu1qXtBO; Mon, 11 Dec 2023 07:43:52 -0800 X-Received: from NAM12-BN8-obe.outbound.protection.outlook.com (NAM12-BN8-obe.outbound.protection.outlook.com [40.107.237.42]) by mx.groups.io with SMTP id smtpd.web10.11585.1702309431804843755 for ; Mon, 11 Dec 2023 07:43:52 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MIydiijXCoKGOwrBYdmaSigCyk8vHkPSonZ6aFJme/J6rgr5BCjjLxZTywcZ6wwIfIuJmmoZxdq6nXo4sI97HgeyBb8ToJA+k+vB3iiIpGwc+i8+fn/n4rKoVNw66Y1GlgoSppdXNaunPc+r9vgzNKNJo8hrTc2x6FMr5lOq/X3t2aGfPvbuGMy9ODHw3rZnqrJsGho+6THb3cOU8NUIesewRwdQsn0mSCynR0HdAMo8JLhEiHQz93+VUviTlOwMu25SJMdYlcQx5YcsEaCdDvAYBdg2moNkoomVgV1b2yHqCcvdDlv4lYc0aA/pj0b5n1jhSMysPvq/d+EYBJVSSg== 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=A1/oOaesD1yJpQFxlBaLpqzUrD+qHVJB0UI3kRA1rH4=; b=DmESmONBXdrmNLi4rWfl4VuS7+TZtyd1CU8RVMxmtKYHFogi18glenV1M4hw14W5hwaEx7Yk6CeoBX+aZ4lL+T1iKUwRqPmV3x0aj5oCVMX1rpdTM3dzz3gxWKfDsrs0uNuTV5sY6T2qcjBFTDDY29hJavJxT8G61LnkVBxrp4uCBVwRMp5bXjDL4rmQ8YtY2Otc+MLlTNW9n6N787ZLA4vz7hLMtuKHAWq6KjA3UETl9hDxZ6NFhwJ/fHO7AjcKKUFVLJ5KPoAOy5aUEtVbZRyaBflxU77DqaZJZo2DTJLpEMSHaMGdWCRqA6RMQ2GtHJPCS7DKAtmfQKXNyp7ScA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=edk2.groups.io 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) X-Received: from DM6PR13CA0063.namprd13.prod.outlook.com (2603:10b6:5:134::40) by MW6PR12MB8733.namprd12.prod.outlook.com (2603:10b6:303:24c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 15:43:48 +0000 X-Received: from DS1PEPF00017095.namprd03.prod.outlook.com (2603:10b6:5:134:cafe::80) by DM6PR13CA0063.outlook.office365.com (2603:10b6:5:134::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.21 via Frontend Transport; Mon, 11 Dec 2023 15:43:48 +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 X-Received: from mail.nvidia.com (216.228.117.161) by DS1PEPF00017095.mail.protection.outlook.com (10.167.17.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.18 via Frontend Transport; Mon, 11 Dec 2023 15:43:48 +0000 X-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, 11 Dec 2023 07:43:23 -0800 X-Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.986.41; Mon, 11 Dec 2023 07:43:23 -0800 X-Received: from 9365154cdc6c.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 11 Dec 2023 07:43:22 -0800 From: "Jeff Brasen via groups.io" To: CC: , , , Jeff Brasen Subject: [edk2-devel] [PATCH] MdePkg: Add FdtLib gmock support Date: Mon, 11 Dec 2023 07:43:13 -0800 Message-ID: <551bf2146720d609621b153dca073a1655489524.1702309338.git.jbrasen@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017095:EE_|MW6PR12MB8733:EE_ X-MS-Office365-Filtering-Correlation-Id: 5f3005c6-351a-4cf4-757c-08dbfa5ff76e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: h6WV9RWbE0Xf6g+XDRXkAxSeCE9umN6MnRYSkzoFr/6VjjGppbmI7Mma16QNj375H4XU7X4ZF3Sr70xbRLf/zPvwoHY1Be8eB/lDy2lrsBpQ6sQjig0Q+EII5XXX2x+hKIv7nqIPmR0eOvFvx5ncOGfj1nimniMDQ3tmzrh9cbCb5j7pgx1bnsR/nlz2le7XC39Fal2SL3ZXbIDxNIAOvSE9YddkQFKQzdsbVTb5/NvMdI+XYSos3XRxkaUIpXtFVYvwYnRa92yVuSyX3+bNIh3KdZ+N8Q4jXiBEafA1IUkU8Ik/DBcWCL1vhOkn6985eZZdSw5cjEHBf27qPPPQ8O/uBrYn0083phg97kVI4UDm1tirXmjS1dZjpEhDdAJ3PJzXk3UeEcHVOwwh74GiJ2EU2g5SRjcGgyi+7FnTfNTzHQLArhDtsV/kGW66Q0iaX12jJlytIZzA029huZ1sAMfJhoLwL6Kt0ilphSqW0a9EF/pqLHDB9vtSLqyjoorfyRXA5pvAPTN0J1oTlCn/itAfdkWSNnC/1snjMZjHXEVXqUkBa+/vmpHUJybiayhMVuX6jtIoVbJRRQvirUOprI1ztlqBHVPKlDXqc022Pr8b99nUSL0CmtXu/fUxs4VSt+jOsuWQ3Q4EP4oO3pvNR+dRBvDnO1bxo7reQiou64+tSnr01eCoJ37+tT/D+SKtKvPS931UsI2UF4XY1Nj+Zw9WkWIxLPKARmzH0VzZzTwU55A9Nq5JomuVGfWKZ++a X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 15:43:48.1699 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5f3005c6-351a-4cf4-757c-08dbfa5ff76e 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: DS1PEPF00017095.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8733 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jbrasen@nvidia.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: o6vgLE4KT5aQVXuaNbTWpgN3x7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=A9ZvjVa7; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Add Google Mock Library for FdtLib Signed-off-by: Jeff Brasen --- .../Include/GoogleTest/Library/MockFdtLib.h | 165 ++++++++++++++++++ .../GoogleTest/MockFdtLib/MockFdtLib.cpp | 34 ++++ .../GoogleTest/MockFdtLib/MockFdtLib.inf | 28 +++ 3 files changed, 227 insertions(+) create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockFdtLib.= h create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtL= ib.cpp create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtL= ib.inf diff --git a/MdePkg/Test/Mock/Include/GoogleTest/Library/MockFdtLib.h b/Mde= Pkg/Test/Mock/Include/GoogleTest/Library/MockFdtLib.h new file mode 100644 index 0000000000..c0aeaa25c0 --- /dev/null +++ b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockFdtLib.h @@ -0,0 +1,165 @@ +/** @file + Google Test mocks for FdtLib + + Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023, Intel Corporation. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef MOCK_FDT_LIB_H_ +#define MOCK_FDT_LIB_H_ + +#include +#include +extern "C" { +#include +#include +#include +} + +struct MockFdtLib { + MOCK_INTERFACE_DECLARATION (MockFdtLib); + + MOCK_FUNCTION_DECLARATION ( + UINT16, + Fdt16ToCpu, + (IN UINT16 Value) + ); + MOCK_FUNCTION_DECLARATION ( + UINT16, + CpuToFdt16, + (IN UINT16 Value) + ); + MOCK_FUNCTION_DECLARATION ( + UINT32, + Fdt32ToCpu, + (IN UINT32 Value) + ); + MOCK_FUNCTION_DECLARATION ( + UINT32, + CpuToFdt32, + (IN UINT32 Value) + ); + MOCK_FUNCTION_DECLARATION ( + UINT64, + Fdt64ToCpu, + (IN UINT64 Value) + ); + MOCK_FUNCTION_DECLARATION ( + UINT64, + CpuToFdt64, + (IN UINT64 Value) + ); + MOCK_FUNCTION_DECLARATION ( + INT32, + FdtCheckHeader, + (IN CONST VOID *Fdt) + ); + MOCK_FUNCTION_DECLARATION ( + INT32, + FdtCreateEmptyTree, + (IN VOID *Buffer, + IN UINT32 BufferSize) + ); + MOCK_FUNCTION_DECLARATION ( + INT32, + FdtNextNode, + (IN CONST VOID *Fdt, + IN INT32 Offset, + IN INT32 *Depth) + ); + MOCK_FUNCTION_DECLARATION ( + INT32, + FdtFirstSubnode, + (IN CONST VOID *Fdt, + IN INT32 Offset) + ); + MOCK_FUNCTION_DECLARATION ( + INT32, + FdtNextSubnode, + (IN CONST VOID *Fdt, + IN INT32 Offset) + ); + MOCK_FUNCTION_DECLARATION ( + INT32, + FdtSubnodeOffsetNameLen, + (IN CONST VOID *Fdt, + IN INT32 ParentOffset, + IN CONST CHAR8 *Name, + IN INT32 NameLength) + ); + MOCK_FUNCTION_DECLARATION ( + INT32, + FdtNodeOffsetByPropValue, + (IN CONST VOID *Fdt, + IN INT32 StartOffset, + IN CONST CHAR8 *PropertyName, + IN CONST VOID *PropertyValue, + IN INT32 PropertyLength) + ); + MOCK_FUNCTION_DECLARATION ( + CONST FDT_PROPERTY *, + FdtGetProperty, + (IN CONST VOID *Fdt, + IN INT32 NodeOffset, + IN CONST CHAR8 *Name, + IN INT32 *Length) + ); + MOCK_FUNCTION_DECLARATION ( + INT32, + FdtFirstPropertyOffset, + (IN CONST VOID *Fdt, + IN INT32 NodeOffset) + ); + MOCK_FUNCTION_DECLARATION ( + INT32, + FdtNextPropertyOffset, + (IN CONST VOID *Fdt, + IN INT32 NodeOffset) + ); + MOCK_FUNCTION_DECLARATION ( + CONST FDT_PROPERTY *, + FdtGetPropertyByOffset, + (IN CONST VOID *Fdt, + IN INT32 Offset, + IN INT32 *Length) + ); + MOCK_FUNCTION_DECLARATION ( + CONST CHAR8 *, + FdtGetString, + (IN CONST VOID *Fdt, + IN INT32 StrOffset, + IN INT32 *Length OPTIONAL) + ); + MOCK_FUNCTION_DECLARATION ( + INT32, + FdtAddSubnode, + (IN VOID *Fdt, + IN INT32 ParentOffset, + IN CONST CHAR8 *Name) + ); + MOCK_FUNCTION_DECLARATION ( + INT32, + FdtSetProp, + (IN VOID *Fdt, + IN INT32 NodeOffset, + IN CONST CHAR8 *Name, + IN CONST VOID *Value, + IN UINT32 Length) + ); + MOCK_FUNCTION_DECLARATION ( + CONST CHAR8 *, + FdtGetName, + (IN VOID *Fdt, + IN INT32 NodeOffset, + IN UINT32 *Length) + ); + MOCK_FUNCTION_DECLARATION ( + INT32, + FdtNodeDepth, + (IN CONST VOID *Fdt, + IN INT32 NodeOffset) + ); +}; + +#endif diff --git a/MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtLib.cpp = b/MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtLib.cpp new file mode 100644 index 0000000000..a955780d23 --- /dev/null +++ b/MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtLib.cpp @@ -0,0 +1,34 @@ +/** @file + Google Test mocks for FdtLib + + Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + Copyright (c) 2023, Intel Corporation. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include + +MOCK_INTERFACE_DEFINITION (MockFdtLib); + +MOCK_FUNCTION_DEFINITION (MockFdtLib, Fdt16ToCpu, 1, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, CpuToFdt16, 1, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, Fdt32ToCpu, 1, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, CpuToFdt32, 1, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, Fdt64ToCpu, 1, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, CpuToFdt64, 1, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, FdtCheckHeader, 1, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, FdtCreateEmptyTree, 2, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, FdtNextNode, 3, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, FdtFirstSubnode, 2, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, FdtNextSubnode, 2, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, FdtSubnodeOffsetNameLen, 4, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, FdtNodeOffsetByPropValue, 5, EFIAPI)= ; +MOCK_FUNCTION_DEFINITION (MockFdtLib, FdtGetProperty, 4, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, FdtFirstPropertyOffset, 2, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, FdtNextPropertyOffset, 2, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, FdtGetPropertyByOffset, 3, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, FdtGetString, 3, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, FdtAddSubnode, 3, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, FdtSetProp, 5, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, FdtGetName, 3, EFIAPI); +MOCK_FUNCTION_DEFINITION (MockFdtLib, FdtNodeDepth, 2, EFIAPI); diff --git a/MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtLib.inf = b/MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtLib.inf new file mode 100644 index 0000000000..cc5311eae4 --- /dev/null +++ b/MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtLib.inf @@ -0,0 +1,28 @@ +## @file +# Google Test mocks for FdtLib +# +# Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2023, Intel Corporation. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D MockHobLib + FILE_GUID =3D 0f5471bc-fc2c-4cf4-b9f7-c1396d32831c + MODULE_TYPE =3D HOST_APPLICATION + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D FdtLib + +[Sources] + MockFdtLib.cpp + +[Packages] + MdePkg/MdePkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec + +[LibraryClasses] + GoogleTestLib + +[BuildOptions] + MSFT:*_*_*_CC_FLAGS =3D /EHsc --=20 2.34.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112310): https://edk2.groups.io/g/devel/message/112310 Mute This Topic: https://groups.io/mt/103110868/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-