TianoCore EDK2 master
Loading...
Searching...
No Matches
UnitTestUefiBootServicesTableLib.c File Reference

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI UnitTestUefiBootServicesTableLibConstructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

EFI_HANDLE gImageHandle = NULL
 
EFI_SYSTEM_TABLEgST = NULL
 
STATIC EFI_BOOT_SERVICES mBootServices
 
EFI_BOOT_SERVICESgBS = &mBootServices
 

Detailed Description

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.

Copyright (c) Microsoft Corporation SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file UnitTestUefiBootServicesTableLib.c.

Function Documentation

◆ UnitTestUefiBootServicesTableLibConstructor()

EFI_STATUS EFIAPI UnitTestUefiBootServicesTableLibConstructor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

The constructor function caches the pointer of Boot Services Table.

The constructor function caches the pointer of Boot Services Table through System Table. It will ASSERT() if the pointer of System Table is NULL. It will ASSERT() if the pointer of Boot Services Table is NULL. It will always return EFI_SUCCESS.

Parameters
ImageHandleThe firmware allocated handle for the EFI image.
SystemTableA pointer to the EFI System Table.
Return values
EFI_SUCCESSThe constructor always returns EFI_SUCCESS.

Definition at line 94 of file UnitTestUefiBootServicesTableLib.c.

Variable Documentation

◆ gBS

EFI_BOOT_SERVICES* gBS = &mBootServices

Cache pointer to the EFI Boot Services Table

Definition at line 76 of file UnitTestUefiBootServicesTableLib.c.

◆ gImageHandle

EFI_HANDLE gImageHandle = NULL

Cache the Image Handle

Definition at line 19 of file UnitTestUefiBootServicesTableLib.c.

◆ gST

Cache pointer to the EFI System Table

Definition at line 20 of file UnitTestUefiBootServicesTableLib.c.

◆ mBootServices

STATIC EFI_BOOT_SERVICES mBootServices

Definition at line 22 of file UnitTestUefiBootServicesTableLib.c.