TianoCore EDK2 master
|
#include <PiDxe.h>
#include <Library/UnitTestPersistenceLib.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DevicePathLib.h>
#include <Library/ShellLib.h>
#include <Library/UefiLib.h>
#include <Protocol/LoadedImage.h>
#include <UnitTestFrameworkTypes.h>
Go to the source code of this file.
Macros | |
#define | CACHE_FILE_SUFFIX L"_Cache.dat" |
Functions | |
STATIC CHAR16 * | GetCacheFileName (IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle) |
BOOLEAN EFIAPI | DoesCacheExist (IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle) |
EFI_STATUS EFIAPI | SaveUnitTestCache (IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle, IN VOID *SaveData, IN UINTN SaveStateSize) |
EFI_STATUS EFIAPI | LoadUnitTestCache (IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle, OUT VOID **SaveData, OUT UINTN *SaveStateSize) |
EFI_STATUS EFIAPI | UnitTestPersistenceLibConstructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) |
Variables | |
CHAR16 * | mCachePath = NULL |
This is an instance of the Unit Test Persistence Lib that will utilize the filesystem that a test application is running from to save a serialized version of the internal test state in case the test needs to quit and restore.
Copyright (c) Microsoft Corporation.
Copyright (c) 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file UnitTestPersistenceLibSimpleFileSystem.c.
#define CACHE_FILE_SUFFIX L"_Cache.dat" |
Definition at line 23 of file UnitTestPersistenceLibSimpleFileSystem.c.
BOOLEAN EFIAPI DoesCacheExist | ( | IN UNIT_TEST_FRAMEWORK_HANDLE | FrameworkHandle | ) |
Determines whether a persistence cache already exists for the given framework.
[in] | FrameworkHandle | A pointer to the framework that is being persisted. |
TRUE | |
FALSE | Cache doesn't exist or an error occurred. |
Definition at line 193 of file UnitTestPersistenceLibSimpleFileSystem.c.
Generate the file name and path to the cache file.
[in] | FrameworkHandle | A pointer to the framework that is being persisted. |
!NULL | A pointer to the EFI_FILE protocol instance for the filesystem. |
NULL | Filesystem could not be found or an error occurred. |
Definition at line 38 of file UnitTestPersistenceLibSimpleFileSystem.c.
EFI_STATUS EFIAPI LoadUnitTestCache | ( | IN UNIT_TEST_FRAMEWORK_HANDLE | FrameworkHandle, |
OUT VOID ** | SaveData, | ||
OUT UINTN * | SaveStateSize | ||
) |
Will retrieve any cached state associated with the given framework. Will allocate a buffer to hold the loaded data.
[in] | FrameworkHandle | A pointer to the framework that is being persisted. |
[out] | SaveData | A pointer pointer that will be updated with the address of the loaded data buffer. |
[out] | SaveStateSize | Return the size of SaveData in bytes. |
EFI_SUCCESS | Data has been loaded successfully and SaveData is updated with a pointer to the buffer. |
Others | An error has occurred and no data has been loaded. SaveData is set to NULL. |
Definition at line 356 of file UnitTestPersistenceLibSimpleFileSystem.c.
EFI_STATUS EFIAPI SaveUnitTestCache | ( | IN UNIT_TEST_FRAMEWORK_HANDLE | FrameworkHandle, |
IN VOID * | SaveData, | ||
IN UINTN | SaveStateSize | ||
) |
Will save the data associated with an internal Unit Test Framework state in a manner that can persist a Unit Test Application quit or even a system reboot.
[in] | FrameworkHandle | A pointer to the framework that is being persisted. |
[in] | SaveData | A pointer to the buffer containing the serialized framework internal state. |
[in] | SaveStateSize | The size of SaveData in bytes. |
EFI_SUCCESS | Data is persisted and the test can be safely quit. |
Others | Data is not persisted and test cannot be resumed upon exit. |
Definition at line 248 of file UnitTestPersistenceLibSimpleFileSystem.c.
EFI_STATUS EFIAPI UnitTestPersistenceLibConstructor | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
Shell based UnitTestPersistenceLib library constructor.
[in] | ImageHandle | The firmware allocated handle for the EFI image. |
[in] | SystemTable | A pointer to the EFI System Table. |
EFI_SUCCESS | The constructor finished successfully. |
Others | Error codes returned from gBS->HandleProtocol. |
Definition at line 469 of file UnitTestPersistenceLibSimpleFileSystem.c.
CHAR16* mCachePath = NULL |
Definition at line 25 of file UnitTestPersistenceLibSimpleFileSystem.c.