[edk2-devel] [edk2-test] [PATCH] Fix missing symbols on edk2-test build

Grant Likely posted 1 patch 3 years, 5 months ago
Failed in applying to current master (apply log)
.../Dependency/SampleDriver/DriverSample.c        | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
[edk2-devel] [edk2-test] [PATCH] Fix missing symbols on edk2-test build
Posted by Grant Likely 3 years, 5 months ago
EDK2 has removed some deprecated function wrappers. The BlackBoxTest
still uses StrnCpy() and UnicodeValueToString(). This patch fixes the
build by moving to UnicodeValueToStringS(). However, the code using
StrnCpy() is simply #ifdef'd out because on reading the code it is
apparent that the testcase is non-functional and the fix is not
straightforward. As I understand it, there are no functional
implementations of the interface in the wild anyway. If/when it does
become important someone can do the work of making a proper test case.

Fixes: Bug 2068

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Cc: G Edhaya Chandran <Edhaya.Chandran@arm.com>
Cc: Eric Jin <eric.jin@intel.com>
Cc: Barton Gao <gaojie@byosoft.com.cn>
---
 .../Dependency/SampleDriver/DriverSample.c        | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/ConfigKeywordHandler/BlackBoxTest/Dependency/SampleDriver/DriverSample.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/ConfigKeywordHandler/BlackBoxTest/Dependency/SampleDriver/DriverSample.c
index fe973a33..584ee8b4 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/ConfigKeywordHandler/BlackBoxTest/Dependency/SampleDriver/DriverSample.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/ConfigKeywordHandler/BlackBoxTest/Dependency/SampleDriver/DriverSample.c
@@ -920,8 +920,9 @@ ExtractConfig (
 
       BackupChar = Value[ValueStrLen];
       *Value++   = L'=';
-      Value += UnicodeValueToString (
+      Value += UnicodeValueToStringS (
                  Value, 
+                 BufferSize - (Value - *Results),
                  PREFIX_ZERO | RADIX_HEX, 
                  PrivateData->Configuration.NameValueVar0, 
                  sizeof (PrivateData->Configuration.NameValueVar0) * 2
@@ -939,8 +940,9 @@ ExtractConfig (
 
       BackupChar = Value[ValueStrLen];
       *Value++   = L'=';
-      Value += UnicodeValueToString (
+      Value += UnicodeValueToStringS (
                 Value, 
+                BufferSize - (Value - *Results),
                 PREFIX_ZERO | RADIX_HEX, 
                 PrivateData->Configuration.NameValueVar1, 
                 sizeof (PrivateData->Configuration.NameValueVar1) * 2
@@ -962,7 +964,8 @@ ExtractConfig (
       //
       StrPointer = (CHAR16 *) PrivateData->Configuration.NameValueVar2;
       for (; *StrPointer != L'\0'; StrPointer++) {
-        Value += UnicodeValueToString (Value, PREFIX_ZERO | RADIX_HEX, *StrPointer, 4);
+        Value += UnicodeValueToStringS (Value, BufferSize - (Value - *Results),
+                                        PREFIX_ZERO | RADIX_HEX, *StrPointer, 4);
       }
     }
     
@@ -1894,7 +1897,7 @@ DriverSampleInit (
   MY_EFI_VARSTORE_DATA            *VarStoreConfig;
   EFI_INPUT_KEY                   HotKey;
   EDKII_FORM_BROWSER_EXTENSION_PROTOCOL *FormBrowserEx;
-#if 1
+#if 0
     EFI_STRING                      Progress;
   EFI_STRING                      Results;
   UINT32                          ProgressErr;
@@ -2243,7 +2246,9 @@ DriverSampleInit (
     HiiRemovePackages (HiiHandle[1]);
   }
 
-#if 1
+#if 0 // gcl - This test case is incomplete and fails to compile. StrnCpy needs to be
+      // changed to StrnCpyS() to fix build error, but there is a larger problem that
+      // the testcases don't match the spec or test any behaviour
   //
   // Test Cases 1: Keyword - GetData and change the value by SetData
   //
-- 
2.20.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67289): https://edk2.groups.io/g/devel/message/67289
Mute This Topic: https://groups.io/mt/78186938/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [edk2-test] [PATCH] Fix missing symbols on edk2-test build
Posted by Samer El-Haj-Mahmoud 3 years, 5 months ago
Reviewed-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>

> -----Original Message-----
> From: Grant Likely <Grant.Likely@arm.com>
> Sent: Wednesday, November 11, 2020 11:00 AM
> To: devel@edk2.groups.io
> Cc: nd <nd@arm.com>; Grant Likely <Grant.Likely@arm.com>; Grant Likely
> <grant.likely@secretlab.ca>; Samer El-Haj-Mahmoud <Samer.El-Haj-
> Mahmoud@arm.com>; G Edhaya Chandran <Edhaya.Chandran@arm.com>;
> Eric Jin <eric.jin@intel.com>; Barton Gao <gaojie@byosoft.com.cn>
> Subject: [edk2-test] [PATCH] Fix missing symbols on edk2-test build
> 
> EDK2 has removed some deprecated function wrappers. The BlackBoxTest
> still uses StrnCpy() and UnicodeValueToString(). This patch fixes the
> build by moving to UnicodeValueToStringS(). However, the code using
> StrnCpy() is simply #ifdef'd out because on reading the code it is
> apparent that the testcase is non-functional and the fix is not
> straightforward. As I understand it, there are no functional
> implementations of the interface in the wild anyway. If/when it does
> become important someone can do the work of making a proper test case.
> 
> Fixes: Bug 2068
> 
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
> Cc: G Edhaya Chandran <Edhaya.Chandran@arm.com>
> Cc: Eric Jin <eric.jin@intel.com>
> Cc: Barton Gao <gaojie@byosoft.com.cn>
> ---
>  .../Dependency/SampleDriver/DriverSample.c        | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/ConfigKeywordHandler/BlackBoxTes
> t/Dependency/SampleDriver/DriverSample.c b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/ConfigKeywordHandler/BlackBoxTes
> t/Dependency/SampleDriver/DriverSample.c
> index fe973a33..584ee8b4 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/ConfigKeywordHandler/BlackBoxTes
> t/Dependency/SampleDriver/DriverSample.c
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/ConfigKeywordHandler/BlackBoxTes
> t/Dependency/SampleDriver/DriverSample.c
> @@ -920,8 +920,9 @@ ExtractConfig (
> 
>        BackupChar = Value[ValueStrLen];
>        *Value++   = L'=';
> -      Value += UnicodeValueToString (
> +      Value += UnicodeValueToStringS (
>                   Value,
> +                 BufferSize - (Value - *Results),
>                   PREFIX_ZERO | RADIX_HEX,
>                   PrivateData->Configuration.NameValueVar0,
>                   sizeof (PrivateData->Configuration.NameValueVar0) * 2
> @@ -939,8 +940,9 @@ ExtractConfig (
> 
>        BackupChar = Value[ValueStrLen];
>        *Value++   = L'=';
> -      Value += UnicodeValueToString (
> +      Value += UnicodeValueToStringS (
>                  Value,
> +                BufferSize - (Value - *Results),
>                  PREFIX_ZERO | RADIX_HEX,
>                  PrivateData->Configuration.NameValueVar1,
>                  sizeof (PrivateData->Configuration.NameValueVar1) * 2
> @@ -962,7 +964,8 @@ ExtractConfig (
>        //
>        StrPointer = (CHAR16 *) PrivateData->Configuration.NameValueVar2;
>        for (; *StrPointer != L'\0'; StrPointer++) {
> -        Value += UnicodeValueToString (Value, PREFIX_ZERO | RADIX_HEX,
> *StrPointer, 4);
> +        Value += UnicodeValueToStringS (Value, BufferSize - (Value - *Results),
> +                                        PREFIX_ZERO | RADIX_HEX, *StrPointer, 4);
>        }
>      }
> 
> @@ -1894,7 +1897,7 @@ DriverSampleInit (
>    MY_EFI_VARSTORE_DATA            *VarStoreConfig;
>    EFI_INPUT_KEY                   HotKey;
>    EDKII_FORM_BROWSER_EXTENSION_PROTOCOL *FormBrowserEx;
> -#if 1
> +#if 0
>      EFI_STRING                      Progress;
>    EFI_STRING                      Results;
>    UINT32                          ProgressErr;
> @@ -2243,7 +2246,9 @@ DriverSampleInit (
>      HiiRemovePackages (HiiHandle[1]);
>    }
> 
> -#if 1
> +#if 0 // gcl - This test case is incomplete and fails to compile. StrnCpy needs
> to be
> +      // changed to StrnCpyS() to fix build error, but there is a larger problem
> that
> +      // the testcases don't match the spec or test any behaviour
>    //
>    // Test Cases 1: Keyword - GetData and change the value by SetData
>    //
> --
> 2.20.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67304): https://edk2.groups.io/g/devel/message/67304
Mute This Topic: https://groups.io/mt/78186938/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [edk2-test] [PATCH] Fix missing symbols on edk2-test build
Posted by G Edhaya Chandran 3 years, 5 months ago
Reviewed-by: G Edhaya Chandran<edhaya.chandran@arm.com>

Build is verified. Upstreamed by commit-id : https://github.com/tianocore/edk2-test/commit/a7c2b532431b96abea7a3f81b6ed46fc10469c11


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#67886): https://edk2.groups.io/g/devel/message/67886
Mute This Topic: https://groups.io/mt/78186938/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-