From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=eric.jin@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4BF892118C50A for ; Tue, 6 Nov 2018 23:19:26 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Nov 2018 23:19:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,474,1534834800"; d="scan'208";a="87299278" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga007.jf.intel.com with ESMTP; 06 Nov 2018 23:19:25 -0800 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 6 Nov 2018 23:19:24 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 6 Nov 2018 23:19:24 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.161]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.199]) with mapi id 14.03.0415.000; Wed, 7 Nov 2018 15:19:22 +0800 From: "Jin, Eric" To: "edk2-devel@lists.01.org" , Supreeth Venkatesh Thread-Topic: [edk2] [edk2-test][Patch v2] uefi-sct/SctPkg:Add checkpoint of ReadKeyStrokeEx Toggle state Thread-Index: AdR2ahE5zBGljbJeQsy27uPYaIXxkQ== Date: Wed, 7 Nov 2018 07:19:22 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTI3NzgyNmUtNDA3OS00YmY4LWIxOTktMDhjMTFmMTRjMjc0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiYmFJU3gxRnl5cnZ6SGthRWI2N1p4blF2V3o4RFlpTHU0MFVOYmxWSU5ISGFiK3RMWFVwRmlQZ1lyd3ZTWUJEeCJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [edk2-test][Patch v2] uefi-sct/SctPkg:Add checkpoint of ReadKeyStrokeEx Toggle state X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Nov 2018 07:19:26 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable It is the patch v2 below.=20 -----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 ReadKe= yStrokeEx Toggle state UEFI drivers which implement the EFI_SIMPLE_TEXT_INPUT_EX protocol are requ= ired 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 availabl= e. Current KeyData.KeyState values are exposed." Cc: Supreeth Venkatesh Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Jin --- .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c | 7 +- .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h | 12 +- .../BlackBoxT= est/SimpleTextInputExBBTestFunction.c | 211 ++++++++++++++++++++ .../BlackBoxTest/SimpleTextInputExBBTestMain.c | 13 +- .../BlackBoxTest/SimpleTextInputExBBTestMain.h | 22 ++- .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.c | 7 +- .../Protocol/SimpleTextInputEx/BlackBoxTest/Guid.h | 12 +- .../BlackBoxT= est/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/B= lackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextI= nputEx/BlackBoxTest/Guid.c index 9cb19f4..ff2d50f 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBox= Test/Guid.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black +++ BoxTest/Guid.c @@ -1,7 +1,7 @@ /** @file =20 Copyright 2006 - 2012 Unified EFI, Inc.
- Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights=20 + reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -63,3 +63,8 @@ EFI_GUID gSimpleTextInputExBBTestFunctionAssert= ionGuid007 =3D EFI_TEST_SIMPLETEXTI EFI_GUID gSimpleTextInputExBBTestFunct= ionAssertionGuid008 =3D EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_= 008_GUID; =20 EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009 =3D EFI_TEST_SIM= PLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_009_GUID; + +EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010 =3D=20 +EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID; + +EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011 =3D=20 +EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID; + diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/B= lackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextI= nputEx/BlackBoxTest/Guid.h index 6c90fca..2a6be48 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBox= Test/Guid.h +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black +++ BoxTest/Guid.h @@ -1,7 +1,7 @@ /** @file =20 Copyright 2006 - 2010 Unified EFI, Inc.
- Copyright (c) 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights=20 + reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -119,3 +119,13 @@ extern EFI_GUID gSimpleTextInputExBBTestFunc= tionAssertionGuid008; { 0x534369f7, 0x8399, 0x4353, { 0x94, 0xad, 0xc4, 0x48, 0xfa, 0xda, 0xeb, = 0x84 } } =20 extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009; + +#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID \ {=20 +0xcf4d54eb, 0x6696, 0x4794, { 0x91, 0x74, 0x59, 0xd, 0x1c, 0x22, 0xa8,=20 +0x67 } } + +extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010; + +#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID \ {=20 +0xf8e8f879, 0xa6d4, 0x4fd3, { 0x8b, 0x8e, 0xba, 0x1d, 0x18, 0xf1, 0x40,=20 +0x71 } } + +extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011; diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/B= lackBoxTest/SimpleTextInputExBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UE= FI/EFI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunct= ion.c index 153ade0..4850627 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBox= Test/SimpleTextInputExBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black +++ BoxTest/SimpleTextInputExBBTestFunction.c @@ -456,6 +456,78 @@ BBTestUnregisterKeyNotifyFunctionManualTest ( } =20 =20 +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; + =20 + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + CHAR16 *DevicePathStr; + + // + // init + // + SimpleTextInputEx =3D=20 + (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL*)ClientInterface; + + // + // Get the Standard Library Interface // Status =3D=20 + gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + =20 + // + // Get Device Path of current Simple_Text_Input_Ex_Protocol // And=20 + out put device path or device name // Status =3D=20 + LocateDevicePathFromSimpleTextInputEx (SimpleTextInputEx, &DevicePath,=20 + StandardLib); if (Status =3D=3D EFI_SUCCESS) { + DevicePathStr =3D SctDevicePathToStr (DevicePath); + if (DevicePathStr !=3D NULL) { + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_DEFAULT, + L"\r\nCurrent Device: %s", + DevicePathStr + ); + Status =3D gtBS->FreePool (DevicePathStr); + if (EFI_ERROR(Status)) + return Status; + DevicePathStr=3DNULL; + } + } else { + // + // Console Splitter/StdErr + // + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_DEFAULT, + L"\r\nCurrent Device: ConsoleSplitter/TxtIn" + ); + } + + // + // + // + BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 ( StandardLib,=20 + SimpleTextInputEx ); + =20 + return EFI_SUCCESS; +} + + + // //Check Points // @@ -1061,3 +1133,142 @@ BBTestUnregisterKeyNotifyFunctionManualTestCheckpoi= nt1 ( =20 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 =3D EFI_TOGGLE_STATE_VALID |=20 + EFI_KEY_STATE_EXPOSED; + + EFI_KEY_TOGGLE_STATE ValidState[] =3D { + 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 + }; +=20 + // + //Reset the console + // + Status =3D SimpleTextInputEx->ReadKeyStrokeEx ( + SimpleTextInputEx,=20 + &Key + ); + if (EFI_ERROR(Status) && Status !=3D EFI_NOT_READY) { + return Status; + } + + if ((Key.KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) =3D=3D 0) { + return EFI_UNSUPPORTED; + } + + // + //Set the KEY_STATE_EXPOSED to check the imcomplete keystroke support =20 + // Status =3D SimpleTextInputEx->SetState ( + SimpleTextInputEx, + &State + ); + + if (Status =3D=3D EFI_UNSUPPORTED || Status =3D=3D 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 =3D %r\n", + __FILE__, + (UINTN)__LINE__, + Status + ); + return Status; + } + + for (Index=3D0; ValidState[Index]; Index++) { + + // + // Set the valid KeyToggleState + // + Status =3D SimpleTextInputEx->SetState ( + SimpleTextInputEx, + ValidState + Index + ); + =20 + if (Status !=3D EFI_SUCCESS) { + StandardLib->RecordAssertion ( + StandardLib, + EFI_TEST_ASSERTION_FAILED, + gTestGenericFailureGuid, + L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState - SetSta= te() doesn't return EFI_SUCCESS with the valid KeyToggleState", + L"%a:%d, Status =3D %r, KeyToggleState =3D %x\n", + __FILE__, + (UINTN)__LINE__, + Status, + ValidState[Index] + ); + continue; + } + + // + // Get the KeyToggleState + // + Status =3D SimpleTextInputEx->ReadKeyStrokeEx ( + SimpleTextInputEx,=20 + &Key + ); + + if (Status !=3D EFI_NOT_READY) { + AssertionType =3D 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 a= nd EFI_KEY_STATE_EXPOSED is enabled", + L"%a:%d, Status =3D %r, Index =3D %d, KeyToggleState = =3D %x\n", + __FILE__, + (UINTN)__LINE__, + Status, + Index, + ValidState[Index] + ); + + } else { + if (Key.KeyState.KeyToggleState =3D=3D ValidState[Index] && + (Key.KeyState.KeyShiftState =3D=3D 0 || Key.KeyState.KeyShiftState= =3D=3D EFI_SHIFT_STATE_VALID) && + Key.Key.ScanCode =3D=3D 0 && Key.Key.UnicodeChar =3D=3D 0) + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + else + AssertionType =3D 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 f= ield is zero", + L"%a:%d, Status =3D %r, Index =3D %d, KeyToggleState = =3D %x, expect State =3D %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/B= lackBoxTest/SimpleTextInputExBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI/E= FI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestMain.c index fdbc90f..5b71b6a 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBox= Test/SimpleTextInputExBBTestMain.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black +++ BoxTest/SimpleTextInputExBBTestMain.c @@ -1,7 +1,7 @@ /** @file =20 Copyright 2006 - 2017 Unified EFI, Inc.
- Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights=20 + reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -106,6 +106,15 @@ EFI_BB_TEST_ENTRY_FIELD gBBTestEntryField[] = =3D { }, #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; // =20 EFI_STATUS -EFIAPI InitializeSimpleTextInputExBBTest ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable @@ -179,7 +187,6 @@ InitializeSimpleTextInputExBBTest ( =20 =20 EFI_STATUS -EFIAPI UnloadSimpleTextInputExBBTest ( IN EFI_HANDLE ImageHandle ) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/B= lackBoxTest/SimpleTextInputExBBTestMain.h b/uefi-sct/SctPkg/TestCase/UEFI/E= FI/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestMain.h index cb2160b..8676606 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/BlackBox= Test/SimpleTextInputExBBTestMain.h +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleTextInputEx/Black +++ BoxTest/SimpleTextInputExBBTestMain.h @@ -1,7 +1,7 @@ /** @file =20 Copyright 2006 - 2017 Unified EFI, Inc.
- Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights=20 + reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -57,6 +57,8 @@ Abstract: #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0106 \ { 0xdbc6e= 659, 0xb0e0, 0x4471, { 0x94, 0x13, 0x45, 0x1b, 0xdc, 0xe2, 0xad, 0xc7 } } =20 +#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107 \ {=20 +0x2c3ca282, 0x5644, 0x41b6, { 0xaf, 0xc9, 0x43, 0x87, 0xf2, 0x53, 0x89,=20 +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 ( =20 =20 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 + ); =20 =20 EFI_STATUS @@ -239,6 +248,13 @@ BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1= ( =20 =20 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/B= lackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextI= nputEx/BlackBoxTest/Guid.c index b79772c..6876814 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBox= Test/Guid.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black +++ BoxTest/Guid.c @@ -1,7 +1,7 @@ /** @file =20 Copyright 2006 - 2015 Unified EFI, Inc.
- Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights=20 + reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -63,3 +63,8 @@ EFI_GUID gSimpleTextInputExBBTestFunctionAssert= ionGuid007 =3D EFI_TEST_SIMPLETEXTI EFI_GUID gSimpleTextInputExBBTestFunct= ionAssertionGuid008 =3D EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_= 008_GUID; =20 EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009 =3D EFI_TEST_SIM= PLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_009_GUID; + +EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010 =3D=20 +EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID; + +EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011 =3D=20 +EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID; + diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/B= lackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextI= nputEx/BlackBoxTest/Guid.h index 6c90fca..2a6be48 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBox= Test/Guid.h +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black +++ BoxTest/Guid.h @@ -1,7 +1,7 @@ /** @file =20 Copyright 2006 - 2010 Unified EFI, Inc.
- Copyright (c) 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights=20 + reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -119,3 +119,13 @@ extern EFI_GUID gSimpleTextInputExBBTestFunc= tionAssertionGuid008; { 0x534369f7, 0x8399, 0x4353, { 0x94, 0xad, 0xc4, 0x48, 0xfa, 0xda, 0xeb, = 0x84 } } =20 extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid009; + +#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_010_GUID \ {=20 +0xcf4d54eb, 0x6696, 0x4794, { 0x91, 0x74, 0x59, 0xd, 0x1c, 0x22, 0xa8,=20 +0x67 } } + +extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid010; + +#define EFI_TEST_SIMPLETEXTINPUTEXBBTESTFUNCTION_ASSERTION_011_GUID \ {=20 +0xf8e8f879, 0xa6d4, 0x4fd3, { 0x8b, 0x8e, 0xba, 0x1d, 0x18, 0xf1, 0x40,=20 +0x71 } } + +extern EFI_GUID gSimpleTextInputExBBTestFunctionAssertionGuid011; diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/B= lackBoxTest/SimpleTextInputExBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UE= FI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestFunct= ion.c index ce5a80a..0b953ca 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBox= Test/SimpleTextInputExBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black +++ BoxTest/SimpleTextInputExBBTestFunction.c @@ -456,6 +456,78 @@ BBTestUnregisterKeyNotifyFunctionManualTest ( } =20 =20 +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; + =20 + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + CHAR16 *DevicePathStr; + + // + // init + // + SimpleTextInputEx =3D=20 + (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL*)ClientInterface; + + // + // Get the Standard Library Interface // Status =3D=20 + gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + if (EFI_ERROR(Status)) { + return Status; + } + =20 + // + // Get Device Path of current Simple_Text_Input_Ex_Protocol // And=20 + out put device path or device name // Status =3D=20 + LocateDevicePathFromSimpleTextInputEx (SimpleTextInputEx, &DevicePath,=20 + StandardLib); if (Status =3D=3D EFI_SUCCESS) { + DevicePathStr =3D SctDevicePathToStr (DevicePath); + if (DevicePathStr !=3D NULL) { + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_DEFAULT, + L"\r\nCurrent Device: %s", + DevicePathStr + ); + Status =3D gtBS->FreePool (DevicePathStr); + if (EFI_ERROR(Status)) + return Status; + DevicePathStr=3DNULL; + } + } else { + // + // Console Splitter/StdErr + // + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_DEFAULT, + L"\r\nCurrent Device: ConsoleSplitter/TxtIn" + ); + } + + // + // + // + BBTestReadKeyStrokeExFunctionAutoTestCheckpoint1 ( StandardLib,=20 + SimpleTextInputEx ); + =20 + return EFI_SUCCESS; +} + + + // //Check Points // @@ -1060,4 +1132,143 @@ BBTestUnregisterKeyNotifyFunctionManualTestCheckpoi= nt1 ( ); =20 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 =3D EFI_TOGGLE_STATE_VALID |=20 + EFI_KEY_STATE_EXPOSED; + + EFI_KEY_TOGGLE_STATE ValidState[] =3D { + 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 + }; +=20 + // + //Reset the console + // + Status =3D SimpleTextInputEx->ReadKeyStrokeEx ( + SimpleTextInputEx,=20 + &Key + ); + if (EFI_ERROR(Status) && Status !=3D EFI_NOT_READY) { + return Status; + } + + if ((Key.KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) =3D=3D 0) { + return EFI_UNSUPPORTED; + } + + // + //Set the KEY_STATE_EXPOSED to check the imcomplete keystroke support =20 + // Status =3D SimpleTextInputEx->SetState ( + SimpleTextInputEx, + &State + ); + + if (Status =3D=3D EFI_UNSUPPORTED || Status =3D=3D 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 =3D %r\n", + __FILE__, + (UINTN)__LINE__, + Status + ); + return Status; + } + + for (Index=3D0; ValidState[Index]; Index++) { + + // + // Set the valid KeyToggleState + // + Status =3D SimpleTextInputEx->SetState ( + SimpleTextInputEx, + ValidState + Index + ); + =20 + if (Status !=3D EFI_SUCCESS) { + StandardLib->RecordAssertion ( + StandardLib, + EFI_TEST_ASSERTION_FAILED, + gTestGenericFailureGuid, + L"EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.SetState - SetSta= te() doesn't return EFI_SUCCESS with the valid KeyToggleState", + L"%a:%d, Status =3D %r, KeyToggleState =3D %x\n", + __FILE__, + (UINTN)__LINE__, + Status, + ValidState[Index] + ); + continue; + } + + // + // Get the KeyToggleState + // + Status =3D SimpleTextInputEx->ReadKeyStrokeEx ( + SimpleTextInputEx,=20 + &Key + ); + + if (Status !=3D EFI_NOT_READY) { + AssertionType =3D 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 a= nd EFI_KEY_STATE_EXPOSED is enabled", + L"%a:%d, Status =3D %r, Index =3D %d, KeyToggleState = =3D %x\n", + __FILE__, + (UINTN)__LINE__, + Status, + Index, + ValidState[Index] + ); + + } else { + if (Key.KeyState.KeyToggleState =3D=3D ValidState[Index] && + (Key.KeyState.KeyShiftState =3D=3D 0 || Key.KeyState.KeyShiftState= =3D=3D EFI_SHIFT_STATE_VALID) && + Key.Key.ScanCode =3D=3D 0 && Key.Key.UnicodeChar =3D=3D 0) + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + else + AssertionType =3D 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 f= ield is zero", + L"%a:%d, Status =3D %r, Index =3D %d, KeyToggleState = =3D %x, expect State =3D %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/B= lackBoxTest/SimpleTextInputExBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI/I= HV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestMain.c index 43dbbda..c0a4f5a 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBox= Test/SimpleTextInputExBBTestMain.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black +++ BoxTest/SimpleTextInputExBBTestMain.c @@ -1,7 +1,7 @@ /** @file =20 Copyright 2006 - 2016 Unified EFI, Inc.
- Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights=20 + reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -106,6 +106,15 @@ EFI_BB_TEST_ENTRY_FIELD gBBTestEntryField[] = =3D { }, #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/SimpleTextInput= Ex/BlackBoxTest/SimpleTextInputExBBTestMain.h b/uefi-sct/SctPkg/TestCase/UE= FI/IHV/Protocol/SimpleTextInputEx/BlackBoxTest/SimpleTextInputExBBTestMain.= h index 0b3312e..bb0d8c9 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/BlackBox= Test/SimpleTextInputExBBTestMain.h +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleTextInputEx/Black +++ BoxTest/SimpleTextInputExBBTestMain.h @@ -1,7 +1,7 @@ /** @file =20 Copyright 2006 - 2014 Unified EFI, Inc.
- Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights=20 + reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -61,6 +61,8 @@ Abstract: #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0106 \ { 0xdbc6e= 659, 0xb0e0, 0x4471, { 0x94, 0x13, 0x45, 0x1b, 0xdc, 0xe2, 0xad, 0xc7 } } =20 +#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_TEST_ENTRY_GUID0107 \ {=20 +0x2c3ca282, 0x5644, 0x41b6, { 0xaf, 0xc9, 0x43, 0x87, 0xf2, 0x53, 0x89,=20 +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 + ); =20 =20 EFI_STATUS @@ -241,6 +252,13 @@ BBTestUnregisterKeyNotifyFunctionManualTestCheckpoint1= ( =20 =20 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