<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">- Bret</p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Michael D Kinney <michael.d.kinney@intel.com><br>
<b>Sent:</b> Friday, July 10, 2020 7:08:59 PM<br>
<b>To:</b> devel@edk2.groups.io <devel@edk2.groups.io><br>
<b>Cc:</b> Sean Brogan <sean.brogan@microsoft.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>; Yao, Jiewen <jiewen.yao@intel.com><br>
<b>Subject:</b> [EXTERNAL] [Patch v3 11/16] UnitTestFrameworkPkg/UnitTestLib: Fix target mode log messages</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">REF: <a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2806&amp;data=02%7C01%7CBret.Barkelew%40microsoft.com%7C37f4c773c1684ce41aea08d8253f692e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637300301580380663&amp;sdata=xRivgP78PSA7wfjoPw8LZL9U9Fnh5x7LClkYmnVGL4M%3D&amp;reserved=0">
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2806&amp;data=02%7C01%7CBret.Barkelew%40microsoft.com%7C37f4c773c1684ce41aea08d8253f692e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637300301580380663&amp;sdata=xRivgP78PSA7wfjoPw8LZL9U9Fnh5x7LClkYmnVGL4M%3D&amp;reserved=0</a><br>
<br>
Update the log messages generated in target mode to use<br>
FileName instead of FunctionName.  FunctionName is an empty<br>
string so the log messages generated do not provide enough<br>
information to know the source of a unit test failure.<br>
<br>
Using FileName combined with LineNumber provides the<br>
right information to identify the location of a unit test<br>
failure.<br>
<br>
Cc: Sean Brogan <sean.brogan@microsoft.com><br>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com><br>
Cc: Jiewen Yao <jiewen.yao@intel.com><br>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com><br>
---<br>
 .../Library/UnitTestLib/Assert.c              | 64 +++++++++----------<br>
 1 file changed, 32 insertions(+), 32 deletions(-)<br>
