MdePkg: Reproduce builds across source format changes

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>
Tested-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
Michael D Kinney 2021-11-01 13:39:13 -07:00 committed by mergify[bot]
parent 48452993ad
commit 5948ec3647
2 changed files with 24 additions and 24 deletions

View File

@ -347,9 +347,9 @@ SaveFrameworkState (
@param[in] Expression Expression to be evaluated for TRUE. @param[in] Expression Expression to be evaluated for TRUE.
**/ **/
#define UT_ASSERT_TRUE(Expression) \ #define UT_ASSERT_TRUE(Expression) \
if(!UnitTestAssertTrue ((Expression), __FUNCTION__, __LINE__, __FILE__, #Expression)) { \ if(!UnitTestAssertTrue ((Expression), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Expression)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \ return UNIT_TEST_ERROR_TEST_FAILED; \
} }
/** /**
@ -359,9 +359,9 @@ SaveFrameworkState (
@param[in] Expression Expression to be evaluated for FALSE. @param[in] Expression Expression to be evaluated for FALSE.
**/ **/
#define UT_ASSERT_FALSE(Expression) \ #define UT_ASSERT_FALSE(Expression) \
if(!UnitTestAssertFalse ((Expression), __FUNCTION__, __LINE__, __FILE__, #Expression)) { \ if(!UnitTestAssertFalse ((Expression), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Expression)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \ return UNIT_TEST_ERROR_TEST_FAILED; \
} }
/** /**
@ -373,7 +373,7 @@ SaveFrameworkState (
@param[in] ValueB Value to be compared for equality (64-bit comparison). @param[in] ValueB Value to be compared for equality (64-bit comparison).
**/ **/
#define UT_ASSERT_EQUAL(ValueA, ValueB) \ #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; \ return UNIT_TEST_ERROR_TEST_FAILED; \
} }
@ -386,9 +386,9 @@ SaveFrameworkState (
@param[in] BufferB Pointer to a buffer for comparison. @param[in] BufferB Pointer to a buffer for comparison.
@param[in] Length Number of bytes to compare in BufferA and BufferB. @param[in] Length Number of bytes to compare in BufferA and BufferB.
**/ **/
#define UT_ASSERT_MEM_EQUAL(BufferA, BufferB, Length) \ #define UT_ASSERT_MEM_EQUAL(BufferA, BufferB, Length) \
if(!UnitTestAssertMemEqual ((VOID *)(UINTN)(BufferA), (VOID *)(UINTN)(BufferB), (UINTN)Length, __FUNCTION__, __LINE__, __FILE__, #BufferA, #BufferB)) { \ if(!UnitTestAssertMemEqual ((VOID *)(UINTN)(BufferA), (VOID *)(UINTN)(BufferB), (UINTN)Length, __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #BufferA, #BufferB)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \ 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] ValueA Value to be compared for inequality (64-bit comparison).
@param[in] ValueB 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) \ #define UT_ASSERT_NOT_EQUAL(ValueA, ValueB) \
if(!UnitTestAssertNotEqual ((UINT64)(ValueA), (UINT64)(ValueB), __FUNCTION__, __LINE__, __FILE__, #ValueA, #ValueB)) { \ if(!UnitTestAssertNotEqual ((UINT64)(ValueA), (UINT64)(ValueB), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #ValueA, #ValueB)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \ return UNIT_TEST_ERROR_TEST_FAILED; \
} }
/** /**
@ -411,9 +411,9 @@ SaveFrameworkState (
@param[in] Status EFI_STATUS value to check. @param[in] Status EFI_STATUS value to check.
**/ **/
#define UT_ASSERT_NOT_EFI_ERROR(Status) \ #define UT_ASSERT_NOT_EFI_ERROR(Status) \
if(!UnitTestAssertNotEfiError ((Status), __FUNCTION__, __LINE__, __FILE__, #Status)) { \ if(!UnitTestAssertNotEfiError ((Status), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Status)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \ return UNIT_TEST_ERROR_TEST_FAILED; \
} }
/** /**
@ -424,9 +424,9 @@ SaveFrameworkState (
@param[in] Status EFI_STATUS values to compare for equality. @param[in] Status EFI_STATUS values to compare for equality.
@param[in] Expected EFI_STATUS values to compare for equality. @param[in] Expected EFI_STATUS values to compare for equality.
**/ **/
#define UT_ASSERT_STATUS_EQUAL(Status, Expected) \ #define UT_ASSERT_STATUS_EQUAL(Status, Expected) \
if(!UnitTestAssertStatusEqual ((Status), (Expected), __FUNCTION__, __LINE__, __FILE__, #Status)) { \ if(!UnitTestAssertStatusEqual ((Status), (Expected), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Status)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \ return UNIT_TEST_ERROR_TEST_FAILED; \
} }
/** /**
@ -436,9 +436,9 @@ SaveFrameworkState (
@param[in] Pointer Pointer to be checked against NULL. @param[in] Pointer Pointer to be checked against NULL.
**/ **/
#define UT_ASSERT_NOT_NULL(Pointer) \ #define UT_ASSERT_NOT_NULL(Pointer) \
if(!UnitTestAssertNotNull ((Pointer), __FUNCTION__, __LINE__, __FILE__, #Pointer)) { \ if(!UnitTestAssertNotNull ((Pointer), __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, #Pointer)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \ return UNIT_TEST_ERROR_TEST_FAILED; \
} }
/** /**
@ -482,7 +482,7 @@ SaveFrameworkState (
} \ } \
if (!UnitTestExpectAssertFailure ( \ if (!UnitTestExpectAssertFailure ( \
UnitTestJumpStatus, \ UnitTestJumpStatus, \
__FUNCTION__, __LINE__, __FILE__, \ __FUNCTION__, DEBUG_LINE_NUMBER, __FILE__, \
#FunctionCall, Status)) { \ #FunctionCall, Status)) { \
return UNIT_TEST_ERROR_TEST_FAILED; \ return UNIT_TEST_ERROR_TEST_FAILED; \
} \ } \

View File

@ -17,7 +17,7 @@
if (!(Expression)) { \ if (!(Expression)) { \
DEBUG ((DEBUG_VERBOSE, \ DEBUG ((DEBUG_VERBOSE, \
"%a(%d) %a: SAFE_STRING_CONSTRAINT_CHECK(%a) failed. Return %r\n", \ "%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; \ return Status; \
} \ } \
} while (FALSE) } while (FALSE)