From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.92.19.68]) by mx.groups.io with SMTP id smtpd.web10.1003.1587494136002677994 for ; Tue, 21 Apr 2020 11:35:36 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=rZGokeIk; spf=pass (domain: outlook.com, ip: 40.92.19.68, mailfrom: michael.kubacki@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PrRf+3i9714IcGPJLal9Ff/a7rBo0gUvO4hLQumxy88AlI9j8HcAuPJSUDLdD/ri8+oEK5H3Qz7nVSeXO2ScHTZt1yzZqpQnVBb2tyOMsASpzOlD7FEDyF6APEWx00bmdaZW9saKvsa7PdqwqgV7gF4n821k2VGheBJSfio45YcN8UR0at8o5aT/F0j2RuvaiDKir47bPjvUiPXv3tlsplk4+04uXSJIH6La3VNDuDO9zzaK1aNwqGWS+n8xXLzku8WJbZwY6JSZAlTj96Q9oBCdVbmelClhTElO84dV+HA2KXaE9Z0MGssQ+Bk/YTT6/KKEknVAi0bXN4pz3jxzpw== 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=wQ6bHsmMq9TBmV06gjQRDarbpkuVtbsbBh7D3rQS1oI=; b=Z2bgJurQ5QifzL9h5oo/wpu9xDCki26geWucQPP31IXGFiePyFAm1Pv2USI3T+nM0OOOeJECdp97n31n7O7FSsvLDtt/FeWJrr7T97tiZe6uiGLOK9goUEjBbfqeoiq7JOI9gQokuK4EnydBhz7csRtOC8Prs5OBnnLa3WKAWGKuQiqhwtP/NINgEggxw2OCL6lhaz9/J8hESeVE4AUUgB/5VYoNpa1ie6/jxqccgm6LCgeWRPw/EIRYiSq9yaEyvKc66hF5kYVkttKQAu1nrxCGHigA7OTaidcnH7d5qNLx9+rXLeM+Sg+ByS2I1hwOETk2V0dVmx6VyeqK7cp5Fw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=outlook.com; dmarc=pass action=none header.from=outlook.com; dkim=pass header.d=outlook.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wQ6bHsmMq9TBmV06gjQRDarbpkuVtbsbBh7D3rQS1oI=; b=rZGokeIk2xRIlQOe046ADbhnY/ltmZnsMzaSqSqDqb3ZQPDHlgWZGc4peHIfhreROsf2P7johLyhjLjoYDamoS5n6zWnRhoJnx/XWaH3NxynERPEsazQEeu3Nfo2vOXFCZ9V+YF6pgLu0tpN7XtS8kFgmkpYI1UyqvYKKP2C9yf/aJz6Nlpoh3+rHUri/BKbVQNK2LsskFIuU2p9f5wGr55ogDdHD7fkfREcZzR9bl6VW+rXphUpzyEg8e0jUqWJmchwUIesUltifhFYwya0JTE6cgoeUE7DvLX53ZtMLCk4ObPaUR4yhp2p+cMvHj0jBNQqeKv8eM0NZeQZ91X3BQ== Received: from DM6NAM11FT059.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::45) by DM6NAM11HT015.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.25; Tue, 21 Apr 2020 18:35:35 +0000 Received: from MWHPR07MB3440.namprd07.prod.outlook.com (2a01:111:e400:fc4d::4c) by DM6NAM11FT059.mail.protection.outlook.com (2a01:111:e400:fc4d::92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.25 via Frontend Transport; Tue, 21 Apr 2020 18:35:35 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:08DF9C00B65CA0AC08CC60B67FF1AD80E88FDEEE760AD5E37A36EEEA17D7A3E4;UpperCasedChecksum:92F445BF52BAFD0D78215A88EA80CEDEA558191269AD66DCEDD666F52E241693;SizeAsReceived:7815;Count:49 Received: from MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::bcc9:271b:20db:52e3]) by MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::bcc9:271b:20db:52e3%6]) with mapi id 15.20.2921.030; Tue, 21 Apr 2020 18:35:35 +0000 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Bret Barkelew , Sean Brogan , Michael D Kinney Subject: [PATCH v1 2/2] UnitTestFrameworkPkg/UnitTestLib: Update SaveFrameworkState() signature Date: Tue, 21 Apr 2020 11:35:02 -0700 Message-ID: X-Mailer: git-send-email 2.16.3.windows.1 In-Reply-To: <20200421183502.39876-1-michael.kubacki@outlook.com> References: <20200421183502.39876-1-michael.kubacki@outlook.com> X-ClientProxiedBy: MWHPR19CA0085.namprd19.prod.outlook.com (2603:10b6:320:1f::23) To MWHPR07MB3440.namprd07.prod.outlook.com (2603:10b6:301:69::28) Return-Path: michael.kubacki@outlook.com X-Microsoft-Original-Message-ID: <20200421183502.39876-3-michael.kubacki@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2001:4898:80e8:b:3907:8d1b:5bae:c73c) by MWHPR19CA0085.namprd19.prod.outlook.com (2603:10b6:320:1f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13 via Frontend Transport; Tue, 21 Apr 2020 18:35:33 +0000 X-Mailer: git-send-email 2.16.3.windows.1 X-Microsoft-Original-Message-ID: <20200421183502.39876-3-michael.kubacki@outlook.com> X-TMN: [NxRWTX+MGlJ2UeTyfh27lLwtjMwDs1ErrXWbhfDDhqqiv5fZfS9kZH+sSj9rdylL] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 49 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 7564f9cf-105c-4e10-d741-08d7e622c6fd X-MS-TrafficTypeDiagnostic: DM6NAM11HT015: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WLonwblBzG0umOs8r50wOwC4M9oMoAVzg4iAki0b0KxNUHIQqSOW02Ws7ysg9XCr4V/WKSOgftWpDLKr8zj3OfdtBcnRn8knhEwfRhrQsGZkYe1Wr4llyTPCShB6Yaq6I5UV7dohE9XKrJ+fAK1EiyBhgjarvMNwdj1LDYoXr54+bV3PxAytfNCh3BGoxZKZZn4csG0NssHuGWn67NirWw7os2T4tdYC9u1BhUkTuJ3BOlps6oyzBSVxa+KfD0li X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR07MB3440.namprd07.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: UsmXjoJ/d+sCTrs7tXqb3zuKWQ9APJNXQysrtxg1Vtg/dYb3UhAVAIxNTA/s+8GAz2qjTmG0+VxvzTZ1g+oUax/9I5qVbhMZa9X3yJe8/DS65v4mhtB0ZMRTAXYU8NYAdR7ZRBT0HB2UAiR6mQATsoO9ndXmX58KdqctubfxSEtk8nU42tJZuo/VGuU0qQe8lrZU5z3PfBJfeBVuwG5xSg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7564f9cf-105c-4e10-d741-08d7e622c6fd X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2020 18:35:35.0548 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6NAM11HT015 Content-Type: text/plain From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2612 Removes the FrameworkHandle parameter from SaveFrameworkState() in the UnitTestLib library instance and updates callers of the function in the library to use the new function signature. Cc: Bret Barkelew Cc: Sean Brogan Cc: Michael D Kinney Signed-off-by: Michael Kubacki --- UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c | 2 +- UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c | 25 ++++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c b/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c index b053e0495912..793335fd0f05 100644 --- a/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c +++ b/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c @@ -162,7 +162,7 @@ RunAllTestSuites ( // // Save current state so if test is started again it doesn't have to run. It will just report // - SaveFrameworkState (FrameworkHandle, NULL, 0); + SaveFrameworkState (NULL, 0); OutputUnitTestFrameworkReport (FrameworkHandle); mFrameworkHandle = NULL; diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c index b136992d99a0..e2405251f0f4 100644 --- a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c +++ b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c @@ -783,11 +783,9 @@ SerializeState ( at least the current execution count) which will be saved by the framework and passed to the test case upon resume. - Generally called from within a test case prior to quitting or rebooting. + This should be called while the current test framework is valid and active. It is + generally called from within a test case prior to quitting or rebooting. - @param[in] FrameworkHandle A handle to the current running framework that - dispatched the test. Necessary for recording - certain test events with the framework. @param[in] ContextToSave A buffer of test case-specific data to be saved along with framework state. Will be passed as "Context" to the test case upon resume. This @@ -795,7 +793,7 @@ SerializeState ( @param[in] ContextToSaveSize Size of the ContextToSave buffer. @retval EFI_SUCCESS The framework state and context were saved. - @retval EFI_INVALID_PARAMETER FrameworkHandle is NULL. + @retval EFI_NOT_FOUND An active framework handle was not found. @retval EFI_INVALID_PARAMETER ContextToSave is not NULL and ContextToSaveSize is 0. @retval EFI_INVALID_PARAMETER ContextToSave is >= 4GB. @@ -808,21 +806,28 @@ SerializeState ( EFI_STATUS EFIAPI SaveFrameworkState ( - IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle, IN UNIT_TEST_CONTEXT ContextToSave OPTIONAL, IN UINTN ContextToSaveSize ) { - EFI_STATUS Status; - UNIT_TEST_SAVE_HEADER *Header; + EFI_STATUS Status; + UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle; + UNIT_TEST_SAVE_HEADER *Header; Header = NULL; + FrameworkHandle = GetActiveFrameworkHandle (); + + // + // Return a unique error code if the framework is not set. + // + if (FrameworkHandle == NULL) { + return EFI_NOT_FOUND; + } // // First, let's not make assumptions about the parameters. // - if (FrameworkHandle == NULL || - (ContextToSave != NULL && ContextToSaveSize == 0) || + if ((ContextToSave != NULL && ContextToSaveSize == 0) || ContextToSaveSize > MAX_UINT32) { return EFI_INVALID_PARAMETER; } -- 2.16.3.windows.1