From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.107.243.98]) by mx.groups.io with SMTP id smtpd.web10.213.1594785987493120591 for ; Tue, 14 Jul 2020 21:06:27 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=brDfjdFG; spf=pass (domain: microsoft.com, ip: 40.107.243.98, mailfrom: bret.barkelew@microsoft.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G4sFufPS9nOc3gVmB0kWldtApE+0W9URqtyBRuo2y82MpO9uf7GOInbiWmTECtrdDL9GZmen3TSWWvFHvI3upygQ3KT4YgHD2ghjn9hjBFQcaPQ+6gRspsHeH6nnUm4crhHZ/hQBN1tSKmxM3SPVbCiadKqMOtOsXgaLopbDI84+6H3JNJTCa7jU9ZaKDt26SD6rXA9Nhr/SY6dd+Hdp5bN60gwhl40esbQS4W1PfVwVdiWtHb6YHXd00LU/EqgRxn76AZpILswjnSeF4cmFEcxvj8QW6iyCNHfiAVYfN7lYsXaCG0yGHD7+tQkYtLsAqx3jO0Zidl9+UigCJH/JZw== 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=20J6YmybCa9OWnNpPlycylZWQPWSUIgVq2MhfugkYI4=; b=HMXextX7c6KDfYMpjvRFm4Cgmn8k4JN7RZCNCrS+J2zWSVyxLGX4Vu6cFYva4/7vMGk5so74XKjSEG6g1jwdi3VPRiqHze4LT3yjiQZS5VPCBZq8jRLi1R7bPGCBI97YHgqVy7lEnytXrdgFSVRNhJBlOzzxomFYtKKATBo5AdVEHkz8r1Cxtl+9PLXsqckgrZNwaMnoL7lxaisRHPzttTKaoHQ0OhIyQhR6qR7KqxT5Apry0bpy+6SDsWFjaof8oEkd0vpSCGpXyFQvCxcfs6SRuRNbKRhtkGqyLMwaSDwsbMhiBMULk0WYbjFNfh8GOEXV9L6pXV3CZTQZJlNWrw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=20J6YmybCa9OWnNpPlycylZWQPWSUIgVq2MhfugkYI4=; b=brDfjdFGsfcPDkVMj70p16wpnUppfs+6zW4D8xBOseYBESmb9Uun5E5nmqPf4I9VGT5ZfVQfF7Ab0ZTlHWY+OU6Qd+LFIXkg+UUxzWienNK4dfhzYpLsHOoJ3G0FJzNmyTkc7HTmBp0o4kE9+8Wwnb+sucxrGf1VgVoMLnS6lK8= Received: from CY4PR21MB0743.namprd21.prod.outlook.com (2603:10b6:903:b2::9) by CY4PR21MB0504.namprd21.prod.outlook.com (2603:10b6:903:dc::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.7; Wed, 15 Jul 2020 04:06:25 +0000 Received: from CY4PR21MB0743.namprd21.prod.outlook.com ([fe80::f112:82fb:d4fd:f7dd]) by CY4PR21MB0743.namprd21.prod.outlook.com ([fe80::f112:82fb:d4fd:f7dd%10]) with mapi id 15.20.3216.008; Wed, 15 Jul 2020 04:06:25 +0000 From: "Bret Barkelew" To: "devel@edk2.groups.io" , liming.gao , "Kinney, Michael D" Subject: Re: [edk2-devel] [Patch v3 00/16] UnitTestFrameworkPkg: Enhancements and bug fixes Thread-Topic: [edk2-devel] [Patch v3 00/16] UnitTestFrameworkPkg: Enhancements and bug fixes Thread-Index: AQHWWauyMY5DViv1aEqXf8PD3x0PG6kIB0Jk Date: Wed, 15 Jul 2020 04:06:25 +0000 Message-ID: References: <20200711020904.24116-1-michael.d.kinney@intel.com>, In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2020-07-15T04:06:21.8674512Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Privileged authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [174.21.66.92] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 4dd82726-4195-4ebd-4819-08d828747184 x-ms-traffictypediagnostic: CY4PR21MB0504: x-ld-processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: KBD/p4LyoHpqW4fMZ2w1VuDqx9ayQGanFMxgBbiazmAAHBbXC3Ji16nnAmW1/Cice1vR8V3Gbg/BTK+koCwSsJRgpTBa8iVd2o4dauIym7i4JfJ3FdBPv2V47kYVp9ozhmb3usNeebjpfgzT7TQ9m/j5sp6WToTIVUrm7Fd6OfMr/BZkzrrSzPnwQuEahjuXNf/LUNyjRX4N0U+ZR2YHPPy9wnwCqhVP2jMq7dp/lCz1scDrciPChwVjI0REy5/h5nuKLCjF2Fhy5iE8nP+4CYFFpxd/yTR5ooip1jT4y76X0wYTMLVK+JYfrm7tf/sv74MBrjchKqQfLgPOKcxQw32A49snn5H9SyMF0LFBj5dDiSd40c2s7DBoTaGqbv4IT+z/1z+tNKwkX4lONSpYjw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR21MB0743.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(346002)(136003)(376002)(396003)(366004)(39860400002)(186003)(91956017)(316002)(66476007)(82950400001)(6506007)(30864003)(82960400001)(76116006)(52536014)(66556008)(2906002)(64756008)(110136005)(66946007)(8990500004)(166002)(55016002)(53546011)(9686003)(7696005)(86362001)(8676002)(5660300002)(966005)(26005)(83380400001)(10290500003)(71200400001)(478600001)(66446008)(33656002)(8936002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: pX0x9UCC1xS/5Z/+gsDEtoUmE3EanUBo3DdKj1LM++f/7z30alBpeOIRkFxOKcGoJprxD0vo0m7vFU2SrQPIx2ravrJpHJte7gmU9rrlgMpv+ESrQvNi08tkW1NCPe7KA77bWsvXxVYXoALDEo54hIqQpS5R/2IOhuQ4tzPznw8eJjRa34ja0PfuJ4pQDr7JKAulPzPktx106vEPy57Xzfqk3IA7+Wu6fVGAj+p2qegZHE5QvNqAHStd+QOEp4H8DNJdYim8K0HtvS0RTJ6QyJdmDlqXXK74UL4A6M2VYrCL0GnzAiL3rjSoUMJH+5GZml87eDh69bVqi40OE71BgzHTH3SzoY8yOtyRmimND0ZWxMBxsoeUTHA6LV24r/tepUd67m9dLGf0U6s7B65ZTtsoBTBz6pSGKdrq+BTxvfGCm6xOo7oZXyW+EHBNxYtrZfbNtc7uCcQu24tZXfMJ/d4isurefi244xJYjh+0lFc= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR21MB0743.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4dd82726-4195-4ebd-4819-08d828747184 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jul 2020 04:06:25.7427 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: UFqmFwT0FatO12tqFKKDcDWvsZDdPE80BKFMuWvGIn2lLjzjx13IVnGZqvVVns3UXS981XW2kVgR1aTJNrR9hg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0504 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_CY4PR21MB0743D5B62080452860A33926EF7E0CY4PR21MB0743namp_" --_000_CY4PR21MB0743D5B62080452860A33926EF7E0CY4PR21MB0743namp_ Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bret Barkelew - Bret ________________________________ From: devel@edk2.groups.io on behalf of Liming Gao = via groups.io Sent: Monday, July 13, 2020 11:54:53 PM To: devel@edk2.groups.io ; Kinney, Michael D Subject: [EXTERNAL] Re: [edk2-devel] [Patch v3 00/16] UnitTestFrameworkPkg= : Enhancements and bug fixes Mike: Thanks for your update. This patch set is good to me. Reviewed-by: Liming= Gao Thanks Liming -----Original Message----- From: devel@edk2.groups.io On Behalf Of Michael D K= inney Sent: 2020=1B$BG/=1B(B7=1B$B7n=1B(B11=1B$BF|=1B(B 10:09 To: devel@edk2.groups.io Subject: [edk2-devel] [Patch v3 00/16] UnitTestFrameworkPkg: Enhancements = and bug fixes Changes in V3 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D * Add UnitTestHostBaseLib class for the global variable that allows host based unit tests to hook and emulate some BaseLib services Changes in V2 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D * Add UnitTestExpectAssertFailure() to UnitTestLib to simplify the macro UT_EXPECT_ASSERT_FAILURE() and provide better log messages. * Expand UnitTestFrameworkPkg sample unit tests to cover test cases for th= e new UT_EXPECT_ASSERT_FAILURE() macro and all other UnitTestLib macros. * Add failure type FAILURETYPE_EXPECTASSERT when the macro UT_EXPECT_ASSERT_FAILURE() does not detect an ASSERT(). * Move print of log messages to end of cleanup function to support log messages generated in a cleanup function. * Update running of target-based tests to use SetJump()/LongJump() around prereq, cleanup, and unit test functions to match the behavior of host based tests using cmocka. This also requires all UnitTestLib Assert functions to generate error log message first and then call UnitTestFailure() where the LongJump() is made to make sure all log messages are added before the LongJump(). REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fb= ugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2797&data=3D02%7C01%7CBret.= Barkelew%40microsoft.com%7Cdb2bad178b6044d37e1208d827c2d38e%7C72f988bf86f14= 1af91ab2d7cd011db47%7C1%7C0%7C637303065010616592&sdata=3DCvs4rSfp%2FUl1= 5lR331i0WOqsz0X0XGYc9nPu%2FFu5Ce0%3D&reserved=3D0 REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fb= ugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2798&data=3D02%7C01%7CBret.= Barkelew%40microsoft.com%7Cdb2bad178b6044d37e1208d827c2d38e%7C72f988bf86f14= 1af91ab2d7cd011db47%7C1%7C0%7C637303065010616592&sdata=3DgKBdHVSP%2F3Qm= wmX%2FAhCjQcIC6BMU%2F8yx6BM03VYaugo%3D&reserved=3D0 REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fb= ugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2799&data=3D02%7C01%7CBret.= Barkelew%40microsoft.com%7Cdb2bad178b6044d37e1208d827c2d38e%7C72f988bf86f14= 1af91ab2d7cd011db47%7C1%7C0%7C637303065010616592&sdata=3DeBVwmQgDnQLCOK= hIybCJ8nn9CU43aO3shuTlUSxzC%2BM%3D&reserved=3D0 REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fb= ugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2800&data=3D02%7C01%7CBret.= Barkelew%40microsoft.com%7Cdb2bad178b6044d37e1208d827c2d38e%7C72f988bf86f14= 1af91ab2d7cd011db47%7C1%7C0%7C637303065010616592&sdata=3D7sFBxWZvhxXfiL= AyCgaExGqAW%2F8yfIU0p2hlMLK4XUg%3D&reserved=3D0 REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fb= ugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2801&data=3D02%7C01%7CBret.= Barkelew%40microsoft.com%7Cdb2bad178b6044d37e1208d827c2d38e%7C72f988bf86f14= 1af91ab2d7cd011db47%7C1%7C0%7C637303065010616592&sdata=3DjYoltIH%2BvS43= A1b5koMYdK0bnmPt8Pa4tz6QkbezYc4%3D&reserved=3D0 REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fb= ugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2803&data=3D02%7C01%7CBret.= Barkelew%40microsoft.com%7Cdb2bad178b6044d37e1208d827c2d38e%7C72f988bf86f14= 1af91ab2d7cd011db47%7C1%7C0%7C637303065010616592&sdata=3DNeyrn2INlcMtlJ= %2BbS456GPRWVxb5ALL%2B9BcLMGqX69Q%3D&reserved=3D0 REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fb= ugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2804&data=3D02%7C01%7CBret.= Barkelew%40microsoft.com%7Cdb2bad178b6044d37e1208d827c2d38e%7C72f988bf86f14= 1af91ab2d7cd011db47%7C1%7C0%7C637303065010616592&sdata=3DhkyOv8qhQ3iC%2= FwvqnayiBeot6AYwfRho%2FUmhfcVd0qo%3D&reserved=3D0 REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fb= ugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2805&data=3D02%7C01%7CBret.= Barkelew%40microsoft.com%7Cdb2bad178b6044d37e1208d827c2d38e%7C72f988bf86f14= 1af91ab2d7cd011db47%7C1%7C0%7C637303065010616592&sdata=3DTLvx%2FUylNXEy= MOBlikWOfnQHnbqyR1JiCm9uIod859Q%3D&reserved=3D0 REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fb= ugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2806&data=3D02%7C01%7CBret.= Barkelew%40microsoft.com%7Cdb2bad178b6044d37e1208d827c2d38e%7C72f988bf86f14= 1af91ab2d7cd011db47%7C1%7C0%7C637303065010616592&sdata=3DWh7uoily48Be5E= FItwd7o6whBtQZy82jh0cIDE%2FDrCY%3D&reserved=3D0 * Add Null base libraries for host based unit tests * Add host based test version of BaseLib with hooks for services that use privileged instructions. * Add new UT_EXPECT_ASSERT_FAILURE() macro to UnitTestLib class * Enable source level debug of unit tests * Increase stack size to 256KB for host based tests on Windows * Update BaseTools to support NULL libs for HOST_APPLICATION modules * Guarantee print log works even if unit test generates an exception * Use filename instead of function name in target mode logs Cc: Liming Gao liming.gao@intel.com Cc: Bob Feng bob.c.feng@intel.com Cc: Sean Brogan sean.brogan@microsoft.com Cc: Bret Barkelew Bret.Barkelew@microsoft.com Cc: Jiewen Yao jiewen.yao@intel.com Signed-off-by: Michael D Kinney michael.d.kinney@intel.com Michael D Kinney (16): BaseTools/Python: Allow HOST_APPLICATION to use NULL libraries MdePkg/BaseCpuLibNull: Add Null version of CpuLib for host testing MdePkg/BaseCacheMaintenanceLibNull: Add Null instance for host testing MdePkg/BaseLib: Break out IA32/X64 GCC inline privileged functions MdePkg/Library/BaseLib: Add BaseLib instance for host based unit tests UnitTestFrameworkPkg: Use host libraries from MdePkg UnitTestFrameworkPkg: Enable source level debug for host tests UnitTestFrameworkPkg: Set host application stack size to 256KB UnitTestFrameworkPkg: Change target mode DebugLib mapping UnitTestFrameworkPkg/UnitTestLib: Move print log into cleanup UnitTestFrameworkPkg/UnitTestLib: Fix target mode log messages UnitTestFrameworkPkg/UnitTestLib: Add checks for ASSERT() MdePkg/Include: Hook DebugLib _ASSERT() for unit tests MdePkg/Include: Add UT_EXPECT_ASSERT_FAILURE() to UnitTestLib MdePkg/Library/BaseStackCheckLib: Fix PCD type in INF UnitTestFramewokPkg/SampleUnitTest: Use UT_EXPECT_ASSERT_FAILURE() .../Python/Workspace/WorkspaceCommon.py | 4 +- MdePkg/Include/Library/DebugLib.h | 28 +- MdePkg/Include/Library/UnitTestLib.h | 90 + .../BaseCacheMaintenanceLibNull.c | 225 ++ .../BaseCacheMaintenanceLibNull.inf | 29 + .../BaseCacheMaintenanceLibNull.uni | 12 + .../Library/BaseCpuLibNull/BaseCpuLibNull.c | 37 + .../Library/BaseCpuLibNull/BaseCpuLibNull.inf | 26 + .../Library/BaseCpuLibNull/BaseCpuLibNull.uni | 11 + MdePkg/Library/BaseLib/BaseLib.inf | 4 +- MdePkg/Library/BaseLib/Ia32/GccInline.c | 1181 +------ .../Ia32/{GccInline.c =3D> GccInlinePriv.c} | 601 +--- MdePkg/Library/BaseLib/UnitTestHost.c | 140 + MdePkg/Library/BaseLib/UnitTestHost.h | 66 + .../Library/BaseLib/UnitTestHostBaseLib.inf | 217 ++ .../Library/BaseLib/UnitTestHostBaseLib.uni | 11 + MdePkg/Library/BaseLib/X64/GccInline.c | 1240 +------ .../X64/{GccInline.c =3D> GccInlinePriv.c} | 572 +--- MdePkg/Library/BaseLib/X86UnitTestHost.c | 2977 +++++++++++++++++ .../BaseStackCheckLib/BaseStackCheckLib.inf | 2 +- MdePkg/MdePkg.dec | 8 +- MdePkg/MdePkg.dsc | 4 +- MdePkg/Test/MdePkgHostTest.dsc | 5 + .../Include/Library/UnitTestHostBaseLib.h | 582 ++++ .../UnitTestDebugAssertLib.c | 49 + .../UnitTestDebugAssertLib.inf | 31 + .../UnitTestDebugAssertLib.uni | 11 + .../Library/UnitTestLib/Assert.c | 217 +- .../Library/UnitTestLib/AssertCmocka.c | 68 + .../Library/UnitTestLib/RunTests.c | 23 +- .../Library/UnitTestLib/RunTestsCmocka.c | 33 +- .../UnitTestResultReportLib.c | 3 +- .../PrivateInclude/UnitTestFrameworkTypes.h | 1 + .../Sample/SampleUnitTest/SampleUnitTest.c | 510 +++ .../SampleUnitTest/SampleUnitTestDxe.inf | 3 + .../SampleUnitTest/SampleUnitTestHost.inf | 3 + .../SampleUnitTest/SampleUnitTestPei.inf | 3 + .../SampleUnitTest/SampleUnitTestSmm.inf | 3 + .../SampleUnitTestUefiShell.inf | 3 + .../Test/UnitTestFrameworkPkgHostTest.dsc | 5 +- UnitTestFrameworkPkg/UnitTestFrameworkPkg.dsc | 4 + .../UnitTestFrameworkPkgHost.dsc.inc | 11 +- .../UnitTestFrameworkPkgTarget.dsc.inc | 10 +- 43 files changed, 5374 insertions(+), 3689 deletions(-) create mode 1006= 44 MdePkg/Library/BaseCacheMaintenanceLibNull/BaseCacheMaintenanceLibNull.c create mode 100644 MdePkg/Library/BaseCacheMaintenanceLibNull/BaseCacheMa= intenanceLibNull.inf create mode 100644 MdePkg/Library/BaseCacheMaintenanceLibNull/BaseCacheMa= intenanceLibNull.uni create mode 100644 MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.c create mode 100644 MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.inf create mode 100644 MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.uni copy MdePkg/Library/BaseLib/Ia32/{GccInline.c =3D> GccInlinePriv.c} (62%)= create mode 100644 MdePkg/Library/BaseLib/UnitTestHost.c create mode 100644 MdePkg/Library/BaseLib/UnitTestHost.h create mode 100644 MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf create mode 100644 MdePkg/Library/BaseLib/UnitTestHostBaseLib.uni copy MdePkg/Library/BaseLib/X64/{GccInline.c =3D> GccInlinePriv.c} (65%) = create mode 100644 MdePkg/Library/BaseLib/X86UnitTestHost.c create mode 100644 MdePkg/Test/UnitTest/Include/Library/UnitTestHostBaseL= ib.h create mode 100644 UnitTestFrameworkPkg/Library/UnitTestDebugAssertLib/Un= itTestDebugAssertLib.c create mode 100644 UnitTestFrameworkPkg/Library/UnitTestDebugAssertLib/Un= itTestDebugAssertLib.inf create mode 100644 UnitTestFrameworkPkg/Library/UnitTestDebugAssertLib/Un= itTestDebugAssertLib.uni -- 2.21.0.windows.1 --_000_CY4PR21MB0743D5B62080452860A33926EF7E0CY4PR21MB0743namp_ Content-Type: text/html; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable

Reviewed-by: Bret Barkelew <bret.barkelew@micros= oft.com>

 

 

- Bret

 


From: devel@edk2.groups.io= <devel@edk2.groups.io> on behalf of Liming Gao via groups.io <lim= ing.gao=3Dintel.com@groups.io>
Sent: Monday, July 13, 2020 11:54:53 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>; Kinney, Mich= ael D <michael.d.kinney@intel.com>
Subject: [EXTERNAL] Re: [edk2-devel] [Patch v3 00/16] UnitTestFrame= workPkg: Enhancements and bug fixes
 
Mike:
 Thanks for your update. This patch set is good to me. Reviewed-by: L= iming Gao <liming.gao@intel.com>

Thanks
Liming
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Micha= el D Kinney
Sent: 2020=1B$BG/=1B(B7=1B$B7n=1B(B11=1B$BF|=1B(B 10:09
To: devel@edk2.groups.io
Subject: [edk2-devel] [Patch v3 00/16] UnitTestFrameworkPkg: Enhancements = and bug fixes

Changes in V3
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
* Add UnitTestHostBaseLib class for the global variable that allows
  host based unit tests to hook and emulate some BaseLib services

Changes in V2
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
* Add UnitTestExpectAssertFailure() to UnitTestLib to simplify the macro   UT_EXPECT_ASSERT_FAILURE() and provide better log messages.
* Expand UnitTestFrameworkPkg sample unit tests to cover test cases for th= e new
  UT_EXPECT_ASSERT_FAILURE() macro and all other UnitTestLib macros.<= br> * Add failure type FAILURETYPE_EXPECTASSERT when the macro
  UT_EXPECT_ASSERT_FAILURE() does not detect an ASSERT().
* Move print of log messages to end of cleanup function to support log
  messages generated in a cleanup function.
* Update running of target-based tests to use SetJump()/LongJump()
  around prereq, cleanup, and unit test functions to match the behavi= or
  of host based tests using cmocka. This also requires all UnitTestLi= b
  Assert functions to generate error log message first and then call<= br>   UnitTestFailure() where the LongJump() is made to make sure all log=
  messages are added before the LongJump().

REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fbugzil= la.tianocore.org%2Fshow_bug.cgi%3Fid%3D2797&amp;data=3D02%7C01%7CBret.B= arkelew%40microsoft.com%7Cdb2bad178b6044d37e1208d827c2d38e%7C72f988bf86f141= af91ab2d7cd011db47%7C1%7C0%7C637303065010616592&amp;sdata=3DCvs4rSfp%2F= Ul15lR331i0WOqsz0X0XGYc9nPu%2FFu5Ce0%3D&amp;reserved=3D0
REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fbugzil= la.tianocore.org%2Fshow_bug.cgi%3Fid%3D2798&amp;data=3D02%7C01%7CBret.B= arkelew%40microsoft.com%7Cdb2bad178b6044d37e1208d827c2d38e%7C72f988bf86f141= af91ab2d7cd011db47%7C1%7C0%7C637303065010616592&amp;sdata=3DgKBdHVSP%2F= 3QmwmX%2FAhCjQcIC6BMU%2F8yx6BM03VYaugo%3D&amp;reserved=3D0
REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fbugzil= la.tianocore.org%2Fshow_bug.cgi%3Fid%3D2799&amp;data=3D02%7C01%7CBret.B= arkelew%40microsoft.com%7Cdb2bad178b6044d37e1208d827c2d38e%7C72f988bf86f141= af91ab2d7cd011db47%7C1%7C0%7C637303065010616592&amp;sdata=3DeBVwmQgDnQL= COKhIybCJ8nn9CU43aO3shuTlUSxzC%2BM%3D&amp;reserved=3D0
REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fbugzil= la.tianocore.org%2Fshow_bug.cgi%3Fid%3D2800&amp;data=3D02%7C01%7CBret.B= arkelew%40microsoft.com%7Cdb2bad178b6044d37e1208d827c2d38e%7C72f988bf86f141= af91ab2d7cd011db47%7C1%7C0%7C637303065010616592&amp;sdata=3D7sFBxWZvhxX= fiLAyCgaExGqAW%2F8yfIU0p2hlMLK4XUg%3D&amp;reserved=3D0
REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fbugzil= la.tianocore.org%2Fshow_bug.cgi%3Fid%3D2801&amp;data=3D02%7C01%7CBret.B= arkelew%40microsoft.com%7Cdb2bad178b6044d37e1208d827c2d38e%7C72f988bf86f141= af91ab2d7cd011db47%7C1%7C0%7C637303065010616592&amp;sdata=3DjYoltIH%2Bv= S43A1b5koMYdK0bnmPt8Pa4tz6QkbezYc4%3D&amp;reserved=3D0
REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fbugzil= la.tianocore.org%2Fshow_bug.cgi%3Fid%3D2803&amp;data=3D02%7C01%7CBret.B= arkelew%40microsoft.com%7Cdb2bad178b6044d37e1208d827c2d38e%7C72f988bf86f141= af91ab2d7cd011db47%7C1%7C0%7C637303065010616592&amp;sdata=3DNeyrn2INlcM= tlJ%2BbS456GPRWVxb5ALL%2B9BcLMGqX69Q%3D&amp;reserved=3D0
REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fbugzil= la.tianocore.org%2Fshow_bug.cgi%3Fid%3D2804&amp;data=3D02%7C01%7CBret.B= arkelew%40microsoft.com%7Cdb2bad178b6044d37e1208d827c2d38e%7C72f988bf86f141= af91ab2d7cd011db47%7C1%7C0%7C637303065010616592&amp;sdata=3DhkyOv8qhQ3i= C%2FwvqnayiBeot6AYwfRho%2FUmhfcVd0qo%3D&amp;reserved=3D0
REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fbugzil= la.tianocore.org%2Fshow_bug.cgi%3Fid%3D2805&amp;data=3D02%7C01%7CBret.B= arkelew%40microsoft.com%7Cdb2bad178b6044d37e1208d827c2d38e%7C72f988bf86f141= af91ab2d7cd011db47%7C1%7C0%7C637303065010616592&amp;sdata=3DTLvx%2FUylN= XEyMOBlikWOfnQHnbqyR1JiCm9uIod859Q%3D&amp;reserved=3D0
REF: https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fbugzil= la.tianocore.org%2Fshow_bug.cgi%3Fid%3D2806&amp;data=3D02%7C01%7CBret.B= arkelew%40microsoft.com%7Cdb2bad178b6044d37e1208d827c2d38e%7C72f988bf86f141= af91ab2d7cd011db47%7C1%7C0%7C637303065010616592&amp;sdata=3DWh7uoily48B= e5EFItwd7o6whBtQZy82jh0cIDE%2FDrCY%3D&amp;reserved=3D0

* Add Null base libraries for host based unit tests
* Add host based test version of BaseLib with hooks for services that use<= br>   privileged instructions.
* Add new UT_EXPECT_ASSERT_FAILURE() macro to UnitTestLib class
* Enable source level debug of unit tests
* Increase stack size to 256KB for host based tests on Windows
* Update BaseTools to support NULL libs for HOST_APPLICATION modules
* Guarantee print log works even if unit test generates an exception
* Use filename instead of function name in target mode logs

Cc: Liming Gao liming.gao@intel.com
Cc: Bob Feng bob.c.feng@intel.com
Cc: Sean Brogan sean.brogan@microsoft.com
Cc: Bret Barkelew Bret.Barkelew@microsoft.com
Cc: Jiewen Yao jiewen.yao@intel.com
Signed-off-by: Michael D Kinney michael.d.kinney@intel.com


Michael D Kinney (16):
  BaseTools/Python: Allow HOST_APPLICATION to use NULL libraries
  MdePkg/BaseCpuLibNull: Add Null version of CpuLib for host testing<= br>   MdePkg/BaseCacheMaintenanceLibNull: Add Null instance for host test= ing
  MdePkg/BaseLib: Break out IA32/X64 GCC inline privileged functions<= br>   MdePkg/Library/BaseLib: Add BaseLib instance for host based unit te= sts
  UnitTestFrameworkPkg: Use host libraries from MdePkg
  UnitTestFrameworkPkg: Enable source level debug for host tests
  UnitTestFrameworkPkg: Set host application stack size to 256KB
  UnitTestFrameworkPkg: Change target mode DebugLib mapping
  UnitTestFrameworkPkg/UnitTestLib: Move print log into cleanup
  UnitTestFrameworkPkg/UnitTestLib: Fix target mode log messages
  UnitTestFrameworkPkg/UnitTestLib: Add checks for ASSERT()
  MdePkg/Include: Hook DebugLib _ASSERT() for unit tests
  MdePkg/Include: Add UT_EXPECT_ASSERT_FAILURE() to UnitTestLib
  MdePkg/Library/BaseStackCheckLib: Fix PCD type in INF
  UnitTestFramewokPkg/SampleUnitTest: Use UT_EXPECT_ASSERT_FAILURE()<= br>
 .../Python/Workspace/WorkspaceCommon.py     = ;  |    4 +-
 MdePkg/Include/Library/DebugLib.h      = ;       |   28 +-
 MdePkg/Include/Library/UnitTestLib.h     &n= bsp;    |   90 +
 .../BaseCacheMaintenanceLibNull.c      = ;       |  225 ++
 .../BaseCacheMaintenanceLibNull.inf     &nb= sp;     |   29 +
 .../BaseCacheMaintenanceLibNull.uni     &nb= sp;     |   12 +
 .../Library/BaseCpuLibNull/BaseCpuLibNull.c   |  = ; 37 +
 .../Library/BaseCpuLibNull/BaseCpuLibNull.inf |   26 +
 .../Library/BaseCpuLibNull/BaseCpuLibNull.uni |   11 +
 MdePkg/Library/BaseLib/BaseLib.inf     &nbs= p;      |    4 +-
 MdePkg/Library/BaseLib/Ia32/GccInline.c     = ;  | 1181 +------
 .../Ia32/{GccInline.c =3D> GccInlinePriv.c}   &nbs= p; |  601 +---
 MdePkg/Library/BaseLib/UnitTestHost.c     &= nbsp;   |  140 +
 MdePkg/Library/BaseLib/UnitTestHost.h     &= nbsp;   |   66 +
 .../Library/BaseLib/UnitTestHostBaseLib.inf   |  217 = ++
 .../Library/BaseLib/UnitTestHostBaseLib.uni   |  = ; 11 +
 MdePkg/Library/BaseLib/X64/GccInline.c     =    | 1240 +------
 .../X64/{GccInline.c =3D> GccInlinePriv.c}    = ;  |  572 +---
 MdePkg/Library/BaseLib/X86UnitTestHost.c    &nbs= p; | 2977 +++++++++++++++++
 .../BaseStackCheckLib/BaseStackCheckLib.inf   |  = ;  2 +-
 MdePkg/MdePkg.dec        &nb= sp;            =         |    8 +-
 MdePkg/MdePkg.dsc        &nb= sp;            =         |    4 +-
 MdePkg/Test/MdePkgHostTest.dsc      &n= bsp;         |    5 = +
 .../Include/Library/UnitTestHostBaseLib.h     |&= nbsp; 582 ++++
 .../UnitTestDebugAssertLib.c      &nbs= p;           |  = ; 49 +
 .../UnitTestDebugAssertLib.inf      &n= bsp;         |   31 +
 .../UnitTestDebugAssertLib.uni      &n= bsp;         |   11 +
 .../Library/UnitTestLib/Assert.c      =         |  217 +-
 .../Library/UnitTestLib/AssertCmocka.c     =    |   68 +
 .../Library/UnitTestLib/RunTests.c     &nbs= p;      |   23 +-
 .../Library/UnitTestLib/RunTestsCmocka.c    &nbs= p; |   33 +-
 .../UnitTestResultReportLib.c      &nb= sp;          |  &nbs= p; 3 +-
 .../PrivateInclude/UnitTestFrameworkTypes.h   |  = ;  1 +
 .../Sample/SampleUnitTest/SampleUnitTest.c    | = 510 +++
 .../SampleUnitTest/SampleUnitTestDxe.inf    &nbs= p; |    3 +
 .../SampleUnitTest/SampleUnitTestHost.inf     |&= nbsp;   3 +
 .../SampleUnitTest/SampleUnitTestPei.inf    &nbs= p; |    3 +
 .../SampleUnitTest/SampleUnitTestSmm.inf    &nbs= p; |    3 +
 .../SampleUnitTestUefiShell.inf      &= nbsp;        |    3 +
 .../Test/UnitTestFrameworkPkgHostTest.dsc     |&= nbsp;   5 +-
 UnitTestFrameworkPkg/UnitTestFrameworkPkg.dsc |    4 = +
 .../UnitTestFrameworkPkgHost.dsc.inc     &n= bsp;    |   11 +-
 .../UnitTestFrameworkPkgTarget.dsc.inc     =    |   10 +-
 43 files changed, 5374 insertions(+), 3689 deletions(-)  create= mode 100644 MdePkg/Library/BaseCacheMaintenanceLibNull/BaseCacheMaintenanc= eLibNull.c
 create mode 100644 MdePkg/Library/BaseCacheMaintenanceLibNull/BaseCa= cheMaintenanceLibNull.inf
 create mode 100644 MdePkg/Library/BaseCacheMaintenanceLibNull/BaseCa= cheMaintenanceLibNull.uni
 create mode 100644 MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.c  create mode 100644 MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.inf<= br>  create mode 100644 MdePkg/Library/BaseCpuLibNull/BaseCpuLibNull.uni<= br>  copy MdePkg/Library/BaseLib/Ia32/{GccInline.c =3D> GccInlinePriv.= c} (62%)  create mode 100644 MdePkg/Library/BaseLib/UnitTestHost.c
 create mode 100644 MdePkg/Library/BaseLib/UnitTestHost.h
 create mode 100644 MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf  create mode 100644 MdePkg/Library/BaseLib/UnitTestHostBaseLib.uni  copy MdePkg/Library/BaseLib/X64/{GccInline.c =3D> GccInlinePriv.c= } (65%)  create mode 100644 MdePkg/Library/BaseLib/X86UnitTestHost.c  create mode 100644 MdePkg/Test/UnitTest/Include/Library/UnitTestHost= BaseLib.h
 create mode 100644 UnitTestFrameworkPkg/Library/UnitTestDebugAssertL= ib/UnitTestDebugAssertLib.c
 create mode 100644 UnitTestFrameworkPkg/Library/UnitTestDebugAssertL= ib/UnitTestDebugAssertLib.inf
 create mode 100644 UnitTestFrameworkPkg/Library/UnitTestDebugAssertL= ib/UnitTestDebugAssertLib.uni

--
2.21.0.windows.1







--_000_CY4PR21MB0743D5B62080452860A33926EF7E0CY4PR21MB0743namp_--