From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.19598.1628757306430580659 for ; Thu, 12 Aug 2021 01:35:06 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=M7tdDuNo; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: hao.a.wu@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10073"; a="194891476" X-IronPort-AV: E=Sophos;i="5.84,315,1620716400"; d="scan'208";a="194891476" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Aug 2021 01:35:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,315,1620716400"; d="scan'208";a="446408155" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by fmsmga007.fm.intel.com with ESMTP; 12 Aug 2021 01:35:05 -0700 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Thu, 12 Aug 2021 01:35:05 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Thu, 12 Aug 2021 01:35:04 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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; Thu, 12 Aug 2021 01:35:04 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Thu, 12 Aug 2021 01:35:04 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.46) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Thu, 12 Aug 2021 01:35:04 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nSL8qLZBkJTTx8LearhAM0J0ARMXUqdZKpwWE1gxZU/6ReNTHiO53wymXDjDG5UPqALi+HR5I9yzM6qpaejktVGc3kseskvaWtOy9jmVbc8LtFy/vbEoH05X/jN+bqLi5EEy+LlJZX7AHo3YQLh5tiSgrOnNChki55dEID5pE0OomM2fYifusvW7zLvdD+eEDXH9e8bcP/bMVE671kSQ/1pOWbuZcsRYxfL3xkA98lSfT+n8VTxnAUpRvvTItLZ0986V/+6NNNcpBbYPUsi7+iGItD3bGbEIVcKDK0pWWUcn6eUIHeNq8o/E4Mxoctjfxnz5f7rDEG81IgOAqzx6Gw== 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=sBFYDrwYh7jkB0WKLpi71jU7L7aAFz6JAv4omk5/Lxo=; b=NZOtLPbM5YnDAOZBbDlzvQ17DVxsY1lmYqhg/0WxOESC2+dVjVyAPmkjaMUB9HTKnFI5ouXWVHmwuztgXeUBfxaEtdXmF9hlTeYkpyzQ3/C/3WTyc8Efw0PAwE9QhTL8ytuVsjTYD2XW0fraqelhUS9pkDRH2Vo79vbZDfJl4pYZVdu/WNTu5xwSWriWNdWkyjfdVdUkgwzSCZJFQJ88q+cGB3uizUsJN2y+TUwXx7BeXcmLMqcFeZDByE15YRDBxKNJnHJZaNE/MGKSyCBntPnsaV3Sei6rYKJgE+8Zb9WSMfgRuvrq7up0BLETJ5QtOB8P0jrNsgN1Z4hd9sTY1w== 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=sBFYDrwYh7jkB0WKLpi71jU7L7aAFz6JAv4omk5/Lxo=; b=M7tdDuNoaHaZigdeCstMTblMqM60fCZD4uqraDmDAgVGlcwvd6uw+9fJ/5o6qNYmazyj4dNwAzhk45EnV1NgE/z33skRQs7gCbG8/mjbkkXzbyxs4Kzs2nbVSBHTiSOx7viD3dB3+Y1momqidKwVgEWdutNvGuN4NrDxLEPi7eQ= Received: from BN8PR11MB3666.namprd11.prod.outlook.com (2603:10b6:408:8c::19) by BN6PR11MB1282.namprd11.prod.outlook.com (2603:10b6:404:4a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.21; Thu, 12 Aug 2021 08:35:02 +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; Thu, 12 Aug 2021 08:35:02 +0000 From: "Wu, Hao A" To: "devel@edk2.groups.io" , "Wu, Hao A" , Liming Gao , Wenyi Xie CC: "songdongkuang@huawei.com" , "Wang, Jian J" Subject: Re: [edk2-devel] [PATCH EDK2 v3 1/1] MdeModulePkg/UefiSortLib:Add UefiSortLib unit test Thread-Topic: [edk2-devel] [PATCH EDK2 v3 1/1] MdeModulePkg/UefiSortLib:Add UefiSortLib unit test Thread-Index: AQHXjnvRcnhD2PTm1kWsVTZ/J89Frqtt5z7ggAGcU+A= Date: Thu, 12 Aug 2021 08:35:02 +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: 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: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0658c989-411c-4e04-5cbd-08d95d6c145a x-ms-traffictypediagnostic: BN6PR11MB1282: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: awXvk3JbNE3g3df18rWwnb1uTZgnK3jJ3AP3tjn8rYcjqGzgdMC2c6XaL/WYugHchPZhDsnvBMd+1ab0fdeKP91Bo8mM4jfYAg//6LAkoxixLJWC7zATcfMryW1ScDGtdC466nT9RPWgC0avY+roXGaSGy3OvDSIzVa8V4bKfxTBkGTVPUUobUacbjn+03vlx+dWqUgZUBWCuGsdFKP8vDv9RUPCTttOXMi3eguEefqDdoQEO/Prjm56YVY6yozNXDFJUsE1M5rVaBl8uV84XYr+OUD5qkAOJ19JqTGhLL6Yuj1gibOL/y+hr7Fz/bYdEtA5jNTBIUZGTLjYjgftUn985XbyVYUmWI38rdXKHClzA6hsM2gXFsF7qCQcseSdtFIFOI/8dRP6rRgnlCZXXgVg0he2ddtpDRp3QNd3x5S3gKRCGhFrlqOflgStRAakXTbpcGJeJ8rDRmcRdHZ6tV7NdkquIyVXsy3HDjYqTcqeK/41a40OHEV0A91jbMYLkSC5afKbFKwcILoImlfxbrOFPGHsS4dXyT/JUvF0eYHX5Ue7KUjxbdLd2PubUuwu+mROuT2jZjKRvTPh5uTBChsI319JUaP0YlvnehuvQ751Ch1ItTGJSzTC/1gyRo6azPwLLoAvCpfU1CithdzU7AR5w4BHfkX6fMqRqFEPg/WOK+2nErkEEtovFLdEZL96PR1GRFdXUF7dUr2qTm0Wt3ci01E9W2WgW9dLlHw1NWrmWBLSRzN6Wyd/T43jtwm1ZGC/iwwUtppEDfpD8so5YfAvtRAjgxuUhGPN1iNpQwGNo8HP2OXUYQCTs/1wxmA3hJanK75s4BXfyIm1W/lx3w== 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)(2906002)(9686003)(55016002)(52536014)(316002)(186003)(38070700005)(7696005)(86362001)(33656002)(107886003)(8936002)(4326008)(110136005)(54906003)(30864003)(83380400001)(966005)(5660300002)(71200400001)(26005)(122000001)(508600001)(38100700002)(8676002)(66556008)(53546011)(66446008)(66476007)(6506007)(66946007)(76116006)(64756008);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Uv3YzCXVxPAKpKCPE+SSKXZnlMIfeHu/6JdISirbukArOx7mWScu//vZ70mC?= =?us-ascii?Q?CVHLm9Q9LEKN24SdsXkJcanVolwWwpfdXvypk6MSk9CMg5dH4/R9uNwLwxkR?= =?us-ascii?Q?um0fTK5FLVN5SAUazk7ty7iJw6Ds/IArwaZFbRNRjWAFtkllW2orKPjXRm91?= =?us-ascii?Q?R9fGft5ornlVYz9ATXHSBe/dOF4xHsHRrIybNSPXSpOYhn+B+dNMHAZmLG1P?= =?us-ascii?Q?t0MMk/2yOcbWMuN5lWBoJSA4FFAPGEmw390PeJ+y8sM+p6EAofFBRCJfIupS?= =?us-ascii?Q?yp3Cl0A91LUVZrF3ye0B6wKs7OF3/bPYeKasCKC7/xlp3FgcVxOIoYKxAdp9?= =?us-ascii?Q?11UtQJ23sw5riZ5Gz5/XyfAZngX6Gv4hove7DMYam9ZzmJ+jU7RDDTPoTgxu?= =?us-ascii?Q?1cxdXq5ZyGUP1MkrmfKMbakfkMio5V05iXIjqjtmHexYzsyPC7tPzda/a6OV?= =?us-ascii?Q?BL+A7yn5J/u1SA3ir3n2Lw/VIRixrA00RBh973I+1fvjN9SQ3tcGJebyzuwx?= =?us-ascii?Q?MFo5nTdRxx0RM2LTpaTRYDs/iwsn2GZVkuMi1kAMPTWZP7t3ruAdFAPPFF3X?= =?us-ascii?Q?1WG0COzs/zAoDVDyYusWFvf9cg7hX+PoQcOKjztz0HdUuGcYbSGNC0y/uUU3?= =?us-ascii?Q?7IBPVnf7abnO6dASuyUA1s/y80QbrkJXSkgvwwbwQEOjZV0CyH4AB+8D6gYY?= =?us-ascii?Q?zarQLpzm6coa0eecDS+3KSRaYi91aGGgV4C5Prq1A4et1vXx9asaSwpuGDgq?= =?us-ascii?Q?T1/g72oHWCUR5SrQnfJ0CnGL7yfS8PDYgWy+GUZbhzmULUPD7w8IRG777nqe?= =?us-ascii?Q?e0TEWiLFbEOBLgxXwktlC5pDx+cXgnKP+9iJPdnVauN6odJGaA+ig79qku2A?= =?us-ascii?Q?Qy9ydZuvMlAhfnAHyHTuQi8+D9mW1lpul41VZJWPUDPVJ157Uon/zBayTsRy?= =?us-ascii?Q?obTouYGaawZ86Yo1cH5Lnqf8wq4aJvMBe9xGyJP7s5B5FNpOu+YJ+SVfqneI?= =?us-ascii?Q?D5R6lDMcsq2C0rzs10ChCs00S6gqMZlXv+1ecjNggYEKfV3BPJR25yMx933e?= =?us-ascii?Q?8RT0kVLu76+LqVLqwMiOtcAC2HzjDkDh/YTx1XQQP1TDuG5VBRRkhU3/CG0Q?= =?us-ascii?Q?yQeCRrZDwGo5Xyymfn6pGGaG7y04xBZHvevKOkHLKUIbDdRgpiw2P4BUnlyg?= =?us-ascii?Q?pFoUToYJoW9Md0bDAGYfmKHuzi0cqIJkfNVDDLctivUtGq+eyL14S3cjAfzW?= =?us-ascii?Q?eI9I7p4yCgcDK5m7dS/Y6tPLzgZsoeZ7kQd6mXRNFHqnRk5ulUve1ssRPsct?= =?us-ascii?Q?svUkNKH14GHSm8qpxTuEQbmI?= 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: 0658c989-411c-4e04-5cbd-08d95d6c145a X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Aug 2021 08:35:02.7414 (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: qfonorjgbnCUhmzsgGhzUPt5klBaGLWhrpx4rNqssqKS8p5N0/viw9PNJi+efgw9NRWUPMooyj7QeRu2xQzLqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1282 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: devel@edk2.groups.io On Behalf Of Wu, Hao > A > Sent: Wednesday, August 11, 2021 4:33 PM > To: Liming Gao ; Wenyi Xie > ; devel@edk2.groups.io > Cc: songdongkuang@huawei.com; Wang, Jian J > Subject: Re: [edk2-devel] [PATCH EDK2 v3 1/1] > MdeModulePkg/UefiSortLib:Add UefiSortLib unit test >=20 > > -----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 > > > > Adding two unit test case for UefiSortLib. One is a test on sorting an = array > 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. >=20 >=20 > Reviewed-by: Hao A Wu >=20 > Hello Liming, >=20 > Since the patch looks more like a feature than a bugfix to me, I would li= ke 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 E= CC > check issues during previous merging attempt. > I verified that the latest patch can pass the merging test > (https://github.com/tianocore/edk2/pull/1892). Since no objection received, pushed via: PR - https://github.com/tianocore/edk2/pull/1892 Commit - https://github.com/tianocore/edk2/commit/ac826886c98524e918753419c= 039d8b44198943f If this commit breaks the Soft Feature Freeze rule, please help to raise. I= will revert it. Best Regards, Hao Wu >=20 > Best Regards, > Hao Wu >=20 >=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 | 3= 2 > > +++ > > MdeModulePkg/Library/UefiSortLib/UnitTest/UefiSortLibUnitTest.c | 20= 7 > > ++++++++++++++++++++ > > MdeModulePkg/MdeModulePkg.ci.yaml | = 1 + > > 4 files changed, 246 insertions(+) > > > > 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] > > > > > > > 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 = the > > 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 n= eed a > > + reboot. This parameter is a VOID* and it is = the > > + responsibility of the test author to ensure t= hat the > > + contents are well understood by all test case= s that may > > + consume it. > > + > > + @retval UNIT_TEST_PASSED The Unit test has completed an= d 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 n= eed a > > + reboot. This parameter is a VOID* and it is = the > > + responsibility of the test author to ensure t= hat the > > + contents are well understood by all test case= s that may > > + consume it. > > + > > + @retval UNIT_TEST_PASSED The Unit test has completed an= d 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 (Stat= us)) { > > + DEBUG ((DEBUG_ERROR, "Failed in CreateUnitTestSuite for UefiSortLi= b > > API Tests\n")); > > + Status =3D EFI_OUT_OF_RESOURCES; > > + goto EXIT; > > + } > > + > > + // > > + // > > + --------------Suite--------Description------------Name--------------F= u > > + 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 >=20 >=20 >=20 >=20 >=20