From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web11.906.1635802670411204424 for ; Mon, 01 Nov 2021 14:37:51 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: michael.d.kinney@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10155"; a="291964412" X-IronPort-AV: E=Sophos;i="5.87,200,1631602800"; d="scan'208";a="291964412" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2021 14:37:50 -0700 X-IronPort-AV: E=Sophos;i="5.87,200,1631602800"; d="scan'208";a="449113019" Received: from mdkinney-mobl2.amr.corp.intel.com ([10.209.76.205]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2021 14:37:49 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Liming Gao , Zhiguang Liu , Michael Kubacki Subject: [Patch V2 2/7] MdePkg: Reproduce builds across source format changes Date: Mon, 1 Nov 2021 14:37:32 -0700 Message-Id: <20211101213737.586-3-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.32.0.windows.1 In-Reply-To: <20211101213737.586-1-michael.d.kinney@intel.com> References: <20211101213737.586-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Cc: Zhiguang Liu Cc: Michael Kubacki Signed-off-by: Michael D Kinney --- 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