public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v1] MdePkg: Add UefiBootServicesTableLib gmock support
@ 2023-06-19  8:38 lakx.huang
  2023-06-27 20:17 ` Michael D Kinney
  0 siblings, 1 reply; 2+ messages in thread
From: lakx.huang @ 2023-06-19  8:38 UTC (permalink / raw)
  To: devel; +Cc: lakx.huang, Michael D Kinney, Liming Gao, Zhiguang Liu

From: LakX Huang <lakx.huang@intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4485

Add Google Mock Library for UefiBootServicesTableLib

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>

Signed-off-by: LakX Huang <lakx.huang@intel.com>
---
 MdePkg/Test/MdePkgHostTest.dsc                |  1 +
 .../Library/MockUefiBootServicesTableLib.h    | 71 ++++++++++++++++++
 .../MockUefiBootServicesTableLib.cpp          | 75 +++++++++++++++++++
 .../MockUefiBootServicesTableLib.inf          | 33 ++++++++
 4 files changed, 180 insertions(+)
 create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiBootServicesTableLib.h
 create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockUefiBootServicesTableLib/MockUefiBootServicesTableLib.cpp
 create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockUefiBootServicesTableLib/MockUefiBootServicesTableLib.inf

diff --git a/MdePkg/Test/MdePkgHostTest.dsc b/MdePkg/Test/MdePkgHostTest.dsc
index 529ea69024..872db61b2f 100644
--- a/MdePkg/Test/MdePkgHostTest.dsc
+++ b/MdePkg/Test/MdePkgHostTest.dsc
@@ -38,3 +38,4 @@
   MdePkg/Test/Mock/Library/GoogleTest/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf
   MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.inf
   MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
+  MdePkg/Test/Mock/Library/GoogleTest/MockUefiBootServicesTableLib/MockUefiBootServicesTableLib.inf
\ No newline at end of file
diff --git a/MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiBootServicesTableLib.h b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiBootServicesTableLib.h
new file mode 100644
index 0000000000..e36c6efdb9
--- /dev/null
+++ b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiBootServicesTableLib.h
@@ -0,0 +1,71 @@
+/** @file
+  Google Test mocks for UefiBootServicesTableLib
+
+  Copyright (c) 2022, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MOCK_UEFI_BOOT_SERVICES_TABLE_LIB_H_
+#define MOCK_UEFI_BOOT_SERVICES_TABLE_LIB_H_
+
+#include <Library/GoogleTestLib.h>
+#include <Library/FunctionMockLib.h>
+extern "C" {
+#include <Uefi.h>
+#include <Library/UefiBootServicesTableLib.h>
+}
+
+struct MockUefiBootServicesTableLib {
+  MOCK_INTERFACE_DECLARATION (MockUefiBootServicesTableLib);
+
+  MOCK_FUNCTION_DECLARATION (
+    EFI_STATUS,
+    gBS_LocateProtocol,
+    (IN   EFI_GUID  *Protocol,
+     IN   VOID      *Registration  OPTIONAL,
+     OUT  VOID      **Interface)
+    );
+
+  MOCK_FUNCTION_DECLARATION (
+    EFI_STATUS,
+    gBS_LocateHandleBuffer,
+    (IN   EFI_LOCATE_SEARCH_TYPE    SearchType,
+     IN   EFI_GUID                  *Protocol       OPTIONAL,
+     IN   VOID                      *SearchKey      OPTIONAL,
+     OUT  UINTN                     *NoHandles,
+     OUT  EFI_HANDLE                **Buffer)
+    );
+
+  MOCK_FUNCTION_DECLARATION (
+    EFI_STATUS,
+    gBS_DisconnectController,
+    (IN  EFI_HANDLE   ControllerHandle,
+     IN  EFI_HANDLE   DriverImageHandle  OPTIONAL,
+     IN  EFI_HANDLE   ChildHandle        OPTIONAL)
+    );
+
+  MOCK_FUNCTION_DECLARATION (
+    EFI_STATUS,
+    gBS_FreePool,
+    (IN  VOID  *Buffer)
+    );
+     
+  MOCK_FUNCTION_DECLARATION (
+    EFI_STATUS,
+    gBS_ConnectController,
+    (IN  EFI_HANDLE                 ControllerHandle,
+     IN  EFI_HANDLE                 *DriverImageHandle    OPTIONAL,
+     IN  EFI_DEVICE_PATH_PROTOCOL   *RemainingDevicePath  OPTIONAL,
+     IN  BOOLEAN                    Recursive)
+    );
+
+  MOCK_FUNCTION_DECLARATION (
+    EFI_STATUS,
+    gBS_HandleProtocol,
+    (IN  EFI_HANDLE    Handle,
+     IN  EFI_GUID      *Protocol,
+     OUT VOID          **Interface)
+    );
+};
+
+#endif
diff --git a/MdePkg/Test/Mock/Library/GoogleTest/MockUefiBootServicesTableLib/MockUefiBootServicesTableLib.cpp b/MdePkg/Test/Mock/Library/GoogleTest/MockUefiBootServicesTableLib/MockUefiBootServicesTableLib.cpp
new file mode 100644
index 0000000000..79964d18f9
--- /dev/null
+++ b/MdePkg/Test/Mock/Library/GoogleTest/MockUefiBootServicesTableLib/MockUefiBootServicesTableLib.cpp
@@ -0,0 +1,75 @@
+/** @file
+  Google Test mocks for UefiBootServicesTableLib
+
+  Copyright (c) 2022, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+#include <GoogleTest/Library/MockUefiBootServicesTableLib.h>
+
+MOCK_INTERFACE_DEFINITION(MockUefiBootServicesTableLib);
+
+MOCK_FUNCTION_DEFINITION(MockUefiBootServicesTableLib, gBS_LocateProtocol, 3, EFIAPI);
+MOCK_FUNCTION_DEFINITION(MockUefiBootServicesTableLib, gBS_LocateHandleBuffer, 5, EFIAPI);
+MOCK_FUNCTION_DEFINITION(MockUefiBootServicesTableLib, gBS_DisconnectController, 3, EFIAPI);
+MOCK_FUNCTION_DEFINITION(MockUefiBootServicesTableLib, gBS_FreePool, 1, EFIAPI);
+MOCK_FUNCTION_DEFINITION(MockUefiBootServicesTableLib, gBS_ConnectController, 4, EFIAPI);
+MOCK_FUNCTION_DEFINITION(MockUefiBootServicesTableLib, gBS_HandleProtocol, 3, EFIAPI);
+
+
+static EFI_BOOT_SERVICES localBs = {
+  {
+    (UINT64)NULL,                                         // Signature
+    0,                                                    // Revision
+    0,                                                    // HeaderSize
+    0,                                                    // CRC32
+    0                                                     // Reserved
+  },
+  NULL,                                                   // RaiseTPL
+  NULL,                                                   // RestoreTPL
+  NULL,                                                   // AllocatePages
+  NULL,                                                   // FreePages
+  NULL,                                                   // GetMemoryMap
+  NULL,                                                   // AllocatePool
+  (EFI_FREE_POOL)gBS_FreePool,                            // FreePool
+  NULL,                                                   // CreateEvent
+  NULL,                                                   // SetTimer
+  NULL,                                                   // WaitForEvent
+  NULL,                                                   // SignalEvent
+  NULL,                                                   // CloseEvent
+  NULL,                                                   // CheckEvent
+  NULL,                                                   // InstallProtocolInterface
+  NULL,                                                   // ReinstallProtocolInterface
+  NULL,                                                   // UninstallProtocolInterface
+  (EFI_HANDLE_PROTOCOL)gBS_HandleProtocol,                // HandleProtocol
+  (VOID *)NULL,                                           // Reserved
+  NULL,                                                   // RegisterProtocolNotify
+  NULL,                                                   // LocateHandle
+  NULL,                                                   // LocateDevicePath
+  NULL,                                                   // InstallConfigurationTable
+  NULL,                                                   // LoadImage
+  NULL,                                                   // StartImage
+  NULL,                                                   // Exit
+  NULL,                                                   // UnloadImage
+  NULL,                                                   // ExitBootServices
+  NULL,                                                   // GetNextMonotonicCount
+  NULL,                                                   // Stall
+  NULL,                                                   // SetWatchdogTimer
+  (EFI_CONNECT_CONTROLLER)gBS_ConnectController,          // ConnectController
+  (EFI_DISCONNECT_CONTROLLER)gBS_DisconnectController,    // DisconnectController
+  NULL,                                                   // OpenProtocol
+  NULL,                                                   // CloseProtocol
+  NULL,                                                   // OpenProtocolInformation
+  NULL,                                                   // ProtocolsPerHandle
+  (EFI_LOCATE_HANDLE_BUFFER)gBS_LocateHandleBuffer,       // LocateHandleBuffer
+  (EFI_LOCATE_PROTOCOL)gBS_LocateProtocol,                // LocateProtocol
+  NULL,                                                   // InstallMultipleProtocolInterfaces
+  NULL,                                                   // UninstallMultipleProtocolInterfaces
+  NULL,                                                   // CalculateCrc32
+  NULL,                                                   // CopyMem
+  NULL,                                                   // SetMem
+  NULL                                                    // CreateEventEx
+};
+
+extern "C" {
+  EFI_BOOT_SERVICES* gBS = &localBs;
+}
\ No newline at end of file
diff --git a/MdePkg/Test/Mock/Library/GoogleTest/MockUefiBootServicesTableLib/MockUefiBootServicesTableLib.inf b/MdePkg/Test/Mock/Library/GoogleTest/MockUefiBootServicesTableLib/MockUefiBootServicesTableLib.inf
new file mode 100644
index 0000000000..e8dcca8fb8
--- /dev/null
+++ b/MdePkg/Test/Mock/Library/GoogleTest/MockUefiBootServicesTableLib/MockUefiBootServicesTableLib.inf
@@ -0,0 +1,33 @@
+## @file
+# Google Test mocks for UefiBootServicesTableLib
+#
+# Copyright (c) 2023, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = MockUefiBootServicesTableLib
+  FILE_GUID                      = 9C6D2161-61B2-4094-BC8D-92F70C5E3C06
+  MODULE_TYPE                    = HOST_APPLICATION
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = MockUefiBootServicesTableLib
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+#  VALID_ARCHITECTURES           = IA32 X64
+#
+
+[Sources]
+  MockUefiBootServicesTableLib.cpp
+
+[Packages]
+  MdePkg/MdePkg.dec
+  UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
+
+[LibraryClasses]
+  GoogleTestLib
+
+[BuildOptions]
+  MSFT:*_*_*_CC_FLAGS = /EHsc
-- 
2.26.2.windows.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] MdePkg: Add UefiBootServicesTableLib gmock support
  2023-06-19  8:38 [PATCH v1] MdePkg: Add UefiBootServicesTableLib gmock support lakx.huang
@ 2023-06-27 20:17 ` Michael D Kinney
  0 siblings, 0 replies; 2+ messages in thread
