UnitTestFrameworkPkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the UnitTestFrameworkPkg package

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
This commit is contained in:
Michael Kubacki 2021-12-05 14:54:19 -08:00 committed by mergify[bot]
parent e5efcf8be8
commit 7c0ad2c338
18 changed files with 368 additions and 309 deletions

View File

@ -144,9 +144,9 @@ DebugAssert (
// //
// Generate a Breakpoint, DeadLoop, or NOP based on PCD settings // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings
// //
if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) { if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
CpuBreakpoint (); CpuBreakpoint ();
} else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) { } else if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
CpuDeadLoop (); CpuDeadLoop ();
} }
} }
@ -181,7 +181,7 @@ DebugClearMemory (
// //
// SetMem() checks for the the ASSERT() condition on Length and returns Buffer // SetMem() checks for the the ASSERT() condition on Length and returns Buffer
// //
return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue)); return SetMem (Buffer, Length, PcdGet8 (PcdDebugClearMemoryValue));
} }
/** /**
@ -200,7 +200,7 @@ DebugAssertEnabled (
VOID VOID
) )
{ {
return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0); return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
} }
/** /**
@ -219,7 +219,7 @@ DebugPrintEnabled (
VOID VOID
) )
{ {
return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0); return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
} }
/** /**
@ -238,7 +238,7 @@ DebugCodeEnabled (
VOID VOID
) )
{ {
return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0); return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
} }
/** /**
@ -257,7 +257,7 @@ DebugClearMemoryEnabled (
VOID VOID
) )
{ {
return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0); return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
} }
/** /**
@ -275,5 +275,5 @@ DebugPrintLevelEnabled (
IN CONST UINTN ErrorLevel IN CONST UINTN ErrorLevel
) )
{ {
return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0); return (BOOLEAN)((ErrorLevel & PcdGet32 (PcdFixedDebugPrintErrorLevel)) != 0);
} }

View File

@ -159,6 +159,7 @@ AllocateAlignedPages (
if (Alignment < SIZE_4KB) { if (Alignment < SIZE_4KB) {
Alignment = SIZE_4KB; Alignment = SIZE_4KB;
} }
AlignmentMask = Alignment - 1; AlignmentMask = Alignment - 1;
// //
@ -171,13 +172,14 @@ AllocateAlignedPages (
if (PageHead.AllocatedBufffer == NULL) { if (PageHead.AllocatedBufffer == NULL) {
return NULL; return NULL;
} }
PageHead.AlignedBuffer = (VOID *)(((UINTN) PageHead.AllocatedBufffer + AlignmentMask) & ~AlignmentMask);
if ((UINTN)PageHead.AlignedBuffer - (UINTN)PageHead.AllocatedBufffer < sizeof(PAGE_HEAD)) { PageHead.AlignedBuffer = (VOID *)(((UINTN)PageHead.AllocatedBufffer + AlignmentMask) & ~AlignmentMask);
if ((UINTN)PageHead.AlignedBuffer - (UINTN)PageHead.AllocatedBufffer < sizeof (PAGE_HEAD)) {
PageHead.AlignedBuffer = (VOID *)((UINTN)PageHead.AlignedBuffer + Alignment); PageHead.AlignedBuffer = (VOID *)((UINTN)PageHead.AlignedBuffer + Alignment);
} }
PageHeadPtr = (VOID *)((UINTN)PageHead.AlignedBuffer - sizeof(PAGE_HEAD)); PageHeadPtr = (VOID *)((UINTN)PageHead.AlignedBuffer - sizeof (PAGE_HEAD));
memcpy (PageHeadPtr, &PageHead, sizeof(PAGE_HEAD)); memcpy (PageHeadPtr, &PageHead, sizeof (PAGE_HEAD));
return PageHead.AlignedBuffer; return PageHead.AlignedBuffer;
} }
@ -267,10 +269,11 @@ FreeAlignedPages (
// //
// NOTE: Partial free is not supported. Just keep it. // NOTE: Partial free is not supported. Just keep it.
// //
PageHeadPtr = (VOID *)((UINTN)Buffer - sizeof(PAGE_HEAD)); PageHeadPtr = (VOID *)((UINTN)Buffer - sizeof (PAGE_HEAD));
if (PageHeadPtr->Signature != PAGE_HEAD_PRIVATE_SIGNATURE) { if (PageHeadPtr->Signature != PAGE_HEAD_PRIVATE_SIGNATURE) {
return; return;
} }
if (PageHeadPtr->AlignedPages != Pages) { if (PageHeadPtr->AlignedPages != Pages) {
return; return;
} }
@ -366,6 +369,7 @@ AllocateZeroPool (
if (Buffer == NULL) { if (Buffer == NULL) {
return NULL; return NULL;
} }
memset (Buffer, 0, AllocationSize); memset (Buffer, 0, AllocationSize);
return Buffer; return Buffer;
} }
@ -444,6 +448,7 @@ AllocateCopyPool (
if (Memory == NULL) { if (Memory == NULL) {
return NULL; return NULL;
} }
memcpy (Memory, Buffer, AllocationSize); memcpy (Memory, Buffer, AllocationSize);
return Memory; return Memory;
} }
@ -534,12 +539,14 @@ ReallocatePool (
VOID *NewBuffer; VOID *NewBuffer;
NewBuffer = malloc (NewSize); NewBuffer = malloc (NewSize);
if (NewBuffer != NULL && OldBuffer != NULL) { if ((NewBuffer != NULL) && (OldBuffer != NULL)) {
memcpy (NewBuffer, OldBuffer, MIN (OldSize, NewSize)); memcpy (NewBuffer, OldBuffer, MIN (OldSize, NewSize));
} }
if (OldBuffer != NULL) { if (OldBuffer != NULL) {
FreePool(OldBuffer); FreePool (OldBuffer);
} }
return NewBuffer; return NewBuffer;
} }

View File

@ -18,7 +18,7 @@
**/ **/
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
SetBootNextDevice( SetBootNextDevice (
VOID VOID
) )
{ {

View File

@ -47,8 +47,8 @@ SetBootNextDevice (
Dp = NULL; Dp = NULL;
NewOptionValid = FALSE; NewOptionValid = FALSE;
UsbDp.Header.Length[0] = (UINT8)(sizeof(USB_CLASS_DEVICE_PATH) & 0xff); UsbDp.Header.Length[0] = (UINT8)(sizeof (USB_CLASS_DEVICE_PATH) & 0xff);
UsbDp.Header.Length[1] = (UINT8)(sizeof(USB_CLASS_DEVICE_PATH) >> 8); UsbDp.Header.Length[1] = (UINT8)(sizeof (USB_CLASS_DEVICE_PATH) >> 8);
UsbDp.Header.Type = MESSAGING_DEVICE_PATH; UsbDp.Header.Type = MESSAGING_DEVICE_PATH;
UsbDp.Header.SubType = MSG_USB_CLASS_DP; UsbDp.Header.SubType = MSG_USB_CLASS_DP;
UsbDp.VendorId = 0xFFFF; UsbDp.VendorId = 0xFFFF;
@ -66,20 +66,20 @@ SetBootNextDevice (
goto CLEANUP; goto CLEANUP;
} }
//@MRT --- Is this memory leak because we lose the old Dp memory // @MRT --- Is this memory leak because we lose the old Dp memory
Dp = AppendDevicePathNode ( Dp = AppendDevicePathNode (
DpEnd, DpEnd,
(EFI_DEVICE_PATH_PROTOCOL *)&UsbDp (EFI_DEVICE_PATH_PROTOCOL *)&UsbDp
); );
if (Dp == NULL) { if (Dp == NULL) {
DEBUG((DEBUG_ERROR, "%a: Unable to create device path. Dp is NULL.\n", __FUNCTION__)); DEBUG ((DEBUG_ERROR, "%a: Unable to create device path. Dp is NULL.\n", __FUNCTION__));
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto CLEANUP; goto CLEANUP;
} }
Status = EfiBootManagerInitializeLoadOption ( Status = EfiBootManagerInitializeLoadOption (
&NewOption, &NewOption,
(UINTN) BootNextValue, (UINTN)BootNextValue,
LoadOptionTypeBoot, LoadOptionTypeBoot,
Attributes, Attributes,
L"Generic USB Class Device", L"Generic USB Class Device",
@ -107,21 +107,24 @@ SetBootNextDevice (
L"BootNext", L"BootNext",
&gEfiGlobalVariableGuid, &gEfiGlobalVariableGuid,
(EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE), (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE),
sizeof(BootNextValue), sizeof (BootNextValue),
&(BootNextValue) &(BootNextValue)
); );
DEBUG((DEBUG_VERBOSE, "%a - Set BootNext Status (%r)\n", __FUNCTION__, Status)); DEBUG ((DEBUG_VERBOSE, "%a - Set BootNext Status (%r)\n", __FUNCTION__, Status));
CLEANUP: CLEANUP:
if (Dp != NULL) { if (Dp != NULL) {
FreePool (Dp); FreePool (Dp);
} }
if (DpEnd != NULL) { if (DpEnd != NULL) {
FreePool (DpEnd); FreePool (DpEnd);
} }
if (NewOptionValid) { if (NewOptionValid) {
EfiBootManagerFreeLoadOption (&NewOption); EfiBootManagerFreeLoadOption (&NewOption);
} }
return Status; return Status;
} }

View File

@ -41,9 +41,9 @@ UnitTestDebugAssert (
UT_LOG_INFO ("Detected expected ASSERT: %a(%d): %a\n", FileName, LineNumber, Description); UT_LOG_INFO ("Detected expected ASSERT: %a(%d): %a\n", FileName, LineNumber, Description);
LongJump (gUnitTestExpectAssertFailureJumpBuffer, 1); LongJump (gUnitTestExpectAssertFailureJumpBuffer, 1);
} else { } else {
AsciiStrCpyS (Message, sizeof(Message), "Detected unexpected ASSERT("); AsciiStrCpyS (Message, sizeof (Message), "Detected unexpected ASSERT(");
AsciiStrCatS (Message, sizeof(Message), Description); AsciiStrCatS (Message, sizeof (Message), Description);
AsciiStrCatS (Message, sizeof(Message), ")"); AsciiStrCatS (Message, sizeof (Message), ")");
UnitTestAssertTrue (FALSE, "", LineNumber, FileName, Message); UnitTestAssertTrue (FALSE, "", LineNumber, FileName, Message);
} }
} }

