public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v1 1/1] PrmPkg/DxePrmContextBufferLib: Fix unit test GCC compilation errors
@ 2022-04-19  1:27 Michael Kubacki
  2022-04-20 16:18 ` [edk2-devel] " Sinha, Ankit
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Kubacki @ 2022-04-19  1:27 UTC (permalink / raw)
  To: devel; +Cc: Michael Kubacki, Nate DeSimone, Ankit Sinha

From: Michael Kubacki <michael.kubacki@microsoft.com>

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

Fixes GCC compilation errors in DxePrmContextBufferLibUnitTest.c.

Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
---
 PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxePrmContextBufferLibUnitTest.c | 28 +++++++-------------
 1 file changed, 10 insertions(+), 18 deletions(-)

diff --git a/PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxePrmContextBufferLibUnitTest.c b/PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxePrmContextBufferLibUnitTest.c
index e244e7b09575..fdc32993b82d 100644
--- a/PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxePrmContextBufferLibUnitTest.c
+++ b/PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxePrmContextBufferLibUnitTest.c
@@ -237,17 +237,17 @@ NullPointerArgumentsShouldFailGracefully (
   PRM_MODULE_CONTEXT_BUFFERS  *ModuleContextBuffersPtr;
 
   UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (NULL, NULL, NULL), EFI_INVALID_PARAMETER);
-  UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (NULL, &ModuleContextBuffers, &ContextBufferPtr), EFI_INVALID_PARAMETER);
-  UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (&Guid, NULL, &ContextBufferPtr), EFI_INVALID_PARAMETER);
+  UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (NULL, &ModuleContextBuffers, (CONST PRM_CONTEXT_BUFFER **)&ContextBufferPtr), EFI_INVALID_PARAMETER);
+  UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (&Guid, NULL, (CONST PRM_CONTEXT_BUFFER **)&ContextBufferPtr), EFI_INVALID_PARAMETER);
   UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (&Guid, &ModuleContextBuffers, NULL), EFI_INVALID_PARAMETER);
 
   UT_ASSERT_EQUAL (GetModuleContextBuffers (ByModuleGuid, NULL, NULL), EFI_INVALID_PARAMETER);
-  UT_ASSERT_EQUAL (GetModuleContextBuffers (ByModuleGuid, NULL, &ModuleContextBuffersPtr), EFI_INVALID_PARAMETER);
+  UT_ASSERT_EQUAL (GetModuleContextBuffers (ByModuleGuid, NULL, (CONST PRM_MODULE_CONTEXT_BUFFERS **)&ModuleContextBuffersPtr), EFI_INVALID_PARAMETER);
   UT_ASSERT_EQUAL (GetModuleContextBuffers (ByModuleGuid, &Guid, NULL), EFI_INVALID_PARAMETER);
 
   UT_ASSERT_EQUAL (GetContextBuffer (NULL, NULL, NULL), EFI_INVALID_PARAMETER);
-  UT_ASSERT_EQUAL (GetContextBuffer (NULL, &ModuleContextBuffers, &ContextBufferPtr), EFI_INVALID_PARAMETER);
-  UT_ASSERT_EQUAL (GetContextBuffer (&Guid, NULL, &ContextBufferPtr), EFI_NOT_FOUND);
+  UT_ASSERT_EQUAL (GetContextBuffer (NULL, &ModuleContextBuffers, (CONST PRM_CONTEXT_BUFFER **)&ContextBufferPtr), EFI_INVALID_PARAMETER);
+  UT_ASSERT_EQUAL (GetContextBuffer (&Guid, NULL, (CONST PRM_CONTEXT_BUFFER **)&ContextBufferPtr), EFI_NOT_FOUND);
   UT_ASSERT_EQUAL (GetContextBuffer (&Guid, &ModuleContextBuffers, NULL), EFI_INVALID_PARAMETER);
 
   return UNIT_TEST_PASSED;
@@ -322,7 +322,7 @@ InitializeFunctionalCorrectness (
 
 **/
 STATIC
-UNIT_TEST_STATUS
+VOID
 EFIAPI
 DeInitializeFunctionalCorrectness (
   IN  UNIT_TEST_CONTEXT  Context
@@ -332,7 +332,6 @@ DeInitializeFunctionalCorrectness (
   PRM_CONFIG_PROTOCOL               *PrmConfigProtocol;
   PRM_CONTEXT_BUFFERS_TEST_CONTEXT  *TestContext;
 
-  UT_ASSERT_NOT_NULL (Context);
   TestContext = (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *)Context;
 
   Status = gBS->HandleProtocol (
@@ -340,7 +339,6 @@ DeInitializeFunctionalCorrectness (
                   &gPrmConfigProtocolGuid,
                   (VOID **)&PrmConfigProtocol
                   );
-  UT_ASSERT_NOT_EFI_ERROR (Status);
 
   if (!EFI_ERROR (Status)) {
     Status =  gBS->UninstallProtocolInterface (
@@ -348,13 +346,10 @@ DeInitializeFunctionalCorrectness (
                      &gPrmConfigProtocolGuid,
                      PrmConfigProtocol
                      );
-    UT_ASSERT_NOT_EFI_ERROR (Status);
     if (!EFI_ERROR (Status)) {
       FreePool (PrmConfigProtocol);
     }
   }
-
-  return UNIT_TEST_PASSED;
 }
 
 /**
@@ -382,7 +377,7 @@ VerifyGetModuleContextBuffers (
   ContextBuffers = NULL;
   TestContext    = (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *)Context;
 
-  Status = GetModuleContextBuffers (TestContext->GuidSearchType, TestContext->Guid, &ContextBuffers);
+  Status = GetModuleContextBuffers (TestContext->GuidSearchType, TestContext->Guid, (CONST PRM_MODULE_CONTEXT_BUFFERS **)&ContextBuffers);
   UT_ASSERT_STATUS_EQUAL (Status, TestContext->ExpectedStatus);
 
   if (!EFI_ERROR (TestContext->ExpectedStatus)) {
@@ -419,14 +414,12 @@ VerifyFindContextBufferInModuleBuffers (
 {
   EFI_STATUS                       Status;
   PRM_CONTEXT_BUFFER               *FoundContextBuffer;
-  PRM_MODULE_CONTEXT_BUFFERS       *ContextBuffers;
   PRM_CONTEXT_BUFFER_TEST_CONTEXT  *TestContext;
 
-  ContextBuffers     = NULL;
   FoundContextBuffer = NULL;
   TestContext        = (PRM_CONTEXT_BUFFER_TEST_CONTEXT *)Context;
 
-  Status = FindContextBufferInModuleBuffers (TestContext->HandlerGuid, TestContext->ContextBuffers, &FoundContextBuffer);
+  Status = FindContextBufferInModuleBuffers (TestContext->HandlerGuid, TestContext->ContextBuffers, (CONST PRM_CONTEXT_BUFFER **)&FoundContextBuffer);
   UT_ASSERT_STATUS_EQUAL (Status, TestContext->ExpectedStatus);
 
   if (!EFI_ERROR (TestContext->ExpectedStatus)) {
@@ -465,14 +458,13 @@ VerifyGetContextBuffer (
 {
   EFI_STATUS                       Status;
   PRM_CONTEXT_BUFFER               *FoundContextBuffer;
-  PRM_MODULE_CONTEXT_BUFFERS       *ContextBuffers;
   PRM_CONTEXT_BUFFER_TEST_CONTEXT  *TestContext;
 
-  ContextBuffers     = NULL;
   FoundContextBuffer = NULL;
   TestContext        = (PRM_CONTEXT_BUFFER_TEST_CONTEXT *)Context;
 
-  Status = GetContextBuffer (TestContext->HandlerGuid, TestContext->ContextBuffers, &FoundContextBuffer);
+  Status = GetContextBuffer (TestContext->HandlerGuid, TestContext->ContextBuffers, (CONST PRM_CONTEXT_BUFFER **)&FoundContextBuffer);
+
   UT_ASSERT_STATUS_EQUAL (Status, TestContext->ExpectedStatus);
 
   if (!EFI_ERROR (TestContext->ExpectedStatus)) {
-- 
2.28.0.windows.1


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

* Re: [edk2-devel] [PATCH v1 1/1] PrmPkg/DxePrmContextBufferLib: Fix unit test GCC compilation errors
  2022-04-19  1:27 [PATCH v1 1/1] PrmPkg/DxePrmContextBufferLib: Fix unit test GCC compilation errors Michael Kubacki
@ 2022-04-20 16:18 ` Sinha, Ankit
  0 siblings, 0 replies; 2+ messages in thread
