[edk2-devel] [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: Print expected Status on ASSERT fail

Jeshua Smith via groups.io posted 1 patch 2 months, 1 week ago
Failed in applying to current master (apply log)
There is a newer version of this series
UnitTestFrameworkPkg/Library/UnitTestLib/AssertCmocka.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[edk2-devel] [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: Print expected Status on ASSERT fail
Posted by Jeshua Smith via groups.io 2 months, 1 week ago
Update the UnitTestAssertStatusEqual error message to print out the
expected value in addition to the seen value.

Change-Id: Ic651584dcdbcf1f8cd8166ad8058744fc0587d72
Signed-off-by: Jeshua Smith <jeshuas@nvidia.com>
---
 UnitTestFrameworkPkg/Library/UnitTestLib/AssertCmocka.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/AssertCmocka.c b/UnitTestFrameworkPkg/Library/UnitTestLib/AssertCmocka.c
index dc05bbd438..0d8e36c938 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestLib/AssertCmocka.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestLib/AssertCmocka.c
@@ -290,7 +290,7 @@ UnitTestAssertStatusEqual (
 {

   CHAR8  TempStr[MAX_STRING_SIZE];

 

-  snprintf (TempStr, sizeof (TempStr), "UT_ASSERT_STATUS_EQUAL(%s:%p)", Description, (VOID *)Status);

+  snprintf (TempStr, sizeof (TempStr), "UT_ASSERT_STATUS_EQUAL(%s:%p expected:%p)", Description, (VOID *)Status, (VOID *)Expected);

   _assert_true ((Status == Expected), TempStr, FileName, (INT32)LineNumber);

 

   return (Status == Expected);

-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96782): https://edk2.groups.io/g/devel/message/96782
Mute This Topic: https://groups.io/mt/95370574/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: Print expected Status on ASSERT fail
Posted by Michael D Kinney 2 months, 1 week ago
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>

Mike

> -----Original Message-----
> From: Jeshua Smith <jeshuas@nvidia.com>
> Sent: Wednesday, November 30, 2022 2:59 PM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; mikuback@linux.microsoft.com; sean.brogan@microsoft.com; Jeshua Smith
> <jeshuas@nvidia.com>
> Subject: [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: Print expected Status on ASSERT fail
> 
> Update the UnitTestAssertStatusEqual error message to print out the
> expected value in addition to the seen value.
> 
> Change-Id: Ic651584dcdbcf1f8cd8166ad8058744fc0587d72
> Signed-off-by: Jeshua Smith <jeshuas@nvidia.com>
> ---
>  UnitTestFrameworkPkg/Library/UnitTestLib/AssertCmocka.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/AssertCmocka.c
> b/UnitTestFrameworkPkg/Library/UnitTestLib/AssertCmocka.c
> index dc05bbd438..0d8e36c938 100644
> --- a/UnitTestFrameworkPkg/Library/UnitTestLib/AssertCmocka.c
> +++ b/UnitTestFrameworkPkg/Library/UnitTestLib/AssertCmocka.c
> @@ -290,7 +290,7 @@ UnitTestAssertStatusEqual (
>  {
> 
>    CHAR8  TempStr[MAX_STRING_SIZE];
> 
> 
> 
> -  snprintf (TempStr, sizeof (TempStr), "UT_ASSERT_STATUS_EQUAL(%s:%p)", Description, (VOID *)Status);
> 
> +  snprintf (TempStr, sizeof (TempStr), "UT_ASSERT_STATUS_EQUAL(%s:%p expected:%p)", Description, (VOID *)Status, (VOID
> *)Expected);
> 
>    _assert_true ((Status == Expected), TempStr, FileName, (INT32)LineNumber);
> 
> 
> 
>    return (Status == Expected);
> 
> --
> 2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96785): https://edk2.groups.io/g/devel/message/96785
Mute This Topic: https://groups.io/mt/95370574/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-