View File

@ -26,7 +26,7 @@ AddUnitTestFailure (
// //
// Make sure that you're cooking with gas. // Make sure that you're cooking with gas.
// //
if (UnitTest == NULL || FailureMessage == NULL) { if ((UnitTest == NULL) || (FailureMessage == NULL)) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -120,6 +120,7 @@ UnitTestAssertTrue (
Description Description
); );
} }
return Expression; return Expression;
} }
@ -166,6 +167,7 @@ UnitTestAssertFalse (
Description Description
); );
} }
return !Expression; return !Expression;
} }
@ -214,7 +216,8 @@ UnitTestAssertNotEfiError (
Status Status
); );
} }
return !EFI_ERROR( Status );
return !EFI_ERROR (Status);
} }
/** /**
@ -271,6 +274,7 @@ UnitTestAssertEqual (
ValueB ValueB
); );
} }
return (ValueA == ValueB); return (ValueA == ValueB);
} }
@ -312,7 +316,7 @@ UnitTestAssertMemEqual (
IN CONST CHAR8 *DescriptionB IN CONST CHAR8 *DescriptionB
) )
{ {
if (CompareMem(BufferA, BufferB, Length) != 0) { if (CompareMem (BufferA, BufferB, Length) != 0) {
UT_LOG_ERROR ( UT_LOG_ERROR (
"[ASSERT FAIL] %a:%d: Value %a != %a for length %d bytes!\n", "[ASSERT FAIL] %a:%d: Value %a != %a for length %d bytes!\n",
FileName, FileName,
@ -332,6 +336,7 @@ UnitTestAssertMemEqual (
); );
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
@ -389,6 +394,7 @@ UnitTestAssertNotEqual (
ValueB ValueB
); );
} }
return (ValueA != ValueB); return (ValueA != ValueB);
} }
@ -442,6 +448,7 @@ UnitTestAssertStatusEqual (
Expected Expected
); );
} }
return (Status == Expected); return (Status == Expected);
} }
@ -490,6 +497,7 @@ UnitTestAssertNotNull (
PointerName PointerName
); );
} }
return (Pointer != NULL); return (Pointer != NULL);
} }
@ -536,6 +544,7 @@ UnitTestExpectAssertFailure (
if (ResultStatus != NULL) { if (ResultStatus != NULL) {
*ResultStatus = UnitTestStatus; *ResultStatus = UnitTestStatus;
} }
if (UnitTestStatus == UNIT_TEST_PASSED) { if (UnitTestStatus == UNIT_TEST_PASSED) {
UT_LOG_INFO ( UT_LOG_INFO (
"[ASSERT PASS] %a:%d: UT_EXPECT_ASSERT_FAILURE(%a) detected expected assert\n", "[ASSERT PASS] %a:%d: UT_EXPECT_ASSERT_FAILURE(%a) detected expected assert\n",
@ -544,6 +553,7 @@ UnitTestExpectAssertFailure (
FunctionCall FunctionCall
); );
} }
if (UnitTestStatus == UNIT_TEST_SKIPPED) { if (UnitTestStatus == UNIT_TEST_SKIPPED) {
UT_LOG_WARNING ( UT_LOG_WARNING (
"[ASSERT WARN] %a:%d: UT_EXPECT_ASSERT_FAILURE(%a) disabled\n", "[ASSERT WARN] %a:%d: UT_EXPECT_ASSERT_FAILURE(%a) disabled\n",
@ -552,6 +562,7 @@ UnitTestExpectAssertFailure (
FunctionCall FunctionCall
); );
} }
if (UnitTestStatus == UNIT_TEST_ERROR_TEST_FAILED) { if (UnitTestStatus == UNIT_TEST_ERROR_TEST_FAILED) {
UT_LOG_ERROR ( UT_LOG_ERROR (
"[ASSERT FAIL] %a:%d: Function call (%a) did not ASSERT()!\n", "[ASSERT FAIL] %a:%d: Function call (%a) did not ASSERT()!\n",
@ -567,5 +578,6 @@ UnitTestExpectAssertFailure (
FunctionCall FunctionCall
); );
} }
return (UnitTestStatus != UNIT_TEST_ERROR_TEST_FAILED); return (UnitTestStatus != UNIT_TEST_ERROR_TEST_FAILED);
} }

View File

@ -48,7 +48,7 @@ UnitTestAssertTrue (
{ {
CHAR8 TempStr[MAX_STRING_SIZE]; CHAR8 TempStr[MAX_STRING_SIZE];
snprintf (TempStr, sizeof(TempStr), "UT_ASSERT_TRUE(%s:%x)", Description, Expression); snprintf (TempStr, sizeof (TempStr), "UT_ASSERT_TRUE(%s:%x)", Description, Expression);
_assert_true (Expression, TempStr, FileName, (INT32)LineNumber); _assert_true (Expression, TempStr, FileName, (INT32)LineNumber);
return Expression; return Expression;
@ -84,7 +84,7 @@ UnitTestAssertFalse (
{ {
CHAR8 TempStr[MAX_STRING_SIZE]; CHAR8 TempStr[MAX_STRING_SIZE];
snprintf (TempStr, sizeof(TempStr), "UT_ASSERT_FALSE(%s:%x)", Description, Expression); snprintf (TempStr, sizeof (TempStr), "UT_ASSERT_FALSE(%s:%x)", Description, Expression);
_assert_true (!Expression, TempStr, FileName, (INT32)LineNumber); _assert_true (!Expression, TempStr, FileName, (INT32)LineNumber);
return !Expression; return !Expression;
@ -120,7 +120,7 @@ UnitTestAssertNotEfiError (
{ {
CHAR8 TempStr[MAX_STRING_SIZE]; CHAR8 TempStr[MAX_STRING_SIZE];
snprintf (TempStr, sizeof(TempStr), "UT_ASSERT_NOT_EFI_ERROR(%s:%p)", Description, (void *)Status); snprintf (TempStr, sizeof (TempStr), "UT_ASSERT_NOT_EFI_ERROR(%s:%p)", Description, (void *)Status);
_assert_true (!EFI_ERROR (Status), TempStr, FileName, (INT32)LineNumber); _assert_true (!EFI_ERROR (Status), TempStr, FileName, (INT32)LineNumber);
return !EFI_ERROR (Status); return !EFI_ERROR (Status);
@ -161,7 +161,7 @@ UnitTestAssertEqual (
{ {
CHAR8 TempStr[MAX_STRING_SIZE]; CHAR8 TempStr[MAX_STRING_SIZE];
snprintf (TempStr, sizeof(TempStr), "UT_ASSERT_EQUAL(%s:%llx, %s:%llx)", DescriptionA, ValueA, DescriptionB, ValueB); snprintf (TempStr, sizeof (TempStr), "UT_ASSERT_EQUAL(%s:%llx, %s:%llx)", DescriptionA, ValueA, DescriptionB, ValueB);
_assert_true ((ValueA == ValueB), TempStr, FileName, (INT32)LineNumber); _assert_true ((ValueA == ValueB), TempStr, FileName, (INT32)LineNumber);
return (ValueA == ValueB); return (ValueA == ValueB);
@ -208,9 +208,9 @@ UnitTestAssertMemEqual (
CHAR8 TempStr[MAX_STRING_SIZE]; CHAR8 TempStr[MAX_STRING_SIZE];
BOOLEAN Result; BOOLEAN Result;
Result = (CompareMem(BufferA, BufferB, Length) == 0); Result = (CompareMem (BufferA, BufferB, Length) == 0);
snprintf (TempStr, sizeof(TempStr), "UT_ASSERT_MEM_EQUAL(%s:%p, %s:%p)", DescriptionA, BufferA, DescriptionB, BufferB); snprintf (TempStr, sizeof (TempStr), "UT_ASSERT_MEM_EQUAL(%s:%p, %s:%p)", DescriptionA, BufferA, DescriptionB, BufferB);
_assert_true (Result, TempStr, FileName, (INT32)LineNumber); _assert_true (Result, TempStr, FileName, (INT32)LineNumber);
return Result; return Result;
@ -251,7 +251,7 @@ UnitTestAssertNotEqual (
{ {
CHAR8 TempStr[MAX_STRING_SIZE]; CHAR8 TempStr[MAX_STRING_SIZE];
snprintf (TempStr, sizeof(TempStr), "UT_ASSERT_NOT_EQUAL(%s:%llx, %s:%llx)", DescriptionA, ValueA, DescriptionB, ValueB); snprintf (TempStr, sizeof (TempStr), "UT_ASSERT_NOT_EQUAL(%s:%llx, %s:%llx)", DescriptionA, ValueA, DescriptionB, ValueB);
_assert_true ((ValueA != ValueB), TempStr, FileName, (INT32)LineNumber); _assert_true ((ValueA != ValueB), TempStr, FileName, (INT32)LineNumber);
return (ValueA != ValueB); return (ValueA != ValueB);
@ -290,7 +290,7 @@ UnitTestAssertStatusEqual (
{ {
CHAR8 TempStr[MAX_STRING_SIZE]; CHAR8 TempStr[MAX_STRING_SIZE];
snprintf (TempStr, sizeof(TempStr), "UT_ASSERT_STATUS_EQUAL(%s:%p)", Description, (VOID *)Status); snprintf (TempStr, sizeof (TempStr), "UT_ASSERT_STATUS_EQUAL(%s:%p)", Description, (VOID *)Status);
_assert_true ((Status == Expected), TempStr, FileName, (INT32)LineNumber); _assert_true ((Status == Expected), TempStr, FileName, (INT32)LineNumber);
return (Status == Expected); return (Status == Expected);
@ -328,7 +328,7 @@ UnitTestAssertNotNull (
{ {
CHAR8 TempStr[MAX_STRING_SIZE]; CHAR8 TempStr[MAX_STRING_SIZE];
snprintf (TempStr, sizeof(TempStr), "UT_ASSERT_NOT_NULL(%s:%p)", PointerName, Pointer); snprintf (TempStr, sizeof (TempStr), "UT_ASSERT_NOT_NULL(%s:%p)", PointerName, Pointer);
_assert_true ((Pointer != NULL), TempStr, FileName, (INT32)LineNumber); _assert_true ((Pointer != NULL), TempStr, FileName, (INT32)LineNumber);
return (Pointer != NULL); return (Pointer != NULL);
@ -379,6 +379,7 @@ UnitTestExpectAssertFailure (
if (ResultStatus != NULL) { if (ResultStatus != NULL) {
*ResultStatus = UnitTestStatus; *ResultStatus = UnitTestStatus;
} }
if (UnitTestStatus == UNIT_TEST_PASSED) { if (UnitTestStatus == UNIT_TEST_PASSED) {
UT_LOG_INFO ( UT_LOG_INFO (
"[ASSERT PASS] %a:%d: UT_EXPECT_ASSERT_FAILURE(%a) detected expected assert\n", "[ASSERT PASS] %a:%d: UT_EXPECT_ASSERT_FAILURE(%a) detected expected assert\n",
@ -387,6 +388,7 @@ UnitTestExpectAssertFailure (
FunctionCall FunctionCall
); );
} }
if (UnitTestStatus == UNIT_TEST_SKIPPED) { if (UnitTestStatus == UNIT_TEST_SKIPPED) {
UT_LOG_WARNING ( UT_LOG_WARNING (
"[ASSERT WARN] %a:%d: UT_EXPECT_ASSERT_FAILURE(%a) disabled\n", "[ASSERT WARN] %a:%d: UT_EXPECT_ASSERT_FAILURE(%a) disabled\n",
@ -395,9 +397,11 @@ UnitTestExpectAssertFailure (
FunctionCall FunctionCall
); );
} }
if (UnitTestStatus == UNIT_TEST_ERROR_TEST_FAILED) { if (UnitTestStatus == UNIT_TEST_ERROR_TEST_FAILED) {
snprintf (TempStr, sizeof(TempStr), "UT_EXPECT_ASSERT_FAILURE(%s) did not trigger ASSERT()", FunctionCall); snprintf (TempStr, sizeof (TempStr), "UT_EXPECT_ASSERT_FAILURE(%s) did not trigger ASSERT()", FunctionCall);
_assert_true (FALSE, TempStr, FileName, (INT32)LineNumber); _assert_true (FALSE, TempStr, FileName, (INT32)LineNumber);
} }
return (UnitTestStatus != UNIT_TEST_ERROR_TEST_FAILED); return (UnitTestStatus != UNIT_TEST_ERROR_TEST_FAILED);
} }

View File

@ -35,7 +35,7 @@ struct _UNIT_TEST_LOG_PREFIX_STRING mLogPrefixStrings[] = {
// //
STATIC STATIC
CONST CHAR8* CONST CHAR8 *
GetStringForStatusLogPrefix ( GetStringForStatusLogPrefix (
IN UINTN LogLevel IN UINTN LogLevel
) )
@ -50,6 +50,7 @@ GetStringForStatusLogPrefix (
break; break;
} }
} }
return Result; return Result;
} }
@ -65,7 +66,7 @@ AddStringToUnitTestLog (
// //
// Make sure that you're cooking with gas. // Make sure that you're cooking with gas.
// //
if (UnitTest == NULL || String == NULL) { if ((UnitTest == NULL) || (String == NULL)) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -86,7 +87,7 @@ AddStringToUnitTestLog (
String, String,
UNIT_TEST_MAX_SINGLE_LOG_STRING_LENGTH UNIT_TEST_MAX_SINGLE_LOG_STRING_LENGTH
); );
if(EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Failed to add unit test log string. Status = %r\n", Status)); DEBUG ((DEBUG_ERROR, "Failed to add unit test log string. Status = %r\n", Status));
return Status; return Status;
} }
@ -129,14 +130,14 @@ UnitTestLogInit (
} }
// //
//check again to make sure allocate worked // check again to make sure allocate worked
// //
if(Test->Log == NULL) { if (Test->Log == NULL) {
DEBUG ((DEBUG_ERROR, "Failed to allocate memory for the log\n")); DEBUG ((DEBUG_ERROR, "Failed to allocate memory for the log\n"));
return; return;
} }
if((Buffer != NULL) && (BufferSize > 0) && (BufferSize <= UNIT_TEST_MAX_LOG_BUFFER)) { if ((Buffer != NULL) && (BufferSize > 0) && (BufferSize <= UNIT_TEST_MAX_LOG_BUFFER)) {
CopyMem (Test->Log, Buffer, BufferSize); CopyMem (Test->Log, Buffer, BufferSize);
} }
} }

View File

@ -54,8 +54,9 @@ RunTestSuite (
// Iterate all tests within the suite // Iterate all tests within the suite
// //
for (TestEntry = (UNIT_TEST_LIST_ENTRY *)GetFirstNode (&(Suite->TestCaseList)); for (TestEntry = (UNIT_TEST_LIST_ENTRY *)GetFirstNode (&(Suite->TestCaseList));
(LIST_ENTRY*)TestEntry != &(Suite->TestCaseList); (LIST_ENTRY *)TestEntry != &(Suite->TestCaseList);
TestEntry = (UNIT_TEST_LIST_ENTRY *)GetNextNode (&(Suite->TestCaseList), (LIST_ENTRY *)TestEntry)) { TestEntry = (UNIT_TEST_LIST_ENTRY *)GetNextNode (&(Suite->TestCaseList), (LIST_ENTRY *)TestEntry))
{
Test = &TestEntry->UT; Test = &TestEntry->UT;
ParentFramework->CurrentTest = Test; ParentFramework->CurrentTest = Test;
@ -67,7 +68,7 @@ RunTestSuite (
// First, check to see whether the test has already been run. // First, check to see whether the test has already been run.
// NOTE: This would generally only be the case if a saved state was detected and loaded. // NOTE: This would generally only be the case if a saved state was detected and loaded.
// //
if (Test->Result != UNIT_TEST_PENDING && Test->Result != UNIT_TEST_RUNNING) { if ((Test->Result != UNIT_TEST_PENDING) && (Test->Result != UNIT_TEST_RUNNING)) {
DEBUG ((DEBUG_VERBOSE, "Test was run on a previous pass. Skipping.\n")); DEBUG ((DEBUG_VERBOSE, "Test was run on a previous pass. Skipping.\n"));
ParentFramework->CurrentTest = NULL; ParentFramework->CurrentTest = NULL;
continue; continue;
@ -75,7 +76,7 @@ RunTestSuite (
// //
// Next, if we're still running, make sure that our test prerequisites are in place. // Next, if we're still running, make sure that our test prerequisites are in place.
if (Test->Result == UNIT_TEST_PENDING && Test->Prerequisite != NULL) { if ((Test->Result == UNIT_TEST_PENDING) && (Test->Prerequisite != NULL)) {
DEBUG ((DEBUG_VERBOSE, "PREREQ\n")); DEBUG ((DEBUG_VERBOSE, "PREREQ\n"));
if (SetJump (&gUnitTestJumpBuffer) == 0) { if (SetJump (&gUnitTestJumpBuffer) == 0) {
if (Test->Prerequisite (Test->Context) != UNIT_TEST_PASSED) { if (Test->Prerequisite (Test->Context) != UNIT_TEST_PASSED) {
@ -167,7 +168,8 @@ RunAllTestSuites (
// //
for (Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetFirstNode (&Framework->TestSuiteList); for (Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetFirstNode (&Framework->TestSuiteList);
(LIST_ENTRY *)Suite != &Framework->TestSuiteList; (LIST_ENTRY *)Suite != &Framework->TestSuiteList;
Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetNextNode (&Framework->TestSuiteList, (LIST_ENTRY *)Suite)) { Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetNextNode (&Framework->TestSuiteList, (LIST_ENTRY *)Suite))
{
Status = RunTestSuite (&(Suite->UTS)); Status = RunTestSuite (&(Suite->UTS));
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Test Suite Failed with Error. %r\n", Status)); DEBUG ((DEBUG_ERROR, "Test Suite Failed with Error. %r\n", Status));

View File

@ -112,10 +112,10 @@ CmockaUnitTestTeardownFunctionRunner (
// stdout and stderr in their xml format // stdout and stderr in their xml format
// //
if (UnitTest->Log != NULL) { if (UnitTest->Log != NULL) {
print_message("UnitTest: %s - %s\n", UnitTest->Name, UnitTest->Description); print_message ("UnitTest: %s - %s\n", UnitTest->Name, UnitTest->Description);
print_message("Log Output Start\n"); print_message ("Log Output Start\n");
print_message("%s", UnitTest->Log); print_message ("%s", UnitTest->Log);
print_message("Log Output End\n"); print_message ("Log Output End\n");
} }
// //
@ -132,6 +132,7 @@ CmockaUnitTestSuiteSetupFunctionRunner (
if (mActiveUnitTestSuite == NULL) { if (mActiveUnitTestSuite == NULL) {
return -1; return -1;
} }
if (mActiveUnitTestSuite->Setup == NULL) { if (mActiveUnitTestSuite->Setup == NULL) {
return 0; return 0;
} }
@ -151,6 +152,7 @@ CmockaUnitTestSuiteTeardownFunctionRunner (
if (mActiveUnitTestSuite == NULL) { if (mActiveUnitTestSuite == NULL) {
return -1; return -1;
} }
if (mActiveUnitTestSuite->Teardown == NULL) { if (mActiveUnitTestSuite->Teardown == NULL) {
return 0; return 0;
} }
@ -195,7 +197,8 @@ RunTestSuite (
Index = 0; Index = 0;
for (TestEntry = (UNIT_TEST_LIST_ENTRY *)GetFirstNode (&(Suite->TestCaseList)); for (TestEntry = (UNIT_TEST_LIST_ENTRY *)GetFirstNode (&(Suite->TestCaseList));
(LIST_ENTRY *)TestEntry != &(Suite->TestCaseList); (LIST_ENTRY *)TestEntry != &(Suite->TestCaseList);
TestEntry = (UNIT_TEST_LIST_ENTRY *)GetNextNode (&(Suite->TestCaseList), (LIST_ENTRY *)TestEntry)) { TestEntry = (UNIT_TEST_LIST_ENTRY *)GetNextNode (&(Suite->TestCaseList), (LIST_ENTRY *)TestEntry))
{
UnitTest = &TestEntry->UT; UnitTest = &TestEntry->UT;
Tests[Index].name = UnitTest->Description; Tests[Index].name = UnitTest->Description;
Tests[Index].test_func = CmockaUnitTestFunctionRunner; Tests[Index].test_func = CmockaUnitTestFunctionRunner;
@ -204,6 +207,7 @@ RunTestSuite (
Tests[Index].initial_state = UnitTest; Tests[Index].initial_state = UnitTest;
Index++; Index++;
} }
ASSERT (Index == Suite->NumTests); ASSERT (Index == Suite->NumTests);
// //
@ -254,9 +258,9 @@ RunAllTestSuites (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
DEBUG((DEBUG_VERBOSE, "---------------------------------------------------------\n")); DEBUG ((DEBUG_VERBOSE, "---------------------------------------------------------\n"));
DEBUG((DEBUG_VERBOSE, "------------ RUNNING ALL TEST SUITES --------------\n")); DEBUG ((DEBUG_VERBOSE, "------------ RUNNING ALL TEST SUITES --------------\n"));
DEBUG((DEBUG_VERBOSE, "---------------------------------------------------------\n")); DEBUG ((DEBUG_VERBOSE, "---------------------------------------------------------\n"));
mFrameworkHandle = FrameworkHandle; mFrameworkHandle = FrameworkHandle;
// //
@ -264,7 +268,8 @@ RunAllTestSuites (
// //
for (Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetFirstNode (&Framework->TestSuiteList); for (Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetFirstNode (&Framework->TestSuiteList);
(LIST_ENTRY *)Suite != &Framework->TestSuiteList; (LIST_ENTRY *)Suite != &Framework->TestSuiteList;
Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetNextNode (&Framework->TestSuiteList, (LIST_ENTRY *)Suite)) { Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetNextNode (&Framework->TestSuiteList, (LIST_ENTRY *)Suite))
{
Status = RunTestSuite (&(Suite->UTS)); Status = RunTestSuite (&(Suite->UTS));
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Test Suite Failed with Error. %r\n", Status)); DEBUG ((DEBUG_ERROR, "Test Suite Failed with Error. %r\n", Status));

View File

@ -47,7 +47,7 @@ IsFrameworkShortNameValid (
} }
STATIC STATIC
CHAR8* CHAR8 *
AllocateAndCopyString ( AllocateAndCopyString (
IN CHAR8 *StringToCopy IN CHAR8 *StringToCopy
) )
@ -57,10 +57,11 @@ AllocateAndCopyString (
NewString = NULL; NewString = NULL;
NewStringLength = AsciiStrnLenS (StringToCopy, UNIT_TEST_MAX_STRING_LENGTH) + 1; NewStringLength = AsciiStrnLenS (StringToCopy, UNIT_TEST_MAX_STRING_LENGTH) + 1;
NewString = AllocatePool (NewStringLength * sizeof( CHAR8 )); NewString = AllocatePool (NewStringLength * sizeof (CHAR8));
if (NewString != NULL) { if (NewString != NULL) {
AsciiStrCpyS (NewString, NewStringLength, StringToCopy); AsciiStrCpyS (NewString, NewStringLength, StringToCopy);
} }
return NewString; return NewString;
} }
@ -74,10 +75,10 @@ SetFrameworkFingerprint (
UINT32 NewFingerprint; UINT32 NewFingerprint;
// For this one we'll just use the title and version as the unique fingerprint. // For this one we'll just use the title and version as the unique fingerprint.
NewFingerprint = CalculateCrc32( Framework->Title, (AsciiStrLen( Framework->Title ) * sizeof( CHAR8 )) ); NewFingerprint = CalculateCrc32 (Framework->Title, (AsciiStrLen (Framework->Title) * sizeof (CHAR8)));
NewFingerprint = (NewFingerprint >> 8) ^ CalculateCrc32( Framework->VersionString, (AsciiStrLen( Framework->VersionString ) * sizeof( CHAR8 )) ); NewFingerprint = (NewFingerprint >> 8) ^ CalculateCrc32 (Framework->VersionString, (AsciiStrLen (Framework->VersionString) * sizeof (CHAR8)));
CopyMem( Fingerprint, &NewFingerprint, UNIT_TEST_FINGERPRINT_SIZE ); CopyMem (Fingerprint, &NewFingerprint, UNIT_TEST_FINGERPRINT_SIZE);
return; return;
} }
@ -92,11 +93,11 @@ SetSuiteFingerprint (
UINT32 NewFingerprint; UINT32 NewFingerprint;
// For this one, we'll use the fingerprint from the framework, and the title of the suite. // For this one, we'll use the fingerprint from the framework, and the title of the suite.
NewFingerprint = CalculateCrc32( &Framework->Fingerprint[0], UNIT_TEST_FINGERPRINT_SIZE ); NewFingerprint = CalculateCrc32 (&Framework->Fingerprint[0], UNIT_TEST_FINGERPRINT_SIZE);
NewFingerprint = (NewFingerprint >> 8) ^ CalculateCrc32( Suite->Title, (AsciiStrLen( Suite->Title ) * sizeof( CHAR8 )) ); NewFingerprint = (NewFingerprint >> 8) ^ CalculateCrc32 (Suite->Title, (AsciiStrLen (Suite->Title) * sizeof (CHAR8)));
NewFingerprint = (NewFingerprint >> 8) ^ CalculateCrc32( Suite->Name, (AsciiStrLen(Suite->Name) * sizeof(CHAR8)) ); NewFingerprint = (NewFingerprint >> 8) ^ CalculateCrc32 (Suite->Name, (AsciiStrLen (Suite->Name) * sizeof (CHAR8)));
CopyMem( Fingerprint, &NewFingerprint, UNIT_TEST_FINGERPRINT_SIZE ); CopyMem (Fingerprint, &NewFingerprint, UNIT_TEST_FINGERPRINT_SIZE);
return; return;
} }
@ -111,11 +112,11 @@ SetTestFingerprint (
UINT32 NewFingerprint; UINT32 NewFingerprint;
// For this one, we'll use the fingerprint from the suite, and the description and classname of the test. // For this one, we'll use the fingerprint from the suite, and the description and classname of the test.
NewFingerprint = CalculateCrc32( &Suite->Fingerprint[0], UNIT_TEST_FINGERPRINT_SIZE ); NewFingerprint = CalculateCrc32 (&Suite->Fingerprint[0], UNIT_TEST_FINGERPRINT_SIZE);
NewFingerprint = (NewFingerprint >> 8) ^ CalculateCrc32( Test->Description, (AsciiStrLen( Test->Description ) * sizeof( CHAR8 )) ); NewFingerprint = (NewFingerprint >> 8) ^ CalculateCrc32 (Test->Description, (AsciiStrLen (Test->Description) * sizeof (CHAR8)));
NewFingerprint = (NewFingerprint >> 8) ^ CalculateCrc32( Test->Name, (AsciiStrLen(Test->Name) * sizeof(CHAR8)) ); NewFingerprint = (NewFingerprint >> 8) ^ CalculateCrc32 (Test->Name, (AsciiStrLen (Test->Name) * sizeof (CHAR8)));
CopyMem( Fingerprint, &NewFingerprint, UNIT_TEST_FINGERPRINT_SIZE ); CopyMem (Fingerprint, &NewFingerprint, UNIT_TEST_FINGERPRINT_SIZE);
return; return;
} }
@ -126,7 +127,7 @@ CompareFingerprints (
IN UINT8 *FingerprintB IN UINT8 *FingerprintB
) )
{ {
return (CompareMem( FingerprintA, FingerprintB, UNIT_TEST_FINGERPRINT_SIZE ) == 0); return (CompareMem (FingerprintA, FingerprintB, UNIT_TEST_FINGERPRINT_SIZE) == 0);
} }
/** /**
@ -216,8 +217,9 @@ InitUnitTestFramework (
// //
// First, check all pointers and make sure nothing's broked. // First, check all pointers and make sure nothing's broked.
// //
if (FrameworkHandle == NULL || Title == NULL || if ((FrameworkHandle == NULL) || (Title == NULL) ||
ShortTitle == NULL || VersionString == NULL) { (ShortTitle == NULL) || (VersionString == NULL))
{
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -246,12 +248,14 @@ InitUnitTestFramework (
NewFramework->Log = NULL; NewFramework->Log = NULL;
NewFramework->CurrentTest = NULL; NewFramework->CurrentTest = NULL;
NewFramework->SavedState = NULL; NewFramework->SavedState = NULL;
if (NewFramework->Title == NULL || if ((NewFramework->Title == NULL) ||
NewFramework->ShortTitle == NULL || (NewFramework->ShortTitle == NULL) ||
NewFramework->VersionString == NULL) { (NewFramework->VersionString == NULL))
{
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto Exit; goto Exit;
} }
InitializeListHead (&(NewFramework->TestSuiteList)); InitializeListHead (&(NewFramework->TestSuiteList));
// //
@ -263,12 +267,12 @@ InitUnitTestFramework (
// If there is a persisted context, load it now. // If there is a persisted context, load it now.
// //
if (DoesCacheExist (NewFrameworkHandle)) { if (DoesCacheExist (NewFrameworkHandle)) {
Status = LoadUnitTestCache (NewFrameworkHandle, (UNIT_TEST_SAVE_HEADER**)(&NewFramework->SavedState)); Status = LoadUnitTestCache (NewFrameworkHandle, (UNIT_TEST_SAVE_HEADER **)(&NewFramework->SavedState));
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
// //
// Don't actually report it as an error, but emit a warning. // Don't actually report it as an error, but emit a warning.
// //
DEBUG (( DEBUG_ERROR, "%a - Cache was detected, but failed to load.\n", __FUNCTION__ )); DEBUG ((DEBUG_ERROR, "%a - Cache was detected, but failed to load.\n", __FUNCTION__));
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
} }
} }
@ -372,13 +376,13 @@ CreateUnitTestSuite (
// //
// Create the suite fingerprint. // Create the suite fingerprint.
// //
SetSuiteFingerprint( &NewSuiteEntry->UTS.Fingerprint[0], Framework, &NewSuiteEntry->UTS ); SetSuiteFingerprint (&NewSuiteEntry->UTS.Fingerprint[0], Framework, &NewSuiteEntry->UTS);
Exit: Exit:
// //
// If everything is going well, add the new suite to the tail list for the framework. // If everything is going well, add the new suite to the tail list for the framework.
// //
if (!EFI_ERROR( Status )) { if (!EFI_ERROR (Status)) {
InsertTailList (&(Framework->TestSuiteList), (LIST_ENTRY *)NewSuiteEntry); InsertTailList (&(Framework->TestSuiteList), (LIST_ENTRY *)NewSuiteEntry);
*SuiteHandle = (UNIT_TEST_SUITE_HANDLE)(&NewSuiteEntry->UTS); *SuiteHandle = (UNIT_TEST_SUITE_HANDLE)(&NewSuiteEntry->UTS);
} else { } else {
@ -445,7 +449,7 @@ AddTestCase (
ParentFramework = (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework; ParentFramework = (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework;
// //
// Create the new entry. // Create the new entry.
NewTestEntry = AllocateZeroPool (sizeof( UNIT_TEST_LIST_ENTRY )); NewTestEntry = AllocateZeroPool (sizeof (UNIT_TEST_LIST_ENTRY));
if (NewTestEntry == NULL) { if (NewTestEntry == NULL) {
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }
@ -468,6 +472,7 @@ AddTestCase (
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto Exit; goto Exit;
} }
if (NewTestEntry->UT.Name == NULL) { if (NewTestEntry->UT.Name == NULL) {
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto Exit; goto Exit;
@ -492,7 +497,7 @@ Exit:
// If everything is going well, add the new suite to the tail list for the framework. // If everything is going well, add the new suite to the tail list for the framework.
// //
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
InsertTailList (&(Suite->TestCaseList), (LIST_ENTRY*)NewTestEntry); InsertTailList (&(Suite->TestCaseList), (LIST_ENTRY *)NewTestEntry);
Suite->NumTests++; Suite->NumTests++;
} else { } else {
// //
@ -520,9 +525,10 @@ UpdateTestFromSave (
// //
// First, evaluate the inputs. // First, evaluate the inputs.
// //
if (Test == NULL || SavedState == NULL) { if ((Test == NULL) || (SavedState == NULL)) {
return; return;
} }
if (SavedState->TestCount == 0) { if (SavedState->TestCount == 0) {
return; return;
} }
@ -590,18 +596,19 @@ UpdateTestFromSave (
// at the beginning of the context structure. // at the beginning of the context structure.
// //
SavedContext = (UNIT_TEST_SAVE_CONTEXT *)FloatingPointer; SavedContext = (UNIT_TEST_SAVE_CONTEXT *)FloatingPointer;
if ((SavedContext->Size - sizeof (UNIT_TEST_SAVE_CONTEXT)) > 0 && if (((SavedContext->Size - sizeof (UNIT_TEST_SAVE_CONTEXT)) > 0) &&
CompareFingerprints (&Test->Fingerprint[0], &SavedContext->Fingerprint[0])) { CompareFingerprints (&Test->Fingerprint[0], &SavedContext->Fingerprint[0]))
{
// //
// Override the test context with the saved context. // Override the test context with the saved context.
// //
Test->Context = (VOID*)SavedContext->Data; Test->Context = (VOID *)SavedContext->Data;
} }
} }
} }
STATIC STATIC
UNIT_TEST_SAVE_HEADER* UNIT_TEST_SAVE_HEADER *
SerializeState ( SerializeState (
IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle, IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle,
IN UNIT_TEST_CONTEXT ContextToSave OPTIONAL, IN UNIT_TEST_CONTEXT ContextToSave OPTIONAL,
@ -628,9 +635,10 @@ SerializeState (
// //
// First, let's not make assumptions about the parameters. // First, let's not make assumptions about the parameters.
// //
if (Framework == NULL || if ((Framework == NULL) ||
(ContextToSave != NULL && ContextToSaveSize == 0) || ((ContextToSave != NULL) && (ContextToSaveSize == 0)) ||
ContextToSaveSize > MAX_UINT32) { (ContextToSaveSize > MAX_UINT32))
{
return NULL; return NULL;
} }
@ -658,7 +666,7 @@ SerializeState (
// //
// Account for the size of a test structure. // Account for the size of a test structure.
// //
TotalSize += sizeof( UNIT_TEST_SAVE_TEST ); TotalSize += sizeof (UNIT_TEST_SAVE_TEST);
// //
// If there's a log, make sure to account for the log size. // If there's a log, make sure to account for the log size.
// //
@ -670,18 +678,21 @@ SerializeState (
ASSERT (LogSize < MAX_UINT32); ASSERT (LogSize < MAX_UINT32);
TotalSize += (UINT32)LogSize; TotalSize += (UINT32)LogSize;
} }
// //
// Increment the test count. // Increment the test count.
// //
TestCount++; TestCount++;
} }
} }
// //
// If there are no tests, we're done here. // If there are no tests, we're done here.
// //
if (TestCount == 0) { if (TestCount == 0) {
return NULL; return NULL;
} }
// //
// Add room for the context, if there is one. // Add room for the context, if there is one.
// //
@ -711,7 +722,7 @@ SerializeState (
// Start adding all of the test cases. // Start adding all of the test cases.
// Set the floating pointer to the start of the current test save buffer. // Set the floating pointer to the start of the current test save buffer.
// //
FloatingPointer = (UINT8*)Header + sizeof( UNIT_TEST_SAVE_HEADER ); FloatingPointer = (UINT8 *)Header + sizeof (UNIT_TEST_SAVE_HEADER);
// //
// Iterate all suites. // Iterate all suites.
// //
@ -737,7 +748,6 @@ SerializeState (
TestSaveData->FailureType = UnitTest->FailureType; TestSaveData->FailureType = UnitTest->FailureType;
AsciiStrnCpyS (&TestSaveData->FailureMessage[0], UNIT_TEST_TESTFAILUREMSG_LENGTH, &UnitTest->FailureMessage[0], UNIT_TEST_TESTFAILUREMSG_LENGTH); AsciiStrnCpyS (&TestSaveData->FailureMessage[0], UNIT_TEST_TESTFAILUREMSG_LENGTH, &UnitTest->FailureMessage[0], UNIT_TEST_TESTFAILUREMSG_LENGTH);
// //
// If there is a log, save the log. // If there is a log, save the log.
// //
@ -762,8 +772,8 @@ SerializeState (
// //
// If there is a context to save, let's do that now. // If there is a context to save, let's do that now.
// //
if (ContextToSave != NULL && Framework->CurrentTest != NULL) { if ((ContextToSave != NULL) && (Framework->CurrentTest != NULL)) {
TestSaveContext = (UNIT_TEST_SAVE_CONTEXT*)FloatingPointer; TestSaveContext = (UNIT_TEST_SAVE_CONTEXT *)FloatingPointer;
TestSaveContext->Size = (UINT32)ContextToSaveSize + sizeof (UNIT_TEST_SAVE_CONTEXT); TestSaveContext->Size = (UINT32)ContextToSaveSize + sizeof (UNIT_TEST_SAVE_CONTEXT);
CopyMem (&TestSaveContext->Fingerprint[0], &Framework->CurrentTest->Fingerprint[0], UNIT_TEST_FINGERPRINT_SIZE); CopyMem (&TestSaveContext->Fingerprint[0], &Framework->CurrentTest->Fingerprint[0], UNIT_TEST_FINGERPRINT_SIZE);
CopyMem (((UINT8 *)TestSaveContext + sizeof (UNIT_TEST_SAVE_CONTEXT)), ContextToSave, ContextToSaveSize); CopyMem (((UINT8 *)TestSaveContext + sizeof (UNIT_TEST_SAVE_CONTEXT)), ContextToSave, ContextToSaveSize);
@ -825,8 +835,9 @@ SaveFrameworkState (
// //
// First, let's not make assumptions about the parameters. // First, let's not make assumptions about the parameters.
// //
if ((ContextToSave != NULL && ContextToSaveSize == 0) || if (((ContextToSave != NULL) && (ContextToSaveSize == 0)) ||
ContextToSaveSize > MAX_UINT32) { (ContextToSaveSize > MAX_UINT32))
{
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }

View File

@ -29,7 +29,7 @@
**/ **/
STATIC STATIC
EFI_DEVICE_PATH_PROTOCOL* EFI_DEVICE_PATH_PROTOCOL *
GetCacheFileDevicePath ( GetCacheFileDevicePath (
IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle
) )
@ -44,7 +44,7 @@ GetCacheFileDevicePath (
UINTN CacheFilePathLength; UINTN CacheFilePathLength;
EFI_DEVICE_PATH_PROTOCOL *CacheFileDevicePath; EFI_DEVICE_PATH_PROTOCOL *CacheFileDevicePath;
Framework = (UNIT_TEST_FRAMEWORK*)FrameworkHandle; Framework = (UNIT_TEST_FRAMEWORK *)FrameworkHandle;
AppPath = NULL; AppPath = NULL;
CacheFilePath = NULL; CacheFilePath = NULL;
TestName = NULL; TestName = NULL;
@ -56,7 +56,7 @@ GetCacheFileDevicePath (
Status = gBS->HandleProtocol ( Status = gBS->HandleProtocol (
gImageHandle, gImageHandle,
&gEfiLoadedImageProtocolGuid, &gEfiLoadedImageProtocolGuid,
(VOID**)&LoadedImage (VOID **)&LoadedImage
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_WARN, "%a - Failed to locate DevicePath for loaded image. %r\n", __FUNCTION__, Status)); DEBUG ((DEBUG_WARN, "%a - Failed to locate DevicePath for loaded image. %r\n", __FUNCTION__, Status));
@ -67,10 +67,11 @@ GetCacheFileDevicePath (
// Before we can start, change test name from ASCII to Unicode. // Before we can start, change test name from ASCII to Unicode.
// //
CacheFilePathLength = AsciiStrLen (Framework->ShortTitle) + 1; CacheFilePathLength = AsciiStrLen (Framework->ShortTitle) + 1;
TestName = AllocatePool (CacheFilePathLength * sizeof(CHAR16)); TestName = AllocatePool (CacheFilePathLength * sizeof (CHAR16));
if (!TestName) { if (!TestName) {
goto Exit; goto Exit;
} }
AsciiStrToUnicodeStrS (Framework->ShortTitle, TestName, CacheFilePathLength); AsciiStrToUnicodeStrS (Framework->ShortTitle, TestName, CacheFilePathLength);
// //
@ -99,6 +100,7 @@ GetCacheFileDevicePath (
if (AppPath[DirectorySlashOffset] == L'\\') { if (AppPath[DirectorySlashOffset] == L'\\') {
break; break;
} }
DirectorySlashOffset--; DirectorySlashOffset--;
} while (DirectorySlashOffset > 0); } while (DirectorySlashOffset > 0);
@ -143,9 +145,11 @@ Exit:
if (AppPath != NULL) { if (AppPath != NULL) {
FreePool (AppPath); FreePool (AppPath);
} }
if (CacheFilePath != NULL) { if (CacheFilePath != NULL) {
FreePool (CacheFilePath); FreePool (CacheFilePath);
} }
if (TestName != NULL) { if (TestName != NULL) {
FreePool (TestName); FreePool (TestName);
} }
@ -229,7 +233,7 @@ SaveUnitTestCache (
// //
// Check the inputs for sanity. // Check the inputs for sanity.
// //
if (FrameworkHandle == NULL || SaveData == NULL) { if ((FrameworkHandle == NULL) || (SaveData == NULL)) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -240,7 +244,7 @@ SaveUnitTestCache (
FileDevicePath = GetCacheFileDevicePath (FrameworkHandle); FileDevicePath = GetCacheFileDevicePath (FrameworkHandle);
// //
//First lets open the file if it exists so we can delete it...This is the work around for truncation // First lets open the file if it exists so we can delete it...This is the work around for truncation
// //
Status = ShellOpenFileByDevicePath ( Status = ShellOpenFileByDevicePath (
&FileDevicePath, &FileDevicePath,
@ -284,7 +288,7 @@ SaveUnitTestCache (
SaveData SaveData
); );
if (EFI_ERROR (Status) || WriteCount != SaveData->SaveStateSize) { if (EFI_ERROR (Status) || (WriteCount != SaveData->SaveStateSize)) {
DEBUG ((DEBUG_ERROR, "%a - Writing to file failed! %r\n", __FUNCTION__, Status)); DEBUG ((DEBUG_ERROR, "%a - Writing to file failed! %r\n", __FUNCTION__, Status));
} else { } else {
DEBUG ((DEBUG_INFO, "%a - SUCCESS!\n", __FUNCTION__)); DEBUG ((DEBUG_INFO, "%a - SUCCESS!\n", __FUNCTION__));
@ -338,7 +342,7 @@ LoadUnitTestCache (
// //
// Check the inputs for sanity. // Check the inputs for sanity.
// //
if (FrameworkHandle == NULL || SaveData == NULL) { if ((FrameworkHandle == NULL) || (SaveData == NULL)) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -399,6 +403,7 @@ Exit:
if (FileDevicePath != NULL) { if (FileDevicePath != NULL) {
FreePool (FileDevicePath); FreePool (FileDevicePath);
} }
if (IsFileOpened) { if (IsFileOpened) {
ShellCloseFile (&FileHandle); ShellCloseFile (&FileHandle);
} }
@ -406,7 +411,7 @@ Exit:
// //
// If we're returning an error, make sure // If we're returning an error, make sure
// the state is sane. // the state is sane.
if (EFI_ERROR (Status) && Buffer != NULL) { if (EFI_ERROR (Status) && (Buffer != NULL)) {
FreePool (Buffer); FreePool (Buffer);
Buffer = NULL; Buffer = NULL;
} }

View File

@ -33,26 +33,26 @@ struct _UNIT_TEST_FAILURE_TYPE_STRING {
}; };
struct _UNIT_TEST_STATUS_STRING mStatusStrings[] = { struct _UNIT_TEST_STATUS_STRING mStatusStrings[] = {
{ UNIT_TEST_PASSED, "PASSED"}, { UNIT_TEST_PASSED, "PASSED" },
{ UNIT_TEST_ERROR_PREREQUISITE_NOT_MET, "NOT RUN - PREREQUISITE FAILED"}, { UNIT_TEST_ERROR_PREREQUISITE_NOT_MET, "NOT RUN - PREREQUISITE FAILED" },
{ UNIT_TEST_ERROR_TEST_FAILED, "FAILED"}, { UNIT_TEST_ERROR_TEST_FAILED, "FAILED" },
{ UNIT_TEST_RUNNING, "RUNNING"}, { UNIT_TEST_RUNNING, "RUNNING" },
{ UNIT_TEST_PENDING, "PENDING"}, { UNIT_TEST_PENDING, "PENDING" },
{ 0, "**UNKNOWN**"} { 0, "**UNKNOWN**" }
}; };
struct _UNIT_TEST_FAILURE_TYPE_STRING mFailureTypeStrings[] = { struct _UNIT_TEST_FAILURE_TYPE_STRING mFailureTypeStrings[] = {
{ FAILURETYPE_NOFAILURE, "NO FAILURE"}, { FAILURETYPE_NOFAILURE, "NO FAILURE" },
{ FAILURETYPE_OTHER, "OTHER FAILURE"}, { FAILURETYPE_OTHER, "OTHER FAILURE" },
{ FAILURETYPE_ASSERTTRUE, "ASSERT_TRUE FAILURE"}, { FAILURETYPE_ASSERTTRUE, "ASSERT_TRUE FAILURE" },
{ FAILURETYPE_ASSERTFALSE, "ASSERT_FALSE FAILURE"}, { FAILURETYPE_ASSERTFALSE, "ASSERT_FALSE FAILURE" },
{ FAILURETYPE_ASSERTEQUAL, "ASSERT_EQUAL FAILURE"}, { FAILURETYPE_ASSERTEQUAL, "ASSERT_EQUAL FAILURE" },
{ FAILURETYPE_ASSERTNOTEQUAL, "ASSERT_NOTEQUAL FAILURE"}, { FAILURETYPE_ASSERTNOTEQUAL, "ASSERT_NOTEQUAL FAILURE" },
{ FAILURETYPE_ASSERTNOTEFIERROR, "ASSERT_NOTEFIERROR FAILURE"}, { FAILURETYPE_ASSERTNOTEFIERROR, "ASSERT_NOTEFIERROR FAILURE" },
{ FAILURETYPE_ASSERTSTATUSEQUAL, "ASSERT_STATUSEQUAL FAILURE"}, { FAILURETYPE_ASSERTSTATUSEQUAL, "ASSERT_STATUSEQUAL FAILURE" },
{ FAILURETYPE_ASSERTNOTNULL, "ASSERT_NOTNULL FAILURE"}, { FAILURETYPE_ASSERTNOTNULL, "ASSERT_NOTNULL FAILURE" },
{ FAILURETYPE_EXPECTASSERT, "EXPECT_ASSERT FAILURE"}, { FAILURETYPE_EXPECTASSERT, "EXPECT_ASSERT FAILURE" },
{ 0, "*UNKNOWN* Failure"} { 0, "*UNKNOWN* Failure" }
}; };
// //
@ -60,7 +60,7 @@ struct _UNIT_TEST_FAILURE_TYPE_STRING mFailureTypeStrings[] = {
// //
STATIC STATIC
CONST CHAR8* CONST CHAR8 *
GetStringForUnitTestStatus ( GetStringForUnitTestStatus (
IN UNIT_TEST_STATUS Status IN UNIT_TEST_STATUS Status
) )
@ -75,6 +75,7 @@ GetStringForUnitTestStatus (
return mStatusStrings[Index].String; return mStatusStrings[Index].String;
} }
} }
// //
// Return last entry if no match found. // Return last entry if no match found.
// //
@ -82,7 +83,7 @@ GetStringForUnitTestStatus (
} }
STATIC STATIC
CONST CHAR8* CONST CHAR8 *
GetStringForFailureType ( GetStringForFailureType (
IN FAILURE_TYPE Failure IN FAILURE_TYPE Failure
) )
@ -97,10 +98,11 @@ GetStringForFailureType (
return mFailureTypeStrings[Index].String; return mFailureTypeStrings[Index].String;
} }
} }
// //
// Return last entry if no match found. // Return last entry if no match found.
// //
DEBUG((DEBUG_INFO, "%a Failure Type does not have string defined 0x%X\n", __FUNCTION__, (UINT32)Failure)); DEBUG ((DEBUG_INFO, "%a Failure Type does not have string defined 0x%X\n", __FUNCTION__, (UINT32)Failure));
return mFailureTypeStrings[Index].String; return mFailureTypeStrings[Index].String;
} }
@ -139,15 +141,15 @@ OutputUnitTestFrameworkReport (
ReportPrint ("------------- UNIT TEST FRAMEWORK RESULTS ---------------\n"); ReportPrint ("------------- UNIT TEST FRAMEWORK RESULTS ---------------\n");
ReportPrint ("---------------------------------------------------------\n"); ReportPrint ("---------------------------------------------------------\n");
//print the version and time // print the version and time
// //
// Iterate all suites // Iterate all suites
// //
for (Suite = (UNIT_TEST_SUITE_LIST_ENTRY*)GetFirstNode(&Framework->TestSuiteList); for (Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetFirstNode (&Framework->TestSuiteList);
(LIST_ENTRY*)Suite != &Framework->TestSuiteList; (LIST_ENTRY *)Suite != &Framework->TestSuiteList;
Suite = (UNIT_TEST_SUITE_LIST_ENTRY*)GetNextNode(&Framework->TestSuiteList, (LIST_ENTRY*)Suite)) { Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetNextNode (&Framework->TestSuiteList, (LIST_ENTRY *)Suite))
{
Test = NULL; Test = NULL;
SPassed = 0; SPassed = 0;
SFailed = 0; SFailed = 0;
@ -161,10 +163,10 @@ OutputUnitTestFrameworkReport (
// //
// Iterate all tests within the suite // Iterate all tests within the suite
// //
for (Test = (UNIT_TEST_LIST_ENTRY*)GetFirstNode(&(Suite->UTS.TestCaseList)); for (Test = (UNIT_TEST_LIST_ENTRY *)GetFirstNode (&(Suite->UTS.TestCaseList));
(LIST_ENTRY*)Test != &(Suite->UTS.TestCaseList); (LIST_ENTRY *)Test != &(Suite->UTS.TestCaseList);
Test = (UNIT_TEST_LIST_ENTRY*)GetNextNode(&(Suite->UTS.TestCaseList), (LIST_ENTRY*)Test)) { Test = (UNIT_TEST_LIST_ENTRY *)GetNextNode (&(Suite->UTS.TestCaseList), (LIST_ENTRY *)Test))
{
ReportPrint ("*********************************************************\n"); ReportPrint ("*********************************************************\n");
ReportPrint (" CLASS NAME: %a\n", Test->UT.Name); ReportPrint (" CLASS NAME: %a\n", Test->UT.Name);
ReportPrint (" TEST: %a\n", Test->UT.Description); ReportPrint (" TEST: %a\n", Test->UT.Description);
@ -192,27 +194,28 @@ OutputUnitTestFrameworkReport (
default: default:
break; break;
} }
ReportPrint ("**********************************************************\n"); ReportPrint ("**********************************************************\n");
} //End Test iteration } // End Test iteration
ReportPrint ("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); ReportPrint ("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
ReportPrint ("Suite Stats\n"); ReportPrint ("Suite Stats\n");
ReportPrint (" Passed: %d (%d%%)\n", SPassed, (SPassed * 100)/(SPassed+SFailed+SNotRun)); ReportPrint (" Passed: %d (%d%%)\n", SPassed, (SPassed * 100)/(SPassed+SFailed+SNotRun));
ReportPrint (" Failed: %d (%d%%)\n", SFailed, (SFailed * 100) / (SPassed + SFailed + SNotRun)); ReportPrint (" Failed: %d (%d%%)\n", SFailed, (SFailed * 100) / (SPassed + SFailed + SNotRun));
ReportPrint (" Not Run: %d (%d%%)\n", SNotRun, (SNotRun * 100) / (SPassed + SFailed + SNotRun)); ReportPrint (" Not Run: %d (%d%%)\n", SNotRun, (SNotRun * 100) / (SPassed + SFailed + SNotRun));
ReportPrint ("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" ); ReportPrint ("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
Passed += SPassed; //add to global counters Passed += SPassed; // add to global counters
Failed += SFailed; //add to global counters Failed += SFailed; // add to global counters
NotRun += SNotRun; //add to global counters NotRun += SNotRun; // add to global counters
}//End Suite iteration }// End Suite iteration
ReportPrint ("=========================================================\n"); ReportPrint ("=========================================================\n");
ReportPrint ("Total Stats\n"); ReportPrint ("Total Stats\n");
ReportPrint (" Passed: %d (%d%%)\n", Passed, (Passed * 100) / (Passed + Failed + NotRun)); ReportPrint (" Passed: %d (%d%%)\n", Passed, (Passed * 100) / (Passed + Failed + NotRun));
ReportPrint (" Failed: %d (%d%%)\n", Failed, (Failed * 100) / (Passed + Failed + NotRun)); ReportPrint (" Failed: %d (%d%%)\n", Failed, (Failed * 100) / (Passed + Failed + NotRun));
ReportPrint (" Not Run: %d (%d%%)\n", NotRun, (NotRun * 100) / (Passed + Failed + NotRun)); ReportPrint (" Not Run: %d (%d%%)\n", NotRun, (NotRun * 100) / (Passed + Failed + NotRun));
ReportPrint ("=========================================================\n" ); ReportPrint ("=========================================================\n");
return EFI_SUCCESS; return EFI_SUCCESS;
} }

View File

@ -29,6 +29,7 @@ ReportPrint (
} else { } else {
gST->ConOut->OutputString (gST->ConOut, String); gST->ConOut->OutputString (gST->ConOut, String);
} }
VA_END (Marker); VA_END (Marker);
} }

View File

@ -28,6 +28,7 @@ ReportPrint (
} else { } else {
DEBUG ((DEBUG_INFO, String)); DEBUG ((DEBUG_INFO, String));
} }
VA_END (Marker); VA_END (Marker);
} }

