]> git.proxmox.com Git - mirror_edk2.git/blob - UnitTestFrameworkPkg/PrivateInclude/Library/UnitTestPersistenceLib.h
UnitTestFrameworkPkg: Apply uncrustify changes
[mirror_edk2.git] / UnitTestFrameworkPkg / PrivateInclude / Library / UnitTestPersistenceLib.h
1 /** @file
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).
5
6 Copyright (c) Microsoft Corporation.<BR>
7 Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10 **/
11
12 #ifndef _UNIT_TEST_PERSISTENCE_LIB_H_
13 #define _UNIT_TEST_PERSISTENCE_LIB_H_
14
15 #include <UnitTestFrameworkTypes.h>
16
17 #define UNIT_TEST_PERSISTENCE_LIB_VERSION 1
18
19 /**
20 Determines whether a persistence cache already exists for
21 the given framework.
22
23 @param[in] FrameworkHandle A pointer to the framework that is being persisted.
24
25 @retval TRUE
26 @retval FALSE Cache doesn't exist or an error occurred.
27
28 **/
29 BOOLEAN
30 EFIAPI
31 DoesCacheExist (
32 IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle
33 );
34
35 /**
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
38 even a system reboot.
39
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
44 @retval EFI_SUCCESS Data is persisted and the test can be safely quit.
45 @retval Others Data is not persisted and test cannot be resumed upon exit.
46
47 **/
48 EFI_STATUS
49 EFIAPI
50 SaveUnitTestCache (
51 IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle,
52 IN UNIT_TEST_SAVE_HEADER *SaveData
53 );
54
55 /**
56 Will retrieve any cached state associated with the given framework.
57 Will allocate a buffer to hold the loaded data.
58
59 @param[in] FrameworkHandle A pointer to the framework that is being persisted.
60 @param[in] SaveData A pointer pointer that will be updated with the address
61 of the loaded data buffer.
62
63 @retval EFI_SUCCESS Data has been loaded successfully and SaveData is updated
64 with a pointer to the buffer.
65 @retval Others An error has occurred and no data has been loaded. SaveData
66 is set to NULL.
67
68 **/
69 EFI_STATUS
70 EFIAPI
71 LoadUnitTestCache (
72 IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle,
73 OUT UNIT_TEST_SAVE_HEADER **SaveData
74 );
75
76 #endif