* [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: Print expected Status on ASSERT fail
@ 2022-11-30 22:58 Jeshua Smith
2022-11-30 23:03 ` Michael D Kinney
0 siblings, 1 reply; 2+ messages in thread
From: Jeshua Smith @ 2022-11-30 22:58 UTC (permalink / raw)
To: devel; +Cc: michael.d.kinney, mikuback, sean.brogan, Jeshua Smith
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: Print expected Status on ASSERT fail
2022-11-30 22:58 [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: Print expected Status on ASSERT fail Jeshua Smith
@ 2022-11-30 23:03 ` Michael D Kinney
0 siblings, 0 replies; 2+ messages in thread
From: Michael D Kinney @ 2022-11-30 23:03 UTC (permalink / raw)
To: Jeshua Smith, devel@edk2.groups.io, Kinney, Michael D
Cc: mikuback@linux.microsoft.com, sean.brogan@microsoft.com
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-30 23:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-30 22:58 [PATCH v2] UnitTestFrameworkPkg/UnitTestLib: Print expected Status on ASSERT fail Jeshua Smith
2022-11-30 23:03 ` Michael D Kinney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox