From nobody Tue Jan 14 22:25:57 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1513728033692151.13922895854216; Tue, 19 Dec 2017 16:00:33 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 26980221C1942; Tue, 19 Dec 2017 15:55:38 -0800 (PST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BAC17221523BF for ; Tue, 19 Dec 2017 15:55:35 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2017 16:00:22 -0800 Received: from mdkinney-mobl2.amr.corp.intel.com ([10.241.98.58]) by FMSMGA003.fm.intel.com with ESMTP; 19 Dec 2017 16:00:22 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=michael.d.kinney@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,429,1508828400"; d="scan'208";a="13197392" From: "Kinney, Michael D" To: edk2-devel@lists.01.org Date: Tue, 19 Dec 2017 16:00:07 -0800 Message-Id: <20171220000014.9140-4-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.14.2.windows.3 In-Reply-To: <20171220000014.9140-1-michael.d.kinney@intel.com> References: <20171220000014.9140-1-michael.d.kinney@intel.com> Subject: [edk2] [staging/edk2-test Patch 03/10] MsUnitTestPkg: Update for VS2017 and 32-bit apps X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael D Kinney , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Sean Brogan Cherry-picked from branch: https://github.com/Microsoft/MS_UEFI/tree/share/XmlAndUnitTest Commit: https://github.com/Microsoft/MS_UEFI/commit/d2901abfc9823c21d3a962fa69e025a= 92832466b * Update Unit Test framework with minor changes to allow 32 bit apps to work. * Update to support VS2017 compiler Cc: Sean Brogan Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney --- MsUnitTestPkg/Include/Library/UnitTestAssertLib.h | 12 ++++++--= ---- MsUnitTestPkg/Library/UnitTestAssertLib/UnitTestAssertLib.c | 8 ++++---- .../Library/UnitTestBootUsbClassLib/UnitTestBootUsb.c | 2 ++ MsUnitTestPkg/Library/UnitTestLib/UnitTestLib.c | 4 ++-- MsUnitTestPkg/Library/UnitTestLib/UnitTestLib.inf | 1 + MsUnitTestPkg/MsUnitTestPkg.dec | 7 +++++++ 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/MsUnitTestPkg/Include/Library/UnitTestAssertLib.h b/MsUnitTest= Pkg/Include/Library/UnitTestAssertLib.h index 9f942848f9..2ebc61b5ab 100644 --- a/MsUnitTestPkg/Include/Library/UnitTestAssertLib.h +++ b/MsUnitTestPkg/Include/Library/UnitTestAssertLib.h @@ -37,13 +37,13 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. if(!UnitTestAssertFalse( Framework, (Expression), __FUNCTION__, __LINE__= , #Expression )) { return UNIT_TEST_ERROR_TEST_FAILED;} =20 #define UT_ASSERT_EQUAL(ValueA, ValueB) \ - if(!UnitTestAssertEqual( Framework, (UINTN)ValueA, (UINTN)ValueB, __FUNC= TION__, __LINE__, #ValueA, #ValueB )) { return UNIT_TEST_ERROR_TEST_FAILED;} + if(!UnitTestAssertEqual( Framework, (UINT64)ValueA, (UINT64)ValueB, __FU= NCTION__, __LINE__, #ValueA, #ValueB )) { return UNIT_TEST_ERROR_TEST_FAILE= D;} =20 #define UT_ASSERT_MEM_EQUAL(ValueA, ValueB, Length) \ if(!UnitTestAssertMemEqual( Framework, (UINTN)ValueA, (UINTN)ValueB, (UI= NTN)Length, __FUNCTION__, __LINE__, #ValueA, #ValueB )) { return UNIT_TEST_= ERROR_TEST_FAILED;} =20 #define UT_ASSERT_NOT_EQUAL(ValueA, ValueB) \ - if(!UnitTestAssertNotEqual( Framework, ValueA, ValueB, __FUNCTION__, __L= INE__, #ValueA, #ValueB )) { return UNIT_TEST_ERROR_TEST_FAILED;} + if(!UnitTestAssertNotEqual( Framework, (UINT64)ValueA, (UINT64)ValueB, _= _FUNCTION__, __LINE__, #ValueA, #ValueB )) { return UNIT_TEST_ERROR_TEST_FA= ILED;} =20 #define UT_ASSERT_NOT_EFI_ERROR(Status) \ if(!UnitTestAssertNotEfiError( Framework, Status, __FUNCTION__, __LINE__= , #Status )) { return UNIT_TEST_ERROR_TEST_FAILED;} @@ -89,8 +89,8 @@ BOOLEAN EFIAPI UnitTestAssertEqual ( IN UNIT_TEST_FRAMEWORK_HANDLE Framework, - IN UINTN ValueA, - IN UINTN ValueB, + IN UINT64 ValueA, + IN UINT64 ValueB, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *DescriptionA, @@ -114,8 +114,8 @@ BOOLEAN EFIAPI UnitTestAssertNotEqual ( IN UNIT_TEST_FRAMEWORK_HANDLE Framework, - IN UINTN ValueA, - IN UINTN ValueB, + IN UINT64 ValueA, + IN UINT64 ValueB, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *DescriptionA, diff --git a/MsUnitTestPkg/Library/UnitTestAssertLib/UnitTestAssertLib.c b/= MsUnitTestPkg/Library/UnitTestAssertLib/UnitTestAssertLib.c index 94279c7056..5721102818 100644 --- a/MsUnitTestPkg/Library/UnitTestAssertLib/UnitTestAssertLib.c +++ b/MsUnitTestPkg/Library/UnitTestAssertLib/UnitTestAssertLib.c @@ -93,8 +93,8 @@ BOOLEAN EFIAPI UnitTestAssertEqual ( IN UNIT_TEST_FRAMEWORK_HANDLE Framework, - IN UINTN ValueA, - IN UINTN ValueB, + IN UINT64 ValueA, + IN UINT64 ValueB, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *DescriptionA, @@ -136,8 +136,8 @@ BOOLEAN EFIAPI UnitTestAssertNotEqual ( IN UNIT_TEST_FRAMEWORK_HANDLE Framework, - IN UINTN ValueA, - IN UINTN ValueB, + IN UINT64 ValueA, + IN UINT64 ValueB, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *DescriptionA, diff --git a/MsUnitTestPkg/Library/UnitTestBootUsbClassLib/UnitTestBootUsb.= c b/MsUnitTestPkg/Library/UnitTestBootUsbClassLib/UnitTestBootUsb.c index c176de726f..7fe82fb849 100644 --- a/MsUnitTestPkg/Library/UnitTestBootUsbClassLib/UnitTestBootUsb.c +++ b/MsUnitTestPkg/Library/UnitTestBootUsbClassLib/UnitTestBootUsb.c @@ -67,6 +67,7 @@ SetUsbBootNext( if (DpEnd =3D=3D NULL) { DEBUG((DEBUG_ERROR, __FUNCTION__ ": Unable to create device path. DpE= nd is NULL.\n")); + Status =3D EFI_OUT_OF_RESOURCES; goto CLEANUP; } =20 @@ -74,6 +75,7 @@ SetUsbBootNext( if (Dp =3D=3D NULL) { DEBUG((DEBUG_ERROR, __FUNCTION__ ": Unable to create device path. Dp = is NULL.\n")); + Status =3D EFI_OUT_OF_RESOURCES; goto CLEANUP; } =20 diff --git a/MsUnitTestPkg/Library/UnitTestLib/UnitTestLib.c b/MsUnitTestPk= g/Library/UnitTestLib/UnitTestLib.c index 53ce0792fb..bc4176d36e 100644 --- a/MsUnitTestPkg/Library/UnitTestLib/UnitTestLib.c +++ b/MsUnitTestPkg/Library/UnitTestLib/UnitTestLib.c @@ -654,7 +654,7 @@ UpdateTestFromSave ( Test->Result =3D MatchingTest->Result; =20 Test->FailureType =3D MatchingTest->FailureType; - StrnCpy(&Test->FailureMessage[0], &MatchingTest->FailureMessage[0], UN= IT_TEST_TESTFAILUREMSG_LENGTH); + StrnCpyS(&Test->FailureMessage[0], UNIT_TEST_TESTFAILUREMSG_LENGTH, &M= atchingTest->FailureMessage[0], UNIT_TEST_TESTFAILUREMSG_LENGTH); =20 // If there is a log string associated, grab that. // We can tell that there's a log string because the "size" will be la= rger than @@ -795,7 +795,7 @@ SerializeState ( // Save the result. TestSaveData->Result =3D UnitTest->Result; TestSaveData->FailureType =3D UnitTest->FailureType; - StrnCpy(&TestSaveData->FailureMessage[0], &UnitTest->FailureMessage[= 0], UNIT_TEST_TESTFAILUREMSG_LENGTH); + StrnCpyS(&TestSaveData->FailureMessage[0], UNIT_TEST_TESTFAILUREMSG_= LENGTH, &UnitTest->FailureMessage[0], UNIT_TEST_TESTFAILUREMSG_LENGTH); =20 =20 // If there is a log, save the log. diff --git a/MsUnitTestPkg/Library/UnitTestLib/UnitTestLib.inf b/MsUnitTest= Pkg/Library/UnitTestLib/UnitTestLib.inf index d85db8ebb9..a6576e1b85 100644 --- a/MsUnitTestPkg/Library/UnitTestLib/UnitTestLib.inf +++ b/MsUnitTestPkg/Library/UnitTestLib/UnitTestLib.inf @@ -39,6 +39,7 @@ LIBRARY_CLASS =3D UnitTestLib|DXE_DRIVER UEFI_APPLICATI= ON DebugLib MemoryAllocationLib BaseMemoryLib + BaseLib UefiRuntimeServicesTableLib UefiLib UnitTestLogLib diff --git a/MsUnitTestPkg/MsUnitTestPkg.dec b/MsUnitTestPkg/MsUnitTestPkg.= dec index 86c481d47d..9bc205c377 100644 --- a/MsUnitTestPkg/MsUnitTestPkg.dec +++ b/MsUnitTestPkg/MsUnitTestPkg.dec @@ -39,6 +39,13 @@ =20 [LibraryClasses] =20 + ## @libraryclass Provides a unit test framework + # + UnitTestLib|Include\Library\UnitTestLib.h + + ## @libraryclass Provide unit test assert helpers + # + UnitTestAssertLib|Include\Library\UnitTestAssertLib.h =20 [Guids] =20 --=20 2.14.2.windows.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel