public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Re: [edk2-test][Patch v2] uefi-sct/SctPkg:Add checkpoint of ReadKeyStrokeEx Toggle state
@ 2018-11-07  7:19 Jin, Eric
  2018-11-07 20:10 ` Supreeth Venkatesh
  0 siblings, 1 reply; 2+ messages in thread
From: Jin, Eric @ 2018-11-07  7:19 UTC (permalink / raw)
  To: edk2-devel@lists.01.org, Supreeth Venkatesh

It is  the patch v2 below. 

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Eric Jin
Sent: Wednesday, November 7, 2018 2:48 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [edk2-test][Patch] uefi-sct/SctPkg:Add checkpoint of ReadKeyStrokeEx Toggle state

UEFI drivers which implement the EFI_SIMPLE_TEXT_INPUT_EX protocol are required to return KeyData.Key and KeyData.KeyState values.
These drivers must always return the most current state of KeyData.KeyState.KeyShiftState and KeyData.KeyState.KeyToggleState.

The change in spec is "EFI_NOT_READY - There was no keystroke data available. Current KeyData.KeyState values are exposed."

Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Jin <eric.jin@intel.com>
---
 .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c |   7 +-
 .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h |  12 +-  .../BlackBoxTest/SimpleTextInputExBBTestFunction.c | 211 ++++++++++++++++++++
 .../BlackBoxTest/SimpleTextInputExBBTestMain.c     |  13 +-
 .../BlackBoxTest/SimpleTextInputExBBTestMain.h     |  22 ++-
 .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c |   7 +-
 .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h |  12 +-  .../BlackBoxTest/SimpleTextInputExBBTestFunction.c | 213 ++++++++++++++++++++-
 .../BlackBoxTest/SimpleTextInputExBBTestMain.c     |  11 +-
 .../BlackBoxTest/SimpleTextInputExBBTestMain.h     |  20 +-
 10 files changed, 515 insertions(+), 13 deletions(-)

diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c
index 9cb19f4..ff2d50f 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black
+++ BoxTest/Guid.c
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2012 Unified EFI, Inc.<BR>
-  Copyright (c) 2010 - 2012, 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 @@ -63,3 +63,8 @@ EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid007 = EFI_TEST_SIMPLETEXTI  EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid008 = EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_008_GUID;
 
 EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009 = EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_009_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010 = 
+EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011 = 
+EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID;
+
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h
index 6c90fca..2a6be48 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black
+++ BoxTest/Guid.h
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2010 Unified EFI, Inc.<BR>
-  Copyright (c) 2010, 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 @@ -119,3 +119,13 @@ extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid008;
 { 0x534369f7, 0x8399, 0x4353, { 0x94, 0xad, 0xc4, 0x48, 0xfa, 0xda, 0xeb, 0x84 } }
 
 extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009;
+
+#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID \ { 
+0xcf4d54eb, 0x6696, 0x4794, { 0x91, 0x74, 0x59, 0xd, 0x1c, 0x22, 0xa8, 
+0x67 } }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010;
+
+#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID \ { 
+0xf8e8f879, 0xa6d4, 0x4fd3, { 0x8b, 0x8e, 0xba, 0x1d, 0x18, 0xf1, 0x40, 
+0x71 } }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011;
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
index 153ade0..4850627 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black
+++ BoxTest/SimpleTextInputExBBTestFunction.c
@@ -456,6 +456,78 @@ BBTestUnregisterKeyNotifyFunctionManualTest (  }
 
 
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTest (
+  IN EFI_BB_TEST_PROTOCOL       *This,
+  IN VOID                       *ClientInterface,
+  IN EFI_TEST_LEVEL             TestLevel,
+  IN EFI_HANDLE                 SupportHandle
+  )
+{
+  EFI_STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;
+  EFI_STATUS                            Status;
+  EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL     *SimpleTextInputEx;
+  
+  EFI_DEVICE_PATH_PROTOCOL             *DevicePath;
+  CHAR16                               *DevicePathStr;
+
+  //
+  // init
+  //
+  SimpleTextInputEx = 
+ (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL*)ClientInterface;
+
+  //
+  // Get the Standard Library Interface  //  Status = 
+ gtBS->HandleProtocol (
+                   SupportHandle,
+                   &gEfiStandardTestLibraryGuid,
+                   (VOID **) &StandardLib
+                   );
+  if (EFI_ERROR(Status)) {
+    return Status;
+  }
+  
+  //
+  // Get Device Path of current Simple_Text_Input_Ex_Protocol  // And 
+ out put device path or device name  //  Status = 
+ LocateDevicePathFromSimpleTextInputEx (SimpleTextInputEx, &DevicePath, 
+ StandardLib);  if (Status == EFI_SUCCESS) {
+    DevicePathStr = SctDevicePathToStr (DevicePath);
+    if (DevicePathStr != NULL) {
+      StandardLib->RecordMessage (
+                     StandardLib,
+                     EFI_VERBOSE_LEVEL_DEFAULT,
+                     L"\r\nCurrent Device: %s",
+                     DevicePathStr
+                     );
+      Status = gtBS->FreePool (DevicePathStr);
+      if (EFI_ERROR(Status))
+        return Status;
+      DevicePathStr=NULL;
+    }
+  } else {
+    //
+    // Console Splitter/StdErr
+    //
+    StandardLib->RecordMessage (
+                   StandardLib,
+                   EFI_VERBOSE_LEVEL_DEFAULT,
+                   L"\r\nCurrent Device: ConsoleSplitter/TxtIn"
+                   );
+  }
+
+  //
+  //
+  //
+  BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 ( StandardLib, 
+ SimpleTextInputEx );
+  
+  return EFI_SUCCESS;
+}
+
+
+
 //
 //Check Points
 //
@@ -1061,3 +1133,142 @@ BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (
 
   return EFI_SUCCESS;
 }
+
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
+  IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL         *StandardLib,
+  IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL          *SimpleTextInputEx
+  )
+{
+  EFI_STATUS            Status;
+  EFI_TEST_ASSERTION    AssertionType;
+  EFI_KEY_DATA          Key;
+  UINT8                 Index;
+
+  EFI_KEY_TOGGLE_STATE  State = EFI_TOGGLE_STATE_VALID | 
+ EFI_KEY_STATE_EXPOSED;
+
+  EFI_KEY_TOGGLE_STATE  ValidState[] = {
+                          EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE,
+                          EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE,
+                          EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED | EFI_CAPS_LOCK_ACTIVE,
+                          EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE | EFI_NUM_LOCK_ACTIVE,
+                          EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE | EFI_CAPS_LOCK_ACTIVE,
+                          EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE | EFI_CAPS_LOCK_ACTIVE,
+                          EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |EFI_NUM_LOCK_ACTIVE | EFI_CAPS_LOCK_ACTIVE,
+                          0
+                          };
+ 
+  //
+  //Reset the console
+  //
+  Status = SimpleTextInputEx->ReadKeyStrokeEx (
+                                  SimpleTextInputEx, 
+                                  &Key
+                                  );
+  if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
+    return Status;
+  }
+
+  if ((Key.KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) == 0) {
+    return EFI_UNSUPPORTED;
+  }
+
+  //
+  //Set the KEY_STATE_EXPOSED to check the imcomplete keystroke support  
+ //  Status = SimpleTextInputEx->SetState (
+                                SimpleTextInputEx,
+                                &State
+                                );
+
+  if (Status == EFI_UNSUPPORTED || Status == EFI_DEVICE_ERROR) {
+    StandardLib->RecordAssertion (
+                   StandardLib,
+                   EFI_TEST_ASSERTION_WARNING,
+                   gTestGenericFailureGuid,
+                   L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState - SetState() doesn't return EFI_SUCCESS with EFI_KEY_STATE_EXPOSED",
+                   L"%a:%d, Status = %r\n",
+                   __FILE__,
+                   (UINTN)__LINE__,
+                   Status
+                   );
+    return Status;
+  }
+
+  for (Index=0; ValidState[Index]; Index++) {
+
+    //
+    // Set the valid KeyToggleState
+    //
+    Status = SimpleTextInputEx->SetState (
+                                  SimpleTextInputEx,
+                                  ValidState + Index
+                                  );
+  
+    if (Status != EFI_SUCCESS) {
+      StandardLib->RecordAssertion (
+                     StandardLib,
+                     EFI_TEST_ASSERTION_FAILED,
+                     gTestGenericFailureGuid,
+                     L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState - SetState() doesn't return EFI_SUCCESS with the valid KeyToggleState",
+                     L"%a:%d, Status = %r, KeyToggleState = %x\n",
+                     __FILE__,
+                     (UINTN)__LINE__,
+                     Status,
+                     ValidState[Index]
+                     );
+      continue;
+    }
+
+    //
+    // Get the KeyToggleState
+    //
+    Status = SimpleTextInputEx->ReadKeyStrokeEx (
+                                  SimpleTextInputEx, 
+                                  &Key
+                                  );
+
+    if (Status != EFI_NOT_READY) {
+      AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+      StandardLib->RecordAssertion (
+                     StandardLib,
+                     AssertionType,
+                     gSimpleTextInputExBBTestFunctionAssertionGuid010,
+                     L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStrokeEx - ReadKeyStrokeEx() doesn't return EFI_NOT_READY when there is no Key data and EFI_KEY_STATE_EXPOSED is enabled",
+                     L"%a:%d, Status = %r, Index = %d, KeyToggleState = %x\n",
+                     __FILE__,
+                     (UINTN)__LINE__,
+                     Status,
+                     Index,
+                     ValidState[Index]
+                     );
+
+    } else {
+      if (Key.KeyState.KeyToggleState == ValidState[Index] &&
+        (Key.KeyState.KeyShiftState == 0 || Key.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID) &&
+        Key.Key.ScanCode == 0 && Key.Key.UnicodeChar == 0)
+        AssertionType = EFI_TEST_ASSERTION_PASSED;
+      else
+        AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+
+      StandardLib->RecordAssertion (
+                     StandardLib,
+                     AssertionType,
+                     gSimpleTextInputExBBTestFunctionAssertionGuid011,
+                     L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStrokeEx - ReadKeyStrokeEx() should get the ValidState with EFI_NOT_READY and other field is zero",
+                     L"%a:%d, Status = %r, Index = %d, KeyToggleState = %x, expect State = %x\n",
+                     __FILE__,
+                     (UINTN)__LINE__,
+                     Status,
+                     Index,
+                     Key.KeyState.KeyToggleState,
+                     ValidState[Index]
+                     );
+
+    }
+  }
+
+  return EFI_SUCCESS;
+}
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestMain.c
index fdbc90f..5b71b6a 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestMain.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black
+++ BoxTest/SimpleTextInputExBBTestMain.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 @@ -106,6 +106,15 @@ EFI_BB_TEST_ENTRY_FIELD gBBTestEntryField[] = {
   },
 #endif
   {
+    EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107,
+    L"ReadKeyStrokeExFunctionAuto",
+    L"Function Auto test for Simple Text Input Ex Protocol ReadKeyStrokeEx().",
+    EFI_TEST_LEVEL_MINIMAL,
+    gSupportProtocolGuid,
+    EFI_TEST_CASE_AUTO,
+    BBTestReadKeyStrokeExFunctionAutoTest
+  },
+  {
     EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0201,
     L"ReadKeyStrokeExConformance",
     L"Conformance test for Simple Text Input Ex Protocol ReadKeyStrokeEx().",
@@ -151,7 +160,6 @@ BOOLEAN     BeenExecuted;
 //
 
 EFI_STATUS
-EFIAPI
 InitializeSimpleTextInputExBBTest (
   IN EFI_HANDLE                   ImageHandle,
   IN EFI_SYSTEM_TABLE             *SystemTable
@@ -179,7 +187,6 @@ InitializeSimpleTextInputExBBTest (
 
 
 EFI_STATUS
-EFIAPI
 UnloadSimpleTextInputExBBTest (
   IN EFI_HANDLE                   ImageHandle
   )
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestMain.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestMain.h
index cb2160b..8676606 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestMain.h
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black
+++ BoxTest/SimpleTextInputExBBTestMain.h
@@ -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 @@ -57,6 +57,8 @@ Abstract:
 #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0106 \  { 0xdbc6e659, 0xb0e0, 0x4471, { 0x94, 0x13, 0x45, 0x1b, 0xdc, 0xe2, 0xad, 0xc7 } }
 
+#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107 \ { 
+0x2c3ca282, 0x5644, 0x41b6, { 0xaf, 0xc9, 0x43, 0x87, 0xf2, 0x53, 0x89, 
+0xbd } }
 //
 // Entry GUIDs for Conf Test
 //
@@ -86,7 +88,6 @@ typedef enum {
 //
 //
 EFI_STATUS
-EFIAPI
 InitializeSimpleTextInputExBBTest (
   IN EFI_HANDLE                   ImageHandle,
   IN EFI_SYSTEM_TABLE             *SystemTable
@@ -94,7 +95,6 @@ InitializeSimpleTextInputExBBTest (
   
   
 EFI_STATUS
-EFIAPI
 UnloadSimpleTextInputExBBTest (
   IN EFI_HANDLE                   ImageHandle
   );
@@ -155,6 +155,15 @@ BBTestUnregisterKeyNotifyFunctionManualTest (
   IN EFI_TEST_LEVEL             TestLevel,
   IN EFI_HANDLE                 SupportHandle
   );
+
+
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTest (
+  IN EFI_BB_TEST_PROTOCOL       *This,
+  IN VOID                       *ClientInterface,
+  IN EFI_TEST_LEVEL             TestLevel,
+  IN EFI_HANDLE                 SupportHandle
+  );
   
   
 EFI_STATUS
@@ -239,6 +248,13 @@ BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (
 
 
 EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
+  IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL         *StandardLib,
+  IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL          *SimpleTextInputEx
+  );
+
+
+EFI_STATUS
 BBTestReadKeyStrokeExConformanceTestCheckpoint1 (
   IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL         *StandardLib,
   IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL          *SimpleTextInputEx
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c
index b79772c..6876814 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black
+++ BoxTest/Guid.c
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2015 Unified EFI, Inc.<BR>
-  Copyright (c) 2010 - 2015, 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 @@ -63,3 +63,8 @@ EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid007 = EFI_TEST_SIMPLETEXTI  EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid008 = EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_008_GUID;
 
 EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009 = EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_009_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010 = 
+EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID;
+
+EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011 = 
+EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID;
+
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h
index 6c90fca..2a6be48 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black
+++ BoxTest/Guid.h
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2010 Unified EFI, Inc.<BR>
-  Copyright (c) 2010, 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 @@ -119,3 +119,13 @@ extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid008;
 { 0x534369f7, 0x8399, 0x4353, { 0x94, 0xad, 0xc4, 0x48, 0xfa, 0xda, 0xeb, 0x84 } }
 
 extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009;
+
+#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID \ { 
+0xcf4d54eb, 0x6696, 0x4794, { 0x91, 0x74, 0x59, 0xd, 0x1c, 0x22, 0xa8, 
+0x67 } }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010;
+
+#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID \ { 
+0xf8e8f879, 0xa6d4, 0x4fd3, { 0x8b, 0x8e, 0xba, 0x1d, 0x18, 0xf1, 0x40, 
+0x71 } }
+
+extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011;
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
index ce5a80a..0b953ca 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunction.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black
+++ BoxTest/SimpleTextInputExBBTestFunction.c
@@ -456,6 +456,78 @@ BBTestUnregisterKeyNotifyFunctionManualTest (  }
 
 
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTest (
+  IN EFI_BB_TEST_PROTOCOL       *This,
+  IN VOID                       *ClientInterface,
+  IN EFI_TEST_LEVEL             TestLevel,
+  IN EFI_HANDLE                 SupportHandle
+  )
+{
+  EFI_STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;
+  EFI_STATUS                            Status;
+  EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL     *SimpleTextInputEx;
+  
+  EFI_DEVICE_PATH_PROTOCOL             *DevicePath;
+  CHAR16                               *DevicePathStr;
+
+  //
+  // init
+  //
+  SimpleTextInputEx = 
+ (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL*)ClientInterface;
+
+  //
+  // Get the Standard Library Interface  //  Status = 
+ gtBS->HandleProtocol (
+                   SupportHandle,
+                   &gEfiStandardTestLibraryGuid,
+                   (VOID **) &StandardLib
+                   );
+  if (EFI_ERROR(Status)) {
+    return Status;
+  }
+  
+  //
+  // Get Device Path of current Simple_Text_Input_Ex_Protocol  // And 
+ out put device path or device name  //  Status = 
+ LocateDevicePathFromSimpleTextInputEx (SimpleTextInputEx, &DevicePath, 
+ StandardLib);  if (Status == EFI_SUCCESS) {
+    DevicePathStr = SctDevicePathToStr (DevicePath);
+    if (DevicePathStr != NULL) {
+      StandardLib->RecordMessage (
+                     StandardLib,
+                     EFI_VERBOSE_LEVEL_DEFAULT,
+                     L"\r\nCurrent Device: %s",
+                     DevicePathStr
+                     );
+      Status = gtBS->FreePool (DevicePathStr);
+      if (EFI_ERROR(Status))
+        return Status;
+      DevicePathStr=NULL;
+    }
+  } else {
+    //
+    // Console Splitter/StdErr
+    //
+    StandardLib->RecordMessage (
+                   StandardLib,
+                   EFI_VERBOSE_LEVEL_DEFAULT,
+                   L"\r\nCurrent Device: ConsoleSplitter/TxtIn"
+                   );
+  }
+
+  //
+  //
+  //
+  BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 ( StandardLib, 
+ SimpleTextInputEx );
+  
+  return EFI_SUCCESS;
+}
+
+
+
 //
 //Check Points
 //
@@ -1060,4 +1132,143 @@ BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (
            );
 
   return EFI_SUCCESS;
-}
\ No newline at end of file
+}
+
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
+  IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL         *StandardLib,
+  IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL          *SimpleTextInputEx
+  )
+{
+  EFI_STATUS            Status;
+  EFI_TEST_ASSERTION    AssertionType;
+  EFI_KEY_DATA          Key;
+  UINT8                 Index;
+
+  EFI_KEY_TOGGLE_STATE  State = EFI_TOGGLE_STATE_VALID | 
+ EFI_KEY_STATE_EXPOSED;
+
+  EFI_KEY_TOGGLE_STATE  ValidState[] = {
+                          EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE,
+                          EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE,
+                          EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED | EFI_CAPS_LOCK_ACTIVE,
+                          EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE | EFI_NUM_LOCK_ACTIVE,
+                          EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE | EFI_CAPS_LOCK_ACTIVE,
+                          EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE | EFI_CAPS_LOCK_ACTIVE,
+                          EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |EFI_NUM_LOCK_ACTIVE | EFI_CAPS_LOCK_ACTIVE,
+                          0
+                          };
+ 
+  //
+  //Reset the console
+  //
+  Status = SimpleTextInputEx->ReadKeyStrokeEx (
+                                  SimpleTextInputEx, 
+                                  &Key
+                                  );
+  if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
+    return Status;
+  }
+
+  if ((Key.KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) == 0) {
+    return EFI_UNSUPPORTED;
+  }
+
+  //
+  //Set the KEY_STATE_EXPOSED to check the imcomplete keystroke support  
+ //  Status = SimpleTextInputEx->SetState (
+                                SimpleTextInputEx,
+                                &State
+                                );
+
+  if (Status == EFI_UNSUPPORTED || Status == EFI_DEVICE_ERROR) {
+    StandardLib->RecordAssertion (
+                   StandardLib,
+                   EFI_TEST_ASSERTION_WARNING,
+                   gTestGenericFailureGuid,
+                   L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState - SetState() doesn't return EFI_SUCCESS with EFI_KEY_STATE_EXPOSED",
+                   L"%a:%d, Status = %r\n",
+                   __FILE__,
+                   (UINTN)__LINE__,
+                   Status
+                   );
+    return Status;
+  }
+
+  for (Index=0; ValidState[Index]; Index++) {
+
+    //
+    // Set the valid KeyToggleState
+    //
+    Status = SimpleTextInputEx->SetState (
+                                  SimpleTextInputEx,
+                                  ValidState + Index
+                                  );
+  
+    if (Status != EFI_SUCCESS) {
+      StandardLib->RecordAssertion (
+                     StandardLib,
+                     EFI_TEST_ASSERTION_FAILED,
+                     gTestGenericFailureGuid,
+                     L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState - SetState() doesn't return EFI_SUCCESS with the valid KeyToggleState",
+                     L"%a:%d, Status = %r, KeyToggleState = %x\n",
+                     __FILE__,
+                     (UINTN)__LINE__,
+                     Status,
+                     ValidState[Index]
+                     );
+      continue;
+    }
+
+    //
+    // Get the KeyToggleState
+    //
+    Status = SimpleTextInputEx->ReadKeyStrokeEx (
+                                  SimpleTextInputEx, 
+                                  &Key
+                                  );
+
+    if (Status != EFI_NOT_READY) {
+      AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+      StandardLib->RecordAssertion (
+                     StandardLib,
+                     AssertionType,
+                     gSimpleTextInputExBBTestFunctionAssertionGuid010,
+                     L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStrokeEx - ReadKeyStrokeEx() doesn't return EFI_NOT_READY when there is no Key data and EFI_KEY_STATE_EXPOSED is enabled",
+                     L"%a:%d, Status = %r, Index = %d, KeyToggleState = %x\n",
+                     __FILE__,
+                     (UINTN)__LINE__,
+                     Status,
+                     Index,
+                     ValidState[Index]
+                     );
+
+    } else {
+      if (Key.KeyState.KeyToggleState == ValidState[Index] &&
+        (Key.KeyState.KeyShiftState == 0 || Key.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID) &&
+        Key.Key.ScanCode == 0 && Key.Key.UnicodeChar == 0)
+        AssertionType = EFI_TEST_ASSERTION_PASSED;
+      else
+      	 AssertionType = EFI_TEST_ASSERTION_FAILED;
+
+
+      StandardLib->RecordAssertion (
+                     StandardLib,
+                     AssertionType,
+                     gSimpleTextInputExBBTestFunctionAssertionGuid011,
+                     L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStrokeEx - ReadKeyStrokeEx() should get the ValidState with EFI_NOT_READY and other field is zero",
+                     L"%a:%d, Status = %r, Index = %d, KeyToggleState = %x, expect State = %x\n",
+                     __FILE__,
+                     (UINTN)__LINE__,
+                     Status,
+                     Index,
+                     Key.KeyState.KeyToggleState,
+                     ValidState[Index]
+                     );
+
+    }
+  }
+
+  return EFI_SUCCESS;
+}
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestMain.c
index 43dbbda..c0a4f5a 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestMain.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black
+++ BoxTest/SimpleTextInputExBBTestMain.c
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2016 Unified EFI, Inc.<BR>
-  Copyright (c) 2010 - 2016, 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 @@ -106,6 +106,15 @@ EFI_BB_TEST_ENTRY_FIELD gBBTestEntryField[] = {
   },
 #endif
   {
+    EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107,
+    L"ReadKeyStrokeExFunctionAuto",
+    L"Function Auto test for Simple Text Input Ex Protocol ReadKeyStrokeEx().",
+    EFI_TEST_LEVEL_MINIMAL,
+    gSupportProtocolGuid,
+    EFI_TEST_CASE_AUTO,
+    BBTestReadKeyStrokeExFunctionAutoTest
+  },
+  {
     EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0201,
     L"ReadKeyStrokeExConformance",
     L"Conformance test for Simple Text Input Ex Protocol ReadKeyStrokeEx().", diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestMain.h b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestMain.h
index 0b3312e..bb0d8c9 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestMain.h
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black
+++ BoxTest/SimpleTextInputExBBTestMain.h
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2014 Unified EFI, Inc.<BR>
-  Copyright (c) 2010 - 2014, 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 @@ -61,6 +61,8 @@ Abstract:
 #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0106 \  { 0xdbc6e659, 0xb0e0, 0x4471, { 0x94, 0x13, 0x45, 0x1b, 0xdc, 0xe2, 0xad, 0xc7 } }
 
+#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107 \ { 
+0x2c3ca282, 0x5644, 0x41b6, { 0xaf, 0xc9, 0x43, 0x87, 0xf2, 0x53, 0x89, 
+0xbd } }
 //
 // Entry GUIDs for Conf Test
 //
@@ -157,6 +159,15 @@ BBTestUnregisterKeyNotifyFunctionManualTest (
   IN EFI_TEST_LEVEL             TestLevel,
   IN EFI_HANDLE                 SupportHandle
   );
+
+
+EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTest (
+  IN EFI_BB_TEST_PROTOCOL       *This,
+  IN VOID                       *ClientInterface,
+  IN EFI_TEST_LEVEL             TestLevel,
+  IN EFI_HANDLE                 SupportHandle
+  );
   
   
 EFI_STATUS
@@ -241,6 +252,13 @@ BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (
 
 
 EFI_STATUS
+BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
+  IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL         *StandardLib,
+  IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL          *SimpleTextInputEx
+  );
+
+
+EFI_STATUS
 BBTestReadKeyStrokeExConformanceTestCheckpoint1 (
   IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL         *StandardLib,
   IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL          *SimpleTextInputEx
--
2.9.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


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

* Re: [edk2-test][Patch v2] uefi-sct/SctPkg:Add checkpoint of ReadKeyStrokeEx Toggle state
  2018-11-07  7:19 [edk2-test][Patch v2] uefi-sct/SctPkg:Add checkpoint of ReadKeyStrokeEx Toggle state Jin, Eric
@ 2018-11-07 20:10 ` Supreeth Venkatesh
  0 siblings, 0 replies; 2+ messages in thread
