UnitTestFrameworkPkg: Modify APIs in UnitTestPersistenceLib

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4183

UnitTestPersistenceLib now consumes private struct definition.
Modify APIs in UnitTestPersistenceLib to make it easy to become
a public library.

Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
This commit is contained in:
Liu, Zhiguang
2022-12-06 13:25:43 +08:00
committed by mergify[bot]
parent e986f4ce96
commit 1cd902f1f4
4 changed files with 36 additions and 18 deletions

View File

@ -2,6 +2,7 @@
Implement UnitTestLib
Copyright (c) Microsoft Corporation.
Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -210,6 +211,7 @@ InitUnitTestFramework (
EFI_STATUS Status;
UNIT_TEST_FRAMEWORK_HANDLE NewFrameworkHandle;
UNIT_TEST_FRAMEWORK *NewFramework;
UINTN SaveStateSize;
Status = EFI_SUCCESS;
NewFramework = NULL;
@ -267,7 +269,7 @@ InitUnitTestFramework (
// If there is a persisted context, load it now.
//
if (DoesCacheExist (NewFrameworkHandle)) {
Status = LoadUnitTestCache (NewFrameworkHandle, (UNIT_TEST_SAVE_HEADER **)(&NewFramework->SavedState));
Status = LoadUnitTestCache (NewFrameworkHandle, (VOID **)(&NewFramework->SavedState), &SaveStateSize);
if (EFI_ERROR (Status)) {
//
// Don't actually report it as an error, but emit a warning.
@ -852,7 +854,7 @@ SaveFrameworkState (
//
// All that should be left to do is save it using the associated persistence lib.
//
Status = SaveUnitTestCache (FrameworkHandle, Header);
Status = SaveUnitTestCache (FrameworkHandle, Header, Header->SaveStateSize);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "%a - Could not save state! %r\n", __FUNCTION__, Status));
Status = EFI_DEVICE_ERROR;