2 This header file describes a library that contains functions to save and
3 restore unit test internal state, in case the test needs to pause and resume
4 (eg. a reboot-based test).
6 Copyright (c) Microsoft Corporation.<BR>
7 Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
12 #ifndef _UNIT_TEST_PERSISTENCE_LIB_H_
13 #define _UNIT_TEST_PERSISTENCE_LIB_H_
15 #include <Library/UnitTestLib.h>
17 #define UNIT_TEST_PERSISTENCE_LIB_VERSION 1
20 Determines whether a persistence cache already exists for
23 @param[in] FrameworkHandle A pointer to the framework that is being persisted.
26 @retval FALSE Cache doesn't exist or an error occurred.
32 IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle
36 Will save the data associated with an internal Unit Test Framework
37 state in a manner that can persist a Unit Test Application quit or
40 @param[in] FrameworkHandle A pointer to the framework that is being persisted.
41 @param[in] SaveData A pointer to the buffer containing the serialized
42 framework internal state.
43 @param[in] SaveStateSize The size of SaveData in bytes.
45 @retval EFI_SUCCESS Data is persisted and the test can be safely quit.
46 @retval Others Data is not persisted and test cannot be resumed upon exit.
52 IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle
,
54 IN UINTN SaveStateSize
58 Will retrieve any cached state associated with the given framework.
59 Will allocate a buffer to hold the loaded data.
61 @param[in] FrameworkHandle A pointer to the framework that is being persisted.
62 @param[out] SaveData A pointer pointer that will be updated with the address
63 of the loaded data buffer.
64 @param[out] SaveStateSize Return the size of SaveData in bytes.
66 @retval EFI_SUCCESS Data has been loaded successfully and SaveData is updated
67 with a pointer to the buffer.
68 @retval Others An error has occurred and no data has been loaded. SaveData
75 IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle
,
77 OUT UINTN
*SaveStateSize