From: Supreeth Venkatesh @ 2018-11-07 20:10 UTC (permalink / raw)
  To: Jin, Eric, edk2-devel@lists.01.org

Some of the same comments of PATCH v1 apply to v2.
Please see comments for v1 and resend a patch v3 as a series.

Thanks,
Supreeth
On Wed, 2018-11-07 at 07:19 +0000, Jin, Eric wrote:
> It is  the patch v2 below. 
> 
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf
> Of Eric Jin
> Sent: Wednesday, November 7, 2018 2:48 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [edk2-test][Patch] uefi-sct/SctPkg:Add checkpoint of
> ReadKeyStrokeEx Toggle state
> 
> UEFI drivers which implement the EFI_SIMPLE_TEXT_INPUT_EX protocol
> are required to return KeyData.Key and KeyData.KeyState values.
> These drivers must always return the most current state of
> KeyData.KeyState.KeyShiftState and KeyData.KeyState.KeyToggleState.
> 
> The change in spec is "EFI_NOT_READY - There was no keystroke data
> available. Current KeyData.KeyState values are exposed."
> 
> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Jin <eric.jin@intel.com>
> ---
>  .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c |   7 +-
>  .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h |  12
> +-  .../BlackBoxTest/SimpleTextInputExBBTestFunction.c | 211
> ++++++++++++++++++++
>  .../BlackBoxTest/SimpleTextInputExBBTestMain.c     |  13 +-
>  .../BlackBoxTest/SimpleTextInputExBBTestMain.h     |  22 ++-
>  .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c |   7 +-
>  .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h |  12
> +-  .../BlackBoxTest/SimpleTextInputExBBTestFunction.c | 213
> ++++++++++++++++++++-
>  .../BlackBoxTest/SimpleTextInputExBBTestMain.c     |  11 +-
>  .../BlackBoxTest/SimpleTextInputExBBTestMain.h     |  20 +-
>  10 files changed, 515 insertions(+), 13 deletions(-)
> 
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.c b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.c
> index 9cb19f4..ff2d50f 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.c
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black
> +++ BoxTest/Guid.c
> @@ -1,7 +1,7 @@
>  /** @file
>  
>    Copyright 2006 - 2012 Unified EFI, Inc.<BR>
> -  Copyright (c) 2010 - 2012, 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 @@ -63,3 +63,8 @@ EFI_GUID
> gSimpleTextInputExBBTestFunctionAssertionGuid007 =
> EFI_TEST_SIMPLETEXTI  EFI_GUID
> gSimpleTextInputExBBTestFunctionAssertionGuid008 =
> EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_008_GUID;
>  
>  EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009 =
> EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_009_GUID;
> +
> +EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010 = 
> +EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID;
> +
> +EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011 = 
> +EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID;
> +
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.h b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.h
> index 6c90fca..2a6be48 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.h
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black
> +++ BoxTest/Guid.h
> @@ -1,7 +1,7 @@
>  /** @file
>  
>    Copyright 2006 - 2010 Unified EFI, Inc.<BR>
> -  Copyright (c) 2010, 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 @@ -119,3 +119,13 @@ extern EFI_GUID
> gSimpleTextInputExBBTestFunctionAssertionGuid008;
>  { 0x534369f7, 0x8399, 0x4353, { 0x94, 0xad, 0xc4, 0x48, 0xfa, 0xda,
> 0xeb, 0x84 } }
>  
>  extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009;
> +
> +#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID
> \ { 
> +0xcf4d54eb, 0x6696, 0x4794, { 0x91, 0x74, 0x59, 0xd, 0x1c, 0x22,
> 0xa8, 
> +0x67 } }
> +
> +extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010;
> +
> +#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID
> \ { 
> +0xf8e8f879, 0xa6d4, 0x4fd3, { 0x8b, 0x8e, 0xba, 0x1d, 0x18, 0xf1,
> 0x40, 
> +0x71 } }
> +
> +extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011;
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> SimpleTextInputExBBTestFunction.c b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> SimpleTextInputExBBTestFunction.c
> index 153ade0..4850627 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> SimpleTextInputExBBTestFunction.c
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black
> +++ BoxTest/SimpleTextInputExBBTestFunction.c
> @@ -456,6 +456,78 @@ BBTestUnregisterKeyNotifyFunctionManualTest (  }
>  
>  
> +EFI_STATUS
> +BBTestReadKeyStrokeExFunctionAutoTest (
> +  IN EFI_BB_TEST_PROTOCOL       *This,
> +  IN VOID                       *ClientInterface,
> +  IN EFI_TEST_LEVEL             TestLevel,
> +  IN EFI_HANDLE                 SupportHandle
> +  )
> +{
> +  EFI_STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;
> +  EFI_STATUS                            Status;
> +  EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL     *SimpleTextInputEx;
> +  
> +  EFI_DEVICE_PATH_PROTOCOL             *DevicePath;
> +  CHAR16                               *DevicePathStr;
> +
> +  //
> +  // init
> +  //
> +  SimpleTextInputEx = 
> + (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL*)ClientInterface;
> +
> +  //
> +  // Get the Standard Library Interface  //  Status = 
> + gtBS->HandleProtocol (
> +                   SupportHandle,
> +                   &gEfiStandardTestLibraryGuid,
> +                   (VOID **) &StandardLib
> +                   );
> +  if (EFI_ERROR(Status)) {
> +    return Status;
> +  }
> +  
> +  //
> +  // Get Device Path of current Simple_Text_Input_Ex_Protocol  //
> And 
> + out put device path or device name  //  Status = 
> + LocateDevicePathFromSimpleTextInputEx (SimpleTextInputEx,
> &DevicePath, 
> + StandardLib);  if (Status == EFI_SUCCESS) {
> +    DevicePathStr = SctDevicePathToStr (DevicePath);
> +    if (DevicePathStr != NULL) {
> +      StandardLib->RecordMessage (
> +                     StandardLib,
> +                     EFI_VERBOSE_LEVEL_DEFAULT,
> +                     L"\r\nCurrent Device: %s",
> +                     DevicePathStr
> +                     );
> +      Status = gtBS->FreePool (DevicePathStr);
> +      if (EFI_ERROR(Status))
> +        return Status;
> +      DevicePathStr=NULL;
> +    }
> +  } else {
> +    //
> +    // Console Splitter/StdErr
> +    //
> +    StandardLib->RecordMessage (
> +                   StandardLib,
> +                   EFI_VERBOSE_LEVEL_DEFAULT,
> +                   L"\r\nCurrent Device: ConsoleSplitter/TxtIn"
> +                   );
> +  }
> +
> +  //
> +  //
> +  //
> +  BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 ( StandardLib, 
> + SimpleTextInputEx );
> +  
> +  return EFI_SUCCESS;
> +}
> +
> +
> +
>  //
>  //Check Points
>  //
> @@ -1061,3 +1133,142 @@
> BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (
>  
>    return EFI_SUCCESS;
>  }
> +
> +EFI_STATUS
> +BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
> +  IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL         *StandardLib,
> +  IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL          *SimpleTextInputEx
> +  )
> +{
> +  EFI_STATUS            Status;
> +  EFI_TEST_ASSERTION    AssertionType;
> +  EFI_KEY_DATA          Key;
> +  UINT8                 Index;
> +
> +  EFI_KEY_TOGGLE_STATE  State = EFI_TOGGLE_STATE_VALID | 
> + EFI_KEY_STATE_EXPOSED;
> +
> +  EFI_KEY_TOGGLE_STATE  ValidState[] = {
> +                          EFI_TOGGLE_STATE_VALID |
> EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE,
> +                          EFI_TOGGLE_STATE_VALID |
> EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE,
> +                          EFI_TOGGLE_STATE_VALID |
> EFI_KEY_STATE_EXPOSED | EFI_CAPS_LOCK_ACTIVE,
> +                          EFI_TOGGLE_STATE_VALID |
> EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE | EFI_NUM_LOCK_ACTIVE,
> +                          EFI_TOGGLE_STATE_VALID |
> EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |
> EFI_CAPS_LOCK_ACTIVE,
> +                          EFI_TOGGLE_STATE_VALID |
> EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE | EFI_CAPS_LOCK_ACTIVE,
> +                          EFI_TOGGLE_STATE_VALID |
> EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |EFI_NUM_LOCK_ACTIVE |
> EFI_CAPS_LOCK_ACTIVE,
> +                          0
> +                          };
> + 
> +  //
> +  //Reset the console
> +  //
> +  Status = SimpleTextInputEx->ReadKeyStrokeEx (
> +                                  SimpleTextInputEx, 
> +                                  &Key
> +                                  );
> +  if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
> +    return Status;
> +  }
> +
> +  if ((Key.KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) == 0) {
> +    return EFI_UNSUPPORTED;
> +  }
> +
> +  //
> +  //Set the KEY_STATE_EXPOSED to check the imcomplete keystroke
> support  
> + //  Status = SimpleTextInputEx->SetState (
> +                                SimpleTextInputEx,
> +                                &State
> +                                );
> +
> +  if (Status == EFI_UNSUPPORTED || Status == EFI_DEVICE_ERROR) {
> +    StandardLib->RecordAssertion (
> +                   StandardLib,
> +                   EFI_TEST_ASSERTION_WARNING,
> +                   gTestGenericFailureGuid,
> +                   L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState -
> SetState() doesn't return EFI_SUCCESS with EFI_KEY_STATE_EXPOSED",
> +                   L"%a:%d, Status = %r\n",
> +                   __FILE__,
> +                   (UINTN)__LINE__,
> +                   Status
> +                   );
> +    return Status;
> +  }
> +
> +  for (Index=0; ValidState[Index]; Index++) {
> +
> +    //
> +    // Set the valid KeyToggleState
> +    //
> +    Status = SimpleTextInputEx->SetState (
> +                                  SimpleTextInputEx,
> +                                  ValidState + Index
> +                                  );
> +  
> +    if (Status != EFI_SUCCESS) {
> +      StandardLib->RecordAssertion (
> +                     StandardLib,
> +                     EFI_TEST_ASSERTION_FAILED,
> +                     gTestGenericFailureGuid,
> +                     L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState -
> SetState() doesn't return EFI_SUCCESS with the valid KeyToggleState",
> +                     L"%a:%d, Status = %r, KeyToggleState = %x\n",
> +                     __FILE__,
> +                     (UINTN)__LINE__,
> +                     Status,
> +                     ValidState[Index]
> +                     );
> +      continue;
> +    }
> +
> +    //
> +    // Get the KeyToggleState
> +    //
> +    Status = SimpleTextInputEx->ReadKeyStrokeEx (
> +                                  SimpleTextInputEx, 
> +                                  &Key
> +                                  );
> +
> +    if (Status != EFI_NOT_READY) {
> +      AssertionType = EFI_TEST_ASSERTION_FAILED;
> +
> +      StandardLib->RecordAssertion (
> +                     StandardLib,
> +                     AssertionType,
> +                     gSimpleTextInputExBBTestFunctionAssertionGuid01
> 0,
> +                     L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStro
> keEx - ReadKeyStrokeEx() doesn't return EFI_NOT_READY when there is
> no Key data and EFI_KEY_STATE_EXPOSED is enabled",
> +                     L"%a:%d, Status = %r, Index = %d,
> KeyToggleState = %x\n",
> +                     __FILE__,
> +                     (UINTN)__LINE__,
> +                     Status,
> +                     Index,
> +                     ValidState[Index]
> +                     );
> +
> +    } else {
> +      if (Key.KeyState.KeyToggleState == ValidState[Index] &&
> +        (Key.KeyState.KeyShiftState == 0 ||
> Key.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID) &&
> +        Key.Key.ScanCode == 0 && Key.Key.UnicodeChar == 0)
> +        AssertionType = EFI_TEST_ASSERTION_PASSED;
> +      else
> +        AssertionType = EFI_TEST_ASSERTION_FAILED;
> +
> +
> +      StandardLib->RecordAssertion (
> +                     StandardLib,
> +                     AssertionType,
> +                     gSimpleTextInputExBBTestFunctionAssertionGuid01
> 1,
> +                     L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStro
> keEx - ReadKeyStrokeEx() should get the ValidState with EFI_NOT_READY
> and other field is zero",
> +                     L"%a:%d, Status = %r, Index = %d,
> KeyToggleState = %x, expect State = %x\n",
> +                     __FILE__,
> +                     (UINTN)__LINE__,
> +                     Status,
> +                     Index,
> +                     Key.KeyState.KeyToggleState,
> +                     ValidState[Index]
> +                     );
> +
> +    }
> +  }
> +
> +  return EFI_SUCCESS;
> +}
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> SimpleTextInputExBBTestMain.c b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> SimpleTextInputExBBTestMain.c
> index fdbc90f..5b71b6a 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> SimpleTextInputExBBTestMain.c
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black
> +++ BoxTest/SimpleTextInputExBBTestMain.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 @@ -106,6 +106,15 @@ EFI_BB_TEST_ENTRY_FIELD
> gBBTestEntryField[] = {
>    },
>  #endif
>    {
> +    EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107,
> +    L"ReadKeyStrokeExFunctionAuto",
> +    L"Function Auto test for Simple Text Input Ex Protocol
> ReadKeyStrokeEx().",
> +    EFI_TEST_LEVEL_MINIMAL,
> +    gSupportProtocolGuid,
> +    EFI_TEST_CASE_AUTO,
> +    BBTestReadKeyStrokeExFunctionAutoTest
> +  },
> +  {
>      EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0201,
>      L"ReadKeyStrokeExConformance",
>      L"Conformance test for Simple Text Input Ex Protocol
> ReadKeyStrokeEx().",
> @@ -151,7 +160,6 @@ BOOLEAN     BeenExecuted;
>  //
>  
>  EFI_STATUS
> -EFIAPI
>  InitializeSimpleTextInputExBBTest (
>    IN EFI_HANDLE                   ImageHandle,
>    IN EFI_SYSTEM_TABLE             *SystemTable
> @@ -179,7 +187,6 @@ InitializeSimpleTextInputExBBTest (
>  
>  
>  EFI_STATUS
> -EFIAPI
>  UnloadSimpleTextInputExBBTest (
>    IN EFI_HANDLE                   ImageHandle
>    )
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> SimpleTextInputExBBTestMain.h b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> SimpleTextInputExBBTestMain.h
> index cb2160b..8676606 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/
> SimpleTextInputExBBTestMain.h
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black
> +++ BoxTest/SimpleTextInputExBBTestMain.h
> @@ -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 @@ -57,6 +57,8 @@ Abstract:
>  #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0106 \  {
> 0xdbc6e659, 0xb0e0, 0x4471, { 0x94, 0x13, 0x45, 0x1b, 0xdc, 0xe2,
> 0xad, 0xc7 } }
>  
> +#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107 \ { 
> +0x2c3ca282, 0x5644, 0x41b6, { 0xaf, 0xc9, 0x43, 0x87, 0xf2, 0x53,
> 0x89, 
> +0xbd } }
>  //
>  // Entry GUIDs for Conf Test
>  //
> @@ -86,7 +88,6 @@ typedef enum {
>  //
>  //
>  EFI_STATUS
> -EFIAPI
>  InitializeSimpleTextInputExBBTest (
>    IN EFI_HANDLE                   ImageHandle,
>    IN EFI_SYSTEM_TABLE             *SystemTable
> @@ -94,7 +95,6 @@ InitializeSimpleTextInputExBBTest (
>    
>    
>  EFI_STATUS
> -EFIAPI
>  UnloadSimpleTextInputExBBTest (
>    IN EFI_HANDLE                   ImageHandle
>    );
> @@ -155,6 +155,15 @@ BBTestUnregisterKeyNotifyFunctionManualTest (
>    IN EFI_TEST_LEVEL             TestLevel,
>    IN EFI_HANDLE                 SupportHandle
>    );
> +
> +
> +EFI_STATUS
> +BBTestReadKeyStrokeExFunctionAutoTest (
> +  IN EFI_BB_TEST_PROTOCOL       *This,
> +  IN VOID                       *ClientInterface,
> +  IN EFI_TEST_LEVEL             TestLevel,
> +  IN EFI_HANDLE                 SupportHandle
> +  );
>    
>    
>  EFI_STATUS
> @@ -239,6 +248,13 @@
> BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (
>  
>  
>  EFI_STATUS
> +BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
> +  IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL         *StandardLib,
> +  IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL          *SimpleTextInputEx
> +  );
> +
> +
> +EFI_STATUS
>  BBTestReadKeyStrokeExConformanceTestCheckpoint1 (
>    IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL         *StandardLib,
>    IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL          *SimpleTextInputEx
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.c b/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.c
> index b79772c..6876814 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.c
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black
> +++ BoxTest/Guid.c
> @@ -1,7 +1,7 @@
>  /** @file
>  
>    Copyright 2006 - 2015 Unified EFI, Inc.<BR>
> -  Copyright (c) 2010 - 2015, 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 @@ -63,3 +63,8 @@ EFI_GUID
> gSimpleTextInputExBBTestFunctionAssertionGuid007 =
> EFI_TEST_SIMPLETEXTI  EFI_GUID
> gSimpleTextInputExBBTestFunctionAssertionGuid008 =
> EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_008_GUID;
>  
>  EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009 =
> EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_009_GUID;
> +
> +EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010 = 
> +EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID;
> +
> +EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011 = 
> +EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID;
> +
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.h b/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.h
> index 6c90fca..2a6be48 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
> Guid.h
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black
> +++ BoxTest/Guid.h
> @@ -1,7 +1,7 @@
>  /** @file
>  
>    Copyright 2006 - 2010 Unified EFI, Inc.<BR>
> -  Copyright (c) 2010, 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 @@ -119,3 +119,13 @@ extern EFI_GUID
> gSimpleTextInputExBBTestFunctionAssertionGuid008;
>  { 0x534369f7, 0x8399, 0x4353, { 0x94, 0xad, 0xc4, 0x48, 0xfa, 0xda,
> 0xeb, 0x84 } }
>  
>  extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009;
> +
> +#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID
> \ { 
> +0xcf4d54eb, 0x6696, 0x4794, { 0x91, 0x74, 0x59, 0xd, 0x1c, 0x22,
> 0xa8, 
> +0x67 } }
> +
> +extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010;
> +
> +#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID
> \ { 
> +0xf8e8f879, 0xa6d4, 0x4fd3, { 0x8b, 0x8e, 0xba, 0x1d, 0x18, 0xf1,
> 0x40, 
> +0x71 } }
> +
> +extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011;
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
> SimpleTextInputExBBTestFunction.c b/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
> SimpleTextInputExBBTestFunction.c
> index ce5a80a..0b953ca 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
> SimpleTextInputExBBTestFunction.c
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black
> +++ BoxTest/SimpleTextInputExBBTestFunction.c
> @@ -456,6 +456,78 @@ BBTestUnregisterKeyNotifyFunctionManualTest (  }
>  
>  
> +EFI_STATUS
> +BBTestReadKeyStrokeExFunctionAutoTest (
> +  IN EFI_BB_TEST_PROTOCOL       *This,
> +  IN VOID                       *ClientInterface,
> +  IN EFI_TEST_LEVEL             TestLevel,
> +  IN EFI_HANDLE                 SupportHandle
> +  )
> +{
> +  EFI_STANDARD_TEST_LIBRARY_PROTOCOL    *StandardLib;
> +  EFI_STATUS                            Status;
> +  EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL     *SimpleTextInputEx;
> +  
> +  EFI_DEVICE_PATH_PROTOCOL             *DevicePath;
> +  CHAR16                               *DevicePathStr;
> +
> +  //
> +  // init
> +  //
> +  SimpleTextInputEx = 
> + (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL*)ClientInterface;
> +
> +  //
> +  // Get the Standard Library Interface  //  Status = 
> + gtBS->HandleProtocol (
> +                   SupportHandle,
> +                   &gEfiStandardTestLibraryGuid,
> +                   (VOID **) &StandardLib
> +                   );
> +  if (EFI_ERROR(Status)) {
> +    return Status;
> +  }
> +  
> +  //
> +  // Get Device Path of current Simple_Text_Input_Ex_Protocol  //
> And 
> + out put device path or device name  //  Status = 
> + LocateDevicePathFromSimpleTextInputEx (SimpleTextInputEx,
> &DevicePath, 
> + StandardLib);  if (Status == EFI_SUCCESS) {
> +    DevicePathStr = SctDevicePathToStr (DevicePath);
> +    if (DevicePathStr != NULL) {
> +      StandardLib->RecordMessage (
> +                     StandardLib,
> +                     EFI_VERBOSE_LEVEL_DEFAULT,
> +                     L"\r\nCurrent Device: %s",
> +                     DevicePathStr
> +                     );
> +      Status = gtBS->FreePool (DevicePathStr);
> +      if (EFI_ERROR(Status))
> +        return Status;
> +      DevicePathStr=NULL;
> +    }
> +  } else {
> +    //
> +    // Console Splitter/StdErr
> +    //
> +    StandardLib->RecordMessage (
> +                   StandardLib,
> +                   EFI_VERBOSE_LEVEL_DEFAULT,
> +                   L"\r\nCurrent Device: ConsoleSplitter/TxtIn"
> +                   );
> +  }
> +
> +  //
> +  //
> +  //
> +  BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 ( StandardLib, 
> + SimpleTextInputEx );
> +  
> +  return EFI_SUCCESS;
> +}
> +
> +
> +
>  //
>  //Check Points
>  //
> @@ -1060,4 +1132,143 @@
> BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (
>             );
>  
>    return EFI_SUCCESS;
> -}
> \ No newline at end of file
> +}
> +
> +EFI_STATUS
> +BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
> +  IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL         *StandardLib,
> +  IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL          *SimpleTextInputEx
> +  )
> +{
> +  EFI_STATUS            Status;
> +  EFI_TEST_ASSERTION    AssertionType;
> +  EFI_KEY_DATA          Key;
> +  UINT8                 Index;
> +
> +  EFI_KEY_TOGGLE_STATE  State = EFI_TOGGLE_STATE_VALID | 
> + EFI_KEY_STATE_EXPOSED;
> +
> +  EFI_KEY_TOGGLE_STATE  ValidState[] = {
> +                          EFI_TOGGLE_STATE_VALID |
> EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE,
> +                          EFI_TOGGLE_STATE_VALID |
> EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE,
> +                          EFI_TOGGLE_STATE_VALID |
> EFI_KEY_STATE_EXPOSED | EFI_CAPS_LOCK_ACTIVE,
> +                          EFI_TOGGLE_STATE_VALID |
> EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE | EFI_NUM_LOCK_ACTIVE,
> +                          EFI_TOGGLE_STATE_VALID |
> EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |
> EFI_CAPS_LOCK_ACTIVE,
> +                          EFI_TOGGLE_STATE_VALID |
> EFI_KEY_STATE_EXPOSED | EFI_NUM_LOCK_ACTIVE | EFI_CAPS_LOCK_ACTIVE,
> +                          EFI_TOGGLE_STATE_VALID |
> EFI_KEY_STATE_EXPOSED | EFI_SCROLL_LOCK_ACTIVE |EFI_NUM_LOCK_ACTIVE |
> EFI_CAPS_LOCK_ACTIVE,
> +                          0
> +                          };
> + 
> +  //
> +  //Reset the console
> +  //
> +  Status = SimpleTextInputEx->ReadKeyStrokeEx (
> +                                  SimpleTextInputEx, 
> +                                  &Key
> +                                  );
> +  if (EFI_ERROR(Status) && Status != EFI_NOT_READY) {
> +    return Status;
> +  }
> +
> +  if ((Key.KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) == 0) {
> +    return EFI_UNSUPPORTED;
> +  }
> +
> +  //
> +  //Set the KEY_STATE_EXPOSED to check the imcomplete keystroke
> support  
> + //  Status = SimpleTextInputEx->SetState (
> +                                SimpleTextInputEx,
> +                                &State
> +                                );
> +
> +  if (Status == EFI_UNSUPPORTED || Status == EFI_DEVICE_ERROR) {
> +    StandardLib->RecordAssertion (
> +                   StandardLib,
> +                   EFI_TEST_ASSERTION_WARNING,
> +                   gTestGenericFailureGuid,
> +                   L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState -
> SetState() doesn't return EFI_SUCCESS with EFI_KEY_STATE_EXPOSED",
> +                   L"%a:%d, Status = %r\n",
> +                   __FILE__,
> +                   (UINTN)__LINE__,
> +                   Status
> +                   );
> +    return Status;
> +  }
> +
> +  for (Index=0; ValidState[Index]; Index++) {
> +
> +    //
> +    // Set the valid KeyToggleState
> +    //
> +    Status = SimpleTextInputEx->SetState (
> +                                  SimpleTextInputEx,
> +                                  ValidState + Index
> +                                  );
> +  
> +    if (Status != EFI_SUCCESS) {
> +      StandardLib->RecordAssertion (
> +                     StandardLib,
> +                     EFI_TEST_ASSERTION_FAILED,
> +                     gTestGenericFailureGuid,
> +                     L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState -
> SetState() doesn't return EFI_SUCCESS with the valid KeyToggleState",
> +                     L"%a:%d, Status = %r, KeyToggleState = %x\n",
> +                     __FILE__,
> +                     (UINTN)__LINE__,
> +                     Status,
> +                     ValidState[Index]
> +                     );
> +      continue;
> +    }
> +
> +    //
> +    // Get the KeyToggleState
> +    //
> +    Status = SimpleTextInputEx->ReadKeyStrokeEx (
> +                                  SimpleTextInputEx, 
> +                                  &Key
> +                                  );
> +
> +    if (Status != EFI_NOT_READY) {
> +      AssertionType = EFI_TEST_ASSERTION_FAILED;
> +
> +      StandardLib->RecordAssertion (
> +                     StandardLib,
> +                     AssertionType,
> +                     gSimpleTextInputExBBTestFunctionAssertionGuid01
> 0,
> +                     L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStro
> keEx - ReadKeyStrokeEx() doesn't return EFI_NOT_READY when there is
> no Key data and EFI_KEY_STATE_EXPOSED is enabled",
> +                     L"%a:%d, Status = %r, Index = %d,
> KeyToggleState = %x\n",
> +                     __FILE__,
> +                     (UINTN)__LINE__,
> +                     Status,
> +                     Index,
> +                     ValidState[Index]
> +                     );
> +
> +    } else {
> +      if (Key.KeyState.KeyToggleState == ValidState[Index] &&
> +        (Key.KeyState.KeyShiftState == 0 ||
> Key.KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID) &&
> +        Key.Key.ScanCode == 0 && Key.Key.UnicodeChar == 0)
> +        AssertionType = EFI_TEST_ASSERTION_PASSED;
> +      else
> +      	 AssertionType = EFI_TEST_ASSERTION_FAILED;
> +
> +
> +      StandardLib->RecordAssertion (
> +                     StandardLib,
> +                     AssertionType,
> +                     gSimpleTextInputExBBTestFunctionAssertionGuid01
> 1,
> +                     L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStro
> keEx - ReadKeyStrokeEx() should get the ValidState with EFI_NOT_READY
> and other field is zero",
> +                     L"%a:%d, Status = %r, Index = %d,
> KeyToggleState = %x, expect State = %x\n",
> +                     __FILE__,
> +                     (UINTN)__LINE__,
> +                     Status,
> +                     Index,
> +                     Key.KeyState.KeyToggleState,
> +                     ValidState[Index]
> +                     );
> +
> +    }
> +  }
> +
> +  return EFI_SUCCESS;
> +}
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
> SimpleTextInputExBBTestMain.c b/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
> SimpleTextInputExBBTestMain.c
> index 43dbbda..c0a4f5a 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
> SimpleTextInputExBBTestMain.c
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black
> +++ BoxTest/SimpleTextInputExBBTestMain.c
> @@ -1,7 +1,7 @@
>  /** @file
>  
>    Copyright 2006 - 2016 Unified EFI, Inc.<BR>
> -  Copyright (c) 2010 - 2016, 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 @@ -106,6 +106,15 @@ EFI_BB_TEST_ENTRY_FIELD
> gBBTestEntryField[] = {
>    },
>  #endif
>    {
> +    EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107,
> +    L"ReadKeyStrokeExFunctionAuto",
> +    L"Function Auto test for Simple Text Input Ex Protocol
> ReadKeyStrokeEx().",
> +    EFI_TEST_LEVEL_MINIMAL,
> +    gSupportProtocolGuid,
> +    EFI_TEST_CASE_AUTO,
> +    BBTestReadKeyStrokeExFunctionAutoTest
> +  },
> +  {
>      EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0201,
>      L"ReadKeyStrokeExConformance",
>      L"Conformance test for Simple Text Input Ex Protocol
> ReadKeyStrokeEx().", diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
> SimpleTextInputExBBTestMain.h b/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
> SimpleTextInputExBBTestMain.h
> index 0b3312e..bb0d8c9 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/
> SimpleTextInputExBBTestMain.h
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black
> +++ BoxTest/SimpleTextInputExBBTestMain.h
> @@ -1,7 +1,7 @@
>  /** @file
>  
>    Copyright 2006 - 2014 Unified EFI, Inc.<BR>
> -  Copyright (c) 2010 - 2014, 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 @@ -61,6 +61,8 @@ Abstract:
>  #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0106 \  {
> 0xdbc6e659, 0xb0e0, 0x4471, { 0x94, 0x13, 0x45, 0x1b, 0xdc, 0xe2,
> 0xad, 0xc7 } }
>  
> +#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107 \ { 
> +0x2c3ca282, 0x5644, 0x41b6, { 0xaf, 0xc9, 0x43, 0x87, 0xf2, 0x53,
> 0x89, 
> +0xbd } }
>  //
>  // Entry GUIDs for Conf Test
>  //
> @@ -157,6 +159,15 @@ BBTestUnregisterKeyNotifyFunctionManualTest (
>    IN EFI_TEST_LEVEL             TestLevel,
>    IN EFI_HANDLE                 SupportHandle
>    );
> +
> +
> +EFI_STATUS
> +BBTestReadKeyStrokeExFunctionAutoTest (
> +  IN EFI_BB_TEST_PROTOCOL       *This,
> +  IN VOID                       *ClientInterface,
> +  IN EFI_TEST_LEVEL             TestLevel,
> +  IN EFI_HANDLE                 SupportHandle
> +  );
>    
>    
>  EFI_STATUS
> @@ -241,6 +252,13 @@
> BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1 (
>  
>  
>  EFI_STATUS
> +BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 (
> +  IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL         *StandardLib,
> +  IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL          *SimpleTextInputEx
> +  );
> +
> +
> +EFI_STATUS
>  BBTestReadKeyStrokeExConformanceTestCheckpoint1 (
>    IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL         *StandardLib,
>    IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL          *SimpleTextInputEx
> --
> 2.9.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel



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

end of thread, other threads:[~2018-11-07 20:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-07  7:19 [edk2-test][Patch v2] uefi-sct/SctPkg:Add checkpoint of ReadKeyStrokeEx Toggle state Jin, Eric
2018-11-07 20:10 ` Supreeth Venkatesh

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