From a1d57239140f09a8b2cc386f9421f6f4e634435f Mon Sep 17 00:00:00 2001 From: Michael D Kinney Date: Wed, 30 Nov 2022 13:14:09 -0800 Subject: 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 Cc: Sean Brogan Cc: Ray Ni Cc: Zhiguang Liu Signed-off-by: Michael D Kinney Reviewed-by: Michael Kubacki Reviewed-by: Ray Ni --- .../Include/Library/UnitTestPersistenceLib.h | 76 ++++++++++++++++++++++ .../Library/UnitTestPersistenceLib.h | 76 ---------------------- UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec | 13 ++-- 3 files changed, 83 insertions(+), 82 deletions(-) create mode 100644 UnitTestFrameworkPkg/Include/Library/UnitTestPersistenceLib.h delete mode 100644 UnitTestFrameworkPkg/PrivateInclude/Library/UnitTestPersistenceLib.h 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.
+ Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _UNIT_TEST_PERSISTENCE_LIB_H_ +#define _UNIT_TEST_PERSISTENCE_LIB_H_ + +#include + +#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 diff --git a/UnitTestFrameworkPkg/PrivateInclude/Library/UnitTestPersistenceLib.h b/UnitTestFrameworkPkg/PrivateInclude/Library/UnitTestPersistenceLib.h deleted file mode 100644 index be29e079ec..0000000000 --- a/UnitTestFrameworkPkg/PrivateInclude/Library/UnitTestPersistenceLib.h +++ /dev/null @@ -1,76 +0,0 @@ -/** @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.
- Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef _UNIT_TEST_PERSISTENCE_LIB_H_ -#define _UNIT_TEST_PERSISTENCE_LIB_H_ - -#include - -#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 diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec index ed12f32009..14e387d63a 100644 --- a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec +++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec @@ -26,11 +26,16 @@ Library/CmockaLib/cmocka/include/cmockery Library/GoogleTestLib/googletest/googletest -[LibraryClasses.Common.Private] +[LibraryClasses] ## @libraryclass Allows save and restore unit test internal state # - UnitTestPersistenceLib|PrivateInclude/Library/UnitTestPersistenceLib.h + UnitTestPersistenceLib|Include/Library/UnitTestPersistenceLib.h + + ## @libraryclass GoogleTest infrastructure + # + GoogleTestLib|Include/Library/GoogleTestLib.h +[LibraryClasses.Common.Private] ## @libraryclass Provides a unit test result report # UnitTestResultReportLib|PrivateInclude/Library/UnitTestResultReportLib.h @@ -39,10 +44,6 @@ # UnitTestBootLib|PrivateInclude/Library/UnitTestBootLib.h - ## @libraryclass GoogleTest infrastructure - # - GoogleTestLib|Include/Library/GoogleTestLib.h - [Guids] gUnitTestFrameworkPkgTokenSpaceGuid = { 0x833d3aba, 0x39b4, 0x43a2, { 0xb9, 0x30, 0x7a, 0x34, 0x53, 0x39, 0x31, 0xb3 } } -- cgit v1.2.3