From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.5006.1628670782506442130 for ; Wed, 11 Aug 2021 01:33:02 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=qvhWBYDc; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: hao.a.wu@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10072"; a="278829654" X-IronPort-AV: E=Sophos;i="5.84,311,1620716400"; d="scan'208";a="278829654" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2021 01:33:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,311,1620716400"; d="scan'208";a="460676554" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga007.jf.intel.com with ESMTP; 11 Aug 2021 01:33:00 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Wed, 11 Aug 2021 01:33:00 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Wed, 11 Aug 2021 01:33:00 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Wed, 11 Aug 2021 01:33:00 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.168) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Wed, 11 Aug 2021 01:32:59 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CWA2iDKtW4LoRdaPLqfxKWQUD2+sJ2MbPs8yFhpOBnkx7KWqLPsed11wwmj2fl/e+NNMi9JBjj+hDsfn8IfkA/x0AaLq46QMrXPOdDxaLXUpS/eWSQ15+W5bSLwvYjQnSez1bjWlXDEpVgLx2tGjCBG3IWgR8Q1c59gp9OOdvod1GhPzYrLp8oV2oHEV/Riv/Yb8CSAtofSLeNLlRR4kLnVu40LUyccbMu5EQ543HoIfuA5m17lYikWC3O33QzW2gBvhgFahYqrVqHEq3Uxm3T6ChGAMfQU6IraRWSZgQPmlbuPpLna9MzM4nftTldo/yoNO0TksMBjBP3G6p1Pa/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wB/KN+R6lL45Qan1XOTTVHYm2WXoDcN9vJ+h91p6P4M=; b=ISTc1FbC2pV+Z6B9Cjv5fiOXC+N17ca2xcGht6NKBSASskwXiT9bar+fgM1VksUxEmarjDF+KZI0P1FLRPXWlHHxzlHKSzzuqZ0OCrs6Y87K+MQFDI6Lhk87xp8OeWG4M8JluHcy/WFvgGH6NMWOc3PFnYokfUzKQNaSECCELB9m7hur3+rONBVls8syd3S2cM5pLdfwmBRz3ovMQChU96jOh7KnxtkDYhkkHakrWeTji+HRwNS4U6FY4W8NAaInmip/f7SkDYibAToggOB4to9O3MZ5pcwt7x0YVEcsJeuGlIaj4Kwl3U7If4YdXos2OiIiUS+CVAJxhL5KvDAoJw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wB/KN+R6lL45Qan1XOTTVHYm2WXoDcN9vJ+h91p6P4M=; b=qvhWBYDcjvbD8ztfIyAg9EhZtcHkGntvG8tY1fFWTS+2thtFfqujJZEQa4OYKJDidSpNahxjNuKmMk9JJw1GLvJ720T2/24UKR/0fWp23kCotCvrzvovO0rNDg2783d+EM/unA6wNVMztqXxJQZ91KRDbM6A3wBZqpSWltIhU2w= Received: from BN8PR11MB3666.namprd11.prod.outlook.com (2603:10b6:408:8c::19) by BN6PR11MB3905.namprd11.prod.outlook.com (2603:10b6:405:82::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.15; Wed, 11 Aug 2021 08:32:58 +0000 Received: from BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::1d8:daf8:84de:1666]) by BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::1d8:daf8:84de:1666%3]) with mapi id 15.20.4415.014; Wed, 11 Aug 2021 08:32:58 +0000 From: "Wu, Hao A" To: Liming Gao , Wenyi Xie , "devel@edk2.groups.io" CC: "songdongkuang@huawei.com" , "Wang, Jian J" Subject: Re: [PATCH EDK2 v3 1/1] MdeModulePkg/UefiSortLib:Add UefiSortLib unit test Thread-Topic: [PATCH EDK2 v3 1/1] MdeModulePkg/UefiSortLib:Add UefiSortLib unit test Thread-Index: AQHXjnvRcnhD2PTm1kWsVTZ/J89Frqtt5z7g Date: Wed, 11 Aug 2021 08:32:57 +0000 Message-ID: References: <1628663739-122023-1-git-send-email-xiewenyi2@huawei.com> <1628663739-122023-2-git-send-email-xiewenyi2@huawei.com> In-Reply-To: <1628663739-122023-2-git-send-email-xiewenyi2@huawei.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: byosoft.com.cn; dkim=none (message not signed) header.d=none;byosoft.com.cn; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 58cd7ddb-c37c-4ec2-729f-08d95ca29fd7 x-ms-traffictypediagnostic: BN6PR11MB3905: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: KOD3AfmyBz6RBgbbc61HXshdLu3AgjlOCiXeiDtx5FvV8LxSxbVLgJr+GxRz44g5D97h8/qKJTEnDXDKAh7xCNzQjzuAdU029PEWna4pONEZrF7P75QJGYTQIAIiBVrTp0ywYDX+u1YvYXWew/5LL9wGcId+QNt0vm5FY7JX+qN3DdNQgnhQhaJe0L0pcQFl/7o5ZtoEtKW9okFm1XJKnNGgEgwgY0tp6SNBulryP5CuvzIN3DOnx6ozjU2jcqw3OniYn6QtR8qyu9BxAtum/X0O+EkvJrPOmPe+qBP41aNiR6qG+9qNPifADri1Id1Iv1XBG2/Q4xteOZUQWraEXbCiINdH2OgTBuodWAjU3kZPBmP+qqtYklwOqw6a6/su8K3eBHaGHl2oo/5HIlumUgxXenzYhSnAMVFASV+eqjGBHOv471ERWAvP5BLLBY+zuh2OQFYjib33Qw/hTxLBty4Uy03ZXaliSy5k+NYGxhlUdToz2a99QEz0XXY8qVcibvNnS3fZJNfq1OZFMI4jUgd+5IWDT8ER9VR6mjJxiPcV9nv7oTCoJGZYJtne27G8TnwbQpYLLxJa4GS4vqOjd4iAYRdHEznARRXIm8A33NT3z5GHvMM+7IXqdgDjlgXUZKKfYoI3am6ytW+K6V3l0wU4MHe1y2k5bn9800dxV3gFm2m1A9QezVSvnwZIPq4Rk2j5rb2X2fPpq28Bl9D6PyJ1ll55HXh7u9Iaqctz9I0+jr3G+ene8NAjRXRiTbtcI93BlA2w+FSqkbAFl/3FimuPALLLq3wAVL0PoAffe+4= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR11MB3666.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(346002)(376002)(136003)(396003)(39860400002)(26005)(33656002)(122000001)(478600001)(38100700002)(76116006)(66476007)(66556008)(64756008)(66446008)(66946007)(71200400001)(110136005)(186003)(54906003)(107886003)(8676002)(8936002)(52536014)(316002)(4326008)(2906002)(86362001)(5660300002)(7696005)(83380400001)(9686003)(38070700005)(55016002)(6506007)(53546011);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?n7LYKwUZzvLCouI2gjXBoALUPbzP2hn9lwzvCy89BBUD0WSTCfk67eLNpOH6?= =?us-ascii?Q?r0uKs4ANErmvYELPXopniI/j3s0HGsxETjtoBWC3wmfhWfR5wDGIYZHlaWSt?= =?us-ascii?Q?KgRuuC+L+jfm2ZcVh7t9UpDSPb5lNb7rirp80Q836Y697ZpHwVqyEpE4DWo0?= =?us-ascii?Q?MPxHNqRmi7IzSwD2VyWL375q1L1kIVAvubzGWxnPqUjIMlbYfJ9elHJlZ3ry?= =?us-ascii?Q?gC9cSKlY2+TGPTygkiYWL203qrdXfoChPlrskbu7Gco11248ET2V0RruNEij?= =?us-ascii?Q?98OnFmXxrlv1yOy8s4NhKg71XuHA52WOT5czm7VdV9qphbIE+wIv/Hs63qe8?= =?us-ascii?Q?R7FtQNO70Wvbyl72CTeb+uuPQ9nfgTje6b0rVbdOv5Al+ctjJ1F2R0eunYyV?= =?us-ascii?Q?YijJt1ysL/1ggnJUZVpMQ9gKDVgw3LE/oVG9n/F6i5zsxWCsrHsmNZDPyoIp?= =?us-ascii?Q?iX2vMCkfeM4FdDKj+s6L4/Z11YQwO15aVf0iC/uea+mmv1FlpB1h4Rj5+LTF?= =?us-ascii?Q?YUqBPVXDTDWbOxvZ1GSF33r3ct17dU7mvQcIFBJ/keajY1lF9JmnY3viUcR2?= =?us-ascii?Q?ofKdfR/Ic/c10N8rSUSdPoVCDjhm0/oRhV1axL+Ww1H5o7d+jc8MyWfRwoGf?= =?us-ascii?Q?bCdWblKoBKR5oswK0qfJgvRsdUlHLKNqs7arrpDnB8mhxGOAjB4AE0xyLq3S?= =?us-ascii?Q?xFMOm95iJcvPWmwtksUmpE1Ov+idKZjMYFFRTbYmvwNt5KSYcWMV9rs0YVvf?= =?us-ascii?Q?lUtitnU83/FqDWI+xha2Somb8WLlsp32Wx9k3sBHITc0i5ZHURSVXQYarcff?= =?us-ascii?Q?Hh89+IrVIZ2xvSVoy+YA0XOrYLkGyhVGopfQDYIzI8mpoWrAbdg5+qE/i4o9?= =?us-ascii?Q?kcdCbWvdyhl11/FzBf3O7Qg5OHlya2jszxX6Qx2VIzyNSKN6QnOLgROkEu2G?= =?us-ascii?Q?grBopoyQtDPlQ/x8UUJJDv/RXPE7NdYF42h2GPUMv5sWqurGTgbXO8Bn48QJ?= =?us-ascii?Q?JI+SKKDWhu18IPw54g/zSAh9zqp6LZ5NJ28II0EQ0mpVq/wAv+3NubeEE73P?= =?us-ascii?Q?zI0A/mWCk99Pw9yiayjFCIaNPke7WgtSYefKoqpic3gGy3t5Ac8mZkgGKq/B?= =?us-ascii?Q?lZM+7sX+QwJEC4nHnkL1ovjHG/Cd9K/Lvq1KqX7x8nuvQyVxNrxYmMdR+hgU?= =?us-ascii?Q?t4uyZQDjsgZEH4q5s5nytoOH1dQjlDWiS0e8pReeIXwx9W0j4UHiwEwT10Xx?= =?us-ascii?Q?Pbw/XCR69npiGRJsYO/aaVEEPxmH2zxQuiNZscar2JM3ERGiFIEJ1kurPMxx?= =?us-ascii?Q?7lg70KarH+VV60A9tJky6CFz?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR11MB3666.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 58cd7ddb-c37c-4ec2-729f-08d95ca29fd7 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Aug 2021 08:32:57.4396 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0bO15gxe6QWKzo70fqv3Ti+KBOIuwq+EIuwdcn86f7Trd6cYglkPTjMjYs+ZtohI1fPrOzQr/LTuFhdQ0I3CdQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB3905 Return-Path: hao.a.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Wenyi Xie > Sent: Wednesday, August 11, 2021 2:36 PM > To: devel@edk2.groups.io; Wang, Jian J ; Wu, Hao A > > Cc: songdongkuang@huawei.com; xiewenyi2@huawei.com > Subject: [PATCH EDK2 v3 1/1] MdeModulePkg/UefiSortLib:Add UefiSortLib > unit test >=20 > Adding two unit test case for UefiSortLib. One is a test on sorting an ar= ray of > UINT32 by using PerformQuickSort, another is a test on comparing the same > buffer by using StringCompare. > Add 'main' function name to ECC exception list to avoid ECC error. Reviewed-by: Hao A Wu Hello Liming, Since the patch looks more like a feature than a bugfix to me, I would like= to confirm that can I merge this change now? I already gave my 'R-b' tag for the V2 patch on 29th July, but met some ECC= check issues during previous merging attempt. I verified that the latest patch can pass the merging test (https://github.= com/tianocore/edk2/pull/1892). Best Regards, Hao Wu >=20 > Cc: Jian J Wang > Cc: Hao A Wu > Signed-off-by: Wenyi Xie > --- > MdeModulePkg/Test/MdeModulePkgHostTest.dsc | 6 = + > MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf | 32 > +++ > MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c | 207 > ++++++++++++++++++++ > MdeModulePkg/MdeModulePkg.ci.yaml | 1 = + > 4 files changed, 246 insertions(+) >=20 > diff --git a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc > b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc > index 4da4692c8451..c9ec835df65d 100644 > --- a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc > +++ b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc > @@ -41,3 +41,9 @@ [Components] > >=20 > gEfiMdeModulePkgTokenSpaceGuid.PcdAllowVariablePolicyEnforcementDis > able|TRUE > } > + > + MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf { > + > + UefiSortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf > + > + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf > + } > diff --git > a/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf > b/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf > new file mode 100644 > index 000000000000..85d8dcd69619 > --- /dev/null > +++ b/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.inf > @@ -0,0 +1,32 @@ > +## @file > +# This is a unit test for the UefiSortLib. > +# > +# Copyright (C) Huawei Technologies Co., Ltd. All rights reserved # > +SPDX-License-Identifier: BSD-2-Clause-Patent ## > + > +[Defines] > + INF_VERSION =3D 0x00010017 > + BASE_NAME =3D UefiSortLibUnitTest > + FILE_GUID =3D 271337A3-0D79-BA3E-BC03-714E518E3B1B > + VERSION_STRING =3D 1.0 > + MODULE_TYPE =3D HOST_APPLICATION > + > +# > +# The following information is for reference only and not required by th= e > build tools. > +# > +# VALID_ARCHITECTURES =3D IA32 X64 > +# > + > +[Sources] > + UefiSortLibUnitTest.c > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec > + > +[LibraryClasses] > + UnitTestLib > + DebugLib > + UefiSortLib > diff --git > a/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c > b/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c > new file mode 100644 > index 000000000000..4f44a02c5b5d > --- /dev/null > +++ b/MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c > @@ -0,0 +1,207 @@ > +/** @file > + Unit tests of the UefiSortLib > + > + Copyright (C) Huawei Technologies Co., Ltd. All rights reserved > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +#define UNIT_TEST_APP_NAME "UefiSortLib Unit Tests" > +#define UNIT_TEST_APP_VERSION "1.0" > + > +#define TEST_ARRAY_SIZE_9 9 > + > +/** > + The function is called by PerformQuickSort to compare int values. > + > + @param[in] Left The pointer to first buffer. > + @param[in] Right The pointer to second buffer. > + > + @retval 0 Buffer1 equal to Buffer2. > + @return <0 Buffer1 is less than Buffer2. > + @return >0 Buffer1 is greater than Buffer2. > + > +**/ > +INTN > +EFIAPI > +TestCompareFunction ( > + IN CONST VOID *Left, > + IN CONST VOID *Right > + ) > +{ > + if (*(UINT32*)Right > *(UINT32*)Left) { > + return 1; > + } else if (*(UINT32*)Right < *(UINT32*)Left) { > + return -1; > + } > + > + return 0; > +} > + > +/** > + Unit test for PerformQuickSort () API of the UefiSortLib. > + > + @param[in] Context [Optional] An optional parameter that enables: > + 1) test-case reuse with varied parameters and > + 2) test-case re-entry for Target tests that nee= d a > + reboot. This parameter is a VOID* and it is th= e > + responsibility of the test author to ensure tha= t the > + contents are well understood by all test cases = that may > + consume it. > + > + @retval UNIT_TEST_PASSED The Unit test has completed and = the > test > + case was successful. > + @retval UNIT_TEST_ERROR_TEST_FAILED A test case assertion has failed= . > +**/ > +UNIT_TEST_STATUS > +EFIAPI > +SortUINT32ArrayShouldSucceed ( > + IN UNIT_TEST_CONTEXT Context > + ) > +{ > + UINTN TestCount; > + UINT32 Index; > + UINT32 TestBuffer[TEST_ARRAY_SIZE_9]; > + UINT32 TestResult[TEST_ARRAY_SIZE_9]; > + > + TestCount =3D TEST_ARRAY_SIZE_9; > + for (Index =3D 0; Index < TEST_ARRAY_SIZE_9; Index++) { > + TestBuffer[Index] =3D Index + 1; > + TestResult[Index] =3D TEST_ARRAY_SIZE_9 - Index; } > + > + PerformQuickSort (TestBuffer, TestCount, sizeof (UINT32), > + (SORT_COMPARE)TestCompareFunction); > + UT_ASSERT_MEM_EQUAL (TestBuffer, TestResult, sizeof (UINT32) * > + TEST_ARRAY_SIZE_9); > + > + return UNIT_TEST_PASSED; > +} > + > +/** > + Unit test for StringCompare () API of the UefiSortLib. > + > + @param[in] Context [Optional] An optional parameter that enables: > + 1) test-case reuse with varied parameters and > + 2) test-case re-entry for Target tests that nee= d a > + reboot. This parameter is a VOID* and it is th= e > + responsibility of the test author to ensure tha= t the > + contents are well understood by all test cases = that may > + consume it. > + > + @retval UNIT_TEST_PASSED The Unit test has completed and = the > test > + case was successful. > + @retval UNIT_TEST_ERROR_TEST_FAILED A test case assertion has failed= . > +**/ > +UNIT_TEST_STATUS > +EFIAPI > +CompareSameBufferShouldSucceed ( > + IN UNIT_TEST_CONTEXT Context > + ) > +{ > + INTN retval; > + CONST CHAR16* TestBuffer[] =3D { L"abcdefg" }; > + > + retval =3D StringCompare (TestBuffer, TestBuffer); UT_ASSERT_TRUE > + (retval =3D=3D 0); > + > + return UNIT_TEST_PASSED; > +} > + > +/** > + Initialze the unit test framework, suite, and unit tests for the > + UefiSortLib and run the UefiSortLib unit test. > + > + @retval EFI_SUCCESS All test cases were dispatched. > + @retval EFI_OUT_OF_RESOURCES There are not enough resources > available to > + initialize the unit tests. > +**/ > +STATIC > +EFI_STATUS > +EFIAPI > +UnitTestingEntry ( > + VOID > + ) > +{ > + EFI_STATUS Status; > + UNIT_TEST_FRAMEWORK_HANDLE Framework; > + UNIT_TEST_SUITE_HANDLE SortTests; > + > + Framework =3D NULL; > + > + DEBUG(( DEBUG_INFO, "%a v%a\n", UNIT_TEST_APP_NAME, > + UNIT_TEST_APP_VERSION )); > + > + // > + // Start setting up the test framework for running the tests. > + // > + Status =3D InitUnitTestFramework (&Framework, UNIT_TEST_APP_NAME, > + gEfiCallerBaseName, UNIT_TEST_APP_VERSION); if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "Failed in InitUnitTestFramework. Status > =3D %r\n", Status)); > + goto EXIT; > + } > + > + // > + // Populate the UefiSortLib Unit Test Suite. > + // > + Status =3D CreateUnitTestSuite (&SortTests, Framework, "UefiSortLib > + Sort Tests", "UefiSortLib.SortLib", NULL, NULL); if (EFI_ERROR (Status= )) { > + DEBUG ((DEBUG_ERROR, "Failed in CreateUnitTestSuite for UefiSortLib > API Tests\n")); > + Status =3D EFI_OUT_OF_RESOURCES; > + goto EXIT; > + } > + > + // > + // > + --------------Suite--------Description------------Name--------------Fu > + nction----------------Pre---Post---Context----------- > + // > + AddTestCase (SortTests, "Sort the Array", "Sort", > SortUINT32ArrayShouldSucceed, NULL, NULL, NULL); > + AddTestCase (SortTests, "Compare the Buffer", "Compare", > CompareSameBufferShouldSucceed, NULL, NULL, NULL); > + > + // > + // Execute the tests. > + // > + Status =3D RunAllTestSuites (Framework); > + > +EXIT: > + if (Framework) { > + FreeUnitTestFramework (Framework); > + } > + > + return Status; > +} > + > +/// > +/// Avoid ECC error for function name that starts with lower case > +letter /// #define UefiSortLibUnitTestMain main > + > +/** > + Standard POSIX C entry point for host based unit test execution. > + > + @param[in] Argc Number of arguments > + @param[in] Argv Array of pointers to arguments > + > + @retval 0 Success > + @retval other Error > +**/ > +INT32 > +UefiSortLibUnitTestMain ( > + IN INT32 Argc, > + IN CHAR8 *Argv[] > + ) > +{ > + UnitTestingEntry (); > + return 0; > +} > diff --git a/MdeModulePkg/MdeModulePkg.ci.yaml > b/MdeModulePkg/MdeModulePkg.ci.yaml > index 8e01caf94cbf..aa304f2ccd5c 100644 > --- a/MdeModulePkg/MdeModulePkg.ci.yaml > +++ b/MdeModulePkg/MdeModulePkg.ci.yaml > @@ -19,6 +19,7 @@ > "ExceptionList": [ > "8005", "UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE.UID", > "8005", "UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE.HID", > + "8001", "UefiSortLibUnitTestMain", > ], > ## Both file path and directory path are accepted. > "IgnoreFiles": [ > -- > 2.20.1.windows.1