From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.101.70; helo=foss.arm.com; envelope-from=supreeth.venkatesh@arm.com; receiver=edk2-devel@lists.01.org Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id 7BB5121168223 for ; Fri, 12 Oct 2018 01:38:05 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5B14EF; Fri, 12 Oct 2018 01:38:05 -0700 (PDT) Received: from [10.6.43.238] (bc-c3-3-14.eu.iaas.arm.com [10.6.43.238]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7CA153F5D3; Fri, 12 Oct 2018 01:38:04 -0700 (PDT) To: Eric Jin , edk2-devel@lists.01.org Cc: Jiaxin Wu References: <20181012021123.11904-1-eric.jin@intel.com> From: Supreeth Venkatesh Message-ID: <934d2f72-2641-b74e-3ed8-ae6142e6a70d@arm.com> Date: Fri, 12 Oct 2018 09:38:01 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181012021123.11904-1-eric.jin@intel.com> Subject: Re: [edk2-test][Patch] uefi-sct\SctPkg: Fix the corner case of ExtractConfig API X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2018 08:38:05 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US migrating over from https://github.com/UEFI/UEFI-SCT/commit/be1ddea30c03bf6c9f38ff826f7c4317b0653a4c Reviewed-by: Supreeth Venkatesh On 10/12/2018 03:11 AM, Eric Jin wrote: > There may be no output with the ExtractConfig API > The export data may be changed automatically > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Eric Jin > Cc: Supreeth Venkatesh > Cc: Jiaxin Wu > --- > .../BlackBoxTest/HIIConfigAccessBBTestFunction.c | 67 +++------------------- > 1 file changed, 9 insertions(+), 58 deletions(-) > > diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestFunction.c > index 07e6782..b327648 100644 > --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestFunction.c > +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/HIIConfigAccess/BlackBoxTest/HIIConfigAccessBBTestFunction.c > @@ -1,7 +1,7 @@ > /** @file > > Copyright 2006 - 2017 Unified EFI, Inc.
> - Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
> + Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
> > This program and the accompanying materials > are licensed and made available under the terms and conditions of the BSD License > @@ -305,9 +305,6 @@ BBTestExtractConfigFunctionTestCheckpoint1 ( > if (Results == NULL) { > AssertionType = EFI_TEST_ASSERTION_FAILED; > } else { > - if (NULL == SctStrStr (MultiConfigAltResp, Results)) { > - AssertionType = EFI_TEST_ASSERTION_FAILED; > - } > gtBS->FreePool (Results); > } > } else if (EFI_OUT_OF_RESOURCES == Status) { > @@ -375,7 +372,7 @@ BBTestExtractConfigFunctionTestCheckpoint1 ( > StandardLib->RecordAssertion ( > StandardLib, > AssertionType, > - gHIIConfigAccessBBTestFunctionAssertionGuid001, > + gHIIConfigAccessBBTestFunctionAssertionGuid002, > L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig- ExtractConfig() returns EFI_SUCCESS and vaild Results with valid parameters .", > L"%a:%d: Status - %r", > __FILE__, > @@ -401,7 +398,6 @@ BBTestExtractConfigFunctionTestCheckpoint2 ( > EFI_STATUS Status; > EFI_TEST_ASSERTION AssertionType; > > - //UINTN Len = 0; > EFI_STRING Request = NULL; > EFI_STRING Progress = NULL; > EFI_STRING Results = NULL; > @@ -427,78 +423,33 @@ BBTestExtractConfigFunctionTestCheckpoint2 ( > &Results > ); > > - if ( EFI_OUT_OF_RESOURCES == Status) { > - AssertionType = EFI_TEST_ASSERTION_WARNING; > + if (EFI_OUT_OF_RESOURCES == Status) { > + AssertionType = EFI_TEST_ASSERTION_WARNING; > + } else if ((EFI_NOT_FOUND == Status) && (Progress == NULL) && (Results == NULL)) { > + AssertionType = EFI_TEST_ASSERTION_PASSED; > } else if ( EFI_SUCCESS != Status ) { > AssertionType = EFI_TEST_ASSERTION_FAILED; > if (Results != NULL) { > gtBS->FreePool (Results); > } > - return Status; > } else { > AssertionType = EFI_TEST_ASSERTION_PASSED; > - if ( (Results != NULL) && (NULL == SctStrStr (MultiConfigAltResp, Results)) ) { > + if (Results == NULL) { > AssertionType = EFI_TEST_ASSERTION_FAILED; > } > } > StandardLib->RecordAssertion ( > StandardLib, > AssertionType, > - gHIIConfigAccessBBTestFunctionAssertionGuid002, > - L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig- ExtractConfig() returns EFI_SUCCESS with Request been NULL .", > + gHIIConfigAccessBBTestFunctionAssertionGuid003, > + L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig- ExtractConfig() returns EFI_SUCCESS or EFI_NOT_FOUND with Request been NULL .", > L"%a:%d: Status - %r", > __FILE__, > (UINTN)__LINE__, > Status > ); > - > - > -/* > - // > - // build out of > - // > - Len = SctStrLen (MultiConfigAltResp); > - Request = (EFI_STRING) SctAllocateZeroPool (2 * Len + 2); > - if (Request == NULL) { > - goto FUNC_EXIT; > - } > - > - > - Status = MultiAltRespToMultiReq (MultiConfigAltResp, Request); > - if (Status != EFI_SUCCESS) { > - goto FUNC_EXIT; > - } > - > - Status = HIIConfigRouting->ExtractConfig( > - HIIConfigRouting, > - Request, > - &Progress, > - &Results > - ); > - // > - // Since ExtractConfig may not append at string tail. > - // We check whether Results is a substring of MultiConfigAltResp from ExportConfig > - // > - if (Status == EFI_SUCCESS && SctStrStr (MultiConfigAltResp, Results) != NULL) { > - AssertionType = EFI_TEST_ASSERTION_PASSED; > - } else if (EFI_OUT_OF_RESOURCES == Status){ > - AssertionType = EFI_TEST_ASSERTION_WARNING; > - } else { > - AssertionType = EFI_TEST_ASSERTION_FAILED; > - } > - StandardLib->RecordAssertion ( > - StandardLib, > - AssertionType, > - gHIIConfigAccessBBTestFunctionAssertionGuid004, > - L"HII_CONFIG_ACCESS_PROTOCOL.ExtractConfig - ExtractConfig() Check if Results is in format.", > - L"%a:%d:", > - __FILE__, > - (UINTN)__LINE__ > - ); > > > -FUNC_EXIT: > -*/ > if ( NULL != MultiConfigAltResp ){ > gtBS->FreePool (MultiConfigAltResp); > }