SecurityPkg: Apply uncrustify formatting to relevant files
Apply uncrustify formatting to GoogleTest cpp and header files. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Signed-off-by: Vivian Nowka-Keane <vnowkakeane@linux.microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
716a3292e0
commit
a00f7a355a
@ -26,7 +26,10 @@ class SetSecureBootModeTest : public Test {
|
|||||||
UINT8 SecureBootMode;
|
UINT8 SecureBootMode;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
void SetUp() override {
|
void
|
||||||
|
SetUp (
|
||||||
|
) override
|
||||||
|
{
|
||||||
// Any random magic number can be used for these tests
|
// Any random magic number can be used for these tests
|
||||||
SecureBootMode = 0xAB;
|
SecureBootMode = 0xAB;
|
||||||
}
|
}
|
||||||
@ -46,13 +49,16 @@ TEST_F(SetSecureBootModeTest, SetVarError) {
|
|||||||
// expected secure boot mode is written to the correct variable in the call
|
// expected secure boot mode is written to the correct variable in the call
|
||||||
// to gRT->SetVariable().
|
// to gRT->SetVariable().
|
||||||
TEST_F (SetSecureBootModeTest, PropogateModeToSetVar) {
|
TEST_F (SetSecureBootModeTest, PropogateModeToSetVar) {
|
||||||
EXPECT_CALL(RtServicesMock,
|
EXPECT_CALL (
|
||||||
|
RtServicesMock,
|
||||||
gRT_SetVariable (
|
gRT_SetVariable (
|
||||||
Char16StrEq (EFI_CUSTOM_MODE_NAME),
|
Char16StrEq (EFI_CUSTOM_MODE_NAME),
|
||||||
BufferEq (&gEfiCustomModeEnableGuid, sizeof (EFI_GUID)),
|
BufferEq (&gEfiCustomModeEnableGuid, sizeof (EFI_GUID)),
|
||||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||||
sizeof (SecureBootMode),
|
sizeof (SecureBootMode),
|
||||||
BufferEq(&SecureBootMode, sizeof(SecureBootMode))))
|
BufferEq (&SecureBootMode, sizeof (SecureBootMode))
|
||||||
|
)
|
||||||
|
)
|
||||||
.WillOnce (Return (EFI_SUCCESS));
|
.WillOnce (Return (EFI_SUCCESS));
|
||||||
|
|
||||||
Status = SetSecureBootMode (SecureBootMode);
|
Status = SetSecureBootMode (SecureBootMode);
|
||||||
@ -67,7 +73,10 @@ class GetSetupModeTest : public Test {
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT8 ExpSetupMode;
|
UINT8 ExpSetupMode;
|
||||||
|
|
||||||
void SetUp() override {
|
void
|
||||||
|
SetUp (
|
||||||
|
) override
|
||||||
|
{
|
||||||
// Any random magic number can be used for these tests
|
// Any random magic number can be used for these tests
|
||||||
ExpSetupMode = 0xAB;
|
ExpSetupMode = 0xAB;
|
||||||
}
|
}
|
||||||
@ -87,17 +96,23 @@ TEST_F(GetSetupModeTest, GetVarError) {
|
|||||||
// setup mode is returned (and with a success return code) when the mode is
|
// setup mode is returned (and with a success return code) when the mode is
|
||||||
// successfully read from the call to gRT->GetVariable().
|
// successfully read from the call to gRT->GetVariable().
|
||||||
TEST_F (GetSetupModeTest, FetchModeFromGetVar) {
|
TEST_F (GetSetupModeTest, FetchModeFromGetVar) {
|
||||||
EXPECT_CALL(RtServicesMock,
|
EXPECT_CALL (
|
||||||
|
RtServicesMock,
|
||||||
gRT_GetVariable (
|
gRT_GetVariable (
|
||||||
Char16StrEq (EFI_SETUP_MODE_NAME),
|
Char16StrEq (EFI_SETUP_MODE_NAME),
|
||||||
BufferEq (&gEfiGlobalVariableGuid, sizeof (EFI_GUID)),
|
BufferEq (&gEfiGlobalVariableGuid, sizeof (EFI_GUID)),
|
||||||
_,
|
_,
|
||||||
Pointee (Eq (sizeof (SetupMode))),
|
Pointee (Eq (sizeof (SetupMode))),
|
||||||
NotNull()))
|
NotNull ()
|
||||||
.WillOnce(DoAll(
|
)
|
||||||
|
)
|
||||||
|
.WillOnce (
|
||||||
|
DoAll (
|
||||||
SetArgPointee<3>(sizeof (ExpSetupMode)),
|
SetArgPointee<3>(sizeof (ExpSetupMode)),
|
||||||
SetArgBuffer<4>(&ExpSetupMode, sizeof (ExpSetupMode)),
|
SetArgBuffer<4>(&ExpSetupMode, sizeof (ExpSetupMode)),
|
||||||
Return(EFI_SUCCESS)));
|
Return (EFI_SUCCESS)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
Status = GetSetupMode (&SetupMode);
|
Status = GetSetupMode (&SetupMode);
|
||||||
ASSERT_EQ (Status, EFI_SUCCESS);
|
ASSERT_EQ (Status, EFI_SUCCESS);
|
||||||
@ -126,7 +141,10 @@ class IsSecureBootEnabledAllocTest : public IsSecureBootEnabledTest {
|
|||||||
protected:
|
protected:
|
||||||
UINT8 *BootEnabledBuffer;
|
UINT8 *BootEnabledBuffer;
|
||||||
|
|
||||||
void SetUp() override {
|
void
|
||||||
|
SetUp (
|
||||||
|
) override
|
||||||
|
{
|
||||||
BootEnabledBuffer = (UINT8 *)AllocatePool (1);
|
BootEnabledBuffer = (UINT8 *)AllocatePool (1);
|
||||||
ASSERT_NE (BootEnabledBuffer, nullptr);
|
ASSERT_NE (BootEnabledBuffer, nullptr);
|
||||||
}
|
}
|
||||||
@ -137,14 +155,20 @@ class IsSecureBootEnabledAllocTest : public IsSecureBootEnabledTest {
|
|||||||
// returns SECURE_BOOT_MODE_ENABLE.
|
// returns SECURE_BOOT_MODE_ENABLE.
|
||||||
TEST_F (IsSecureBootEnabledAllocTest, IsEnabled) {
|
TEST_F (IsSecureBootEnabledAllocTest, IsEnabled) {
|
||||||
*BootEnabledBuffer = SECURE_BOOT_MODE_ENABLE;
|
*BootEnabledBuffer = SECURE_BOOT_MODE_ENABLE;
|
||||||
EXPECT_CALL(UefiLibMock,
|
EXPECT_CALL (
|
||||||
|
UefiLibMock,
|
||||||
GetEfiGlobalVariable2 (
|
GetEfiGlobalVariable2 (
|
||||||
Char16StrEq (EFI_SECURE_BOOT_MODE_NAME),
|
Char16StrEq (EFI_SECURE_BOOT_MODE_NAME),
|
||||||
NotNull (),
|
NotNull (),
|
||||||
_))
|
_
|
||||||
.WillOnce(DoAll(
|
)
|
||||||
|
)
|
||||||
|
.WillOnce (
|
||||||
|
DoAll (
|
||||||
SetArgBuffer<1>(&BootEnabledBuffer, sizeof (VOID *)),
|
SetArgBuffer<1>(&BootEnabledBuffer, sizeof (VOID *)),
|
||||||
Return(EFI_SUCCESS)));
|
Return (EFI_SUCCESS)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
Enabled = IsSecureBootEnabled ();
|
Enabled = IsSecureBootEnabled ();
|
||||||
EXPECT_EQ (Enabled, TRUE);
|
EXPECT_EQ (Enabled, TRUE);
|
||||||
@ -155,20 +179,31 @@ TEST_F(IsSecureBootEnabledAllocTest, IsEnabled) {
|
|||||||
// returns SECURE_BOOT_MODE_DISABLE.
|
// returns SECURE_BOOT_MODE_DISABLE.
|
||||||
TEST_F (IsSecureBootEnabledAllocTest, IsDisabled) {
|
TEST_F (IsSecureBootEnabledAllocTest, IsDisabled) {
|
||||||
*BootEnabledBuffer = SECURE_BOOT_MODE_DISABLE;
|
*BootEnabledBuffer = SECURE_BOOT_MODE_DISABLE;
|
||||||
EXPECT_CALL(UefiLibMock,
|
EXPECT_CALL (
|
||||||
|
UefiLibMock,
|
||||||
GetEfiGlobalVariable2 (
|
GetEfiGlobalVariable2 (
|
||||||
Char16StrEq (EFI_SECURE_BOOT_MODE_NAME),
|
Char16StrEq (EFI_SECURE_BOOT_MODE_NAME),
|
||||||
NotNull (),
|
NotNull (),
|
||||||
_))
|
_
|
||||||
.WillOnce(DoAll(
|
)
|
||||||
|
)
|
||||||
|
.WillOnce (
|
||||||
|
DoAll (
|
||||||
SetArgBuffer<1>(&BootEnabledBuffer, sizeof (VOID *)),
|
SetArgBuffer<1>(&BootEnabledBuffer, sizeof (VOID *)),
|
||||||
Return(EFI_SUCCESS)));
|
Return (EFI_SUCCESS)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
Enabled = IsSecureBootEnabled ();
|
Enabled = IsSecureBootEnabled ();
|
||||||
EXPECT_EQ (Enabled, FALSE);
|
EXPECT_EQ (Enabled, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int
|
||||||
|
main (
|
||||||
|
int argc,
|
||||||
|
char *argv[]
|
||||||
|
)
|
||||||
|
{
|
||||||
testing::InitGoogleTest (&argc, argv);
|
testing::InitGoogleTest (&argc, argv);
|
||||||
return RUN_ALL_TESTS ();
|
return RUN_ALL_TESTS ();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user