View File

@ -51,7 +51,7 @@ typedef UINT32 FAILURE_TYPE;
/// ///
typedef struct { typedef struct {
CHAR8 *Description; CHAR8 *Description;
CHAR8 *Name; //can't have spaces and should be short CHAR8 *Name; // can't have spaces and should be short
CHAR8 *Log; CHAR8 *Log;
FAILURE_TYPE FailureType; FAILURE_TYPE FailureType;
CHAR8 FailureMessage[UNIT_TEST_TESTFAILUREMSG_LENGTH]; CHAR8 FailureMessage[UNIT_TEST_TESTFAILUREMSG_LENGTH];

View File

@ -664,14 +664,14 @@ UefiTestMain (
Framework = NULL; Framework = NULL;
DEBUG(( DEBUG_INFO, "%a v%a\n", UNIT_TEST_NAME, UNIT_TEST_VERSION )); DEBUG ((DEBUG_INFO, "%a v%a\n", UNIT_TEST_NAME, UNIT_TEST_VERSION));
// //
// Start setting up the test framework for running the tests. // Start setting up the test framework for running the tests.
// //
Status = InitUnitTestFramework (&Framework, UNIT_TEST_NAME, gEfiCallerBaseName, UNIT_TEST_VERSION); Status = InitUnitTestFramework (&Framework, UNIT_TEST_NAME, gEfiCallerBaseName, UNIT_TEST_VERSION);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG((DEBUG_ERROR, "Failed in InitUnitTestFramework. Status = %r\n", Status)); DEBUG ((DEBUG_ERROR, "Failed in InitUnitTestFramework. Status = %r\n", Status));
goto EXIT; goto EXIT;
} }
@ -684,6 +684,7 @@ UefiTestMain (
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto EXIT; goto EXIT;
} }
AddTestCase (SimpleMathTests, "Adding 1 to 1 should produce 2", "Addition", OnePlusOneShouldEqualTwo, NULL, NULL, NULL); AddTestCase (SimpleMathTests, "Adding 1 to 1 should produce 2", "Addition", OnePlusOneShouldEqualTwo, NULL, NULL, NULL);
// //
@ -695,6 +696,7 @@ UefiTestMain (
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto EXIT; goto EXIT;
} }
AddTestCase (GlobalVarTests, "You should be able to change a global BOOLEAN", "Boolean", GlobalBooleanShouldBeChangeable, NULL, NULL, NULL); AddTestCase (GlobalVarTests, "You should be able to change a global BOOLEAN", "Boolean", GlobalBooleanShouldBeChangeable, NULL, NULL, NULL);
AddTestCase (GlobalVarTests, "You should be able to change a global pointer", "Pointer", GlobalPointerShouldBeChangeable, MakeSureThatPointerIsNull, ClearThePointer, NULL); AddTestCase (GlobalVarTests, "You should be able to change a global pointer", "Pointer", GlobalPointerShouldBeChangeable, MakeSureThatPointerIsNull, ClearThePointer, NULL);
@ -707,6 +709,7 @@ UefiTestMain (
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto EXIT; goto EXIT;
} }
AddTestCase (MacroTestsAssertsEnabled, "Test UT_ASSERT_TRUE() macro", "MacroUtAssertTrue", MacroUtAssertTrue, NULL, NULL, NULL); AddTestCase (MacroTestsAssertsEnabled, "Test UT_ASSERT_TRUE() macro", "MacroUtAssertTrue", MacroUtAssertTrue, NULL, NULL, NULL);
AddTestCase (MacroTestsAssertsEnabled, "Test UT_ASSERT_FALSE() macro", "MacroUtAssertFalse", MacroUtAssertFalse, NULL, NULL, NULL); AddTestCase (MacroTestsAssertsEnabled, "Test UT_ASSERT_FALSE() macro", "MacroUtAssertFalse", MacroUtAssertFalse, NULL, NULL, NULL);
AddTestCase (MacroTestsAssertsEnabled, "Test UT_ASSERT_EQUAL() macro", "MacroUtAssertEqual", MacroUtAssertEqual, NULL, NULL, NULL); AddTestCase (MacroTestsAssertsEnabled, "Test UT_ASSERT_EQUAL() macro", "MacroUtAssertEqual", MacroUtAssertEqual, NULL, NULL, NULL);
@ -731,6 +734,7 @@ UefiTestMain (
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto EXIT; goto EXIT;
} }
AddTestCase (MacroTestsAssertsDisabled, "Test UT_ASSERT_TRUE() macro", "MacroUtAssertTrue", MacroUtAssertTrue, NULL, NULL, NULL); AddTestCase (MacroTestsAssertsDisabled, "Test UT_ASSERT_TRUE() macro", "MacroUtAssertTrue", MacroUtAssertTrue, NULL, NULL, NULL);
AddTestCase (MacroTestsAssertsDisabled, "Test UT_ASSERT_FALSE() macro", "MacroUtAssertFalse", MacroUtAssertFalse, NULL, NULL, NULL); AddTestCase (MacroTestsAssertsDisabled, "Test UT_ASSERT_FALSE() macro", "MacroUtAssertFalse", MacroUtAssertFalse, NULL, NULL, NULL);
AddTestCase (MacroTestsAssertsDisabled, "Test UT_ASSERT_EQUAL() macro", "MacroUtAssertEqual", MacroUtAssertEqual, NULL, NULL, NULL); AddTestCase (MacroTestsAssertsDisabled, "Test UT_ASSERT_EQUAL() macro", "MacroUtAssertEqual", MacroUtAssertEqual, NULL, NULL, NULL);