public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@arm.com>
To: devel@edk2.groups.io
Cc: 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
Date: Wed, 11 Nov 2020 16:00:11 +0000	[thread overview]
Message-ID: <20201111160010.8881-1-grant.likely@arm.com> (raw)

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


             reply	other threads:[~2020-11-11 16:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11 16:00 Grant Likely [this message]
2020-11-11 20:53 ` [edk2-test] [PATCH] Fix missing symbols on edk2-test build Samer El-Haj-Mahmoud
2020-11-24 10:20   ` [edk2-devel] " G Edhaya Chandran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201111160010.8881-1-grant.likely@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox