UnitTestFrameworkPkg: Add UnitTestUefiBootServicesTableLib

This library supports a Boot Services table library implementation
that allows code dependent upon UefiBootServicesTableLib to operate
in an isolated execution environment such as within
the context of a host-based unit test framework.

The unit test should initialize the Boot Services database with any
required elements (e.g. protocols, events, handles, etc.) prior to
the services being invoked by code under test.

It is strongly recommended to clean any global databases (e.g.
protocol, event, handles, etc.) after every unit test so the tests
execute in a predictable manner from a clean state.

This library is being moved here from PrmPkg so it can be made more
generally available to other packages and improved upon for others
use.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
Michael Kubacki
2022-11-03 20:07:49 -04:00
committed by mergify[bot]
parent 82e70d9ac0
commit 6e8b0b6913
13 changed files with 3720 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
## @file
# UEFI Boot Services Table Library for unit tests implementation.
#
# Copyright (c) Microsoft Corporation
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = UnitTestUefiBootServicesTableLib
MODULE_UNI_FILE = UefiBootServicesTableLibTest.uni
FILE_GUID = AA3A0651-89EB-4951-9D68-50F27360EBC2
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = UefiBootServicesTableLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE
CONSTRUCTOR = UnitTestUefiBootServicesTableLibConstructor
#
# VALID_ARCHITECTURES = IA32 X64 EBC
#
[Sources]
UnitTestUefiBootServicesTableLib.h
UnitTestUefiBootServicesTableLib.c
UnitTestUefiBootServicesTableLibEventTimer.c
UnitTestUefiBootServicesTableLibImage.c
UnitTestUefiBootServicesTableLibMemory.c
UnitTestUefiBootServicesTableLibProtocol.h
UnitTestUefiBootServicesTableLibProtocol.c
UnitTestUefiBootServicesTableLibMisc.c
UnitTestUefiBootServicesTableLibTpl.c
[Packages]
MdePkg/MdePkg.dec
[LibraryClasses]
BaseLib
BaseMemoryLib
DebugLib
MemoryAllocationLib
UnitTestLib
[UserExtensions.TianoCore."ExtraFiles"]
TimerExtra.uni