From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=eric.jin@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7084F21167463 for ; Thu, 11 Oct 2018 19:11:35 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2018 19:11:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,370,1534834800"; d="scan'208";a="271716429" Received: from shwdeopenpsi175.ccr.corp.intel.com ([10.239.9.140]) by fmsmga006.fm.intel.com with ESMTP; 11 Oct 2018 19:11:32 -0700 From: Eric Jin To: edk2-devel@lists.01.org Cc: Supreeth Venkatesh , Jiaxin Wu Date: Fri, 12 Oct 2018 10:11:23 +0800 Message-Id: <20181012021123.11904-1-eric.jin@intel.com> X-Mailer: git-send-email 2.9.0.windows.1 Subject: [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 02:11:35 -0000 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); } -- 2.9.0.windows.1