<br>
diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/Assert.c b/UnitTestFrameworkPkg/Library/UnitTestLib/Assert.c<br>
index c327ba88f1..8a131fab2b 100644<br>
--- a/UnitTestFrameworkPkg/Library/UnitTestLib/Assert.c<br>
+++ b/UnitTestFrameworkPkg/Library/UnitTestLib/Assert.c<br>
@@ -105,14 +105,14 @@ UnitTestAssertTrue (<br>
   if (!Expression) {<br>
     UnitTestLogFailure (<br>
       FAILURETYPE_ASSERTTRUE,<br>
-      "%a::%d Expression (%a) is not TRUE!\n",<br>
-      FunctionName,<br>
+      "%a:%d: Expression (%a) is not TRUE!\n",<br>
+      FileName,<br>
       LineNumber,<br>
       Description<br>
       );<br>
     UT_LOG_ERROR (<br>
-      "[ASSERT FAIL] %a::%d Expression (%a) is not TRUE!\n",<br>
-      FunctionName,<br>
+      "[ASSERT FAIL] %a:%d: Expression (%a) is not TRUE!\n",<br>
+      FileName,<br>
       LineNumber,<br>
       Description<br>
       );<br>
@@ -151,14 +151,14 @@ UnitTestAssertFalse (<br>
   if (Expression) {<br>
     UnitTestLogFailure (<br>
       FAILURETYPE_ASSERTFALSE,<br>
-      "%a::%d Expression(%a) is not FALSE!\n",<br>
-      FunctionName,<br>
+      "%a:%d: Expression(%a) is not FALSE!\n",<br>
+      FileName,<br>
       LineNumber,<br>
       Description<br>
       );<br>
     UT_LOG_ERROR (<br>
-      "[ASSERT FAIL] %a::%d Expression (%a) is not FALSE!\n",<br>
-      FunctionName,<br>
+      "[ASSERT FAIL] %a:%d: Expression (%a) is not FALSE!\n",<br>
+      FileName,<br>
       LineNumber,<br>
       Description<br>
       );<br>
@@ -197,15 +197,15 @@ UnitTestAssertNotEfiError (<br>
   if (EFI_ERROR (Status)) {<br>
     UnitTestLogFailure (<br>
       FAILURETYPE_ASSERTNOTEFIERROR,<br>
-      "%a::%d Status '%a' is EFI_ERROR (%r)!\n",<br>
-      FunctionName,<br>
+      "%a:%d: Status '%a' is EFI_ERROR (%r)!\n",<br>
+      FileName,<br>
       LineNumber,<br>
       Description,<br>
       Status<br>
       );<br>
     UT_LOG_ERROR (<br>
-      "[ASSERT FAIL] %a::%d Status '%a' is EFI_ERROR (%r)!\n",<br>
-      FunctionName,<br>
+      "[ASSERT FAIL] %a:%d: Status '%a' is EFI_ERROR (%r)!\n",<br>
+      FileName,<br>
       LineNumber,<br>
       Description,<br>
       Status<br>
@@ -250,8 +250,8 @@ UnitTestAssertEqual (<br>
   if (ValueA != ValueB) {<br>
     UnitTestLogFailure (<br>
       FAILURETYPE_ASSERTEQUAL,<br>
-      "%a::%d Value %a != %a (%d != %d)!\n",<br>
-      FunctionName,<br>
+      "%a:%d: Value %a != %a (%d != %d)!\n",<br>
+      FileName,<br>
       LineNumber,<br>
       DescriptionA,<br>
       DescriptionB,<br>
@@ -259,8 +259,8 @@ UnitTestAssertEqual (<br>
       ValueB<br>
       );<br>
     UT_LOG_ERROR (<br>
-      "[ASSERT FAIL] %a::%d Value %a != %a (%d != %d)!\n",<br>
-      FunctionName,<br>
+      "[ASSERT FAIL] %a:%d: Value %a != %a (%d != %d)!\n",<br>
+      FileName,<br>
       LineNumber,<br>
       DescriptionA,<br>
       DescriptionB,<br>
@@ -312,16 +312,16 @@ UnitTestAssertMemEqual (<br>
   if (CompareMem(BufferA, BufferB, Length) != 0) {<br>
     UnitTestLogFailure (<br>
       FAILURETYPE_ASSERTEQUAL,<br>
-      "%a::%d Memory at %a != %a for length %d bytes!\n",<br>
-      FunctionName,<br>
+      "%a:%d: Memory at %a != %a for length %d bytes!\n",<br>
+      FileName,<br>
       LineNumber,<br>
       DescriptionA,<br>
       DescriptionB,<br>
       Length<br>
       );<br>
     UT_LOG_ERROR (<br>
-      "[ASSERT FAIL] %a::%d Value %a != %a for length %d bytes!\n",<br>
-      FunctionName,<br>
+      "[ASSERT FAIL] %a:%d: Value %a != %a for length %d bytes!\n",<br>
+      FileName,<br>
       LineNumber,<br>
       DescriptionA,<br>
       DescriptionB,<br>
@@ -368,8 +368,8 @@ UnitTestAssertNotEqual (<br>
   if (ValueA == ValueB) {<br>
     UnitTestLogFailure (<br>
       FAILURETYPE_ASSERTNOTEQUAL,<br>
-      "%a::%d Value %a == %a (%d == %d)!\n",<br>
-      FunctionName,<br>
+      "%a:%d: Value %a == %a (%d == %d)!\n",<br>
+      FileName,<br>
       LineNumber,<br>
       DescriptionA,<br>
       DescriptionB,<br>
@@ -377,8 +377,8 @@ UnitTestAssertNotEqual (<br>
       ValueB<br>
       );<br>
     UT_LOG_ERROR (<br>
-      "[ASSERT FAIL] %a::%d Value %a == %a (%d == %d)!\n",<br>
-      FunctionName,<br>
+      "[ASSERT FAIL] %a:%d: Value %a == %a (%d == %d)!\n",<br>
+      FileName,<br>
       LineNumber,<br>
       DescriptionA,<br>
       DescriptionB,<br>
@@ -423,16 +423,16 @@ UnitTestAssertStatusEqual (<br>
   if (Status != Expected) {<br>
     UnitTestLogFailure (<br>
       FAILURETYPE_ASSERTSTATUSEQUAL,<br>
-      "%a::%d Status '%a' is %r, should be %r!\n",<br>
-      FunctionName,<br>
+      "%a:%d: Status '%a' is %r, should be %r!\n",<br>
+      FileName,<br>
       LineNumber,<br>
       Description,<br>
       Status,<br>
       Expected<br>
       );<br>
     UT_LOG_ERROR (<br>
-      "[ASSERT FAIL] %a::%d Status '%a' is %r, should be %r!\n",<br>
-      FunctionName,<br>
+      "[ASSERT FAIL] %a:%d: Status '%a' is %r, should be %r!\n",<br>
+      FileName,<br>
       LineNumber,<br>
       Description,<br>
       Status,<br>
@@ -475,14 +475,14 @@ UnitTestAssertNotNull (<br>
   if (Pointer == NULL) {<br>
     UnitTestLogFailure (<br>
       FAILURETYPE_ASSERTNOTNULL,<br>
-      "%a::%d Pointer (%a) is NULL!\n",<br>
-      FunctionName,<br>
+      "%a:%d: Pointer (%a) is NULL!\n",<br>
+      FileName,<br>
       LineNumber,<br>
       PointerName<br>
       );<br>
     UT_LOG_ERROR (<br>
-      "[ASSERT FAIL] %a::%d Pointer (%a) is NULL!\n",<br>
-      FunctionName,<br>
+      "[ASSERT FAIL] %a:%d: Pointer (%a) is NULL!\n",<br>
+      FileName,<br>
       LineNumber,<br>
       PointerName<br>
       );<br>
-- <br>
2.21.0.windows.1<br>
<br>
</div>
</span></font></div>
</body>
</html>

<div width="1" style="color:white;clear:both">_._,_._,_</div>
<hr>
Groups.io Links:<p>


You receive all messages sent to this group.



<p>

<a target="_blank" href="https://edk2.groups.io/g/devel/message/62578">View/Reply Online (#62578)</a> |


  


|


  
    <a target="_blank" href="https://groups.io/mt/75514378/1813853">Mute This Topic</a>
  

| <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>



<br>

<a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> |
<a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |

<a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>

 [edk2-devel-archive@redhat.com]<br>
<div width="1" style="color:white;clear:both">_._,_._,_</div>