From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: devel@edk2.groups.io
Cc: Liming Gao <gaoliming@byosoft.com.cn>,
Zhiguang Liu <zhiguang.liu@intel.com>,
Michael Kubacki <michael.kubacki@microsoft.com>
Subject: [Patch V2 2/7] MdePkg: Reproduce builds across source format changes
Date: Mon, 1 Nov 2021 14:37:32 -0700 [thread overview]
Message-ID: <20211101213737.586-3-michael.d.kinney@intel.com> (raw)
In-Reply-To: <20211101213737.586-1-michael.d.kinney@intel.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3688
* Use DEBUG_LINE_NUMBER instead of __LINE__.
* Use DEBUG_EXPRESSION_STRING instead of #Expression.
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
MdePkg/Include/Library/UnitTestLib.h | 46 ++++++++++++++--------------
MdePkg/Library/BaseLib/SafeString.c | 2 +-
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/MdePkg/Include/Library/UnitTestLib.h b/MdePkg/Include/Library/UnitTestLib.h
index 99175496c8cd..142e865cb219 100644
--- a/MdePkg/Include/Library/UnitTestLib.h
+++ b/MdePkg/Include/Library/UnitTestLib.h
@@ -347,9 +347,9 @@ SaveFrameworkState (
@param[in] Expression Expression to be evaluated for TRUE.
**/
-#define UT_ASSERT_TRUE(Expression) \
- if(!UnitTestAssertTrue ((Expression), __FUNCTION__, __LINE__, __FILE__, #Expression)) { \
- return UNIT_TEST_ERROR_TEST_FAILED; \
+#define UT_ASSERT_TRUE(Expression) \
+ if(!UnitTestAssertTrue ((Expression), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Expression)) { \
+ return UNIT_TEST_ERROR_TEST_FAILED; \
}
/**
@@ -359,9 +359,9 @@ SaveFrameworkState (
@param[in] Expression Expression to be evaluated for FALSE.
**/
-#define UT_ASSERT_FALSE(Expression) \
- if(!UnitTestAssertFalse ((Expression), __FUNCTION__, __LINE__, __FILE__, #Expression)) { \
- return UNIT_TEST_ERROR_TEST_FAILED; \
+#define UT_ASSERT_FALSE(Expression) \
+ if(!UnitTestAssertFalse ((Expression), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Expression)) { \
+ return UNIT_TEST_ERROR_TEST_FAILED; \
}
/**
@@ -373,7 +373,7 @@ SaveFrameworkState (
@param[in] ValueB Value to be compared for equality (64-bit comparison).
**/
#define UT_ASSERT_EQUAL(ValueA, ValueB) \
- if(!UnitTestAssertEqual ((UINT64)(ValueA), (UINT64)(ValueB), __FUNCTION__, __LINE__, __FILE__, #ValueA, #ValueB)) { \
+ if(!UnitTestAssertEqual ((UINT64)(ValueA), (UINT64)(ValueB), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #ValueA, #ValueB)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
}
@@ -386,9 +386,9 @@ SaveFrameworkState (
@param[in] BufferB Pointer to a buffer for comparison.
@param[in] Length Number of bytes to compare in BufferA and BufferB.
**/
-#define UT_ASSERT_MEM_EQUAL(BufferA, BufferB, Length) \
- if(!UnitTestAssertMemEqual ((VOID *)(UINTN)(BufferA), (VOID *)(UINTN)(BufferB), (UINTN)Length, __FUNCTION__, __LINE__, __FILE__, #BufferA, #BufferB)) { \
- return UNIT_TEST_ERROR_TEST_FAILED; \
+#define UT_ASSERT_MEM_EQUAL(BufferA, BufferB, Length) \
+ if(!UnitTestAssertMemEqual ((VOID *)(UINTN)(BufferA), (VOID *)(UINTN)(BufferB), (UINTN)Length, __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #BufferA, #BufferB)) { \
+ return UNIT_TEST_ERROR_TEST_FAILED; \
}
/**
@@ -399,9 +399,9 @@ SaveFrameworkState (
@param[in] ValueA Value to be compared for inequality (64-bit comparison).
@param[in] ValueB Value to be compared for inequality (64-bit comparison).
**/
-#define UT_ASSERT_NOT_EQUAL(ValueA, ValueB) \
- if(!UnitTestAssertNotEqual ((UINT64)(ValueA), (UINT64)(ValueB), __FUNCTION__, __LINE__, __FILE__, #ValueA, #ValueB)) { \
- return UNIT_TEST_ERROR_TEST_FAILED; \
+#define UT_ASSERT_NOT_EQUAL(ValueA, ValueB) \
+ if(!UnitTestAssertNotEqual ((UINT64)(ValueA), (UINT64)(ValueB), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #ValueA, #ValueB)) { \
+ return UNIT_TEST_ERROR_TEST_FAILED; \
}
/**
@@ -411,9 +411,9 @@ SaveFrameworkState (
@param[in] Status EFI_STATUS value to check.
**/
-#define UT_ASSERT_NOT_EFI_ERROR(Status) \
- if(!UnitTestAssertNotEfiError ((Status), __FUNCTION__, __LINE__, __FILE__, #Status)) { \
- return UNIT_TEST_ERROR_TEST_FAILED; \
+#define UT_ASSERT_NOT_EFI_ERROR(Status) \
+ if(!UnitTestAssertNotEfiError ((Status), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Status)) { \
+ return UNIT_TEST_ERROR_TEST_FAILED; \
}
/**
@@ -424,9 +424,9 @@ SaveFrameworkState (
@param[in] Status EFI_STATUS values to compare for equality.
@param[in] Expected EFI_STATUS values to compare for equality.
**/
-#define UT_ASSERT_STATUS_EQUAL(Status, Expected) \
- if(!UnitTestAssertStatusEqual ((Status), (Expected), __FUNCTION__, __LINE__, __FILE__, #Status)) { \
- return UNIT_TEST_ERROR_TEST_FAILED; \
+#define UT_ASSERT_STATUS_EQUAL(Status, Expected) \
+ if(!UnitTestAssertStatusEqual ((Status), (Expected), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Status)) { \
+ return UNIT_TEST_ERROR_TEST_FAILED; \
}
/**
@@ -436,9 +436,9 @@ SaveFrameworkState (
@param[in] Pointer Pointer to be checked against NULL.
**/
-#define UT_ASSERT_NOT_NULL(Pointer) \
- if(!UnitTestAssertNotNull ((Pointer), __FUNCTION__, __LINE__, __FILE__, #Pointer)) { \
- return UNIT_TEST_ERROR_TEST_FAILED; \
+#define UT_ASSERT_NOT_NULL(Pointer) \
+ if(!UnitTestAssertNotNull ((Pointer), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Pointer)) { \
+ return UNIT_TEST_ERROR_TEST_FAILED; \
}
/**
@@ -482,7 +482,7 @@ SaveFrameworkState (
} \
if (!UnitTestExpectAssertFailure ( \
UnitTestJumpStatus, \
- __FUNCTION__, __LINE__, __FILE__, \
+ __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, \
#FunctionCall, Status)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \
} \
diff --git a/MdePkg/Library/BaseLib/SafeString.c b/MdePkg/Library/BaseLib/SafeString.c
index 3bb23ca1a130..24e818b921ea 100644
--- a/MdePkg/Library/BaseLib/SafeString.c
+++ b/MdePkg/Library/BaseLib/SafeString.c
@@ -17,7 +17,7 @@
if (!(Expression)) { \
DEBUG ((DEBUG_VERBOSE, \
"%a(%d) %a: SAFE_STRING_CONSTRAINT_CHECK(%a) failed. Return %r\n", \
- __FILE__, __LINE__, __FUNCTION__, #Expression, Status)); \
+ __FILE__, DEBUG_LINE_NUMBER, __FUNCTION__, DEBUG_EXPRESSION_STRING (Expression), Status)); \
return Status; \
} \
} while (FALSE)
--
2.32.0.windows.1
next prev parent reply other threads:[~2021-11-01 21:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-01 21:37 [Patch V2 0/7] Reproduce builds across source format changes Michael D Kinney
2021-11-01 21:37 ` [Patch V2 1/7] MdePkg/Include: Enhance DebugLib to support reproduce builds Michael D Kinney
2021-11-02 2:12 ` 回复: " gaoliming
2021-11-02 7:05 ` [edk2-devel] " Michael D Kinney
2021-11-04 5:24 ` 回复: " gaoliming
2021-11-01 21:37 ` Michael D Kinney [this message]
2021-11-01 21:37 ` [Patch V2 3/7] ArmPkg: Reproduce builds across source format changes Michael D Kinney
2021-11-01 21:37 ` [Patch V2 4/7] MdeModulePkg: " Michael D Kinney
2021-11-01 21:37 ` [Patch V2 5/7] NetworkPkg: " Michael D Kinney
2021-11-08 17:09 ` [edk2-devel] " Maciej Rabeda
2021-11-01 21:37 ` [Patch V2 6/7] SecurityPkg: " Michael D Kinney
2021-11-02 0:14 ` Yao, Jiewen
2021-11-01 21:37 ` [Patch V2 7/7] OvmfPkg: " Michael D Kinney
2021-11-05 3:18 ` Yao, Jiewen
2021-11-02 2:31 ` 回复: [Patch V2 0/7] " gaoliming
2021-11-02 7:10 ` Michael D Kinney
2021-11-04 5:15 ` 回复: [edk2-devel] " gaoliming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211101213737.586-3-michael.d.kinney@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox