From 760f15e1869cebc9942be0bf923c9db08e9ba41d Mon Sep 17 00:00:00 2001 From: Aaron Pop Date: Tue, 14 Jan 2025 12:36:30 -0800 Subject: [PATCH] Removal of SecureBoot options from ConfApp --- SetupDataPkg/ConfApp/ConfApp.c | 30 +- SetupDataPkg/ConfApp/ConfApp.inf | 3 - SetupDataPkg/ConfApp/SecureBoot.c | 285 ------ .../UnitTest/ConfAppSecureBootUnitTest.c | 817 ------------------ .../UnitTest/ConfAppSecureBootUnitTest.inf | 57 -- .../ConfApp/UnitTest/ConfAppUnitTest.c | 84 +- SetupDataPkg/Test/SetupDataPkgHostTest.dsc | 7 - 7 files changed, 8 insertions(+), 1275 deletions(-) delete mode 100644 SetupDataPkg/ConfApp/SecureBoot.c delete mode 100644 SetupDataPkg/ConfApp/UnitTest/ConfAppSecureBootUnitTest.c delete mode 100644 SetupDataPkg/ConfApp/UnitTest/ConfAppSecureBootUnitTest.inf diff --git a/SetupDataPkg/ConfApp/ConfApp.c b/SetupDataPkg/ConfApp/ConfApp.c index 50c25480..2544b100 100644 --- a/SetupDataPkg/ConfApp/ConfApp.c +++ b/SetupDataPkg/ConfApp/ConfApp.c @@ -7,7 +7,6 @@ **/ #include -#include #include #include @@ -19,13 +18,12 @@ #include #include #include -#include #include #include #include "ConfApp.h" -#define MAIN_STATE_OPTIONS 6 +#define MAIN_STATE_OPTIONS 5 CONST ConfAppKeyOptions MainStateOptions[MAIN_STATE_OPTIONS] = { { @@ -40,27 +38,18 @@ CONST ConfAppKeyOptions MainStateOptions[MAIN_STATE_OPTIONS] = { { .KeyName = L"2", .KeyNameTextAttr = EFI_TEXT_ATTR (EFI_YELLOW, EFI_BLACK), - .Description = L"Configure Secure Boot.", - .DescriptionTextAttr = EFI_TEXT_ATTR (EFI_WHITE, EFI_BLACK), - .UnicodeChar = '2', - .ScanCode = SCAN_NULL, - .EndState = SecureBoot - }, - { - .KeyName = L"3", - .KeyNameTextAttr = EFI_TEXT_ATTR (EFI_YELLOW, EFI_BLACK), .Description = L"Boot Options.", .DescriptionTextAttr = EFI_TEXT_ATTR (EFI_WHITE, EFI_BLACK), - .UnicodeChar = '3', + .UnicodeChar = '2', .ScanCode = SCAN_NULL, .EndState = BootOption }, { - .KeyName = L"4", + .KeyName = L"3", .KeyNameTextAttr = EFI_TEXT_ATTR (EFI_YELLOW, EFI_BLACK), .Description = L"Update Setup Configuration.\n", .DescriptionTextAttr = EFI_TEXT_ATTR (EFI_WHITE, EFI_BLACK), - .UnicodeChar = '4', + .UnicodeChar = '3', .ScanCode = SCAN_NULL, .EndState = SetupConf }, @@ -86,8 +75,6 @@ CONST ConfAppKeyOptions MainStateOptions[MAIN_STATE_OPTIONS] = { ConfState_t mConfState = MainInit; EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *mSimpleTextInEx = NULL; -SECURE_BOOT_PAYLOAD_INFO *mSecureBootKeys; -UINT8 mSecureBootKeysCount; /** Quick helper function to see if ReadyToBoot has already been signalled. @@ -363,12 +350,6 @@ ConfAppEntry ( DEBUG ((DEBUG_ERROR, "Unable to reset SimpleTextIn on ConIn. Code = %r.\n", Status)); } - Status = GetPlatformKeyStore (&mSecureBootKeys, &mSecureBootKeysCount); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "Failed to get platform secure boot keys. Code = %r.\n", Status)); - goto Exit; - } - // Force-connect all controllers. // EfiBootManagerConnectAll (); @@ -413,9 +394,6 @@ ConfAppEntry ( case SystemInfo: Status = SysInfoMgr (); break; - case SecureBoot: - Status = SecureBootMgr (); - break; case BootOption: Status = BootOptionMgr (); break; diff --git a/SetupDataPkg/ConfApp/ConfApp.inf b/SetupDataPkg/ConfApp/ConfApp.inf index d1bdb46c..4c132790 100644 --- a/SetupDataPkg/ConfApp/ConfApp.inf +++ b/SetupDataPkg/ConfApp/ConfApp.inf @@ -19,7 +19,6 @@ BootOptions.c ConfApp.c ConfApp.h - SecureBoot.c SetupConf.c SystemInfo.c SvdUsb/SvdUsb.c @@ -44,8 +43,6 @@ UefiLib ResetSystemLib UefiBootManagerLib - MuSecureBootKeySelectorLib - SecureBootKeyStoreLib JsonLiteParserLib FileHandleLib XmlTreeLib diff --git a/SetupDataPkg/ConfApp/SecureBoot.c b/SetupDataPkg/ConfApp/SecureBoot.c deleted file mode 100644 index 7780a2df..00000000 --- a/SetupDataPkg/ConfApp/SecureBoot.c +++ /dev/null @@ -1,285 +0,0 @@ -/** @file - Test driver to locate conf data from variable storage and print all contained entries. - - Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
- Copyright (c) Microsoft Corporation. - SPDX-License-Identifier: BSD-2-Clause-Patent -**/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ConfApp.h" - -ConfAppKeyOptions SecureBootClearTemplate = { - .KeyName = L"0", - .KeyNameTextAttr = EFI_TEXT_ATTR (EFI_YELLOW, EFI_BLACK), - .Description = L"None.\n", - .DescriptionTextAttr = EFI_TEXT_ATTR (EFI_WHITE, EFI_BLACK), - .UnicodeChar = '0', - .ScanCode = SCAN_NULL, - .EndState = SecureBootClear -}; - -ConfAppKeyOptions SecureBootEnrollTemplate = { - .KeyName = L"1", - .KeyNameTextAttr = EFI_TEXT_ATTR (EFI_YELLOW, EFI_BLACK), - .Description = L"None.\n", - .DescriptionTextAttr = EFI_TEXT_ATTR (EFI_WHITE, EFI_BLACK), - .UnicodeChar = '1', - .ScanCode = SCAN_NULL, - .EndState = SecureBootEnroll -}; - -ConfAppKeyOptions SecureBootEscTemplate = { - .KeyName = L"ESC", - .KeyNameTextAttr = EFI_TEXT_ATTR (EFI_YELLOW, EFI_BLACK), - .Description = L"Return to main menu.", - .DescriptionTextAttr = EFI_TEXT_ATTR (EFI_WHITE, EFI_BLACK), - .UnicodeChar = CHAR_NULL, - .ScanCode = SCAN_ESC, - .EndState = SecureBootExit -}; - -UINTN mSecBootOptionCount = 0; -ConfAppKeyOptions *mSecBootStateOptions = NULL; -UINT8 mSelectedKeyIndex = MU_SB_CONFIG_NONE; -CHAR16 *mKeyNameBuffer = NULL; -SecureBootState_t mSecBootState = SecureBootInit; -UINTN mCurrentState = (UINTN)-1; - -/** - Helper internal function to reset all local variable in this file. -**/ -STATIC -VOID -ResetGlobals ( - VOID - ) -{ - mSecBootOptionCount = 0; - if (mSecBootStateOptions != NULL) { - FreePool (mSecBootStateOptions); - mSecBootStateOptions = NULL; - } - - mSelectedKeyIndex = MU_SB_CONFIG_NONE; - if (mKeyNameBuffer != NULL) { - FreePool (mKeyNameBuffer); - mKeyNameBuffer = NULL; - } - - mSecBootState = SecureBootInit; - mCurrentState = (UINTN)-1; -} - -/** - Helper function to print current Secure Boot status and available selections. - - @retval EFI_SUCCESS The options are successfully printed. - @retval EFI_SECURITY_VIOLATION Current system secure boot state is unknown. -**/ -EFI_STATUS -PrintSBOptions ( - VOID - ) -{ - EFI_STATUS Status; - UINTN Index; - UINT8 EnrollTextColor; - UINT8 ClearTextColor; - SecureBootState_t EnrollEndState; - SecureBootState_t ClearEndState; - - PrintScreenInit (); - Print (L"Secure Boot Options:\n"); - - gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_WHITE, EFI_BLACK)); - Print (L"Current Status:\t\t"); - - mCurrentState = GetCurrentSecureBootConfig (); - if (mCurrentState == MU_SB_CONFIG_NONE) { - gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_RED, EFI_BLACK)); - Print (L"None\n"); - } else if (mCurrentState == MU_SB_CONFIG_UNKNOWN) { - gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_BLUE, EFI_BLACK)); - Print (L"Unknown\n"); - } else { - gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_GREEN, EFI_BLACK)); - Print (L"%s\n", mSecureBootKeys[mCurrentState].SecureBootKeyName); - } - - Print (L"\n"); - - EnrollTextColor = SecureBootEnrollTemplate.DescriptionTextAttr; - EnrollEndState = SecureBootEnrollTemplate.EndState; - ClearTextColor = SecureBootClearTemplate.DescriptionTextAttr; - ClearEndState = SecureBootClearTemplate.EndState; - if ((mCurrentState != MU_SB_CONFIG_NONE) && IsPostReadyToBoot ()) { - gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_YELLOW, EFI_BLACK)); - Print (L"Post ready to boot, below options are view only:\n"); - EnrollTextColor = EFI_TEXT_ATTR (EFI_DARKGRAY, EFI_BLACK); - ClearTextColor = EFI_TEXT_ATTR (EFI_DARKGRAY, EFI_BLACK); - EnrollEndState = SecureBootError; - ClearEndState = SecureBootError; - } - - mSecBootOptionCount = mSecureBootKeysCount + 2; // Two extra options for clear and exit - mSecBootStateOptions = AllocatePool (sizeof (ConfAppKeyOptions) * mSecBootOptionCount); - mKeyNameBuffer = AllocatePool ((sizeof (CHAR16) * 2) * mSecBootOptionCount); - for (Index = 0; Index < mSecureBootKeysCount; Index++) { - CopyMem (&mSecBootStateOptions[Index], &SecureBootEnrollTemplate, sizeof (ConfAppKeyOptions)); - mSecBootStateOptions[Index].Description = mSecureBootKeys[Index].SecureBootKeyName; - mKeyNameBuffer[Index * 2] = L'0' + (CHAR16)Index; - mKeyNameBuffer[Index * 2 + 1] = L'\0'; - mSecBootStateOptions[Index].KeyName = &mKeyNameBuffer[Index * 2]; - mSecBootStateOptions[Index].UnicodeChar = '0' + (CHAR16)Index; - mSecBootStateOptions[Index].DescriptionTextAttr = EnrollTextColor; - mSecBootStateOptions[Index].EndState = EnrollEndState; - } - - CopyMem (&mSecBootStateOptions[Index], &SecureBootClearTemplate, sizeof (ConfAppKeyOptions)); - mKeyNameBuffer[Index * 2] = L'0' + (CHAR16)Index; - mKeyNameBuffer[Index * 2 + 1] = L'\0'; - mSecBootStateOptions[Index].KeyName = &mKeyNameBuffer[Index * 2]; - mSecBootStateOptions[Index].UnicodeChar = '0' + (CHAR16)Index; - mSecBootStateOptions[Index].DescriptionTextAttr = ClearTextColor; - mSecBootStateOptions[Index].EndState = ClearEndState; - - Index++; - CopyMem (&mSecBootStateOptions[Index], &SecureBootEscTemplate, sizeof (ConfAppKeyOptions)); - - Status = PrintAvailableOptions (mSecBootStateOptions, mSecBootOptionCount); - if (EFI_ERROR (Status)) { - ASSERT (FALSE); - } - - return Status; -} - -/** - State machine for secure boot page. It will react to user input from keystroke - to set selected secure boot option or go back to previous page. - - @retval EFI_SUCCESS This iteration of state machine proceeds successfully. - @retval Others Failed to wait for valid keystrokes or failed to set - platform key to variable service. -**/ -EFI_STATUS -EFIAPI -SecureBootMgr ( - VOID - ) -{ - EFI_STATUS Status = EFI_SUCCESS; - EFI_KEY_DATA KeyData; - - switch (mSecBootState) { - case SecureBootInit: - // Collect what is needed and print in this step - Status = PrintSBOptions (); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a Error occurred while printing secure boot options - %r\n", __FUNCTION__, Status)); - ASSERT (FALSE); - break; - } - - mSecBootState = SecureBootWait; - break; - case SecureBootWait: - // Wait for key stroke event. - // - Status = PollKeyStroke (FALSE, 0, &KeyData); - if (Status == EFI_NOT_READY) { - Status = EFI_SUCCESS; - } else if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a Error occurred waiting for secure boot selections - %r\n", __FUNCTION__, Status)); - ASSERT (FALSE); - } else { - Status = CheckSupportedOptions (&KeyData, mSecBootStateOptions, mSecBootOptionCount, (UINT32 *)&mSecBootState); - if (Status == EFI_NOT_FOUND) { - Status = EFI_SUCCESS; - } else if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a Error processing incoming keystroke - %r\n", __FUNCTION__, Status)); - ASSERT (FALSE); - } else if (mSecBootState == SecureBootEnroll) { - mSelectedKeyIndex = (UINT8)(KeyData.Key.UnicodeChar - '0'); - if (mSelectedKeyIndex >= mSecureBootKeysCount) { - DEBUG ((DEBUG_ERROR, "%a The selected key does not exist - %d\n", __FUNCTION__, mSelectedKeyIndex)); - Status = EFI_BUFFER_TOO_SMALL; - ASSERT (FALSE); - } - } - } - - break; - case SecureBootClear: - DEBUG ((DEBUG_INFO, "Selected clear Secure Boot Key\n")); - if (mCurrentState != MU_SB_CONFIG_NONE) { - Status = DeleteSecureBootVariables (); - if (!EFI_ERROR (Status)) { - mSecBootState = SecureBootConfChange; - } else { - mSecBootState = SecureBootInit; - } - } else { - mSecBootState = SecureBootWait; - } - - break; - case SecureBootEnroll: - DEBUG ((DEBUG_INFO, "Selected %s\n", mSecureBootKeys[mSelectedKeyIndex].SecureBootKeyName)); - if (mCurrentState != mSelectedKeyIndex) { - // First wipe off existing variables if it is enrolled somehow - if (mCurrentState != MU_SB_CONFIG_NONE) { - Status = DeleteSecureBootVariables (); - if (EFI_ERROR (Status)) { - break; - } - } - - Status = SetSecureBootConfig (mSelectedKeyIndex); - if (!EFI_ERROR (Status)) { - mSecBootState = SecureBootConfChange; - } else { - mSecBootState = SecureBootInit; - } - } else { - mSecBootState = SecureBootWait; - } - - break; - case SecureBootError: - Print (L"Cannot change secure boot settings post security boundary!\n"); - mSecBootState = SecureBootWait; - break; - case SecureBootExit: - ResetGlobals (); - ExitSubRoutine (); - break; - case SecureBootConfChange: - ResetCold (); - // Should not be here - CpuDeadLoop (); - break; - default: - ASSERT (FALSE); - Status = EFI_DEVICE_ERROR; - break; - } - - return Status; -} diff --git a/SetupDataPkg/ConfApp/UnitTest/ConfAppSecureBootUnitTest.c b/SetupDataPkg/ConfApp/UnitTest/ConfAppSecureBootUnitTest.c deleted file mode 100644 index 070fcf8d..00000000 --- a/SetupDataPkg/ConfApp/UnitTest/ConfAppSecureBootUnitTest.c +++ /dev/null @@ -1,817 +0,0 @@ -/** @file - Unit tests of the Boot Option page of ConfApp module - - Copyright (C) Microsoft Corporation. - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include "ConfApp.h" - -#define UNIT_TEST_APP_NAME "Conf Application Secure Boot Unit Tests" -#define UNIT_TEST_APP_VERSION "1.0" - -extern EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL MockSimpleInput; -extern SecureBootState_t mSecBootState; - -/** - State machine for system information page. It will display fundamental information, including - UEFI version, system time, and configuration settings. - - @retval EFI_SUCCESS This iteration of state machine proceeds successfully. - @retval Others Failed to wait for valid keystrokes or application of - new configuration data failed. -**/ -EFI_STATUS -EFIAPI -SysInfoMgr ( - VOID - ) -{ - // Not used - ASSERT (FALSE); - return EFI_ACCESS_DENIED; -} - -/** - State machine for boot option page. It will react to user input from keystroke - to boot to selected boot option or go back to previous page. - - @retval EFI_SUCCESS This iteration of state machine proceeds successfully. - @retval Others Failed to wait for valid keystrokes. Failed boot will not - return error code but cause reboot directly. -**/ -EFI_STATUS -EFIAPI -BootOptionMgr ( - VOID - ) -{ - // Not used - ASSERT (FALSE); - return EFI_ACCESS_DENIED; -} - -/** - State machine for configuration setup. It will react to user keystroke to accept - configuration data from selected option. - - @retval EFI_SUCCESS This iteration of state machine proceeds successfully. - @retval Others Failed to wait for valid keystrokes or application of - new configuration data failed. -**/ -EFI_STATUS -EFIAPI -SetupConfMgr ( - VOID - ) -{ - // Not used - ASSERT (FALSE); - return EFI_ACCESS_DENIED; -} - -/** - This function will connect all the system driver to controller - first, and then special connect the default console, this make - sure all the system controller available and the platform default - console connected. - -**/ -VOID -EFIAPI -EfiBootManagerConnectAll ( - VOID - ) -{ - return; -} - -/** - This function will delete the secure boot keys, thus - disabling secure boot. - - @return EFI_SUCCESS or underlying failure code. -**/ -EFI_STATUS -EFIAPI -DeleteSecureBootVariables ( - VOID - ) -{ - return (EFI_STATUS)mock (); -} - -/** - Query the index of the actively used Secure Boot keys corresponds to the Secure Boot key store, if it - can be determined. - - @retval UINTN Will return an index of key store or MU_SB_CONFIG_NONE if secure boot is not enabled, - or MU_SB_CONFIG_UNKOWN if the active key does not match anything in the key store. - -**/ -UINTN -EFIAPI -GetCurrentSecureBootConfig ( - VOID - ) -{ - return (UINTN)mock (); -} - -/** - Returns the status of setting secure boot keys. - - @param [in] Index The index of key from key stores. - - @retval Will return the status of setting secure boot variables. - -**/ -EFI_STATUS -EFIAPI -SetSecureBootConfig ( - IN UINT8 Index - ) -{ - check_expected (Index); - return (EFI_STATUS)mock (); -} - -/** - Mock version of Print. - - @param Format A Null-terminated Unicode format string. - @param ... A Variable argument list whose contents are accessed based - on the format string specified by Format. - - @return The number of Unicode characters printed to ConOut. - -**/ -UINTN -EFIAPI -Print ( - IN CONST CHAR16 *Format, - ... - ) -{ - CHAR8 Buffer[128]; - VA_LIST Marker; - UINTN Ret; - - VA_START (Marker, Format); - Ret = AsciiVSPrintUnicodeFormat (Buffer, sizeof (Buffer), Format, Marker); - VA_END (Marker); - - DEBUG ((DEBUG_INFO, "%a", Buffer)); - - return Ret; -} - -/** - Mock function for WaitForEvent. - - @param[in] NumberOfEvents The number of events in the Event array. - @param[in] Event An array of EFI_EVENT. - @param[out] Index The pointer to the index of the event which satisfied the wait condition. - - @retval EFI_SUCCESS The event indicated by Index was signaled. - @retval EFI_INVALID_PARAMETER 1) NumberOfEvents is 0. - 2) The event indicated by Index is of type - EVT_NOTIFY_SIGNAL. - @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION. - -**/ -EFI_STATUS -EFIAPI -MockWaitForEvent ( - IN UINTN NumberOfEvents, - IN EFI_EVENT *Event, - OUT UINTN *Index - ) -{ - assert_int_equal (NumberOfEvents, 1); - assert_int_equal (Event[0], MockSimpleInput.WaitForKeyEx); - assert_non_null (Index); - - *Index = 0; - return EFI_SUCCESS; -} - -/// -/// Mock version of the UEFI Boot Services Table -/// -EFI_BOOT_SERVICES MockBoot = { - { - EFI_BOOT_SERVICES_SIGNATURE, - EFI_BOOT_SERVICES_REVISION, - sizeof (EFI_BOOT_SERVICES), - 0, - 0 - }, - .WaitForEvent = MockWaitForEvent, -}; - -/** - Clean up state machine for this page. - - @param[in] Context [Optional] An optional parameter that enables: - 1) test-case reuse with varied parameters and - 2) test-case re-entry for Target tests that need a - reboot. This parameter is a VOID* and it is the - responsibility of the test author to ensure that the - contents are well understood by all test cases that may - consume it. - - @retval UNIT_TEST_PASSED Test case cleanup succeeded. - @retval UNIT_TEST_ERROR_CLEANUP_FAILED Test case cleanup failed. - -**/ -VOID -EFIAPI -SecureBootCleanup ( - IN UNIT_TEST_CONTEXT Context - ) -{ - mSecBootState = SecureBootInit; -} - -/** - Unit test for SecureBoot page when selecting ESC. - - @param[in] Context [Optional] An optional parameter that enables: - 1) test-case reuse with varied parameters and - 2) test-case re-entry for Target tests that need a - reboot. This parameter is a VOID* and it is the - responsibility of the test author to ensure that the - contents are well understood by all test cases that may - consume it. - - @retval UNIT_TEST_PASSED The Unit test has completed and the test - case was successful. - @retval UNIT_TEST_ERROR_TEST_FAILED A test case assertion has failed. -**/ -UNIT_TEST_STATUS -EFIAPI -ConfAppSecureBootInit ( - IN UNIT_TEST_CONTEXT Context - ) -{ - EFI_STATUS Status; - - will_return (MockClearScreen, EFI_SUCCESS); - will_return_always (MockSetAttribute, EFI_SUCCESS); - - will_return (GetCurrentSecureBootConfig, MU_SB_CONFIG_UNKNOWN); - - expect_memory (MockGetVariable, VariableName, READY_TO_BOOT_INDICATOR_VAR_NAME, sizeof (READY_TO_BOOT_INDICATOR_VAR_NAME)); - expect_memory (MockGetVariable, VendorGuid, &gMuVarPolicyDxePhaseGuid, sizeof (EFI_GUID)); - - will_return (MockGetVariable, 0); - will_return (MockGetVariable, NULL); - will_return (MockGetVariable, EFI_NOT_FOUND); - - expect_any (MockSetCursorPosition, Column); - expect_any (MockSetCursorPosition, Row); - will_return (MockSetCursorPosition, EFI_SUCCESS); - - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - - return UNIT_TEST_PASSED; -} - -/** - Unit test for SecureBoot page when selecting ESC. - - @param[in] Context [Optional] An optional parameter that enables: - 1) test-case reuse with varied parameters and - 2) test-case re-entry for Target tests that need a - reboot. This parameter is a VOID* and it is the - responsibility of the test author to ensure that the - contents are well understood by all test cases that may - consume it. - - @retval UNIT_TEST_PASSED The Unit test has completed and the test - case was successful. - @retval UNIT_TEST_ERROR_TEST_FAILED A test case assertion has failed. -**/ -UNIT_TEST_STATUS -EFIAPI -ConfAppSecureBootSelectEsc ( - IN UNIT_TEST_CONTEXT Context - ) -{ - EFI_STATUS Status; - EFI_KEY_DATA KeyData1; - - will_return (MockClearScreen, EFI_SUCCESS); - will_return_always (MockSetAttribute, EFI_SUCCESS); - - will_return (GetCurrentSecureBootConfig, MU_SB_CONFIG_NONE); - - expect_any (MockSetCursorPosition, Column); - expect_any (MockSetCursorPosition, Row); - will_return (MockSetCursorPosition, EFI_SUCCESS); - - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - UT_ASSERT_EQUAL (mSecBootState, SecureBootWait); - - mSimpleTextInEx = &MockSimpleInput; - - KeyData1.Key.UnicodeChar = CHAR_NULL; - KeyData1.Key.ScanCode = SCAN_ESC; - will_return (MockReadKey, &KeyData1); - - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - UT_ASSERT_EQUAL (mSecBootState, SecureBootExit); - - return UNIT_TEST_PASSED; -} - -/** - Unit test for SecureBoot page when selecting others. - - @param[in] Context [Optional] An optional parameter that enables: - 1) test-case reuse with varied parameters and - 2) test-case re-entry for Target tests that need a - reboot. This parameter is a VOID* and it is the - responsibility of the test author to ensure that the - contents are well understood by all test cases that may - consume it. - - @retval UNIT_TEST_PASSED The Unit test has completed and the test - case was successful. - @retval UNIT_TEST_ERROR_TEST_FAILED A test case assertion has failed. -**/ -UNIT_TEST_STATUS -EFIAPI -SecureBootSelectOther ( - IN UNIT_TEST_CONTEXT Context - ) -{ - EFI_STATUS Status; - EFI_KEY_DATA KeyData1; - - will_return (MockClearScreen, EFI_SUCCESS); - will_return_always (MockSetAttribute, EFI_SUCCESS); - - will_return (GetCurrentSecureBootConfig, MU_SB_CONFIG_NONE); - - expect_any (MockSetCursorPosition, Column); - expect_any (MockSetCursorPosition, Row); - will_return (MockSetCursorPosition, EFI_SUCCESS); - - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - UT_ASSERT_EQUAL (mSecBootState, SecureBootWait); - - mSimpleTextInEx = &MockSimpleInput; - - KeyData1.Key.UnicodeChar = 'X'; - KeyData1.Key.ScanCode = SCAN_NULL; - will_return (MockReadKey, &KeyData1); - - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - UT_ASSERT_EQUAL (mSecBootState, SecureBootWait); - - return UNIT_TEST_PASSED; -} - -/** - Unit test for SecureBoot page when selecting secure boot one option. - - @param[in] Context [Optional] An optional parameter that enables: - 1) test-case reuse with varied parameters and - 2) test-case re-entry for Target tests that need a - reboot. This parameter is a VOID* and it is the - responsibility of the test author to ensure that the - contents are well understood by all test cases that may - consume it. - - @retval UNIT_TEST_PASSED The Unit test has completed and the test - case was successful. - @retval UNIT_TEST_ERROR_TEST_FAILED A test case assertion has failed. -**/ -UNIT_TEST_STATUS -EFIAPI -SecureBootSelectOne ( - IN UNIT_TEST_CONTEXT Context - ) -{ - EFI_STATUS Status; - EFI_KEY_DATA KeyData1; - SECURE_BOOT_PAYLOAD_INFO SBKey = { - .SecureBootKeyName = L"Dummy Key" - }; - - mSecureBootKeys = &SBKey; - mSecureBootKeysCount = 1; - - will_return (MockClearScreen, EFI_SUCCESS); - will_return_always (MockSetAttribute, EFI_SUCCESS); - - will_return (GetCurrentSecureBootConfig, MU_SB_CONFIG_NONE); - - // Expect the prints twice - expect_any (MockSetCursorPosition, Column); - expect_any (MockSetCursorPosition, Row); - will_return (MockSetCursorPosition, EFI_SUCCESS); - - // Initial run - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - UT_ASSERT_EQUAL (mSecBootState, SecureBootWait); - - mSimpleTextInEx = &MockSimpleInput; - - KeyData1.Key.UnicodeChar = '0'; - KeyData1.Key.ScanCode = SCAN_NULL; - will_return (MockReadKey, &KeyData1); - - expect_value (SetSecureBootConfig, Index, 0); - will_return (SetSecureBootConfig, EFI_SUCCESS); - - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - UT_ASSERT_EQUAL (mSecBootState, SecureBootEnroll); - - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - UT_ASSERT_EQUAL (mSecBootState, SecureBootConfChange); - - return UNIT_TEST_PASSED; -} - -/** - Unit test for SecureBoot page when selecting secure boot options. - - @param[in] Context [Optional] An optional parameter that enables: - 1) test-case reuse with varied parameters and - 2) test-case re-entry for Target tests that need a - reboot. This parameter is a VOID* and it is the - responsibility of the test author to ensure that the - contents are well understood by all test cases that may - consume it. - - @retval UNIT_TEST_PASSED The Unit test has completed and the test - case was successful. - @retval UNIT_TEST_ERROR_TEST_FAILED A test case assertion has failed. -**/ -UNIT_TEST_STATUS -EFIAPI -ConfAppSecureBootSelectMore ( - IN UNIT_TEST_CONTEXT Context - ) -{ - EFI_STATUS Status; - EFI_KEY_DATA KeyData1; - SECURE_BOOT_PAYLOAD_INFO SBKey[2] = { - { .SecureBootKeyName = L"Dummy Key 1" }, - { .SecureBootKeyName = L"Dummy Key 2" }, - }; - - mSecureBootKeys = SBKey; - mSecureBootKeysCount = 2; - - will_return (MockClearScreen, EFI_SUCCESS); - will_return_always (MockSetAttribute, EFI_SUCCESS); - - will_return (GetCurrentSecureBootConfig, MU_SB_CONFIG_NONE); - - // Expect the prints twice - expect_any (MockSetCursorPosition, Column); - expect_any (MockSetCursorPosition, Row); - will_return (MockSetCursorPosition, EFI_SUCCESS); - - // Initial run - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - UT_ASSERT_EQUAL (mSecBootState, SecureBootWait); - - mSimpleTextInEx = &MockSimpleInput; - - KeyData1.Key.UnicodeChar = '1'; - KeyData1.Key.ScanCode = SCAN_NULL; - will_return (MockReadKey, &KeyData1); - - expect_value (SetSecureBootConfig, Index, 1); - will_return (SetSecureBootConfig, EFI_SUCCESS); - - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - UT_ASSERT_EQUAL (mSecBootState, SecureBootEnroll); - - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - UT_ASSERT_EQUAL (mSecBootState, SecureBootConfChange); - - return UNIT_TEST_PASSED; -} - -/** - Unit test for SecureBoot page when selecting clear option. - - @param[in] Context [Optional] An optional parameter that enables: - 1) test-case reuse with varied parameters and - 2) test-case re-entry for Target tests that need a - reboot. This parameter is a VOID* and it is the - responsibility of the test author to ensure that the - contents are well understood by all test cases that may - consume it. - - @retval UNIT_TEST_PASSED The Unit test has completed and the test - case was successful. - @retval UNIT_TEST_ERROR_TEST_FAILED A test case assertion has failed. -**/ -UNIT_TEST_STATUS -EFIAPI -ConfAppSecureBootSelectClear ( - IN UNIT_TEST_CONTEXT Context - ) -{ - EFI_STATUS Status; - EFI_KEY_DATA KeyData1; - SECURE_BOOT_PAYLOAD_INFO SBKey[2] = { - { .SecureBootKeyName = L"Dummy Key 1" }, - { .SecureBootKeyName = L"Dummy Key 2" }, - }; - - mSecureBootKeys = SBKey; - mSecureBootKeysCount = 2; - - will_return (MockClearScreen, EFI_SUCCESS); - will_return_always (MockSetAttribute, EFI_SUCCESS); - - will_return (GetCurrentSecureBootConfig, MU_SB_CONFIG_NONE); - - // Expect the prints twice - expect_any (MockSetCursorPosition, Column); - expect_any (MockSetCursorPosition, Row); - will_return (MockSetCursorPosition, EFI_SUCCESS); - - // Initial run - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - UT_ASSERT_EQUAL (mSecBootState, SecureBootWait); - - mSimpleTextInEx = &MockSimpleInput; - - KeyData1.Key.UnicodeChar = '0' + mSecureBootKeysCount; - KeyData1.Key.ScanCode = SCAN_NULL; - will_return (MockReadKey, &KeyData1); - - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - UT_ASSERT_EQUAL (mSecBootState, SecureBootClear); - - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - UT_ASSERT_EQUAL (mSecBootState, SecureBootWait); - - return UNIT_TEST_PASSED; -} - -/** - Unit test for SecureBoot page when selecting secure boot options after ready to boot. - - @param[in] Context [Optional] An optional parameter that enables: - 1) test-case reuse with varied parameters and - 2) test-case re-entry for Target tests that need a - reboot. This parameter is a VOID* and it is the - responsibility of the test author to ensure that the - contents are well understood by all test cases that may - consume it. - - @retval UNIT_TEST_PASSED The Unit test has completed and the test - case was successful. - @retval UNIT_TEST_ERROR_TEST_FAILED A test case assertion has failed. -**/ -UNIT_TEST_STATUS -EFIAPI -ConfAppSecureBootPostRTB ( - IN UNIT_TEST_CONTEXT Context - ) -{ - EFI_STATUS Status; - POLICY_LOCK_VAR LockVar = PHASE_INDICATOR_SET; - EFI_KEY_DATA KeyData1; - SECURE_BOOT_PAYLOAD_INFO SBKey[2] = { - { .SecureBootKeyName = L"Dummy Key 1" }, - { .SecureBootKeyName = L"Dummy Key 2" }, - }; - - mSecureBootKeys = SBKey; - mSecureBootKeysCount = 2; - - will_return (MockClearScreen, EFI_SUCCESS); - will_return_always (MockSetAttribute, EFI_SUCCESS); - - will_return (GetCurrentSecureBootConfig, MU_SB_CONFIG_UNKNOWN); - - expect_memory (MockGetVariable, VariableName, READY_TO_BOOT_INDICATOR_VAR_NAME, sizeof (READY_TO_BOOT_INDICATOR_VAR_NAME)); - expect_memory (MockGetVariable, VendorGuid, &gMuVarPolicyDxePhaseGuid, sizeof (EFI_GUID)); - - will_return (MockGetVariable, sizeof (LockVar)); - will_return (MockGetVariable, &LockVar); - will_return (MockGetVariable, EFI_SUCCESS); - - // Expect the prints twice - expect_any (MockSetCursorPosition, Column); - expect_any (MockSetCursorPosition, Row); - will_return (MockSetCursorPosition, EFI_SUCCESS); - - // Initial run - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - UT_ASSERT_EQUAL (mSecBootState, SecureBootWait); - - mSimpleTextInEx = &MockSimpleInput; - - KeyData1.Key.UnicodeChar = '1'; - KeyData1.Key.ScanCode = SCAN_NULL; - will_return (MockReadKey, &KeyData1); - - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - UT_ASSERT_EQUAL (mSecBootState, SecureBootError); - - return UNIT_TEST_PASSED; -} - -/** - Unit test for SecureBoot page when selecting new secure boot options. - - @param[in] Context [Optional] An optional parameter that enables: - 1) test-case reuse with varied parameters and - 2) test-case re-entry for Target tests that need a - reboot. This parameter is a VOID* and it is the - responsibility of the test author to ensure that the - contents are well understood by all test cases that may - consume it. - - @retval UNIT_TEST_PASSED The Unit test has completed and the test - case was successful. - @retval UNIT_TEST_ERROR_TEST_FAILED A test case assertion has failed. -**/ -UNIT_TEST_STATUS -EFIAPI -ConfAppSecureBootUpdateKeys ( - IN UNIT_TEST_CONTEXT Context - ) -{ - EFI_STATUS Status; - EFI_KEY_DATA KeyData1; - SECURE_BOOT_PAYLOAD_INFO SBKey[2] = { - { .SecureBootKeyName = L"Dummy Key 1" }, - { .SecureBootKeyName = L"Dummy Key 2" }, - }; - - mSecureBootKeys = SBKey; - mSecureBootKeysCount = 2; - - will_return (MockClearScreen, EFI_SUCCESS); - will_return_always (MockSetAttribute, EFI_SUCCESS); - - will_return (GetCurrentSecureBootConfig, 0); - - expect_memory (MockGetVariable, VariableName, READY_TO_BOOT_INDICATOR_VAR_NAME, sizeof (READY_TO_BOOT_INDICATOR_VAR_NAME)); - expect_memory (MockGetVariable, VendorGuid, &gMuVarPolicyDxePhaseGuid, sizeof (EFI_GUID)); - - will_return (MockGetVariable, 0); - will_return (MockGetVariable, NULL); - will_return (MockGetVariable, EFI_NOT_FOUND); - - // Expect the prints twice - expect_any (MockSetCursorPosition, Column); - expect_any (MockSetCursorPosition, Row); - will_return (MockSetCursorPosition, EFI_SUCCESS); - - // Initial run - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - UT_ASSERT_EQUAL (mSecBootState, SecureBootWait); - - mSimpleTextInEx = &MockSimpleInput; - - KeyData1.Key.UnicodeChar = '1'; - KeyData1.Key.ScanCode = SCAN_NULL; - will_return (MockReadKey, &KeyData1); - - expect_value (SetSecureBootConfig, Index, 1); - will_return (SetSecureBootConfig, EFI_SUCCESS); - - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - UT_ASSERT_EQUAL (mSecBootState, SecureBootEnroll); - - will_return (DeleteSecureBootVariables, EFI_SUCCESS); - - Status = SecureBootMgr (); - UT_ASSERT_NOT_EFI_ERROR (Status); - UT_ASSERT_EQUAL (mSecBootState, SecureBootConfChange); - - return UNIT_TEST_PASSED; -} - -/** - Initialize the unit test framework, suite, and unit tests for the - ConfApp and run the ConfApp unit test. - - @retval EFI_SUCCESS All test cases were dispatched. - @retval EFI_OUT_OF_RESOURCES There are not enough resources available to - initialize the unit tests. -**/ -STATIC -EFI_STATUS -EFIAPI -UnitTestingEntry ( - VOID - ) -{ - EFI_STATUS Status; - UNIT_TEST_FRAMEWORK_HANDLE Framework; - UNIT_TEST_SUITE_HANDLE MiscTests; - - Framework = NULL; - - DEBUG ((DEBUG_INFO, "%a v%a\n", UNIT_TEST_APP_NAME, UNIT_TEST_APP_VERSION)); - - // - // Start setting up the test framework for running the tests. - // - Status = InitUnitTestFramework (&Framework, UNIT_TEST_APP_NAME, gEfiCallerBaseName, UNIT_TEST_APP_VERSION); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "Failed in InitUnitTestFramework. Status = %r\n", Status)); - goto EXIT; - } - - // - // Populate the ConfDataSettingProvider Unit Test Suite. - // - Status = CreateUnitTestSuite (&MiscTests, Framework, "ConfDataSettingProvider Misc Tests", "ConfDataSettingProvider.Misc", NULL, NULL); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "Failed in CreateUnitTestSuite for MiscTests\n")); - Status = EFI_OUT_OF_RESOURCES; - goto EXIT; - } - - // - // --------------Suite-----------Description--------------Name----------Function--------Pre---Post-------------------Context----------- - // - AddTestCase (MiscTests, "Secure Boot page should initialize properly", "NormalInit", ConfAppSecureBootInit, NULL, SecureBootCleanup, NULL); - AddTestCase (MiscTests, "Secure Boot page select Esc should go to previous menu", "SelectEsc", ConfAppSecureBootSelectEsc, NULL, SecureBootCleanup, NULL); - AddTestCase (MiscTests, "Secure Boot page select others should do nothing", "SelectOther", SecureBootSelectOther, NULL, SecureBootCleanup, NULL); - AddTestCase (MiscTests, "Secure Boot page should change to the first selection", "SecureBootOne", SecureBootSelectOne, NULL, SecureBootCleanup, NULL); - AddTestCase (MiscTests, "Secure Boot page should change to non-first selection", "SecureBootMore", ConfAppSecureBootSelectMore, NULL, SecureBootCleanup, NULL); - AddTestCase (MiscTests, "Secure Boot page should change to clear enrolled settings", "SelectClear", ConfAppSecureBootSelectClear, NULL, SecureBootCleanup, NULL); - AddTestCase (MiscTests, "Secure Boot page should block selecting options post RTB", "PostRTB", ConfAppSecureBootPostRTB, NULL, SecureBootCleanup, NULL); - AddTestCase (MiscTests, "Secure Boot page should success updating for selected options", "UpdateKey", ConfAppSecureBootUpdateKeys, NULL, SecureBootCleanup, NULL); - - // - // Execute the tests. - // - Status = RunAllTestSuites (Framework); - -EXIT: - if (Framework) { - FreeUnitTestFramework (Framework); - } - - return Status; -} - -/** - Standard POSIX C entry point for host based unit test execution. -**/ -int -main ( - int argc, - char *argv[] - ) -{ - return UnitTestingEntry (); -} diff --git a/SetupDataPkg/ConfApp/UnitTest/ConfAppSecureBootUnitTest.inf b/SetupDataPkg/ConfApp/UnitTest/ConfAppSecureBootUnitTest.inf deleted file mode 100644 index 0dffd0c4..00000000 --- a/SetupDataPkg/ConfApp/UnitTest/ConfAppSecureBootUnitTest.inf +++ /dev/null @@ -1,57 +0,0 @@ -## @file -# Unit tests of the Boot Option page of ConfApp module -# -# Copyright (C) Microsoft Corporation. -# SPDX-License-Identifier: BSD-2-Clause-Patent -## - -[Defines] - INF_VERSION = 0x00010006 - BASE_NAME = ConfAppSecureBootUnitTest - FILE_GUID = 98AA24A5-D73D-4CD9-8EA1-4910CB1AC551 - MODULE_TYPE = HOST_APPLICATION - VERSION_STRING = 1.0 - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - ConfAppSecureBootUnitTest.c - ConInConOut.c - ConfAppUnitTestCommon.c - ../ConfApp.c - ../ConfApp.h - ../SecureBoot.c - -[Packages] - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec - MsCorePkg/MsCorePkg.dec - PcBdsPkg/PcBdsPkg.dec - SecurityPkg/SecurityPkg.dec - SetupDataPkg/SetupDataPkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - UefiRuntimeServicesTableLib - BaseLib - BaseMemoryLib - DebugLib - UnitTestLib - PrintLib - ResetSystemLib - SecureBootKeyStoreLib - PerformanceLib - ConfigSystemModeLib - -[Guids] - gMuVarPolicyDxePhaseGuid - gEfiEventReadyToBootGuid - -[Protocols] - gEdkiiVariablePolicyProtocolGuid - gEfiSimpleTextInputExProtocolGuid diff --git a/SetupDataPkg/ConfApp/UnitTest/ConfAppUnitTest.c b/SetupDataPkg/ConfApp/UnitTest/ConfAppUnitTest.c index 78c124bf..b30dab12 100644 --- a/SetupDataPkg/ConfApp/UnitTest/ConfAppUnitTest.c +++ b/SetupDataPkg/ConfApp/UnitTest/ConfAppUnitTest.c @@ -101,24 +101,6 @@ BootOptionMgr ( return (EFI_STATUS)mock (); } -/** - State machine for secure boot page. It will react to user input from keystroke - to set selected secure boot option or go back to previous page. - - @retval EFI_SUCCESS This iteration of state machine proceeds successfully. - @retval Others Failed to wait for valid keystrokes or failed to set - platform key to variable service. -**/ -EFI_STATUS -EFIAPI -SecureBootMgr ( - VOID - ) -{ - SwitchMachineState ((ConfState_t)mock ()); - return (EFI_STATUS)mock (); -} - /** State machine for configuration setup. It will react to user keystroke to accept configuration data from selected option. @@ -438,8 +420,8 @@ ConfAppEntrySelect2 ( KeyData1.Key.ScanCode = SCAN_NULL; will_return (MockReadKey, &KeyData1); - will_return (SecureBootMgr, MainExit); - will_return (SecureBootMgr, EFI_SUCCESS); + will_return (BootOptionMgr, MainExit); + will_return (BootOptionMgr, EFI_SUCCESS); KeyData2.Key.UnicodeChar = 'y'; KeyData2.Key.ScanCode = SCAN_NULL; @@ -495,63 +477,6 @@ ConfAppEntrySelect3 ( KeyData1.Key.ScanCode = SCAN_NULL; will_return (MockReadKey, &KeyData1); - will_return (BootOptionMgr, MainExit); - will_return (BootOptionMgr, EFI_SUCCESS); - - KeyData2.Key.UnicodeChar = 'y'; - KeyData2.Key.ScanCode = SCAN_NULL; - will_return (MockReadKey, &KeyData2); - - will_return (ResetCold, &JumpBuf); - - if (!SetJump (&JumpBuf)) { - ConfAppEntry (NULL, NULL); - } - - return UNIT_TEST_PASSED; -} - -/** - Unit test for ConfAppEntry of ConfApp when selecting 4. - - @param[in] Context [Optional] An optional parameter that enables: - 1) test-case reuse with varied parameters and - 2) test-case re-entry for Target tests that need a - reboot. This parameter is a VOID* and it is the - responsibility of the test author to ensure that the - contents are well understood by all test cases that may - consume it. - - @retval UNIT_TEST_PASSED The Unit test has completed and the test - case was successful. - @retval UNIT_TEST_ERROR_TEST_FAILED A test case assertion has failed. -**/ -UNIT_TEST_STATUS -EFIAPI -ConfAppEntrySelect4 ( - IN UNIT_TEST_CONTEXT Context - ) -{ - EFI_KEY_DATA KeyData1; - EFI_KEY_DATA KeyData2; - BASE_LIBRARY_JUMP_BUFFER JumpBuf; - - will_return (MockSetWatchdogTimer, EFI_SUCCESS); - - expect_value (MockEnableCursor, Visible, FALSE); - will_return (MockEnableCursor, EFI_SUCCESS); - - expect_any_count (MockSetCursorPosition, Column, 1); - expect_any_count (MockSetCursorPosition, Row, 1); - will_return_count (MockSetCursorPosition, EFI_SUCCESS, 1); - - will_return (MockClearScreen, EFI_SUCCESS); - will_return_always (MockSetAttribute, EFI_SUCCESS); - - KeyData1.Key.UnicodeChar = '4'; - KeyData1.Key.ScanCode = SCAN_NULL; - will_return (MockReadKey, &KeyData1); - will_return (SetupConfMgr, MainExit); will_return (SetupConfMgr, EFI_SUCCESS); @@ -842,9 +767,8 @@ UnitTestingEntry ( // --------------Suite-----------Description--------------Name----------Function--------Pre---Post-------------------Context----------- // AddTestCase (MiscTests, "ConfApp Select 1 should go to System Info", "Select1", ConfAppEntrySelect1, NULL, ConfAppCleanup, NULL); - AddTestCase (MiscTests, "ConfApp Select 2 should go to Secure Boot", "Select2", ConfAppEntrySelect2, NULL, ConfAppCleanup, NULL); - AddTestCase (MiscTests, "ConfApp Select 3 should go to Boot Options", "Select3", ConfAppEntrySelect3, NULL, ConfAppCleanup, NULL); - AddTestCase (MiscTests, "ConfApp Select 4 should go to Setup Option", "Select4", ConfAppEntrySelect4, NULL, ConfAppCleanup, NULL); + AddTestCase (MiscTests, "ConfApp Select 2 should go to Boot Options", "Select2", ConfAppEntrySelect2, NULL, ConfAppCleanup, NULL); + AddTestCase (MiscTests, "ConfApp Select 3 should go to Setup Option", "Select3", ConfAppEntrySelect3, NULL, ConfAppCleanup, NULL); AddTestCase (MiscTests, "ConfApp Select h should reprint the options", "SelectH", ConfAppEntrySelectH, NULL, ConfAppCleanup, NULL); AddTestCase (MiscTests, "ConfApp Select ESC should confirm reboot", "SelectEsc", ConfAppEntrySelectEsc, NULL, ConfAppCleanup, NULL); AddTestCase (MiscTests, "ConfApp Select other should do nothing", "SelectOther", ConfAppEntrySelectOther, NULL, ConfAppCleanup, NULL); diff --git a/SetupDataPkg/Test/SetupDataPkgHostTest.dsc b/SetupDataPkg/Test/SetupDataPkgHostTest.dsc index 2d8cd6a5..2b11a34d 100644 --- a/SetupDataPkg/Test/SetupDataPkgHostTest.dsc +++ b/SetupDataPkg/Test/SetupDataPkgHostTest.dsc @@ -103,10 +103,3 @@ gSetupDataPkgTokenSpaceGuid.PcdConfigurationPolicyGuid|{GUID("00000000-0000-0000-0000-000000000000")} } - - SetupDataPkg/ConfApp/UnitTest/ConfAppSecureBootUnitTest.inf { - - UefiBootServicesTableLib|SetupDataPkg/Test/MockLibrary/MockUefiBootServicesTableLib/MockUefiBootServicesTableLib.inf - UefiRuntimeServicesTableLib|SetupDataPkg/Test/MockLibrary/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf - ResetSystemLib|SetupDataPkg/Test/MockLibrary/MockResetSystemLib/MockResetSystemLib.inf - }