summaryrefslogtreecommitdiffstats
path: root/UnitTestFrameworkPkg/Include
diff options
context:
space:
mode:
authorMichael D Kinney <michael.d.kinney@intel.com>2022-11-30 13:14:09 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-12-01 21:01:21 +0000
commita1d57239140f09a8b2cc386f9421f6f4e634435f (patch)
tree240e573e063d89c7255ab4b53e21bc1a2a05cbd2 /UnitTestFrameworkPkg/Include
parenta8a78ef194f4a6aaf4c178d1c545a372c94e88bb (diff)
downloadedk2-a1d57239140f09a8b2cc386f9421f6f4e634435f.tar.gz
edk2-a1d57239140f09a8b2cc386f9421f6f4e634435f.tar.bz2
edk2-a1d57239140f09a8b2cc386f9421f6f4e634435f.zip
UnitTestFrameworkPkg: Library classes private to public
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4178 * Change GoogleTestLib class from private to public. * Change UnitTestPersistenceLib class from private to public. Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
Diffstat (limited to 'UnitTestFrameworkPkg/Include')
-rw-r--r--UnitTestFrameworkPkg/Include/Library/UnitTestPersistenceLib.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/UnitTestFrameworkPkg/Include/Library/UnitTestPersistenceLib.h b/UnitTestFrameworkPkg/Include/Library/UnitTestPersistenceLib.h
new file mode 100644
index 0000000000..be29e079ec
--- /dev/null
+++ b/UnitTestFrameworkPkg/Include/Library/UnitTestPersistenceLib.h
@@ -0,0 +1,76 @@
+/** @file
+ This header file describes a library that contains functions to save and
+ restore unit test internal state, in case the test needs to pause and resume
+ (eg. a reboot-based test).
+
+ Copyright (c) Microsoft Corporation.<BR>
+ Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _UNIT_TEST_PERSISTENCE_LIB_H_
+#define _UNIT_TEST_PERSISTENCE_LIB_H_
+
+#include <UnitTestFrameworkTypes.h>
+
+#define UNIT_TEST_PERSISTENCE_LIB_VERSION 1
+
+/**
+ Determines whether a persistence cache already exists for
+ the given framework.
+
+ @param[in] FrameworkHandle A pointer to the framework that is being persisted.
+
+ @retval TRUE
+ @retval FALSE Cache doesn't exist or an error occurred.
+
+**/
+BOOLEAN
+EFIAPI
+DoesCacheExist (
+ IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle
+ );
+
+/**
+ 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.
+
+ @param[in] FrameworkHandle A pointer to the framework that is being persisted.
+ @param[in] SaveData A pointer to the buffer containing the serialized
+ framework internal state.
+
+ @retval EFI_SUCCESS Data is persisted and the test can be safely quit.
+ @retval Others Data is not persisted and test cannot be resumed upon exit.
+
+**/
+EFI_STATUS
+EFIAPI
+SaveUnitTestCache (
+ IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle,
+ IN UNIT_TEST_SAVE_HEADER *SaveData
+ );
+
+/**
+ Will retrieve any cached state associated with the given framework.
+ Will allocate a buffer to hold the loaded data.
+
+ @param[in] FrameworkHandle A pointer to the framework that is being persisted.
+ @param[in] SaveData A pointer pointer that will be updated with the address
+ of the loaded data buffer.
+
+ @retval EFI_SUCCESS Data has been loaded successfully and SaveData is updated
+ with a pointer to the buffer.
+ @retval Others An error has occurred and no data has been loaded. SaveData
+ is set to NULL.
+
+**/
+EFI_STATUS
+EFIAPI
+LoadUnitTestCache (
+ IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle,
+ OUT UNIT_TEST_SAVE_HEADER **SaveData
+ );
+
+#endif