From: Bret Barkelew <brbar...@microsoft.com>

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

Remove the FrameworkHandle parameter from the SaveFrameworkState interface
in UnitTestLib

Cc: Michael D Kinney <michael.d.kin...@intel.com>
Cc: Liming Gao <liming....@intel.com>
Cc: Sean Brogan <sean.bro...@microsoft.com>
Cc: Bret Barkelew <bret.barke...@microsoft.com>
Signed-off-by: Guomin Jiang <guomin.ji...@intel.com>
---
 MdePkg/Include/Library/UnitTestLib.h                |  4 ----
 UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c |  2 +-
 .../Library/UnitTestLib/UnitTestLib.c               | 13 +++++--------
 3 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/MdePkg/Include/Library/UnitTestLib.h 
b/MdePkg/Include/Library/UnitTestLib.h
index c06c36bea5..38e4652959 100644
--- a/MdePkg/Include/Library/UnitTestLib.h
+++ b/MdePkg/Include/Library/UnitTestLib.h
@@ -315,9 +315,6 @@ FreeUnitTestFramework (
 
   Generally called from within a test case prior to quitting or rebooting.
 
-  @param[in]  FrameworkHandle    A handle to the current running framework that
-                                 dispatched the test.  Necessary for recording
-                                 certain test events with the framework.
   @param[in]  ContextToSave      A buffer of test case-specific data to be 
saved
                                  along with framework state.  Will be passed as
                                  "Context" to the test case upon resume.  This
@@ -338,7 +335,6 @@ FreeUnitTestFramework (
 EFI_STATUS
 EFIAPI
 SaveFrameworkState (
-  IN UNIT_TEST_FRAMEWORK_HANDLE  FrameworkHandle,
   IN UNIT_TEST_CONTEXT           ContextToSave     OPTIONAL,
   IN UINTN                       ContextToSaveSize
   );
diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c 
b/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
index b053e04959..793335fd0f 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
@@ -162,7 +162,7 @@ RunAllTestSuites (
   //
   // Save current state so if test is started again it doesn't have to run.  
It will just report
   //
-  SaveFrameworkState (FrameworkHandle, NULL, 0);
+  SaveFrameworkState (NULL, 0);
   OutputUnitTestFrameworkReport (FrameworkHandle);
 
   mFrameworkHandle = NULL;
diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c 
b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
index b136992d99..9a701d1047 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
@@ -785,9 +785,6 @@ SerializeState (
 
   Generally called from within a test case prior to quitting or rebooting.
 
-  @param[in]  FrameworkHandle    A handle to the current running framework that
-                                 dispatched the test.  Necessary for recording
-                                 certain test events with the framework.
   @param[in]  ContextToSave      A buffer of test case-specific data to be 
saved
                                  along with framework state.  Will be passed as
                                  "Context" to the test case upon resume.  This
@@ -808,21 +805,21 @@ SerializeState (
 EFI_STATUS
 EFIAPI
 SaveFrameworkState (
-  IN UNIT_TEST_FRAMEWORK_HANDLE  FrameworkHandle,
   IN UNIT_TEST_CONTEXT           ContextToSave     OPTIONAL,
   IN UINTN                       ContextToSaveSize
   )
 {
-  EFI_STATUS             Status;
-  UNIT_TEST_SAVE_HEADER  *Header;
+  EFI_STATUS                  Status;
+  UNIT_TEST_FRAMEWORK_HANDLE  FrameworkHandle;
+  UNIT_TEST_SAVE_HEADER       *Header;
 
   Header = NULL;
+  FrameworkHandle = GetActiveFrameworkHandle();
 
   //
   // First, let's not make assumptions about the parameters.
   //
-  if (FrameworkHandle == NULL ||
-      (ContextToSave != NULL && ContextToSaveSize == 0) ||
+  if ((ContextToSave != NULL && ContextToSaveSize == 0) ||
       ContextToSaveSize > MAX_UINT32) {
     return EFI_INVALID_PARAMETER;
   }
-- 
2.25.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#57289): https://edk2.groups.io/g/devel/message/57289
Mute This Topic: https://groups.io/mt/73002350/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to