From: Michael D Kinney @ 2023-06-27 20:17 UTC (permalink / raw)
  To: Huang, LakX, devel@edk2.groups.io
  Cc: Gao, Liming, Liu, Zhiguang, Kinney, Michael D

I only see a few services from the UEFI Boot Services Table supported.

I recommend the commit message be updated to indicate it is only partial 
supppot and list the APIs supported.

Mike


> -----Original Message-----
> From: Huang, LakX <lakx.huang@intel.com>
> Sent: Monday, June 19, 2023 1:38 AM
> To: devel@edk2.groups.io
> Cc: Huang, LakX <lakx.huang@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Liu,
> Zhiguang <zhiguang.liu@intel.com>
> Subject: [PATCH v1] MdePkg: Add UefiBootServicesTableLib gmock support
> 
> From: LakX Huang <lakx.huang@intel.com>
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4485
> 
> Add Google Mock Library for UefiBootServicesTableLib
> 
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> 
> Signed-off-by: LakX Huang <lakx.huang@intel.com>
> ---
>  MdePkg/Test/MdePkgHostTest.dsc                |  1 +
>  .../Library/MockUefiBootServicesTableLib.h    | 71 ++++++++++++++++++
>  .../MockUefiBootServicesTableLib.cpp          | 75 +++++++++++++++++++
>  .../MockUefiBootServicesTableLib.inf          | 33 ++++++++
>  4 files changed, 180 insertions(+)
>  create mode 100644
> MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiBootServicesTableLib.h
>  create mode 100644
> MdePkg/Test/Mock/Library/GoogleTest/MockUefiBootServicesTableLib/MockUefiBo
> otServicesTableLib.cpp
>  create mode 100644
> MdePkg/Test/Mock/Library/GoogleTest/MockUefiBootServicesTableLib/MockUefiBo
> otServicesTableLib.inf
> 
> diff --git a/MdePkg/Test/MdePkgHostTest.dsc
> b/MdePkg/Test/MdePkgHostTest.dsc
> index 529ea69024..872db61b2f 100644
> --- a/MdePkg/Test/MdePkgHostTest.dsc
> +++ b/MdePkg/Test/MdePkgHostTest.dsc
> @@ -38,3 +38,4 @@
> 
> MdePkg/Test/Mock/Library/GoogleTest/MockUefiRuntimeServicesTableLib/MockUef
> iRuntimeServicesTableLib.inf
> 
> 
> MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.i
> nf
> 
>    MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
> 
> +
> MdePkg/Test/Mock/Library/GoogleTest/MockUefiBootServicesTableLib/MockUefiBo
> otServicesTableLib.inf
> \ No newline at end of file
> diff --git
> a/MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiBootServicesTableLib.
> h
> b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiBootServicesTableLib.
> h
> new file mode 100644
> index 0000000000..e36c6efdb9
> --- /dev/null
> +++
> b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiBootServicesTableLib.
> h
> @@ -0,0 +1,71 @@
> +/** @file
> 
> +  Google Test mocks for UefiBootServicesTableLib
> 
> +
> 
> +  Copyright (c) 2022, Intel Corporation. All rights reserved.
> 
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +**/
> 
> +
> 
> +#ifndef MOCK_UEFI_BOOT_SERVICES_TABLE_LIB_H_
> 
> +#define MOCK_UEFI_BOOT_SERVICES_TABLE_LIB_H_
> 
> +
> 
> +#include <Library/GoogleTestLib.h>
> 
> +#include <Library/FunctionMockLib.h>
> 
> +extern "C" {
> 
> +#include <Uefi.h>
> 
> +#include <Library/UefiBootServicesTableLib.h>
> 
> +}
> 
> +
> 
> +struct MockUefiBootServicesTableLib {
> 
> +  MOCK_INTERFACE_DECLARATION (MockUefiBootServicesTableLib);
> 
> +
> 
> +  MOCK_FUNCTION_DECLARATION (
> 
> +    EFI_STATUS,
> 
> +    gBS_LocateProtocol,
> 
> +    (IN   EFI_GUID  *Protocol,
> 
> +     IN   VOID      *Registration  OPTIONAL,
> 
> +     OUT  VOID      **Interface)
> 
> +    );
> 
> +
> 
> +  MOCK_FUNCTION_DECLARATION (
> 
> +    EFI_STATUS,
> 
> +    gBS_LocateHandleBuffer,
> 
> +    (IN   EFI_LOCATE_SEARCH_TYPE    SearchType,
> 
> +     IN   EFI_GUID                  *Protocol       OPTIONAL,
> 
> +     IN   VOID                      *SearchKey      OPTIONAL,
> 
> +     OUT  UINTN                     *NoHandles,
> 
> +     OUT  EFI_HANDLE                **Buffer)
> 
> +    );
> 
> +
> 
> +  MOCK_FUNCTION_DECLARATION (
> 
> +    EFI_STATUS,
> 
> +    gBS_DisconnectController,
> 
> +    (IN  EFI_HANDLE   ControllerHandle,
> 
> +     IN  EFI_HANDLE   DriverImageHandle  OPTIONAL,
> 
> +     IN  EFI_HANDLE   ChildHandle        OPTIONAL)
> 
> +    );
> 
> +
> 
> +  MOCK_FUNCTION_DECLARATION (
> 
> +    EFI_STATUS,
> 
> +    gBS_FreePool,
> 
> +    (IN  VOID  *Buffer)
> 
> +    );
> 
> +
> 
> +  MOCK_FUNCTION_DECLARATION (
> 
> +    EFI_STATUS,
> 
> +    gBS_ConnectController,
> 
> +    (IN  EFI_HANDLE                 ControllerHandle,
> 
> +     IN  EFI_HANDLE                 *DriverImageHandle    OPTIONAL,
> 
> +     IN  EFI_DEVICE_PATH_PROTOCOL   *RemainingDevicePath  OPTIONAL,
> 
> +     IN  BOOLEAN                    Recursive)
> 
> +    );
> 
> +
> 
> +  MOCK_FUNCTION_DECLARATION (
> 
> +    EFI_STATUS,
> 
> +    gBS_HandleProtocol,
> 
> +    (IN  EFI_HANDLE    Handle,
> 
> +     IN  EFI_GUID      *Protocol,
> 
> +     OUT VOID          **Interface)
> 
> +    );
> 
> +};
> 
> +
> 
> +#endif
> 
> diff --git
> a/MdePkg/Test/Mock/Library/GoogleTest/MockUefiBootServicesTableLib/MockUefi
> BootServicesTableLib.cpp
> b/MdePkg/Test/Mock/Library/GoogleTest/MockUefiBootServicesTableLib/MockUefi
> BootServicesTableLib.cpp
> new file mode 100644
> index 0000000000..79964d18f9
> --- /dev/null
> +++
> b/MdePkg/Test/Mock/Library/GoogleTest/MockUefiBootServicesTableLib/MockUefi
> BootServicesTableLib.cpp
> @@ -0,0 +1,75 @@
> +/** @file
> 
> +  Google Test mocks for UefiBootServicesTableLib
> 
> +
> 
> +  Copyright (c) 2022, Intel Corporation. All rights reserved.
> 
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +**/
> 
> +#include <GoogleTest/Library/MockUefiBootServicesTableLib.h>
> 
> +
> 
> +MOCK_INTERFACE_DEFINITION(MockUefiBootServicesTableLib);
> 
> +
> 
> +MOCK_FUNCTION_DEFINITION(MockUefiBootServicesTableLib, gBS_LocateProtocol,
> 3, EFIAPI);
> 
> +MOCK_FUNCTION_DEFINITION(MockUefiBootServicesTableLib,
> gBS_LocateHandleBuffer, 5, EFIAPI);
> 
> +MOCK_FUNCTION_DEFINITION(MockUefiBootServicesTableLib,
> gBS_DisconnectController, 3, EFIAPI);
> 
> +MOCK_FUNCTION_DEFINITION(MockUefiBootServicesTableLib, gBS_FreePool, 1,
> EFIAPI);
> 
> +MOCK_FUNCTION_DEFINITION(MockUefiBootServicesTableLib,
> gBS_ConnectController, 4, EFIAPI);
> 
> +MOCK_FUNCTION_DEFINITION(MockUefiBootServicesTableLib, gBS_HandleProtocol,
> 3, EFIAPI);
> 
> +
> 
> +
> 
> +static EFI_BOOT_SERVICES localBs = {
> 
> +  {
> 
> +    (UINT64)NULL,                                         // Signature
> 
> +    0,                                                    // Revision
> 
> +    0,                                                    // HeaderSize
> 
> +    0,                                                    // CRC32
> 
> +    0                                                     // Reserved
> 
> +  },
> 
> +  NULL,                                                   // RaiseTPL
> 
> +  NULL,                                                   // RestoreTPL
> 
> +  NULL,                                                   // AllocatePages
> 
> +  NULL,                                                   // FreePages
> 
> +  NULL,                                                   // GetMemoryMap
> 
> +  NULL,                                                   // AllocatePool
> 
> +  (EFI_FREE_POOL)gBS_FreePool,                            // FreePool
> 
> +  NULL,                                                   // CreateEvent
> 
> +  NULL,                                                   // SetTimer
> 
> +  NULL,                                                   // WaitForEvent
> 
> +  NULL,                                                   // SignalEvent
> 
> +  NULL,                                                   // CloseEvent
> 
> +  NULL,                                                   // CheckEvent
> 
> +  NULL,                                                   //
> InstallProtocolInterface
> 
> +  NULL,                                                   //
> ReinstallProtocolInterface
> 
> +  NULL,                                                   //
> UninstallProtocolInterface
> 
> +  (EFI_HANDLE_PROTOCOL)gBS_HandleProtocol,                //
> HandleProtocol
> 
> +  (VOID *)NULL,                                           // Reserved
> 
> +  NULL,                                                   //
> RegisterProtocolNotify
> 
> +  NULL,                                                   // LocateHandle
> 
> +  NULL,                                                   //
> LocateDevicePath
> 
> +  NULL,                                                   //
> InstallConfigurationTable
> 
> +  NULL,                                                   // LoadImage
> 
> +  NULL,                                                   // StartImage
> 
> +  NULL,                                                   // Exit
> 
> +  NULL,                                                   // UnloadImage
> 
> +  NULL,                                                   //
> ExitBootServices
> 
> +  NULL,                                                   //
> GetNextMonotonicCount
> 
> +  NULL,                                                   // Stall
> 
> +  NULL,                                                   //
> SetWatchdogTimer
> 
> +  (EFI_CONNECT_CONTROLLER)gBS_ConnectController,          //
> ConnectController
> 
> +  (EFI_DISCONNECT_CONTROLLER)gBS_DisconnectController,    //
> DisconnectController
> 
> +  NULL,                                                   // OpenProtocol
> 
> +  NULL,                                                   // CloseProtocol
> 
> +  NULL,                                                   //
> OpenProtocolInformation
> 
> +  NULL,                                                   //
> ProtocolsPerHandle
> 
> +  (EFI_LOCATE_HANDLE_BUFFER)gBS_LocateHandleBuffer,       //
> LocateHandleBuffer
> 
> +  (EFI_LOCATE_PROTOCOL)gBS_LocateProtocol,                //
> LocateProtocol
> 
> +  NULL,                                                   //
> InstallMultipleProtocolInterfaces
> 
> +  NULL,                                                   //
> UninstallMultipleProtocolInterfaces
> 
> +  NULL,                                                   //
> CalculateCrc32
> 
> +  NULL,                                                   // CopyMem
> 
> +  NULL,                                                   // SetMem
> 
> +  NULL                                                    // CreateEventEx
> 
> +};
> 
> +
> 
> +extern "C" {
> 
> +  EFI_BOOT_SERVICES* gBS = &localBs;
> 
> +}
> \ No newline at end of file
> diff --git
> a/MdePkg/Test/Mock/Library/GoogleTest/MockUefiBootServicesTableLib/MockUefi
> BootServicesTableLib.inf
> b/MdePkg/Test/Mock/Library/GoogleTest/MockUefiBootServicesTableLib/MockUefi
> BootServicesTableLib.inf
> new file mode 100644
> index 0000000000..e8dcca8fb8
> --- /dev/null
> +++
> b/MdePkg/Test/Mock/Library/GoogleTest/MockUefiBootServicesTableLib/MockUefi
> BootServicesTableLib.inf
> @@ -0,0 +1,33 @@
> +## @file
> 
> +# Google Test mocks for UefiBootServicesTableLib
> 
> +#
> 
> +# Copyright (c) 2023, Intel Corporation. All rights reserved.
> 
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +##
> 
> +
> 
> +[Defines]
> 
> +  INF_VERSION                    = 0x00010005
> 
> +  BASE_NAME                      = MockUefiBootServicesTableLib
> 
> +  FILE_GUID                      = 9C6D2161-61B2-4094-BC8D-92F70C5E3C06
> 
> +  MODULE_TYPE                    = HOST_APPLICATION
> 
> +  VERSION_STRING                 = 1.0
> 
> +  LIBRARY_CLASS                  = MockUefiBootServicesTableLib
> 
> +
> 
> +#
> 
> +# The following information is for reference only and not required by the
> build tools.
> 
> +#
> 
> +#  VALID_ARCHITECTURES           = IA32 X64
> 
> +#
> 
> +
> 
> +[Sources]
> 
> +  MockUefiBootServicesTableLib.cpp
> 
> +
> 
> +[Packages]
> 
> +  MdePkg/MdePkg.dec
> 
> +  UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
> 
> +
> 
> +[LibraryClasses]
> 
> +  GoogleTestLib
> 
> +
> 
> +[BuildOptions]
> 
> +  MSFT:*_*_*_CC_FLAGS = /EHsc
> 
> --
> 2.26.2.windows.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-27 20:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-19  8:38 [PATCH v1] MdePkg: Add UefiBootServicesTableLib gmock support lakx.huang
2023-06-27 20:17 ` Michael D Kinney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox