MdeModulePkg: added SecurityManagementLib mock
Added Google Mock test support for SecurityManagementLib Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
3f453cd7aa
commit
1c3a22059b
@@ -71,3 +71,4 @@
|
||||
MdeModulePkg/Test/Mock/Library/GoogleTest/MockHiiLib/MockHiiLib.inf
|
||||
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
|
||||
MdeModulePkg/Test/Mock/Library/GoogleTest/MockVariablePolicyHelperLib/MockVariablePolicyHelperLib.inf
|
||||
MdeModulePkg/Test/Mock/Library/GoogleTest/MockSecurityManagementLib/MockSecurityManagementLib.inf
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/** @file
|
||||
Google Test mocks for DevicePathLib
|
||||
|
||||
Copyright (c) 2025, Yandex. All rights reserved.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#ifndef MOCK_SECURITY_MANAGEMENT_LIB_H_
|
||||
#define MOCK_SECURITY_MANAGEMENT_LIB_LIB_H_
|
||||
|
||||
#include <Library/GoogleTestLib.h>
|
||||
#include <Library/FunctionMockLib.h>
|
||||
extern "C" {
|
||||
#include <Uefi.h>
|
||||
#include <Library/SecurityManagementLib.h>
|
||||
}
|
||||
|
||||
struct MockSecurityManagementLib {
|
||||
MOCK_INTERFACE_DECLARATION (MockSecurityManagementLib);
|
||||
|
||||
MOCK_FUNCTION_DECLARATION (
|
||||
EFI_STATUS,
|
||||
RegisterSecurityHandler,
|
||||
(IN SECURITY_FILE_AUTHENTICATION_STATE_HANDLER SecurityHandler,
|
||||
IN UINT32 AuthenticationOperation)
|
||||
);
|
||||
|
||||
MOCK_FUNCTION_DECLARATION (
|
||||
EFI_STATUS,
|
||||
ExecuteSecurityHandlers,
|
||||
(IN UINT32 AuthenticationStatus,
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *FilePath)
|
||||
);
|
||||
|
||||
MOCK_FUNCTION_DECLARATION (
|
||||
EFI_STATUS,
|
||||
RegisterSecurity2Handler,
|
||||
(IN SECURITY2_FILE_AUTHENTICATION_HANDLER Security2Handler,
|
||||
IN UINT32 AuthenticationOperation)
|
||||
);
|
||||
|
||||
MOCK_FUNCTION_DECLARATION (
|
||||
EFI_STATUS,
|
||||
ExecuteSecurity2Handlers,
|
||||
(IN UINT32 AuthenticationOperation,
|
||||
IN UINT32 AuthenticationStatus,
|
||||
IN CONST EFI_DEVICE_PATH_PROTOCOL *File OPTIONAL,
|
||||
IN VOID *FileBuffer,
|
||||
IN UINTN FileSize,
|
||||
IN BOOLEAN BootPolicy)
|
||||
);
|
||||
};
|
||||
|
||||
#endif // MOCK_SECURITY_MANAGEMENT_LIB_H_
|
||||
@@ -0,0 +1,15 @@
|
||||
/** @file
|
||||
Google Test mocks for SecurityManagementLib
|
||||
|
||||
Copyright (c) 2025, Yandex. All rights reserved.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#include <GoogleTest/Library/MockSecurityManagementLib.h>
|
||||
|
||||
MOCK_INTERFACE_DEFINITION (MockSecurityManagementLib);
|
||||
|
||||
MOCK_FUNCTION_DEFINITION (MockSecurityManagementLib, RegisterSecurityHandler, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION (MockSecurityManagementLib, ExecuteSecurityHandlers, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION (MockSecurityManagementLib, RegisterSecurity2Handler, 2, EFIAPI);
|
||||
MOCK_FUNCTION_DEFINITION (MockSecurityManagementLib, ExecuteSecurity2Handlers, 6, EFIAPI);
|
||||
@@ -0,0 +1,34 @@
|
||||
## @file
|
||||
# Google Test mocks for SecurityManagementLib
|
||||
#
|
||||
# Copyright (c) 2025, Yandex. All rights reserved.
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = MockSecurityManagementLib
|
||||
FILE_GUID = 22FF8498-3FE9-495B-81B7-6595145F5832
|
||||
MODULE_TYPE = HOST_APPLICATION
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = SecurityManagementLib
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64
|
||||
#
|
||||
|
||||
[Sources]
|
||||
MockSecurityManagementLib.cpp
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
GoogleTestLib
|
||||
|
||||
[BuildOptions]
|
||||
MSFT:*_*_*_CC_FLAGS = /EHsc
|
||||
Reference in New Issue
Block a user