Reviewed-by: Bret Barkelew <bret.barke...@microsoft.com>

- Bret

From: Guomin Jiang<mailto:guomin.ji...@intel.com>
Sent: Monday, April 13, 2020 6:53 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Bret Barkelew<mailto:bret.barke...@microsoft.com>; Kinney, Michael 
D<mailto:michael.d.kin...@intel.com>; Liming Gao<mailto:liming....@intel.com>; 
Sean Brogan<mailto:sean.bro...@microsoft.com>; Bret 
Barkelew<mailto:bret.barke...@microsoft.com>
Subject: [EXTERNAL] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Remove 
FrameworkHandle parameter

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

REF: 
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2612&amp;data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cffe40198dda04043796c08d7e016acfd%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637224260308125582&amp;sdata=Ilxdkaz%2BRcTdU6bvTRPB394PGKWZ0TQibcN4NaYDBEg%3D&amp;reserved=0

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 (#57290): https://edk2.groups.io/g/devel/message/57290
Mute This Topic: https://groups.io/mt/73003006/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to