From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web10.37670.1670830370994968807 for ; Sun, 11 Dec 2022 23:32:51 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=kWCNQHfp; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: zhiguang.liu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670830371; x=1702366371; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=fLMN6PHlCSYlXMlBcFKjMD4x+D1SUINrGnqg6J/eDuo=; b=kWCNQHfpA3Tx30JX+GCYjJy0bNimbIqMcHyQRg32/Iw7pzhXl/pZWgqW xkj4oTCfwKeYCbt9ZBcRrFD1jgc6YARJlA21m6xPNyPPl2liGN/QmDArB PnzyN+01l8J6Pwe9k+f26o117wq7GZxyxoEmd+UxCQE2966AmdliW0Glw EvpVfJU4jsYv7eTGTBrdFrxIygCKGMyVHhSLl0VLL3CkveX1SGjCqomrj kVcmysuo5ZLcMYTvOCStAYtzmCsKjW1bXZjaNlNl1IFruJYYWaHc1lCY0 Uj/Y3Vpp5JcXdE5hieVPj4JKbANlQGBIvAENGqwBgNqeymuvnRL/vf+af g==; X-IronPort-AV: E=McAfee;i="6500,9779,10558"; a="404045961" X-IronPort-AV: E=Sophos;i="5.96,237,1665471600"; d="scan'208";a="404045961" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Dec 2022 23:32:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10558"; a="893390045" X-IronPort-AV: E=Sophos;i="5.96,237,1665471600"; d="scan'208";a="893390045" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga006.fm.intel.com with ESMTP; 11 Dec 2022 23:32:50 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) 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.2507.16; Sun, 11 Dec 2022 23:32:49 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Sun, 11 Dec 2022 23:32:49 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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.2507.16 via Frontend Transport; Sun, 11 Dec 2022 23:32:49 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.174) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Sun, 11 Dec 2022 23:32:49 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lGxqToHn9vlXsvcgI9JVmo3n+eRAh/gms0Pepfk9EFIrWll9sXXRZSaOM1BfIfeLSwDPUocD8XBeTYSJK6Wr0O26/QrnO61D13tX91Lm+nHJWygB33SkoSq+QmISQyQB/IWZj34HH/qkdM/gr7C8yOcb0oxnqqP3lCsX6nOpgnxuyTtLM1w3Ku5KEM9GUDUEEYHQsfzj0UcEsfAKZs2XMiqrN7qIzBWIh4Sizlc04eH3kxHXv5twipbJNuAdmgsnd8EuY/hmKyOz2n0qNHcrwi3hLl95cl7heC7kJg03S9e3T9UypFF0Hma8CR1LQXiZHTRo9D6M0VTLhQw6LoQpBw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BF1EBbu3L15b5E7fOxiZ9Tbiswvc/FLkFtfD7rwDSSI=; b=jvistogrl3INXClgp60fZMKuO7TlqiibTCRecOLlszwZXA6P+mbh9CsQa4J56aaTu5BCnWU9dWKkEqJRyaK6XC7zZhNJiw5Z5kTkV3ne4Hynvm+5+A5xYBi3Xz6/nUtUAeDx/NaNGycpIjfT+nc/soD6g29+gCv7yhNOvOSE9PQ4e+Mo//X6z9EoyxOWZpQbqo4et8rujDht9lqArXfaPXv0MysIMSkkUkaUsQjxB8aeidK1QKcvsjbpIR8GYyAuCemr4y8yRK4mqPYjaAznXcYpmf9SIQfF2OcUFqv10SrMn+VKo1kM74dCGSIiBQfx8qct9CQGMXHt0cLRXX2fQA== 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 Received: from PH0PR11MB5048.namprd11.prod.outlook.com (2603:10b6:510:3d::14) by SN7PR11MB6749.namprd11.prod.outlook.com (2603:10b6:806:267::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.19; Mon, 12 Dec 2022 07:32:47 +0000 Received: from PH0PR11MB5048.namprd11.prod.outlook.com ([fe80::f382:d721:8364:480d]) by PH0PR11MB5048.namprd11.prod.outlook.com ([fe80::f382:d721:8364:480d%2]) with mapi id 15.20.5880.019; Mon, 12 Dec 2022 07:32:47 +0000 From: "Zhiguang Liu" To: "devel@edk2.groups.io" , "Liu, Zhiguang" , "Kinney, Michael D" , Michael Kubacki , Sean Brogan CC: "Ni, Ray" Subject: Re: [edk2-devel] [PATCH] UnitTestFrameworkPkg: Modify APIs in UnitTestPersistenceLib Thread-Topic: [edk2-devel] [PATCH] UnitTestFrameworkPkg: Modify APIs in UnitTestPersistenceLib Thread-Index: AQHZCTM/PtZjfGWiGkyWIvBhZzLCmK5p5QWA Date: Mon, 12 Dec 2022 07:32:47 +0000 Message-ID: References: <172E1CF5498F8F29.13790@groups.io> In-Reply-To: <172E1CF5498F8F29.13790@groups.io> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR11MB5048:EE_|SN7PR11MB6749:EE_ x-ms-office365-filtering-correlation-id: 42d6729a-7c8c-4e21-8ec9-08dadc131105 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: MAhl8beeGfIfy6JdVKof/KYNkgAhAR5RaGwU+TurFF3xEMRVFR30oFrnqFXxnCcBGC4xaKUawalD822NGjAXbzRIo8w2gIYm6E3F8/3m+pYi17tAZJOR0FO10iEiDnrF7zklYuSTIfpcFr0iDvFy3TgRQHdosKW6Vw1hyqPeQwsRo/46Z9U5d9RPNEY66KlWxGtrKiP2zZVkvNKjegWt57wB31fdkpzfnNCQucOnINf5cTCMgrp1Izk2AYWF+krIY07Jeh2KbQNOXRJJg4Tc/4nYHKNt1aMisHSKpLS1ptseiyR4Gcw/qt8QB+X1h97/t2Z5MUEZhqXk1TdhdAGbFbcq8VqWOxSMUIPMDL0U9fOTwSuHNmjX0s0SPqS17veqBQt1s8+bTtXYw2zN5CtUostL97fIkTbGehitgoUF/SzBcKNytIm9gAbDS2xl8cOOwbBn1kAL01R1QCFva5I7ONTJN8BTsyvrx5jy5j6YH2omJbSzfUWuBp0IZnmZZkJi5ru6JWMt3EhJTGTRyBtk4REnqlWUEf3jVim5jIHcnVzwD5YCqVVzQba9/ZZQw6YIqabhiNxXDxdUyGqmDT850GetOAjpv3vherALJtO1viArheDDJV4jhBjvcXbwnxJzNl2OJnA7RxJJdiLUKy2/hCTNlSWkMXtwCwDtpIhnH9xesb2Ex3yW0T0Er0AiTJndz5kN/CGnpHdNOA8Q0C53aC3l3tyPYoVigw/8TvWc5t0HAwRRga3VcZaCd5C9i34hoG1+pO6eCMF2B5ZeNCjX0w== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5048.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(39860400002)(136003)(366004)(346002)(376002)(396003)(451199015)(30864003)(122000001)(66899015)(2906002)(82960400001)(38100700002)(55016003)(41300700001)(86362001)(53546011)(9686003)(66476007)(76116006)(107886003)(7696005)(6506007)(38070700005)(110136005)(5660300002)(316002)(26005)(64756008)(4326008)(66446008)(8676002)(66556008)(66946007)(52536014)(8936002)(45080400002)(478600001)(966005)(71200400001)(186003)(83380400001)(33656002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?UgDxz9z57eskdWALmOm1k4s80lzqVBF41ZoC1KWWYqsI6dT/Lxj1lDQhgbP/?= =?us-ascii?Q?EzqAJ0w46hFrcLDDq0OcxljzfUTlqhajsDr2cTDXAQgV9+GzQUMAYCFOAreL?= =?us-ascii?Q?A3FVa8yfrxbbH0jYBnRXnIdEgJsOmrsKfn1VOsRtXvdv5MvYnj0g19iGkKwf?= =?us-ascii?Q?I/m0Rm2nVPR39NEA8ZVbA559l5pPhgszpctsRCX0ThtQ2ynTWsiea2JLv4tF?= =?us-ascii?Q?wvnUg1x9L57v52nfadzba6iG2Y+dJCWpAJxUt05GKA1wmuWCMdcLab2Af1W7?= =?us-ascii?Q?YyrxbRuHiV3nRl2ZP4lpKNOfzNe/mCoqWiR+Eb92p7897dYSMgp7UNIf094y?= =?us-ascii?Q?RgcjVAp29PC8+pslWnWZLHPC8ZwhAH+b3HxmdTCHhdmBJEeO4KwEssRYq/xS?= =?us-ascii?Q?WtsNR+GHahwkUcgJqqyFS2/4Pot07ptljhB3p9ZawSiLUeByE3cz/dnJfKsb?= =?us-ascii?Q?QGAvfO8SYpDa03BxPJwZGjjWzIRSNp964GnEZBkxDczgZCG+PHXGFSGSIEW5?= =?us-ascii?Q?XE61sEsHCmRXLF2XUayMmu+yoq02MzrplMBStpdH2s4pIgFu+E9lclYXIex0?= =?us-ascii?Q?VshgAvO+pcsJCDPTtVahvyFZRRaReG80nGXPbrdqe+dKhujrOYEXVpEQ1Brm?= =?us-ascii?Q?W5bhE50uyzA8Y+sfUGWZAWglMnBFnbZkj/fwcBh7YJyQNOSYbzF0sgvQ9DWY?= =?us-ascii?Q?9FErSt6eXil1ri9J2NvsfqJs5VvE9E3vEQDG4hIwixbV1cBUNVbVdJE7YXUk?= =?us-ascii?Q?1nrO609Gvan2Byx06xJEFMo2OLbAxRG7Tnvkac26PIt01/NXheAthuKHOgzH?= =?us-ascii?Q?KeTqYtwXMbX87j8l7iAlHPZ5sj9miGIWk1psG30Kfrrgkh0GZDN5hgbxK9BY?= =?us-ascii?Q?PLYCX2fe/Trd/KaA1yIZl1lskKHL3PlFYnX4N76CQMgpN0CLG4LfYq33lhbG?= =?us-ascii?Q?KXavI5uzeXn20fR2vZx79X6Gv+lK2IUnDvOsJFySnE8uBs+Yc7nWvICsVIqX?= =?us-ascii?Q?9mJcmkTLP4QTCR/b06KKrJNdGrzihNIzCCdiYLckP0hXB1mvQM+7ECB+wMzV?= =?us-ascii?Q?nrWhIGxyJRmWpGGtbXu70wUg5yoWwhYrQQoYPsKFLEEyxCCOKT3l15JZyQ9/?= =?us-ascii?Q?FoOzRBPkRqipj8lfMQ+H5lp/RlSUPTBJcxBSjccUHhrgmOguOu8X5DaYzuGg?= =?us-ascii?Q?xuUPulw8U6P/fnySSIaNsK9bKgic4RXgc4cCsOOaKmWPT8+YkdiwIwMr4FWw?= =?us-ascii?Q?Mox5F9j1zPwqWBa3Buzq7VnzpzzQfotNpvSTjdgIfR+a43CP4SfchEHCHAaa?= =?us-ascii?Q?OhUtBrjpG5bA5Bh49bJetumY/JoehBU60iHhhVTVq2kUDy0xNaEC0okonP+d?= =?us-ascii?Q?1aYbIfBYYDWJJYKT7BFigQMJw1RbrZGDj2xFQ/avvyBi0WCcWtIE8KbwUK5w?= =?us-ascii?Q?Kl/Yf9L63crpo3jdsdguPeep++Ga4U9vNaJMspvC1sLnv9D5Bd91I2VWrZv/?= =?us-ascii?Q?UrpJFxQXl8QrdPEjBzyi6n+Wk57/lH6xA06rXi5MgbX63X/Z6Qc1K2vM33Jb?= =?us-ascii?Q?I64NbofktMPOSSNOr64k3TJGRXyC5b3Gj5ZGUl5z?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5048.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 42d6729a-7c8c-4e21-8ec9-08dadc131105 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Dec 2022 07:32:47.3787 (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: FPg/4QW4vhFCyHuXKGXXoTuSDVdHGPET+unDpxudHbqXu/EF9VX5YYpUyEDg5PWsWC5HkDavkue4IUyKD5YgAg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR11MB6749 Return-Path: zhiguang.liu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi UnitTestFrameworkPkg Maintainers and reviewers, Could you help review this patch? Thanks Zhiguang > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of > Zhiguang Liu > Sent: Tuesday, December 6, 2022 1:26 PM > To: devel@edk2.groups.io > Cc: Liu, Zhiguang ; Kinney, Michael D > ; Michael Kubacki > ; Sean Brogan > ; Ni, Ray > Subject: [edk2-devel] [PATCH] UnitTestFrameworkPkg: Modify APIs in > UnitTestPersistenceLib >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4183 >=20 > UnitTestPersistenceLib now consumes private struct definition. > Modify APIs in UnitTestPersistenceLib to make it easy to become a public > library. >=20 > Cc: Michael D Kinney > Cc: Michael Kubacki > Cc: Sean Brogan > Cc: Ray Ni > Signed-off-by: Zhiguang Liu > --- > .../Include/Library/UnitTestPersistenceLib.h | 14 +++++++---- > .../Library/UnitTestLib/UnitTestLib.c | 6 +++-- > .../UnitTestPersistenceLibNull.c | 11 ++++++--- > .../UnitTestPersistenceLibSimpleFileSystem.c | 23 ++++++++++++------- > 4 files changed, 36 insertions(+), 18 deletions(-) >=20 > diff --git a/UnitTestFrameworkPkg/Include/Library/UnitTestPersistenceLib.= h > b/UnitTestFrameworkPkg/Include/Library/UnitTestPersistenceLib.h > index be29e079ec..5543b79a0d 100644 > --- a/UnitTestFrameworkPkg/Include/Library/UnitTestPersistenceLib.h > +++ b/UnitTestFrameworkPkg/Include/Library/UnitTestPersistenceLib.h > @@ -4,7 +4,7 @@ > (eg. a reboot-based test). >=20 > Copyright (c) Microsoft Corporation.
> - Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
> + Copyright (c) 2019 - 2022, Intel Corporation. All rights > + reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -12,7 +12,7 @@ > #ifndef _UNIT_TEST_PERSISTENCE_LIB_H_ > #define _UNIT_TEST_PERSISTENCE_LIB_H_ >=20 > -#include > +#include >=20 > #define UNIT_TEST_PERSISTENCE_LIB_VERSION 1 >=20 > @@ -40,6 +40,7 @@ DoesCacheExist ( > @param[in] FrameworkHandle A pointer to the framework that is being > persisted. > @param[in] SaveData A pointer to the buffer containing the s= erialized > framework internal state. > + @param[in] SaveStateSize The size of SaveData in bytes. >=20 > @retval EFI_SUCCESS Data is persisted and the test can be safely= quit. > @retval Others Data is not persisted and test cannot be res= umed > upon exit. > @@ -49,7 +50,8 @@ EFI_STATUS > EFIAPI > SaveUnitTestCache ( > IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle, > - IN UNIT_TEST_SAVE_HEADER *SaveData > + IN VOID *SaveData, > + IN UINTN SaveStateSize > ); >=20 > /** > @@ -57,8 +59,9 @@ SaveUnitTestCache ( > Will allocate a buffer to hold the loaded data. >=20 > @param[in] FrameworkHandle A pointer to the framework that is being > persisted. > - @param[in] SaveData A pointer pointer that will be updated w= ith the > address > + @param[out] SaveData A pointer pointer that will be updated w= ith > the address > of the loaded data buffer. > + @param[out] SaveStateSize Return the size of SaveData in bytes. >=20 > @retval EFI_SUCCESS Data has been loaded successfully and Sa= veData > is updated > with a pointer to the buffer. > @@ -70,7 +73,8 @@ EFI_STATUS > EFIAPI > LoadUnitTestCache ( > IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle, > - OUT UNIT_TEST_SAVE_HEADER **SaveData > + OUT VOID **SaveData, > + OUT UINTN *SaveStateSize > ); >=20 > #endif > diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c > b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c > index 64d5880783..5b442ed122 100644 > --- a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c > +++ b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c > @@ -2,6 +2,7 @@ > Implement UnitTestLib >=20 > Copyright (c) Microsoft Corporation. > + Copyright (c) 2022, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent **/ >=20 > @@ -210,6 +211,7 @@ InitUnitTestFramework ( > EFI_STATUS Status; > UNIT_TEST_FRAMEWORK_HANDLE NewFrameworkHandle; > UNIT_TEST_FRAMEWORK *NewFramework; > + UINTN SaveStateSize; >=20 > Status =3D EFI_SUCCESS; > NewFramework =3D NULL; > @@ -267,7 +269,7 @@ InitUnitTestFramework ( > // If there is a persisted context, load it now. > // > if (DoesCacheExist (NewFrameworkHandle)) { > - Status =3D LoadUnitTestCache (NewFrameworkHandle, > (UNIT_TEST_SAVE_HEADER **)(&NewFramework->SavedState)); > + Status =3D LoadUnitTestCache (NewFrameworkHandle, (VOID > + **)(&NewFramework->SavedState), &SaveStateSize); > if (EFI_ERROR (Status)) { > // > // Don't actually report it as an error, but emit a warning. > @@ -852,7 +854,7 @@ SaveFrameworkState ( > // > // All that should be left to do is save it using the associated persi= stence lib. > // > - Status =3D SaveUnitTestCache (FrameworkHandle, Header); > + Status =3D SaveUnitTestCache (FrameworkHandle, Header, > + Header->SaveStateSize); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "%a - Could not save state! %r\n", > __FUNCTION__, Status)); > Status =3D EFI_DEVICE_ERROR; > diff --git > a/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibNull/UnitTestPersis > tenceLibNull.c > b/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibNull/UnitTestPersis > tenceLibNull.c > index e28327652e..abb24cff98 100644 > --- > a/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibNull/UnitTestPersis > tenceLibNull.c > +++ > b/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibNull/UnitTestPe > +++ rsistenceLibNull.c > @@ -2,6 +2,7 @@ > This is an instance of the Unit Test Persistence Lib that does nothing= . >=20 > Copyright (c) Microsoft Corporation.
> + Copyright (c) 2022, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent **/ >=20 > @@ -35,6 +36,7 @@ DoesCacheExist ( > @param[in] FrameworkHandle A pointer to the framework that is being > persisted. > @param[in] SaveData A pointer to the buffer containing the se= rialized > framework internal state. > + @param[in] SaveStateSize The size of SaveData in bytes. >=20 > @retval EFI_SUCCESS Data is persisted and the test can be safely qui= t. > @retval Others Data is not persisted and test cannot be resumed= upon > exit. > @@ -44,7 +46,8 @@ EFI_STATUS > EFIAPI > SaveUnitTestCache ( > IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle, > - IN UNIT_TEST_SAVE_HEADER *SaveData > + IN VOID *SaveData, > + IN UINTN SaveStateSize > ) > { > return EFI_UNSUPPORTED; > @@ -55,8 +58,9 @@ SaveUnitTestCache ( > Will allocate a buffer to hold the loaded data. >=20 > @param[in] FrameworkHandle A pointer to the framework that is being > persisted. > - @param[in] SaveData A pointer pointer that will be updated wi= th the > address > + @param[out] SaveData A pointer pointer that will be updated wi= th the > address > of the loaded data buffer. > + @param[out] SaveStateSize Return the size of SaveData in bytes. >=20 > @retval EFI_SUCCESS Data has been loaded successfully and SaveData i= s > updated > with a pointer to the buffer. > @@ -68,7 +72,8 @@ EFI_STATUS > EFIAPI > LoadUnitTestCache ( > IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle, > - OUT UNIT_TEST_SAVE_HEADER **SaveData > + OUT VOID **SaveData, > + OUT UINTN *SaveStateSize > ) > { > return EFI_UNSUPPORTED; > diff --git > a/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/ > UnitTestPersistenceLibSimpleFileSystem.c > b/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/ > UnitTestPersistenceLibSimpleFileSystem.c > index ed4a7d1615..d7a62145da 100644 > --- > a/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/ > UnitTestPersistenceLibSimpleFileSystem.c > +++ > b/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSyste > +++ m/UnitTestPersistenceLibSimpleFileSystem.c > @@ -4,6 +4,7 @@ > version of the internal test state in case the test needs to quit and = restore. >=20 > Copyright (c) Microsoft Corporation.
> + Copyright (c) 2022, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent **/ >=20 > @@ -16,6 +17,7 @@ > #include > #include > #include > +#include >=20 > #define CACHE_FILE_SUFFIX L"_Cache.dat" >=20 > @@ -213,6 +215,7 @@ DoesCacheExist ( > @param[in] FrameworkHandle A pointer to the framework that is being > persisted. > @param[in] SaveData A pointer to the buffer containing the se= rialized > framework internal state. > + @param[in] SaveStateSize The size of SaveData in bytes. >=20 > @retval EFI_SUCCESS Data is persisted and the test can be safely qui= t. > @retval Others Data is not persisted and test cannot be resumed= upon > exit. > @@ -222,7 +225,8 @@ EFI_STATUS > EFIAPI > SaveUnitTestCache ( > IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle, > - IN UNIT_TEST_SAVE_HEADER *SaveData > + IN VOID *SaveData, > + IN UINTN SaveStateSize > ) > { > EFI_DEVICE_PATH_PROTOCOL *FileDevicePath; @@ -280,7 +284,7 @@ > SaveUnitTestCache ( > // > // Write the data to the file. > // > - WriteCount =3D SaveData->SaveStateSize; > + WriteCount =3D SaveStateSize; > DEBUG ((DEBUG_INFO, "%a - Writing %d bytes to file...\n", __FUNCTION__= , > WriteCount)); > Status =3D ShellWriteFile ( > FileHandle, > @@ -288,7 +292,7 @@ SaveUnitTestCache ( > SaveData > ); >=20 > - if (EFI_ERROR (Status) || (WriteCount !=3D SaveData->SaveStateSize)) { > + if (EFI_ERROR (Status) || (WriteCount !=3D SaveStateSize)) { > DEBUG ((DEBUG_ERROR, "%a - Writing to file failed! %r\n", > __FUNCTION__, Status)); > } else { > DEBUG ((DEBUG_INFO, "%a - SUCCESS!\n", __FUNCTION__)); @@ -312,8 > +316,9 @@ Exit: > Will allocate a buffer to hold the loaded data. >=20 > @param[in] FrameworkHandle A pointer to the framework that is being > persisted. > - @param[in] SaveData A pointer pointer that will be updated wi= th the > address > + @param[out] SaveData A pointer pointer that will be updated wi= th the > address > of the loaded data buffer. > + @param[out] SaveStateSize Return the size of SaveData in bytes. >=20 > @retval EFI_SUCCESS Data has been loaded successfully and SaveData i= s > updated > with a pointer to the buffer. > @@ -325,7 +330,8 @@ EFI_STATUS > EFIAPI > LoadUnitTestCache ( > IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle, > - OUT UNIT_TEST_SAVE_HEADER **SaveData > + OUT VOID **SaveData, > + OUT UINTN *SaveStateSize > ) > { > EFI_STATUS Status; > @@ -334,7 +340,7 @@ LoadUnitTestCache ( > BOOLEAN IsFileOpened; > UINT64 LargeFileSize; > UINTN FileSize; > - UNIT_TEST_SAVE_HEADER *Buffer; > + VOID *Buffer; >=20 > IsFileOpened =3D FALSE; > Buffer =3D NULL; > @@ -380,8 +386,9 @@ LoadUnitTestCache ( > // > // Now that we know the size, let's allocated a buffer to hold the con= tents. > // > - FileSize =3D (UINTN)LargeFileSize; // You know what... if it's too = large, this lib > don't care. > - Buffer =3D AllocatePool (FileSize); > + FileSize =3D (UINTN)LargeFileSize; // You know what... if it's t= oo large, this > lib don't care. > + *SaveStateSize =3D FileSize; > + Buffer =3D AllocatePool (FileSize); > if (Buffer =3D=3D NULL) { > DEBUG ((DEBUG_ERROR, "%a - Failed to allocate a pool to hold the fil= e > contents! %r\n", __FUNCTION__, Status)); > Status =3D EFI_OUT_OF_RESOURCES; > -- > 2.31.1.windows.1 >=20 >=20 >=20 >=20 >=20