public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] UnitTestFrameworkPkg/UnitTestLib: Remove FrameworkHandle parameter
@ 2020-04-14  1:53 Guomin Jiang
  2020-04-14  2:46 ` [EXTERNAL] " Bret Barkelew
  0 siblings, 1 reply; 2+ messages in thread
From: Guomin Jiang @ 2020-04-14  1:53 UTC (permalink / raw)
  To: devel
  Cc: Bret Barkelew, Michael D Kinney, Liming Gao, Sean Brogan,
	Bret Barkelew

From: Bret Barkelew <brbarkel@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.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Guomin Jiang <guomin.jiang@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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [EXTERNAL] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Remove FrameworkHandle parameter
  2020-04-14  1:53 [PATCH] UnitTestFrameworkPkg/UnitTestLib: Remove FrameworkHandle parameter Guomin Jiang
@ 2020-04-14  2:46 ` Bret Barkelew
  0 siblings, 0 replies; 2+ messages in thread
From: Bret Barkelew @ 2020-04-14  2:46 UTC (permalink / raw)
  To: Guomin Jiang, devel@edk2.groups.io
  Cc: Kinney, Michael D, Liming Gao, Sean Brogan

[-- Attachment #1: Type: text/plain, Size: 5118 bytes --]

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

- Bret

From: Guomin Jiang<mailto:guomin.jiang@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.Barkelew@microsoft.com>; Kinney, Michael D<mailto:michael.d.kinney@intel.com>; Liming Gao<mailto:liming.gao@intel.com>; Sean Brogan<mailto:sean.brogan@microsoft.com>; Bret Barkelew<mailto:Bret.Barkelew@microsoft.com>
Subject: [EXTERNAL] [PATCH] UnitTestFrameworkPkg/UnitTestLib: Remove FrameworkHandle parameter

From: Bret Barkelew <brbarkel@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.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Guomin Jiang <guomin.jiang@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


[-- Attachment #2: Type: text/html, Size: 10730 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-14  2:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-14  1:53 [PATCH] UnitTestFrameworkPkg/UnitTestLib: Remove FrameworkHandle parameter Guomin Jiang
2020-04-14  2:46 ` [EXTERNAL] " Bret Barkelew

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox