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 7BECCD802AD for ; Tue, 23 Jan 2024 23:13:32 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=TIKK4VYROyJ/A5UFggV67a7RixhAyLYCz7L22pKTVPY=; 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=1706051611; v=1; b=aPhnHA6ZMZCHSZ+srweJL6sVdJYVGsUDGVwD3VZWExEZuvE0vksO4kRMRWGtP+YcN9opqzAE 6x0wcW2HUnRVmqpSYPQwmsD8lfvZDDuyfQKVnzOzAaLt05oznyDErmjgYpHi8LZ5vuY+jNaRNZx K4Kk2v5R1joPFzpDn+2qELXU= X-Received: by 127.0.0.2 with SMTP id PjD0YY7687511xOTvCypK3Io; Tue, 23 Jan 2024 15:13:31 -0800 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.47]) by mx.groups.io with SMTP id smtpd.web10.9280.1706051610354689912 for ; Tue, 23 Jan 2024 15:13:30 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B+ty0Kwg2LEk6u9J5RGG+GniJCoqaOlXa9932LgKm+377WV/OTZCCOaMikc2jVDjAaMZ5voTXE2yhoyTBuwSjvv8Ayh8NlJTr3k0RoGc0yZUGQ77W8Le9pgU52sGiHC941FlECedtvJ+FSHQIsBxMXGB3g3gqAcanYICKLejMvrKWgUkTdnG/UUvA8kGvHNaoJ2g3SQ60cUJyD7BWFgxaigO5fDHnAYMoZLHTnkae6cvz1bxRPtOxw34aCM4NDAE8npdRBwLyIrg7H5IfyZJ0QV5El1PIc7lSOItR1g7bAcKACYU9wyqeOA2YC6O18qc3OpFDQXockvyWzPwE5JAhg== 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=iLeVq8aSU4algv2rPOCw37SJuxWqDsHP98MaH8qSfYM=; b=BPVKHEM4Tgup2dSNsZOgkXpjqGHJPidUc/6bLZAYRTgpOY80kDHv4mK2ebfyjabGGPpSgt61zv1HsuKBSWSlfWwFwXdubHdH5quh+hIzg7CqmljktfZZ25NMtP3IOVHWV9k5GxecXUYZKbZIpv9T+YayyFaLNnKYgNNg2a5cdfAQAIaWeoerhNE84H88p3+BcI2GUH/fRiEx3oetWBL6rCc6m/mWgWMjr038CF8RwdlWz4Kwz0O9aH8cbBzlrtBZKCliaOnOGN40E2IGPxWs0/hLbz0frVum9myFPVxveSNiOjdVSw1ePIuYIC90ZX2EDCTJfu7E35M3fMbSybLx3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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 BYAPR05CA0032.namprd05.prod.outlook.com (2603:10b6:a03:c0::45) by PH7PR12MB9067.namprd12.prod.outlook.com (2603:10b6:510:1f5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32; Tue, 23 Jan 2024 23:13:26 +0000 X-Received: from CO1PEPF000042AB.namprd03.prod.outlook.com (2603:10b6:a03:c0:cafe::1f) by BYAPR05CA0032.outlook.office365.com (2603:10b6:a03:c0::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.21 via Frontend Transport; Tue, 23 Jan 2024 23:13:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (216.228.118.233) by CO1PEPF000042AB.mail.protection.outlook.com (10.167.243.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.16 via Frontend Transport; Tue, 23 Jan 2024 23:13:26 +0000 X-Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 23 Jan 2024 15:13:18 -0800 X-Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 23 Jan 2024 15:13:18 -0800 X-Received: from cad98f4d2e3d.nvidia.com (10.127.8.12) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Tue, 23 Jan 2024 15:13:18 -0800 From: "Jeff Brasen via groups.io" To: CC: , , , Jeff Brasen Subject: [edk2-devel] [PATCH v2 1/1] MdePkg: Add FdtLib gmock support Date: Tue, 23 Jan 2024 15:13:20 -0800 Message-ID: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000042AB:EE_|PH7PR12MB9067:EE_ X-MS-Office365-Filtering-Correlation-Id: eb885065-e733-450f-94e1-08dc1c68e76c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: w66hMvrb/0pWooeKMo77Qu9s+C2CUPzF97VH8l3Y3+H0TY/K8bFc3qXpjF8IWgM9IMAR9aPxkGmk9JDqs5hy2TwDq45nB1Qbl5bQHVmgNTNkUPH/Br20BwZUnaQEEnnpWhTlQKW/ND3oGY0t3NJ4oi9o6mGGYzCwHlCf6J9bmL7dw+S8wSFO1MgminXK44pB0tjhOQj2hDTZpnuF8BHBvGZcSn5Jl28ZO+naKw/OzisNTEYnfE0S52fmrJi8wM3/5yLsDBijPkYUGksTx0oSEO5h/lYzX1R0OuRp5TW3x+RWyqxk/IOskhOvXNmfpQQ45qAmjnt+gkOZ85Kq1RtIKV4dS/KI2nQm6GGaF4fdQJK60cwzzF7aNpz5bBexRgQ98KoHph9DU3nFY+XAGZb9pPfLk89c2vql6bv+Wgz7zPCQgCOQp/V9JSiecUstz2XlCc0WRZryu7uy83H+UMtC5RNmh8C3RA3/nigzJEGZB5Bbee99v53q345W1X+2xsttzsN2btITwK9/TcssDHsMTNArgdIApYezISw930hd2Cu3IJO+C7gbQ2QUGunZSjynHQZ74oPPpobqIgfGIY1xNvVU0tOG7dlrl5z4sZ/XQZSxdIIb4DvNOd5e6H/e2Sh+bUbanwg0BZLq5h4mdEakpucLjh1udIgDwSWN0FE0waoN6/fc32Svnz8rFjSDl9jQbHyOCQVcq1a5k2ahrOTNKCn8b9NyWJpUpZbdJCSrzw/mwwsZi0GLUPyiXKC8jm9q X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 23:13:26.3815 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eb885065-e733-450f-94e1-08dc1c68e76c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000042AB.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB9067 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: bZ0TLR5mXoNsFMq0i2XBF5P2x7686176AA= 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=aPhnHA6Z; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=none; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Add Google Mock Library for FdtLib Signed-off-by: Jeff Brasen --- .../GoogleTest/MockFdtLib/MockFdtLib.inf | 28 +++ .../Include/GoogleTest/Library/MockFdtLib.h | 164 ++++++++++++++++++ .../GoogleTest/MockFdtLib/MockFdtLib.cpp | 34 ++++ 3 files changed, 226 insertions(+) create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtL= ib.inf create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockFdtLib.= h create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockFdtLib/MockFdtL= ib.cpp 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 000000000000..b227bcbae963 --- /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 MockFdtLib + 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 /bigobj 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 000000000000..73da571910df --- /dev/null +++ b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockFdtLib.h @@ -0,0 +1,164 @@ +/** @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 +} + +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 000000000000..a955780d23fe --- /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); --=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 (#114238): https://edk2.groups.io/g/devel/message/114238 Mute This Topic: https://groups.io/mt/103921590/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-