From: Sinha, Ankit @ 2022-04-20 16:18 UTC (permalink / raw)
  To: devel@edk2.groups.io, mikuback@linux.microsoft.com; +Cc: Desimone, Nathaniel L

Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>


> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Michael
> Kubacki
> Sent: Monday, April 18, 2022 6:27 PM
> To: devel@edk2.groups.io
> Cc: Michael Kubacki <mikuback@linux.microsoft.com>; Desimone, Nathaniel
> L <nathaniel.l.desimone@intel.com>; Sinha, Ankit <ankit.sinha@intel.com>
> Subject: [edk2-devel] [PATCH v1 1/1] PrmPkg/DxePrmContextBufferLib: Fix
> unit test GCC compilation errors
> 
> From: Michael Kubacki <michael.kubacki@microsoft.com>
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=3905
> 
> Fixes GCC compilation errors in DxePrmContextBufferLibUnitTest.c.
> 
> Cc: Michael Kubacki <mikuback@linux.microsoft.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Ankit Sinha <ankit.sinha@intel.com>
> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
> ---
> 
> PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxePrmContextBufferLi
> bUnitTest.c | 28 +++++++-------------
>  1 file changed, 10 insertions(+), 18 deletions(-)
> 
> diff --git
> a/PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxePrmContextBuffer
> LibUnitTest.c
> b/PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxePrmContextBuffer
> LibUnitTest.c
> index e244e7b09575..fdc32993b82d 100644
> ---
> a/PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxePrmContextBuffer
> LibUnitTest.c
> +++
> b/PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxePrmContextBuffer
> +++ LibUnitTest.c
> @@ -237,17 +237,17 @@ NullPointerArgumentsShouldFailGracefully (
>    PRM_MODULE_CONTEXT_BUFFERS  *ModuleContextBuffersPtr;
> 
>    UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (NULL, NULL,
> NULL), EFI_INVALID_PARAMETER);
> -  UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (NULL,
> &ModuleContextBuffers, &ContextBufferPtr), EFI_INVALID_PARAMETER);
> -  UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (&Guid, NULL,
> &ContextBufferPtr), EFI_INVALID_PARAMETER);
> +  UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (NULL,
> + &ModuleContextBuffers, (CONST PRM_CONTEXT_BUFFER
> + **)&ContextBufferPtr), EFI_INVALID_PARAMETER);  UT_ASSERT_EQUAL
> + (FindContextBufferInModuleBuffers (&Guid, NULL, (CONST
> + PRM_CONTEXT_BUFFER **)&ContextBufferPtr),
> EFI_INVALID_PARAMETER);
>    UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (&Guid,
> &ModuleContextBuffers, NULL), EFI_INVALID_PARAMETER);
> 
>    UT_ASSERT_EQUAL (GetModuleContextBuffers (ByModuleGuid, NULL,
> NULL), EFI_INVALID_PARAMETER);
> -  UT_ASSERT_EQUAL (GetModuleContextBuffers (ByModuleGuid, NULL,
> &ModuleContextBuffersPtr), EFI_INVALID_PARAMETER);
> +  UT_ASSERT_EQUAL (GetModuleContextBuffers (ByModuleGuid, NULL,
> (CONST
> + PRM_MODULE_CONTEXT_BUFFERS **)&ModuleContextBuffersPtr),
> + EFI_INVALID_PARAMETER);
>    UT_ASSERT_EQUAL (GetModuleContextBuffers (ByModuleGuid, &Guid,
> NULL), EFI_INVALID_PARAMETER);
> 
>    UT_ASSERT_EQUAL (GetContextBuffer (NULL, NULL, NULL),
> EFI_INVALID_PARAMETER);
> -  UT_ASSERT_EQUAL (GetContextBuffer (NULL, &ModuleContextBuffers,
> &ContextBufferPtr), EFI_INVALID_PARAMETER);
> -  UT_ASSERT_EQUAL (GetContextBuffer (&Guid, NULL, &ContextBufferPtr),
> EFI_NOT_FOUND);
> +  UT_ASSERT_EQUAL (GetContextBuffer (NULL, &ModuleContextBuffers,
> + (CONST PRM_CONTEXT_BUFFER **)&ContextBufferPtr),
> + EFI_INVALID_PARAMETER);  UT_ASSERT_EQUAL (GetContextBuffer
> (&Guid,
> + NULL, (CONST PRM_CONTEXT_BUFFER **)&ContextBufferPtr),
> EFI_NOT_FOUND);
>    UT_ASSERT_EQUAL (GetContextBuffer (&Guid, &ModuleContextBuffers,
> NULL), EFI_INVALID_PARAMETER);
> 
>    return UNIT_TEST_PASSED;
> @@ -322,7 +322,7 @@ InitializeFunctionalCorrectness (
> 
>  **/
>  STATIC
> -UNIT_TEST_STATUS
> +VOID
>  EFIAPI
>  DeInitializeFunctionalCorrectness (
>    IN  UNIT_TEST_CONTEXT  Context
> @@ -332,7 +332,6 @@ DeInitializeFunctionalCorrectness (
>    PRM_CONFIG_PROTOCOL               *PrmConfigProtocol;
>    PRM_CONTEXT_BUFFERS_TEST_CONTEXT  *TestContext;
> 
> -  UT_ASSERT_NOT_NULL (Context);
>    TestContext = (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *)Context;
> 
>    Status = gBS->HandleProtocol (
> @@ -340,7 +339,6 @@ DeInitializeFunctionalCorrectness (
>                    &gPrmConfigProtocolGuid,
>                    (VOID **)&PrmConfigProtocol
>                    );
> -  UT_ASSERT_NOT_EFI_ERROR (Status);
> 
>    if (!EFI_ERROR (Status)) {
>      Status =  gBS->UninstallProtocolInterface ( @@ -348,13 +346,10 @@
> DeInitializeFunctionalCorrectness (
>                       &gPrmConfigProtocolGuid,
>                       PrmConfigProtocol
>                       );
> -    UT_ASSERT_NOT_EFI_ERROR (Status);
>      if (!EFI_ERROR (Status)) {
>        FreePool (PrmConfigProtocol);
>      }
>    }
> -
> -  return UNIT_TEST_PASSED;
>  }
> 
>  /**
> @@ -382,7 +377,7 @@ VerifyGetModuleContextBuffers (
>    ContextBuffers = NULL;
>    TestContext    = (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *)Context;
> 
> -  Status = GetModuleContextBuffers (TestContext->GuidSearchType,
> TestContext->Guid, &ContextBuffers);
> +  Status = GetModuleContextBuffers (TestContext->GuidSearchType,
> + TestContext->Guid, (CONST PRM_MODULE_CONTEXT_BUFFERS
> + **)&ContextBuffers);
>    UT_ASSERT_STATUS_EQUAL (Status, TestContext->ExpectedStatus);
> 
>    if (!EFI_ERROR (TestContext->ExpectedStatus)) { @@ -419,14 +414,12 @@
> VerifyFindContextBufferInModuleBuffers (  {
>    EFI_STATUS                       Status;
>    PRM_CONTEXT_BUFFER               *FoundContextBuffer;
> -  PRM_MODULE_CONTEXT_BUFFERS       *ContextBuffers;
>    PRM_CONTEXT_BUFFER_TEST_CONTEXT  *TestContext;
> 
> -  ContextBuffers     = NULL;
>    FoundContextBuffer = NULL;
>    TestContext        = (PRM_CONTEXT_BUFFER_TEST_CONTEXT *)Context;
> 
> -  Status = FindContextBufferInModuleBuffers (TestContext->HandlerGuid,
> TestContext->ContextBuffers, &FoundContextBuffer);
> +  Status = FindContextBufferInModuleBuffers (TestContext->HandlerGuid,
> + TestContext->ContextBuffers, (CONST PRM_CONTEXT_BUFFER
> + **)&FoundContextBuffer);
>    UT_ASSERT_STATUS_EQUAL (Status, TestContext->ExpectedStatus);
> 
>    if (!EFI_ERROR (TestContext->ExpectedStatus)) { @@ -465,14 +458,13 @@
> VerifyGetContextBuffer (  {
>    EFI_STATUS                       Status;
>    PRM_CONTEXT_BUFFER               *FoundContextBuffer;
> -  PRM_MODULE_CONTEXT_BUFFERS       *ContextBuffers;
>    PRM_CONTEXT_BUFFER_TEST_CONTEXT  *TestContext;
> 
> -  ContextBuffers     = NULL;
>    FoundContextBuffer = NULL;
>    TestContext        = (PRM_CONTEXT_BUFFER_TEST_CONTEXT *)Context;
> 
> -  Status = GetContextBuffer (TestContext->HandlerGuid, TestContext-
> >ContextBuffers, &FoundContextBuffer);
> +  Status = GetContextBuffer (TestContext->HandlerGuid,
> + TestContext->ContextBuffers, (CONST PRM_CONTEXT_BUFFER
> + **)&FoundContextBuffer);
> +
>    UT_ASSERT_STATUS_EQUAL (Status, TestContext->ExpectedStatus);
> 
>    if (!EFI_ERROR (TestContext->ExpectedStatus)) {
> --
> 2.28.0.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#89042): https://edk2.groups.io/g/devel/message/89042
> Mute This Topic: https://groups.io/mt/90553692/1772825
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [ankit.sinha@intel.com]
> -=-=-=-=-=-=
> 


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

end of thread, other threads:[~2022-04-20 16:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-19  1:27 [PATCH v1 1/1] PrmPkg/DxePrmContextBufferLib: Fix unit test GCC compilation errors Michael Kubacki
2022-04-20 16:18 ` [edk2-devel] " Sinha, Ankit

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