public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-test][Patch] uefi-sct\SctPkg: Fix the corner case of ExtractConfig API
@ 2018-10-12  2:11 Eric Jin
  2018-10-12  8:38 ` Supreeth Venkatesh
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Jin @ 2018-10-12  2:11 UTC (permalink / raw)
  To: edk2-devel; +Cc: Supreeth Venkatesh, Jiaxin Wu

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 <eric.jin@intel.com>
Cc: Supreeth Venkatesh <Supreeth.Venkatesh@arm.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
---
 .../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.<BR>
-  Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
 
   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 <MultiConfigRequest> out of <MultiConfigAltResp> 
-  //
-  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 <AltResp> 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 <MultiConfigAltResp> format.",
-                 L"%a:%d:",
-                 __FILE__,
-                 (UINTN)__LINE__
-                 );
    
 
-FUNC_EXIT:
-*/
   if ( NULL != MultiConfigAltResp ){
     gtBS->FreePool (MultiConfigAltResp);
   }
-- 
2.9.0.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [edk2-test][Patch] uefi-sct\SctPkg: Fix the corner case of ExtractConfig API
  2018-10-12  2:11 [edk2-test][Patch] uefi-sct\SctPkg: Fix the corner case of ExtractConfig API Eric Jin
@ 2018-10-12  8:38 ` Supreeth Venkatesh
  0 siblings, 0 replies; 2+ messages in thread
From: Supreeth Venkatesh @ 2018-10-12  8:38 UTC (permalink / raw)
  To: Eric Jin, edk2-devel; +Cc: Jiaxin Wu

migrating over from 
https://github.com/UEFI/UEFI-SCT/commit/be1ddea30c03bf6c9f38ff826f7c4317b0653a4c

Reviewed-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>



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 <eric.jin@intel.com>
> Cc: Supreeth Venkatesh <Supreeth.Venkatesh@arm.com>
> Cc: Jiaxin Wu <jiaxin.wu@intel.com>
> ---
>   .../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.<BR>
> -  Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
>   
>     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 <MultiConfigRequest> out of <MultiConfigAltResp>
> -  //
> -  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 <AltResp> 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 <MultiConfigAltResp> format.",
> -                 L"%a:%d:",
> -                 __FILE__,
> -                 (UINTN)__LINE__
> -                 );
>      
>   
> -FUNC_EXIT:
> -*/
>     if ( NULL != MultiConfigAltResp ){
>       gtBS->FreePool (MultiConfigAltResp);
>     }



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-12  8:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-12  2:11 [edk2-test][Patch] uefi-sct\SctPkg: Fix the corner case of ExtractConfig API Eric Jin
2018-10-12  8:38 ` Supreeth Venkatesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox