summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2021-12-05 14:54:19 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-07 17:24:28 +0000
commit7c0ad2c33810ead45b7919f8f8d0e282dae52e71 (patch)
tree8391fcdaa5269b2223e9f4cb461287c082f32e2a
parente5efcf8be8a1bf59aa98875787475e3144ee4cef (diff)
downloadedk2-7c0ad2c33810ead45b7919f8f8d0e282dae52e71.tar.gz
edk2-7c0ad2c33810ead45b7919f8f8d0e282dae52e71.tar.bz2
edk2-7c0ad2c33810ead45b7919f8f8d0e282dae52e71.zip
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>
-rw-r--r--UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.c30
-rw-r--r--UnitTestFrameworkPkg/Library/Posix/MemoryAllocationLibPosix/MemoryAllocationLibPosix.c39
-rw-r--r--UnitTestFrameworkPkg/Library/UnitTestBootLibNull/UnitTestBootLibNull.c2
-rw-r--r--UnitTestFrameworkPkg/Library/UnitTestBootLibUsbClass/UnitTestBootLibUsbClass.c19
-rw-r--r--UnitTestFrameworkPkg/Library/UnitTestDebugAssertLib/UnitTestDebugAssertLib.c6
-rw-r--r--UnitTestFrameworkPkg/Library/UnitTestLib/Assert.c18
-rw-r--r--UnitTestFrameworkPkg/Library/UnitTestLib/AssertCmocka.c24
-rw-r--r--UnitTestFrameworkPkg/Library/UnitTestLib/Log.c17
-rw-r--r--UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c22
-rw-r--r--UnitTestFrameworkPkg/Library/UnitTestLib/RunTestsCmocka.c43
-rw-r--r--UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c131
-rw-r--r--UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/UnitTestPersistenceLibSimpleFileSystem.c33
-rw-r--r--UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLib.c115
-rw-r--r--UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.c1
-rw-r--r--UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibDebugLib.c1
-rw-r--r--UnitTestFrameworkPkg/PrivateInclude/Library/UnitTestPersistenceLib.h2
-rw-r--r--UnitTestFrameworkPkg/PrivateInclude/UnitTestFrameworkTypes.h122
-rw-r--r--UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTest/SampleUnitTest.c52
18 files changed, 368 insertions, 309 deletions
diff --git a/UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.c b/UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.c
index 0daea00728..694f4beb8b 100644
--- a/UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.c
+++ b/UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.c
@@ -68,9 +68,9 @@ DebugPrint (
VOID
EFIAPI
DebugVPrint (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN VA_LIST VaListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN VA_LIST VaListMarker
)
{
CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
@@ -99,9 +99,9 @@ DebugVPrint (
VOID
EFIAPI
DebugBPrint (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- IN BASE_LIST BaseListMarker
+ IN UINTN ErrorLevel,
+ IN CONST CHAR8 *Format,
+ IN BASE_LIST BaseListMarker
)
{
CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
@@ -144,9 +144,9 @@ DebugAssert (
//
// 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 ();
- } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
+ } else if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
CpuDeadLoop ();
}
}
@@ -181,7 +181,7 @@ DebugClearMemory (
//
// 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
)
{
- 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
)
{
- 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
)
{
- 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
)
{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
+ return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
}
/**
@@ -272,8 +272,8 @@ DebugClearMemoryEnabled (
BOOLEAN
EFIAPI
DebugPrintLevelEnabled (
- IN CONST UINTN ErrorLevel
+ IN CONST UINTN ErrorLevel
)
{
- return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0);
+ return (BOOLEAN)((ErrorLevel & PcdGet32 (PcdFixedDebugPrintErrorLevel)) != 0);
}
diff --git a/UnitTestFrameworkPkg/Library/Posix/MemoryAllocationLibPosix/MemoryAllocationLibPosix.c b/UnitTestFrameworkPkg/Library/Posix/MemoryAllocationLibPosix/MemoryAllocationLibPosix.c
index 1f590524d8..54029283fb 100644
--- a/UnitTestFrameworkPkg/Library/Posix/MemoryAllocationLibPosix/MemoryAllocationLibPosix.c
+++ b/UnitTestFrameworkPkg/Library/Posix/MemoryAllocationLibPosix/MemoryAllocationLibPosix.c
@@ -26,11 +26,11 @@
/// aligned allocation.
///
typedef struct {
- UINT32 Signature;
- VOID *AllocatedBufffer;
- UINTN TotalPages;
- VOID *AlignedBuffer;
- UINTN AlignedPages;
+ UINT32 Signature;
+ VOID *AllocatedBufffer;
+ UINTN TotalPages;
+ VOID *AlignedBuffer;
+ UINTN AlignedPages;
} PAGE_HEAD;
/**
@@ -159,25 +159,27 @@ AllocateAlignedPages (
if (Alignment < SIZE_4KB) {
Alignment = SIZE_4KB;
}
- AlignmentMask = Alignment - 1;
+
+ AlignmentMask = Alignment - 1;
//
// We need reserve Alignment pages for PAGE_HEAD, as meta data.
//
- PageHead.Signature = PAGE_HEAD_PRIVATE_SIGNATURE;
- PageHead.TotalPages = Pages + EFI_SIZE_TO_PAGES (Alignment) * 2;
- PageHead.AlignedPages = Pages;
+ PageHead.Signature = PAGE_HEAD_PRIVATE_SIGNATURE;
+ PageHead.TotalPages = Pages + EFI_SIZE_TO_PAGES (Alignment) * 2;
+ PageHead.AlignedPages = Pages;
PageHead.AllocatedBufffer = malloc (EFI_PAGES_TO_SIZE (PageHead.TotalPages));
if (PageHead.AllocatedBufffer == 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);
}
- PageHeadPtr = (VOID *)((UINTN)PageHead.AlignedBuffer - sizeof(PAGE_HEAD));
- memcpy (PageHeadPtr, &PageHead, sizeof(PAGE_HEAD));
+ PageHeadPtr = (VOID *)((UINTN)PageHead.AlignedBuffer - sizeof (PAGE_HEAD));
+ memcpy (PageHeadPtr, &PageHead, sizeof (PAGE_HEAD));
return PageHead.AlignedBuffer;
}
@@ -267,10 +269,11 @@ FreeAlignedPages (
//
// 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) {
return;
}
+
if (PageHeadPtr->AlignedPages != Pages) {
return;
}
@@ -366,6 +369,7 @@ AllocateZeroPool (
if (Buffer == NULL) {
return NULL;
}
+
memset (Buffer, 0, AllocationSize);
return Buffer;
}
@@ -444,6 +448,7 @@ AllocateCopyPool (
if (Memory == NULL) {
return NULL;
}
+
memcpy (Memory, Buffer, AllocationSize);
return Memory;
}
@@ -534,12 +539,14 @@ ReallocatePool (
VOID *NewBuffer;
NewBuffer = malloc (NewSize);
- if (NewBuffer != NULL && OldBuffer != NULL) {
+ if ((NewBuffer != NULL) && (OldBuffer != NULL)) {
memcpy (NewBuffer, OldBuffer, MIN (OldSize, NewSize));
}
+
if (OldBuffer != NULL) {
- FreePool(OldBuffer);
+ FreePool (OldBuffer);
}
+
return NewBuffer;
}
diff --git a/UnitTestFrameworkPkg/Library/UnitTestBootLibNull/UnitTestBootLibNull.c b/UnitTestFrameworkPkg/Library/UnitTestBootLibNull/UnitTestBootLibNull.c
index c5a5162c58..a49aaefdb7 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestBootLibNull/UnitTestBootLibNull.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestBootLibNull/UnitTestBootLibNull.c
@@ -18,7 +18,7 @@
**/
EFI_STATUS
EFIAPI
-SetBootNextDevice(
+SetBootNextDevice (
VOID
)
{
diff --git a/UnitTestFrameworkPkg/Library/UnitTestBootLibUsbClass/UnitTestBootLibUsbClass.c b/UnitTestFrameworkPkg/Library/UnitTestBootLibUsbClass/UnitTestBootLibUsbClass.c
index 4ce48bd233..ebb42186a5 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestBootLibUsbClass/UnitTestBootLibUsbClass.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestBootLibUsbClass/UnitTestBootLibUsbClass.c
@@ -26,7 +26,7 @@
EFI_STATUS
EFIAPI
SetBootNextDevice (
- VOID
+ VOID
)
{
EFI_STATUS Status;
@@ -47,8 +47,8 @@ SetBootNextDevice (
Dp = NULL;
NewOptionValid = FALSE;
- 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[0] = (UINT8)(sizeof (USB_CLASS_DEVICE_PATH) & 0xff);
+ UsbDp.Header.Length[1] = (UINT8)(sizeof (USB_CLASS_DEVICE_PATH) >> 8);
UsbDp.Header.Type = MESSAGING_DEVICE_PATH;
UsbDp.Header.SubType = MSG_USB_CLASS_DP;
UsbDp.VendorId = 0xFFFF;
@@ -66,20 +66,20 @@ SetBootNextDevice (
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 (
DpEnd,
(EFI_DEVICE_PATH_PROTOCOL *)&UsbDp
);
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;
goto CLEANUP;
}
Status = EfiBootManagerInitializeLoadOption (
&NewOption,
- (UINTN) BootNextValue,
+ (UINTN)BootNextValue,
LoadOptionTypeBoot,
Attributes,
L"Generic USB Class Device",
@@ -107,21 +107,24 @@ SetBootNextDevice (
L"BootNext",
&gEfiGlobalVariableGuid,
(EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE),
- sizeof(BootNextValue),
+ sizeof (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:
if (Dp != NULL) {
FreePool (Dp);
}
+
if (DpEnd != NULL) {
FreePool (DpEnd);
}
+
if (NewOptionValid) {
EfiBootManagerFreeLoadOption (&NewOption);
}
+
return Status;
}
diff --git a/UnitTestFrameworkPkg/Library/UnitTestDebugAssertLib/UnitTestDebugAssertLib.c b/UnitTestFrameworkPkg/Library/UnitTestDebugAssertLib/UnitTestDebugAssertLib.c
index 0a4001e182..0462ffd64d 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestDebugAssertLib/UnitTestDebugAssertLib.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestDebugAssertLib/UnitTestDebugAssertLib.c
@@ -41,9 +41,9 @@ UnitTestDebugAssert (
UT_LOG_INFO ("Detected expected ASSERT: %a(%d): %a\n", FileName, LineNumber, Description);
LongJump (gUnitTestExpectAssertFailureJumpBuffer, 1);
} else {
- AsciiStrCpyS (Message, sizeof(Message), "Detected unexpected ASSERT(");
- AsciiStrCatS (Message, sizeof(Message), Description);
- AsciiStrCatS (Message, sizeof(Message), ")");
+ AsciiStrCpyS (Message, sizeof (Message), "Detected unexpected ASSERT(");
+ AsciiStrCatS (Message, sizeof (Message), Description);
+ AsciiStrCatS (Message, sizeof (Message), ")");
UnitTestAssertTrue (FALSE, "", LineNumber, FileName, Message);
}
}
diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/Assert.c b/UnitTestFrameworkPkg/Library/UnitTestLib/Assert.c
index 9a74016456..35636565b7 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestLib/Assert.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestLib/Assert.c
@@ -26,7 +26,7 @@ AddUnitTestFailure (
//
// Make sure that you're cooking with gas.
//
- if (UnitTest == NULL || FailureMessage == NULL) {
+ if ((UnitTest == NULL) || (FailureMessage == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -120,6 +120,7 @@ UnitTestAssertTrue (
Description
);
}
+
return Expression;
}
@@ -166,6 +167,7 @@ UnitTestAssertFalse (
Description
);
}
+
return !Expression;
}
@@ -214,7 +216,8 @@ UnitTestAssertNotEfiError (
Status
);
}
- return !EFI_ERROR( Status );
+
+ return !EFI_ERROR (Status);
}
/**
@@ -271,6 +274,7 @@ UnitTestAssertEqual (
ValueB
);
}
+
return (ValueA == ValueB);
}
@@ -312,7 +316,7 @@ UnitTestAssertMemEqual (
IN CONST CHAR8 *DescriptionB
)
{
- if (CompareMem(BufferA, BufferB, Length) != 0) {
+ if (CompareMem (BufferA, BufferB, Length) != 0) {
UT_LOG_ERROR (
"[ASSERT FAIL] %a:%d: Value %a != %a for length %d bytes!\n",
FileName,
@@ -332,6 +336,7 @@ UnitTestAssertMemEqual (
);
return FALSE;
}
+
return TRUE;
}
@@ -389,6 +394,7 @@ UnitTestAssertNotEqual (
ValueB
);
}
+
return (ValueA != ValueB);
}
@@ -442,6 +448,7 @@ UnitTestAssertStatusEqual (
Expected
);
}
+
return (Status == Expected);
}
@@ -490,6 +497,7 @@ UnitTestAssertNotNull (
PointerName
);
}
+
return (Pointer != NULL);
}
@@ -536,6 +544,7 @@ UnitTestExpectAssertFailure (
if (ResultStatus != NULL) {
*ResultStatus = UnitTestStatus;
}
+
if (UnitTestStatus == UNIT_TEST_PASSED) {
UT_LOG_INFO (
"[ASSERT PASS] %a:%d: UT_EXPECT_ASSERT_FAILURE(%a) detected expected assert\n",
@@ -544,6 +553,7 @@ UnitTestExpectAssertFailure (
FunctionCall
);
}
+
if (UnitTestStatus == UNIT_TEST_SKIPPED) {
UT_LOG_WARNING (
"[ASSERT WARN] %a:%d: UT_EXPECT_ASSERT_FAILURE(%a) disabled\n",
@@ -552,6 +562,7 @@ UnitTestExpectAssertFailure (
FunctionCall
);
}
+
if (UnitTestStatus == UNIT_TEST_ERROR_TEST_FAILED) {
UT_LOG_ERROR (
"[ASSERT FAIL] %a:%d: Function call (%a) did not ASSERT()!\n",
@@ -567,5 +578,6 @@ UnitTestExpectAssertFailure (
FunctionCall
);
}
+
return (UnitTestStatus != UNIT_TEST_ERROR_TEST_FAILED);
}
diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/AssertCmocka.c b/UnitTestFrameworkPkg/Library/UnitTestLib/AssertCmocka.c
index 687c6243ab..dc05bbd438 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestLib/AssertCmocka.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestLib/AssertCmocka.c
@@ -48,7 +48,7 @@ UnitTestAssertTrue (
{
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);
return Expression;
@@ -84,7 +84,7 @@ UnitTestAssertFalse (
{
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);
return !Expression;
@@ -120,7 +120,7 @@ UnitTestAssertNotEfiError (
{
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);
return !EFI_ERROR (Status);
@@ -161,7 +161,7 @@ UnitTestAssertEqual (
{
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);
return (ValueA == ValueB);
@@ -208,9 +208,9 @@ UnitTestAssertMemEqual (
CHAR8 TempStr[MAX_STRING_SIZE];
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);
return Result;
@@ -251,7 +251,7 @@ UnitTestAssertNotEqual (
{
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);
return (ValueA != ValueB);
@@ -290,7 +290,7 @@ UnitTestAssertStatusEqual (
{
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);
return (Status == Expected);
@@ -328,7 +328,7 @@ UnitTestAssertNotNull (
{
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);
return (Pointer != NULL);
@@ -379,6 +379,7 @@ UnitTestExpectAssertFailure (
if (ResultStatus != NULL) {
*ResultStatus = UnitTestStatus;
}
+
if (UnitTestStatus == UNIT_TEST_PASSED) {
UT_LOG_INFO (
"[ASSERT PASS] %a:%d: UT_EXPECT_ASSERT_FAILURE(%a) detected expected assert\n",
@@ -387,6 +388,7 @@ UnitTestExpectAssertFailure (
FunctionCall
);
}
+
if (UnitTestStatus == UNIT_TEST_SKIPPED) {
UT_LOG_WARNING (
"[ASSERT WARN] %a:%d: UT_EXPECT_ASSERT_FAILURE(%a) disabled\n",
@@ -395,9 +397,11 @@ UnitTestExpectAssertFailure (
FunctionCall
);
}
+
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);
}
+
return (UnitTestStatus != UNIT_TEST_ERROR_TEST_FAILED);
}
diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/Log.c b/UnitTestFrameworkPkg/Library/UnitTestLib/Log.c
index d9838105e2..3998aafdf8 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestLib/Log.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestLib/Log.c
@@ -19,8 +19,8 @@
#define UNIT_TEST_MAX_LOG_BUFFER SIZE_16KB
struct _UNIT_TEST_LOG_PREFIX_STRING {
- UNIT_TEST_STATUS LogLevel;
- CHAR8 *String;
+ UNIT_TEST_STATUS LogLevel;
+ CHAR8 *String;
};
struct _UNIT_TEST_LOG_PREFIX_STRING mLogPrefixStrings[] = {
@@ -35,7 +35,7 @@ struct _UNIT_TEST_LOG_PREFIX_STRING mLogPrefixStrings[] = {
//
STATIC
-CONST CHAR8*
+CONST CHAR8 *
GetStringForStatusLogPrefix (
IN UINTN LogLevel
)
@@ -50,6 +50,7 @@ GetStringForStatusLogPrefix (
break;
}
}
+
return Result;
}
@@ -65,7 +66,7 @@ AddStringToUnitTestLog (
//
// Make sure that you're cooking with gas.
//
- if (UnitTest == NULL || String == NULL) {
+ if ((UnitTest == NULL) || (String == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -86,7 +87,7 @@ AddStringToUnitTestLog (
String,
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));
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"));
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);
}
}
diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c b/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
index 2dc1d159d5..9bc743ca8e 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestLib/RunTests.c
@@ -54,8 +54,9 @@ RunTestSuite (
// Iterate all tests within the suite
//
for (TestEntry = (UNIT_TEST_LIST_ENTRY *)GetFirstNode (&(Suite->TestCaseList));
- (LIST_ENTRY*)TestEntry != &(Suite->TestCaseList);
- TestEntry = (UNIT_TEST_LIST_ENTRY *)GetNextNode (&(Suite->TestCaseList), (LIST_ENTRY *)TestEntry)) {
+ (LIST_ENTRY *)TestEntry != &(Suite->TestCaseList);
+ TestEntry = (UNIT_TEST_LIST_ENTRY *)GetNextNode (&(Suite->TestCaseList), (LIST_ENTRY *)TestEntry))
+ {
Test = &TestEntry->UT;
ParentFramework->CurrentTest = Test;
@@ -67,7 +68,7 @@ RunTestSuite (
// 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.
//
- 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"));
ParentFramework->CurrentTest = NULL;
continue;
@@ -75,19 +76,19 @@ RunTestSuite (
//
// 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"));
if (SetJump (&gUnitTestJumpBuffer) == 0) {
if (Test->Prerequisite (Test->Context) != UNIT_TEST_PASSED) {
DEBUG ((DEBUG_ERROR, "Prerequisite Not Met\n"));
- Test->Result = UNIT_TEST_ERROR_PREREQUISITE_NOT_MET;
- ParentFramework->CurrentTest = NULL;
+ Test->Result = UNIT_TEST_ERROR_PREREQUISITE_NOT_MET;
+ ParentFramework->CurrentTest = NULL;
continue;
}
} else {
DEBUG ((DEBUG_ERROR, "Prerequisite Not Met\n"));
- Test->Result = UNIT_TEST_ERROR_PREREQUISITE_NOT_MET;
- ParentFramework->CurrentTest = NULL;
+ Test->Result = UNIT_TEST_ERROR_PREREQUISITE_NOT_MET;
+ ParentFramework->CurrentTest = NULL;
continue;
}
}
@@ -166,8 +167,9 @@ RunAllTestSuites (
// Iterate all suites
//
for (Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetFirstNode (&Framework->TestSuiteList);
- (LIST_ENTRY *)Suite != &Framework->TestSuiteList;
- Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetNextNode (&Framework->TestSuiteList, (LIST_ENTRY *)Suite)) {
+ (LIST_ENTRY *)Suite != &Framework->TestSuiteList;
+ Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetNextNode (&Framework->TestSuiteList, (LIST_ENTRY *)Suite))
+ {
Status = RunTestSuite (&(Suite->UTS));
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Test Suite Failed with Error. %r\n", Status));
diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/RunTestsCmocka.c b/UnitTestFrameworkPkg/Library/UnitTestLib/RunTestsCmocka.c
index 96aa4d9b13..ca4dae1206 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestLib/RunTestsCmocka.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestLib/RunTestsCmocka.c
@@ -38,7 +38,7 @@ UNIT_TEST_SUITE *mActiveUnitTestSuite = NULL;
void
CmockaUnitTestFunctionRunner (
- void **state
+ void **state
)
{
UNIT_TEST *UnitTest;
@@ -52,16 +52,16 @@ CmockaUnitTestFunctionRunner (
if (UnitTest->RunTest == NULL) {
UnitTest->Result = UNIT_TEST_SKIPPED;
} else {
- UnitTest->Result = UNIT_TEST_RUNNING;
+ UnitTest->Result = UNIT_TEST_RUNNING;
Framework->CurrentTest = UnitTest;
- UnitTest->Result = UnitTest->RunTest (UnitTest->Context);
+ UnitTest->Result = UnitTest->RunTest (UnitTest->Context);
Framework->CurrentTest = NULL;
}
}
int
CmockaUnitTestSetupFunctionRunner (
- void **state
+ void **state
)
{
UNIT_TEST *UnitTest;
@@ -78,7 +78,7 @@ CmockaUnitTestSetupFunctionRunner (
}
Framework->CurrentTest = UnitTest;
- Result = UnitTest->Prerequisite (UnitTest->Context);
+ Result = UnitTest->Prerequisite (UnitTest->Context);
Framework->CurrentTest = NULL;
//
@@ -89,7 +89,7 @@ CmockaUnitTestSetupFunctionRunner (
int
CmockaUnitTestTeardownFunctionRunner (
- void **state
+ void **state
)
{
UNIT_TEST *UnitTest;
@@ -112,10 +112,10 @@ CmockaUnitTestTeardownFunctionRunner (
// stdout and stderr in their xml format
//
if (UnitTest->Log != NULL) {
- print_message("UnitTest: %s - %s\n", UnitTest->Name, UnitTest->Description);
- print_message("Log Output Start\n");
- print_message("%s", UnitTest->Log);
- print_message("Log Output End\n");
+ print_message ("UnitTest: %s - %s\n", UnitTest->Name, UnitTest->Description);
+ print_message ("Log Output Start\n");
+ print_message ("%s", UnitTest->Log);
+ print_message ("Log Output End\n");
}
//
@@ -126,12 +126,13 @@ CmockaUnitTestTeardownFunctionRunner (
int
CmockaUnitTestSuiteSetupFunctionRunner (
- void **state
+ void **state
)
{
if (mActiveUnitTestSuite == NULL) {
return -1;
}
+
if (mActiveUnitTestSuite->Setup == NULL) {
return 0;
}
@@ -145,12 +146,13 @@ CmockaUnitTestSuiteSetupFunctionRunner (
int
CmockaUnitTestSuiteTeardownFunctionRunner (
- void **state
+ void **state
)
{
if (mActiveUnitTestSuite == NULL) {
return -1;
}
+
if (mActiveUnitTestSuite->Teardown == NULL) {
return 0;
}
@@ -173,7 +175,7 @@ RunTestSuite (
struct CMUnitTest *Tests;
UINTN Index;
- TestEntry = NULL;
+ TestEntry = NULL;
if (Suite == NULL) {
return EFI_INVALID_PARAMETER;
@@ -195,7 +197,8 @@ RunTestSuite (
Index = 0;
for (TestEntry = (UNIT_TEST_LIST_ENTRY *)GetFirstNode (&(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;
Tests[Index].name = UnitTest->Description;
Tests[Index].test_func = CmockaUnitTestFunctionRunner;
@@ -204,6 +207,7 @@ RunTestSuite (
Tests[Index].initial_state = UnitTest;
Index++;
}
+
ASSERT (Index == Suite->NumTests);
//
@@ -254,17 +258,18 @@ RunAllTestSuites (
return EFI_INVALID_PARAMETER;
}
- DEBUG((DEBUG_VERBOSE, "---------------------------------------------------------\n"));
- DEBUG((DEBUG_VERBOSE, "------------ RUNNING ALL TEST SUITES --------------\n"));
- DEBUG((DEBUG_VERBOSE, "---------------------------------------------------------\n"));
+ DEBUG ((DEBUG_VERBOSE, "---------------------------------------------------------\n"));
+ DEBUG ((DEBUG_VERBOSE, "------------ RUNNING ALL TEST SUITES --------------\n"));
+ DEBUG ((DEBUG_VERBOSE, "---------------------------------------------------------\n"));
mFrameworkHandle = FrameworkHandle;
//
// Iterate all suites
//
for (Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetFirstNode (&Framework->TestSuiteList);
- (LIST_ENTRY *)Suite != &Framework->TestSuiteList;
- Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetNextNode (&Framework->TestSuiteList, (LIST_ENTRY *)Suite)) {
+ (LIST_ENTRY *)Suite != &Framework->TestSuiteList;
+ Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetNextNode (&Framework->TestSuiteList, (LIST_ENTRY *)Suite))
+ {
Status = RunTestSuite (&(Suite->UTS));
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Test Suite Failed with Error. %r\n", Status));
diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
index bcecdd1aa6..64d5880783 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.c
@@ -47,7 +47,7 @@ IsFrameworkShortNameValid (
}
STATIC
-CHAR8*
+CHAR8 *
AllocateAndCopyString (
IN CHAR8 *StringToCopy
)
@@ -55,12 +55,13 @@ AllocateAndCopyString (
CHAR8 *NewString;
UINTN NewStringLength;
- NewString = NULL;
+ NewString = NULL;
NewStringLength = AsciiStrnLenS (StringToCopy, UNIT_TEST_MAX_STRING_LENGTH) + 1;
- NewString = AllocatePool (NewStringLength * sizeof( CHAR8 ));
+ NewString = AllocatePool (NewStringLength * sizeof (CHAR8));
if (NewString != NULL) {
AsciiStrCpyS (NewString, NewStringLength, StringToCopy);
}
+
return NewString;
}
@@ -74,10 +75,10 @@ SetFrameworkFingerprint (
UINT32 NewFingerprint;
// 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 = (NewFingerprint >> 8) ^ CalculateCrc32( Framework->VersionString, (AsciiStrLen( Framework->VersionString ) * sizeof( CHAR8 )) );
+ NewFingerprint = CalculateCrc32 (Framework->Title, (AsciiStrLen (Framework->Title) * 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;
}
@@ -92,11 +93,11 @@ SetSuiteFingerprint (
UINT32 NewFingerprint;
// 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 = (NewFingerprint >> 8) ^ CalculateCrc32( Suite->Title, (AsciiStrLen( Suite->Title ) * sizeof( CHAR8 )) );
- NewFingerprint = (NewFingerprint >> 8) ^ CalculateCrc32( Suite->Name, (AsciiStrLen(Suite->Name) * sizeof(CHAR8)) );
+ 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->Name, (AsciiStrLen (Suite->Name) * sizeof (CHAR8)));
- CopyMem( Fingerprint, &NewFingerprint, UNIT_TEST_FINGERPRINT_SIZE );
+ CopyMem (Fingerprint, &NewFingerprint, UNIT_TEST_FINGERPRINT_SIZE);
return;
}
@@ -111,11 +112,11 @@ SetTestFingerprint (
UINT32 NewFingerprint;
// 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 = (NewFingerprint >> 8) ^ CalculateCrc32( Test->Description, (AsciiStrLen( Test->Description ) * sizeof( CHAR8 )) );
- NewFingerprint = (NewFingerprint >> 8) ^ CalculateCrc32( Test->Name, (AsciiStrLen(Test->Name) * sizeof(CHAR8)) );
+ 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->Name, (AsciiStrLen (Test->Name) * sizeof (CHAR8)));
- CopyMem( Fingerprint, &NewFingerprint, UNIT_TEST_FINGERPRINT_SIZE );
+ CopyMem (Fingerprint, &NewFingerprint, UNIT_TEST_FINGERPRINT_SIZE);
return;
}
@@ -126,7 +127,7 @@ CompareFingerprints (
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.
//
- if (FrameworkHandle == NULL || Title == NULL ||
- ShortTitle == NULL || VersionString == NULL) {
+ if ((FrameworkHandle == NULL) || (Title == NULL) ||
+ (ShortTitle == NULL) || (VersionString == NULL))
+ {
return EFI_INVALID_PARAMETER;
}
@@ -246,12 +248,14 @@ InitUnitTestFramework (
NewFramework->Log = NULL;
NewFramework->CurrentTest = NULL;
NewFramework->SavedState = NULL;
- if (NewFramework->Title == NULL ||
- NewFramework->ShortTitle == NULL ||
- NewFramework->VersionString == NULL) {
+ if ((NewFramework->Title == NULL) ||
+ (NewFramework->ShortTitle == NULL) ||
+ (NewFramework->VersionString == NULL))
+ {
Status = EFI_OUT_OF_RESOURCES;
goto Exit;
}
+
InitializeListHead (&(NewFramework->TestSuiteList));
//
@@ -263,12 +267,12 @@ InitUnitTestFramework (
// If there is a persisted context, load it now.
//
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)) {
//
// 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;
}
}
@@ -330,7 +334,7 @@ CreateUnitTestSuite (
UNIT_TEST_SUITE_LIST_ENTRY *NewSuiteEntry;
UNIT_TEST_FRAMEWORK *Framework;
- Status = EFI_SUCCESS;
+ Status = EFI_SUCCESS;
Framework = (UNIT_TEST_FRAMEWORK *)FrameworkHandle;
//
@@ -351,12 +355,12 @@ CreateUnitTestSuite (
//
// Copy the fields we think we need.
//
- NewSuiteEntry->UTS.NumTests = 0;
- NewSuiteEntry->UTS.Title = AllocateAndCopyString (Title);
- NewSuiteEntry->UTS.Name = AllocateAndCopyString (Name);
- NewSuiteEntry->UTS.Setup = Setup;
- NewSuiteEntry->UTS.Teardown = Teardown;
- NewSuiteEntry->UTS.ParentFramework = FrameworkHandle;
+ NewSuiteEntry->UTS.NumTests = 0;
+ NewSuiteEntry->UTS.Title = AllocateAndCopyString (Title);
+ NewSuiteEntry->UTS.Name = AllocateAndCopyString (Name);
+ NewSuiteEntry->UTS.Setup = Setup;
+ NewSuiteEntry->UTS.Teardown = Teardown;
+ NewSuiteEntry->UTS.ParentFramework = FrameworkHandle;
InitializeListHead (&(NewSuiteEntry->Entry)); // List entry for sibling suites.
InitializeListHead (&(NewSuiteEntry->UTS.TestCaseList)); // List entry for child tests.
if (NewSuiteEntry->UTS.Title == NULL) {
@@ -372,13 +376,13 @@ CreateUnitTestSuite (
//
// Create the suite fingerprint.
//
- SetSuiteFingerprint( &NewSuiteEntry->UTS.Fingerprint[0], Framework, &NewSuiteEntry->UTS );
+ SetSuiteFingerprint (&NewSuiteEntry->UTS.Fingerprint[0], Framework, &NewSuiteEntry->UTS);
Exit:
//
// 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);
*SuiteHandle = (UNIT_TEST_SUITE_HANDLE)(&NewSuiteEntry->UTS);
} else {
@@ -432,8 +436,8 @@ AddTestCase (
UNIT_TEST_FRAMEWORK *ParentFramework;
UNIT_TEST_SUITE *Suite;
- Status = EFI_SUCCESS;
- Suite = (UNIT_TEST_SUITE *)SuiteHandle;
+ Status = EFI_SUCCESS;
+ Suite = (UNIT_TEST_SUITE *)SuiteHandle;
//
// First, let's check to make sure that our parameters look good.
@@ -445,7 +449,7 @@ AddTestCase (
ParentFramework = (UNIT_TEST_FRAMEWORK *)Suite->ParentFramework;
//
// Create the new entry.
- NewTestEntry = AllocateZeroPool (sizeof( UNIT_TEST_LIST_ENTRY ));
+ NewTestEntry = AllocateZeroPool (sizeof (UNIT_TEST_LIST_ENTRY));
if (NewTestEntry == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -468,6 +472,7 @@ AddTestCase (
Status = EFI_OUT_OF_RESOURCES;
goto Exit;
}
+
if (NewTestEntry->UT.Name == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Exit;
@@ -492,7 +497,7 @@ Exit:
// If everything is going well, add the new suite to the tail list for the framework.
//
if (!EFI_ERROR (Status)) {
- InsertTailList (&(Suite->TestCaseList), (LIST_ENTRY*)NewTestEntry);
+ InsertTailList (&(Suite->TestCaseList), (LIST_ENTRY *)NewTestEntry);
Suite->NumTests++;
} else {
//
@@ -520,9 +525,10 @@ UpdateTestFromSave (
//
// First, evaluate the inputs.
//
- if (Test == NULL || SavedState == NULL) {
+ if ((Test == NULL) || (SavedState == NULL)) {
return;
}
+
if (SavedState->TestCount == 0) {
return;
}
@@ -590,18 +596,19 @@ UpdateTestFromSave (
// at the beginning of the context structure.
//
SavedContext = (UNIT_TEST_SAVE_CONTEXT *)FloatingPointer;
- if ((SavedContext->Size - sizeof (UNIT_TEST_SAVE_CONTEXT)) > 0 &&
- CompareFingerprints (&Test->Fingerprint[0], &SavedContext->Fingerprint[0])) {
+ if (((SavedContext->Size - sizeof (UNIT_TEST_SAVE_CONTEXT)) > 0) &&
+ CompareFingerprints (&Test->Fingerprint[0], &SavedContext->Fingerprint[0]))
+ {
//
// Override the test context with the saved context.
//
- Test->Context = (VOID*)SavedContext->Data;
+ Test->Context = (VOID *)SavedContext->Data;
}
}
}
STATIC
-UNIT_TEST_SAVE_HEADER*
+UNIT_TEST_SAVE_HEADER *
SerializeState (
IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle,
IN UNIT_TEST_CONTEXT ContextToSave OPTIONAL,
@@ -628,9 +635,10 @@ SerializeState (
//
// First, let's not make assumptions about the parameters.
//
- if (Framework == NULL ||
- (ContextToSave != NULL && ContextToSaveSize == 0) ||
- ContextToSaveSize > MAX_UINT32) {
+ if ((Framework == NULL) ||
+ ((ContextToSave != NULL) && (ContextToSaveSize == 0)) ||
+ (ContextToSaveSize > MAX_UINT32))
+ {
return NULL;
}
@@ -658,11 +666,11 @@ SerializeState (
//
// 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 (UnitTest->Log != NULL) {
+ if (UnitTest->Log != NULL) {
//
// The +1 is for the NULL character. Can't forget the NULL character.
//
@@ -670,18 +678,21 @@ SerializeState (
ASSERT (LogSize < MAX_UINT32);
TotalSize += (UINT32)LogSize;
}
+
//
// Increment the test count.
//
TestCount++;
}
}
+
//
// If there are no tests, we're done here.
//
if (TestCount == 0) {
return NULL;
}
+
//
// Add room for the context, if there is one.
//
@@ -700,8 +711,8 @@ SerializeState (
//
// Alright, let's start setting up some data.
//
- Header->Version = UNIT_TEST_PERSISTENCE_LIB_VERSION;
- Header->SaveStateSize = TotalSize;
+ Header->Version = UNIT_TEST_PERSISTENCE_LIB_VERSION;
+ Header->SaveStateSize = TotalSize;
CopyMem (&Header->Fingerprint[0], &Framework->Fingerprint[0], UNIT_TEST_FINGERPRINT_SIZE);
CopyMem (&Header->StartTime, &Framework->StartTime, sizeof (EFI_TIME));
Header->TestCount = TestCount;
@@ -711,7 +722,7 @@ SerializeState (
// Start adding all of the test cases.
// 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.
//
@@ -722,8 +733,8 @@ SerializeState (
//
TestListHead = &((UNIT_TEST_SUITE_LIST_ENTRY *)Suite)->UTS.TestCaseList;
for (Test = GetFirstNode (TestListHead); Test != TestListHead; Test = GetNextNode (TestListHead, Test)) {
- TestSaveData = (UNIT_TEST_SAVE_TEST *)FloatingPointer;
- UnitTest = &((UNIT_TEST_LIST_ENTRY *)Test)->UT;
+ TestSaveData = (UNIT_TEST_SAVE_TEST *)FloatingPointer;
+ UnitTest = &((UNIT_TEST_LIST_ENTRY *)Test)->UT;
//
// Save the fingerprint.
@@ -733,11 +744,10 @@ SerializeState (
//
// Save the result.
//
- TestSaveData->Result = UnitTest->Result;
+ TestSaveData->Result = UnitTest->Result;
TestSaveData->FailureType = UnitTest->FailureType;
AsciiStrnCpyS (&TestSaveData->FailureMessage[0], UNIT_TEST_TESTFAILUREMSG_LENGTH, &UnitTest->FailureMessage[0], UNIT_TEST_TESTFAILUREMSG_LENGTH);
-
//
// If there is a log, save the log.
//
@@ -762,9 +772,9 @@ SerializeState (
//
// If there is a context to save, let's do that now.
//
- if (ContextToSave != NULL && Framework->CurrentTest != NULL) {
- TestSaveContext = (UNIT_TEST_SAVE_CONTEXT*)FloatingPointer;
- TestSaveContext->Size = (UINT32)ContextToSaveSize + sizeof (UNIT_TEST_SAVE_CONTEXT);
+ if ((ContextToSave != NULL) && (Framework->CurrentTest != NULL)) {
+ TestSaveContext = (UNIT_TEST_SAVE_CONTEXT *)FloatingPointer;
+ TestSaveContext->Size = (UINT32)ContextToSaveSize + sizeof (UNIT_TEST_SAVE_CONTEXT);
CopyMem (&TestSaveContext->Fingerprint[0], &Framework->CurrentTest->Fingerprint[0], UNIT_TEST_FINGERPRINT_SIZE);
CopyMem (((UINT8 *)TestSaveContext + sizeof (UNIT_TEST_SAVE_CONTEXT)), ContextToSave, ContextToSaveSize);
Header->HasSavedContext = TRUE;
@@ -804,15 +814,15 @@ SerializeState (
EFI_STATUS
EFIAPI
SaveFrameworkState (
- IN UNIT_TEST_CONTEXT ContextToSave OPTIONAL,
- IN UINTN ContextToSaveSize
+ IN UNIT_TEST_CONTEXT ContextToSave OPTIONAL,
+ IN UINTN ContextToSaveSize
)
{
EFI_STATUS Status;
UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle;
UNIT_TEST_SAVE_HEADER *Header;
- Header = NULL;
+ Header = NULL;
FrameworkHandle = GetActiveFrameworkHandle ();
//
@@ -825,8 +835,9 @@ SaveFrameworkState (
//
// First, let's not make assumptions about the parameters.
//
- if ((ContextToSave != NULL && ContextToSaveSize == 0) ||
- ContextToSaveSize > MAX_UINT32) {
+ if (((ContextToSave != NULL) && (ContextToSaveSize == 0)) ||
+ (ContextToSaveSize > MAX_UINT32))
+ {
return EFI_INVALID_PARAMETER;
}
diff --git a/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/UnitTestPersistenceLibSimpleFileSystem.c b/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/UnitTestPersistenceLibSimpleFileSystem.c
index 6da85c459d..ed4a7d1615 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/UnitTestPersistenceLibSimpleFileSystem.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/UnitTestPersistenceLibSimpleFileSystem.c
@@ -29,7 +29,7 @@
**/
STATIC
-EFI_DEVICE_PATH_PROTOCOL*
+EFI_DEVICE_PATH_PROTOCOL *
GetCacheFileDevicePath (
IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle
)
@@ -44,7 +44,7 @@ GetCacheFileDevicePath (
UINTN CacheFilePathLength;
EFI_DEVICE_PATH_PROTOCOL *CacheFileDevicePath;
- Framework = (UNIT_TEST_FRAMEWORK*)FrameworkHandle;
+ Framework = (UNIT_TEST_FRAMEWORK *)FrameworkHandle;
AppPath = NULL;
CacheFilePath = NULL;
TestName = NULL;
@@ -56,7 +56,7 @@ GetCacheFileDevicePath (
Status = gBS->HandleProtocol (
gImageHandle,
&gEfiLoadedImageProtocolGuid,
- (VOID**)&LoadedImage
+ (VOID **)&LoadedImage
);
if (EFI_ERROR (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.
//
CacheFilePathLength = AsciiStrLen (Framework->ShortTitle) + 1;
- TestName = AllocatePool (CacheFilePathLength * sizeof(CHAR16));
+ TestName = AllocatePool (CacheFilePathLength * sizeof (CHAR16));
if (!TestName) {
goto Exit;
}
+
AsciiStrToUnicodeStrS (Framework->ShortTitle, TestName, CacheFilePathLength);
//
@@ -82,7 +83,7 @@ GetCacheFileDevicePath (
// PathCleanUpDirectories (FileNameCopy);
// if (PathRemoveLastItem (FileNameCopy)) {
//
- AppPath = ConvertDevicePathToText (LoadedImage->FilePath, TRUE, TRUE); // NOTE: This must be freed.
+ AppPath = ConvertDevicePathToText (LoadedImage->FilePath, TRUE, TRUE); // NOTE: This must be freed.
DirectorySlashOffset = StrLen (AppPath);
//
// Make sure we didn't get any weird data.
@@ -99,6 +100,7 @@ GetCacheFileDevicePath (
if (AppPath[DirectorySlashOffset] == L'\\') {
break;
}
+
DirectorySlashOffset--;
} while (DirectorySlashOffset > 0);
@@ -115,11 +117,11 @@ GetCacheFileDevicePath (
//
// Now we know some things, we're ready to produce our output string, I think.
//
- CacheFilePathLength = DirectorySlashOffset + 1;
+ CacheFilePathLength = DirectorySlashOffset + 1;
CacheFilePathLength += StrLen (TestName);
CacheFilePathLength += StrLen (CACHE_FILE_SUFFIX);
CacheFilePathLength += 1; // Don't forget the NULL terminator.
- CacheFilePath = AllocateZeroPool (CacheFilePathLength * sizeof (CHAR16));
+ CacheFilePath = AllocateZeroPool (CacheFilePathLength * sizeof (CHAR16));
if (!CacheFilePath) {
goto Exit;
}
@@ -129,7 +131,7 @@ GetCacheFileDevicePath (
//
StrnCpyS (CacheFilePath, CacheFilePathLength, AppPath, DirectorySlashOffset + 1); // Copy the path for the parent directory.
StrCatS (CacheFilePath, CacheFilePathLength, TestName); // Copy the base name for the test cache.
- StrCatS (CacheFilePath, CacheFilePathLength, CACHE_FILE_SUFFIX); // Copy the file suffix.
+ StrCatS (CacheFilePath, CacheFilePathLength, CACHE_FILE_SUFFIX); // Copy the file suffix.
//
// Finally, try to create the device path for the thing thing.
@@ -143,9 +145,11 @@ Exit:
if (AppPath != NULL) {
FreePool (AppPath);
}
+
if (CacheFilePath != NULL) {
FreePool (CacheFilePath);
}
+
if (TestName != NULL) {
FreePool (TestName);
}
@@ -229,7 +233,7 @@ SaveUnitTestCache (
//
// Check the inputs for sanity.
//
- if (FrameworkHandle == NULL || SaveData == NULL) {
+ if ((FrameworkHandle == NULL) || (SaveData == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -240,7 +244,7 @@ SaveUnitTestCache (
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 (
&FileDevicePath,
@@ -284,7 +288,7 @@ SaveUnitTestCache (
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));
} else {
DEBUG ((DEBUG_INFO, "%a - SUCCESS!\n", __FUNCTION__));
@@ -338,7 +342,7 @@ LoadUnitTestCache (
//
// Check the inputs for sanity.
//
- if (FrameworkHandle == NULL || SaveData == NULL) {
+ if ((FrameworkHandle == NULL) || (SaveData == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -377,7 +381,7 @@ LoadUnitTestCache (
// Now that we know the size, let's allocated a buffer to hold the contents.
//
FileSize = (UINTN)LargeFileSize; // You know what... if it's too large, this lib don't care.
- Buffer = AllocatePool (FileSize);
+ Buffer = AllocatePool (FileSize);
if (Buffer == NULL) {
DEBUG ((DEBUG_ERROR, "%a - Failed to allocate a pool to hold the file contents! %r\n", __FUNCTION__, Status));
Status = EFI_OUT_OF_RESOURCES;
@@ -399,6 +403,7 @@ Exit:
if (FileDevicePath != NULL) {
FreePool (FileDevicePath);
}
+
if (IsFileOpened) {
ShellCloseFile (&FileHandle);
}
@@ -406,7 +411,7 @@ Exit:
//
// If we're returning an error, make sure
// the state is sane.
- if (EFI_ERROR (Status) && Buffer != NULL) {
+ if (EFI_ERROR (Status) && (Buffer != NULL)) {
FreePool (Buffer);
Buffer = NULL;
}
diff --git a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLib.c b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLib.c
index 7f7443a233..d088b927a6 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLib.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLib.c
@@ -23,36 +23,36 @@ ReportOutput (
);
struct _UNIT_TEST_STATUS_STRING {
- UNIT_TEST_STATUS Status;
- CHAR8 *String;
+ UNIT_TEST_STATUS Status;
+ CHAR8 *String;
};
struct _UNIT_TEST_FAILURE_TYPE_STRING {
- FAILURE_TYPE Type;
- CHAR8 *String;
+ FAILURE_TYPE Type;
+ CHAR8 *String;
};
struct _UNIT_TEST_STATUS_STRING mStatusStrings[] = {
- { UNIT_TEST_PASSED, "PASSED"},
- { UNIT_TEST_ERROR_PREREQUISITE_NOT_MET, "NOT RUN - PREREQUISITE FAILED"},
- { UNIT_TEST_ERROR_TEST_FAILED, "FAILED"},
- { UNIT_TEST_RUNNING, "RUNNING"},
- { UNIT_TEST_PENDING, "PENDING"},
- { 0, "**UNKNOWN**"}
+ { UNIT_TEST_PASSED, "PASSED" },
+ { UNIT_TEST_ERROR_PREREQUISITE_NOT_MET, "NOT RUN - PREREQUISITE FAILED" },
+ { UNIT_TEST_ERROR_TEST_FAILED, "FAILED" },
+ { UNIT_TEST_RUNNING, "RUNNING" },
+ { UNIT_TEST_PENDING, "PENDING" },
+ { 0, "**UNKNOWN**" }
};
-struct _UNIT_TEST_FAILURE_TYPE_STRING mFailureTypeStrings[] = {
- { FAILURETYPE_NOFAILURE, "NO FAILURE"},
- { FAILURETYPE_OTHER, "OTHER FAILURE"},
- { FAILURETYPE_ASSERTTRUE, "ASSERT_TRUE FAILURE"},
- { FAILURETYPE_ASSERTFALSE, "ASSERT_FALSE FAILURE"},
- { FAILURETYPE_ASSERTEQUAL, "ASSERT_EQUAL FAILURE"},
- { FAILURETYPE_ASSERTNOTEQUAL, "ASSERT_NOTEQUAL FAILURE"},
- { FAILURETYPE_ASSERTNOTEFIERROR, "ASSERT_NOTEFIERROR FAILURE"},
- { FAILURETYPE_ASSERTSTATUSEQUAL, "ASSERT_STATUSEQUAL FAILURE"},
- { FAILURETYPE_ASSERTNOTNULL, "ASSERT_NOTNULL FAILURE"},
- { FAILURETYPE_EXPECTASSERT, "EXPECT_ASSERT FAILURE"},
- { 0, "*UNKNOWN* Failure"}
+struct _UNIT_TEST_FAILURE_TYPE_STRING mFailureTypeStrings[] = {
+ { FAILURETYPE_NOFAILURE, "NO FAILURE" },
+ { FAILURETYPE_OTHER, "OTHER FAILURE" },
+ { FAILURETYPE_ASSERTTRUE, "ASSERT_TRUE FAILURE" },
+ { FAILURETYPE_ASSERTFALSE, "ASSERT_FALSE FAILURE" },
+ { FAILURETYPE_ASSERTEQUAL, "ASSERT_EQUAL FAILURE" },
+ { FAILURETYPE_ASSERTNOTEQUAL, "ASSERT_NOTEQUAL FAILURE" },
+ { FAILURETYPE_ASSERTNOTEFIERROR, "ASSERT_NOTEFIERROR FAILURE" },
+ { FAILURETYPE_ASSERTSTATUSEQUAL, "ASSERT_STATUSEQUAL FAILURE" },
+ { FAILURETYPE_ASSERTNOTNULL, "ASSERT_NOTNULL FAILURE" },
+ { FAILURETYPE_EXPECTASSERT, "EXPECT_ASSERT FAILURE" },
+ { 0, "*UNKNOWN* Failure" }
};
//
@@ -60,7 +60,7 @@ struct _UNIT_TEST_FAILURE_TYPE_STRING mFailureTypeStrings[] = {
//
STATIC
-CONST CHAR8*
+CONST CHAR8 *
GetStringForUnitTestStatus (
IN UNIT_TEST_STATUS Status
)
@@ -75,6 +75,7 @@ GetStringForUnitTestStatus (
return mStatusStrings[Index].String;
}
}
+
//
// Return last entry if no match found.
//
@@ -82,7 +83,7 @@ GetStringForUnitTestStatus (
}
STATIC
-CONST CHAR8*
+CONST CHAR8 *
GetStringForFailureType (
IN FAILURE_TYPE Failure
)
@@ -97,10 +98,11 @@ GetStringForFailureType (
return mFailureTypeStrings[Index].String;
}
}
+
//
// 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;
}
@@ -128,7 +130,7 @@ OutputUnitTestFrameworkReport (
Passed = 0;
Failed = 0;
NotRun = 0;
- Suite = NULL;
+ Suite = NULL;
Framework = (UNIT_TEST_FRAMEWORK *)FrameworkHandle;
if (Framework == NULL) {
@@ -139,16 +141,16 @@ OutputUnitTestFrameworkReport (
ReportPrint ("------------- UNIT TEST FRAMEWORK RESULTS ---------------\n");
ReportPrint ("---------------------------------------------------------\n");
- //print the version and time
+ // print the version and time
//
// Iterate all suites
//
- for (Suite = (UNIT_TEST_SUITE_LIST_ENTRY*)GetFirstNode(&Framework->TestSuiteList);
- (LIST_ENTRY*)Suite != &Framework->TestSuiteList;
- Suite = (UNIT_TEST_SUITE_LIST_ENTRY*)GetNextNode(&Framework->TestSuiteList, (LIST_ENTRY*)Suite)) {
-
- Test = NULL;
+ for (Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetFirstNode (&Framework->TestSuiteList);
+ (LIST_ENTRY *)Suite != &Framework->TestSuiteList;
+ Suite = (UNIT_TEST_SUITE_LIST_ENTRY *)GetNextNode (&Framework->TestSuiteList, (LIST_ENTRY *)Suite))
+ {
+ Test = NULL;
SPassed = 0;
SFailed = 0;
SNotRun = 0;
@@ -161,10 +163,10 @@ OutputUnitTestFrameworkReport (
//
// Iterate all tests within the suite
//
- for (Test = (UNIT_TEST_LIST_ENTRY*)GetFirstNode(&(Suite->UTS.TestCaseList));
- (LIST_ENTRY*)Test != &(Suite->UTS.TestCaseList);
- Test = (UNIT_TEST_LIST_ENTRY*)GetNextNode(&(Suite->UTS.TestCaseList), (LIST_ENTRY*)Test)) {
-
+ for (Test = (UNIT_TEST_LIST_ENTRY *)GetFirstNode (&(Suite->UTS.TestCaseList));
+ (LIST_ENTRY *)Test != &(Suite->UTS.TestCaseList);
+ Test = (UNIT_TEST_LIST_ENTRY *)GetNextNode (&(Suite->UTS.TestCaseList), (LIST_ENTRY *)Test))
+ {
ReportPrint ("*********************************************************\n");
ReportPrint (" CLASS NAME: %a\n", Test->UT.Name);
ReportPrint (" TEST: %a\n", Test->UT.Description);
@@ -178,41 +180,42 @@ OutputUnitTestFrameworkReport (
}
switch (Test->UT.Result) {
- case UNIT_TEST_PASSED:
- SPassed++;
- break;
- case UNIT_TEST_ERROR_TEST_FAILED:
- SFailed++;
- break;
- case UNIT_TEST_PENDING: // Fall through...
- case UNIT_TEST_RUNNING: // Fall through...
- case UNIT_TEST_ERROR_PREREQUISITE_NOT_MET:
- SNotRun++;
- break;
- default:
- break;
+ case UNIT_TEST_PASSED:
+ SPassed++;
+ break;
+ case UNIT_TEST_ERROR_TEST_FAILED:
+ SFailed++;
+ break;
+ case UNIT_TEST_PENDING: // Fall through...
+ case UNIT_TEST_RUNNING: // Fall through...
+ case UNIT_TEST_ERROR_PREREQUISITE_NOT_MET:
+ SNotRun++;
+ break;
+ default:
+ break;
}
+
ReportPrint ("**********************************************************\n");
- } //End Test iteration
+ } // End Test iteration
ReportPrint ("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
ReportPrint ("Suite Stats\n");
ReportPrint (" Passed: %d (%d%%)\n", SPassed, (SPassed * 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 ("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" );
+ ReportPrint ("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
- Passed += SPassed; //add to global counters
- Failed += SFailed; //add to global counters
- NotRun += SNotRun; //add to global counters
- }//End Suite iteration
+ Passed += SPassed; // add to global counters
+ Failed += SFailed; // add to global counters
+ NotRun += SNotRun; // add to global counters
+ }// End Suite iteration
ReportPrint ("=========================================================\n");
ReportPrint ("Total Stats\n");
ReportPrint (" Passed: %d (%d%%)\n", Passed, (Passed * 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 ("=========================================================\n" );
+ ReportPrint ("=========================================================\n");
return EFI_SUCCESS;
}
diff --git a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.c b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.c
index db5402d6a2..aba00fe7b9 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.c
@@ -29,6 +29,7 @@ ReportPrint (
} else {
gST->ConOut->OutputString (gST->ConOut, String);
}
+
VA_END (Marker);
}
diff --git a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibDebugLib.c b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibDebugLib.c
index 1d62c6a371..ac330861fd 100644
--- a/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibDebugLib.c
+++ b/UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibDebugLib.c
@@ -28,6 +28,7 @@ ReportPrint (
} else {
DEBUG ((DEBUG_INFO, String));
}
+
VA_END (Marker);
}
diff --git a/UnitTestFrameworkPkg/PrivateInclude/Library/UnitTestPersistenceLib.h b/UnitTestFrameworkPkg/PrivateInclude/Library/UnitTestPersistenceLib.h
index af19ba8f53..be29e079ec 100644
--- a/UnitTestFrameworkPkg/PrivateInclude/Library/UnitTestPersistenceLib.h
+++ b/UnitTestFrameworkPkg/PrivateInclude/Library/UnitTestPersistenceLib.h
@@ -14,7 +14,7 @@
#include <UnitTestFrameworkTypes.h>
-#define UNIT_TEST_PERSISTENCE_LIB_VERSION 1
+#define UNIT_TEST_PERSISTENCE_LIB_VERSION 1
/**
Determines whether a persistence cache already exists for
diff --git a/UnitTestFrameworkPkg/PrivateInclude/UnitTestFrameworkTypes.h b/UnitTestFrameworkPkg/PrivateInclude/UnitTestFrameworkTypes.h
index b0e2f61bbf..adce413818 100644
--- a/UnitTestFrameworkPkg/PrivateInclude/UnitTestFrameworkTypes.h
+++ b/UnitTestFrameworkPkg/PrivateInclude/UnitTestFrameworkTypes.h
@@ -15,14 +15,14 @@
///
/// The maximum length of a string stored in the unit test framework
///
-#define UNIT_TEST_MAX_STRING_LENGTH (120)
+#define UNIT_TEST_MAX_STRING_LENGTH (120)
///
/// The size of a firngerprint used to save/resume execution of a unit test
/// framework. This is the size of a CRC32 value which is 32-bit value.
///
///
-#define UNIT_TEST_FINGERPRINT_SIZE (sizeof (UINT32))
+#define UNIT_TEST_FINGERPRINT_SIZE (sizeof (UINT32))
///
/// The maximum length of a test failure message stored in the unit test
@@ -35,55 +35,55 @@
/// test.
///
typedef UINT32 FAILURE_TYPE;
-#define FAILURETYPE_NOFAILURE (0)
-#define FAILURETYPE_OTHER (1)
-#define FAILURETYPE_ASSERTTRUE (2)
-#define FAILURETYPE_ASSERTFALSE (3)
-#define FAILURETYPE_ASSERTEQUAL (4)
-#define FAILURETYPE_ASSERTNOTEQUAL (5)
-#define FAILURETYPE_ASSERTNOTEFIERROR (6)
-#define FAILURETYPE_ASSERTSTATUSEQUAL (7)
-#define FAILURETYPE_ASSERTNOTNULL (8)
-#define FAILURETYPE_EXPECTASSERT (9)
+#define FAILURETYPE_NOFAILURE (0)
+#define FAILURETYPE_OTHER (1)
+#define FAILURETYPE_ASSERTTRUE (2)
+#define FAILURETYPE_ASSERTFALSE (3)
+#define FAILURETYPE_ASSERTEQUAL (4)
+#define FAILURETYPE_ASSERTNOTEQUAL (5)
+#define FAILURETYPE_ASSERTNOTEFIERROR (6)
+#define FAILURETYPE_ASSERTSTATUSEQUAL (7)
+#define FAILURETYPE_ASSERTNOTNULL (8)
+#define FAILURETYPE_EXPECTASSERT (9)
///
/// Unit Test context structure tracked by the unit test framework.
///
typedef struct {
- CHAR8 *Description;
- CHAR8 *Name; //can't have spaces and should be short
- CHAR8 *Log;
- FAILURE_TYPE FailureType;
- CHAR8 FailureMessage[UNIT_TEST_TESTFAILUREMSG_LENGTH];
- UINT8 Fingerprint[UNIT_TEST_FINGERPRINT_SIZE];
- UNIT_TEST_STATUS Result;
- UNIT_TEST_FUNCTION RunTest;
- UNIT_TEST_PREREQUISITE Prerequisite;
- UNIT_TEST_CLEANUP CleanUp;
- UNIT_TEST_CONTEXT Context;
- UNIT_TEST_SUITE_HANDLE ParentSuite;
+ CHAR8 *Description;
+ CHAR8 *Name; // can't have spaces and should be short
+ CHAR8 *Log;
+ FAILURE_TYPE FailureType;
+ CHAR8 FailureMessage[UNIT_TEST_TESTFAILUREMSG_LENGTH];
+ UINT8 Fingerprint[UNIT_TEST_FINGERPRINT_SIZE];
+ UNIT_TEST_STATUS Result;
+ UNIT_TEST_FUNCTION RunTest;
+ UNIT_TEST_PREREQUISITE Prerequisite;
+ UNIT_TEST_CLEANUP CleanUp;
+ UNIT_TEST_CONTEXT Context;
+ UNIT_TEST_SUITE_HANDLE ParentSuite;
} UNIT_TEST;
///
/// Structure used to store the set of unit tests in a unit test suite as a list.
///
typedef struct {
- LIST_ENTRY Entry;
- UNIT_TEST UT;
+ LIST_ENTRY Entry;
+ UNIT_TEST UT;
} UNIT_TEST_LIST_ENTRY;
///
/// Unit Test Suite context structure tracked by the unit test framework.
///
typedef struct {
- UINTN NumTests;
- CHAR8 *Title;
- CHAR8 *Name;
- UINT8 Fingerprint[UNIT_TEST_FINGERPRINT_SIZE];
- UNIT_TEST_SUITE_SETUP Setup;
- UNIT_TEST_SUITE_TEARDOWN Teardown;
- LIST_ENTRY TestCaseList; // UNIT_TEST_LIST_ENTRY
- UNIT_TEST_FRAMEWORK_HANDLE ParentFramework;
+ UINTN NumTests;
+ CHAR8 *Title;
+ CHAR8 *Name;
+ UINT8 Fingerprint[UNIT_TEST_FINGERPRINT_SIZE];
+ UNIT_TEST_SUITE_SETUP Setup;
+ UNIT_TEST_SUITE_TEARDOWN Teardown;
+ LIST_ENTRY TestCaseList; // UNIT_TEST_LIST_ENTRY
+ UNIT_TEST_FRAMEWORK_HANDLE ParentFramework;
} UNIT_TEST_SUITE;
///
@@ -91,57 +91,57 @@ typedef struct {
/// as a list.
///
typedef struct {
- LIST_ENTRY Entry;
- UNIT_TEST_SUITE UTS;
+ LIST_ENTRY Entry;
+ UNIT_TEST_SUITE UTS;
} UNIT_TEST_SUITE_LIST_ENTRY;
///
/// Unit Test Framework context structure tracked by the unit test framework.
///
typedef struct {
- CHAR8 *Title;
- CHAR8 *ShortTitle; // This title should contain NO spaces or non-filename characters. Is used in reporting and serialization.
- CHAR8 *VersionString;
- CHAR8 *Log;
- UINT8 Fingerprint[UNIT_TEST_FINGERPRINT_SIZE];
- LIST_ENTRY TestSuiteList; // UNIT_TEST_SUITE_LIST_ENTRY
- EFI_TIME StartTime;
- EFI_TIME EndTime;
- UNIT_TEST *CurrentTest;
- VOID *SavedState; // This is an instance of UNIT_TEST_SAVE_HEADER*, if present.
+ CHAR8 *Title;
+ CHAR8 *ShortTitle; // This title should contain NO spaces or non-filename characters. Is used in reporting and serialization.
+ CHAR8 *VersionString;
+ CHAR8 *Log;
+ UINT8 Fingerprint[UNIT_TEST_FINGERPRINT_SIZE];
+ LIST_ENTRY TestSuiteList; // UNIT_TEST_SUITE_LIST_ENTRY
+ EFI_TIME StartTime;
+ EFI_TIME EndTime;
+ UNIT_TEST *CurrentTest;
+ VOID *SavedState; // This is an instance of UNIT_TEST_SAVE_HEADER*, if present.
} UNIT_TEST_FRAMEWORK;
///
/// Serialized version of a unit test
///
typedef struct {
- UINT32 Size; // Size of the UNIT_TEST_SAVE_TEST including Log[]
- UINT8 Fingerprint[UNIT_TEST_FINGERPRINT_SIZE]; // Fingerprint of the test itself.
- CHAR8 FailureMessage[UNIT_TEST_TESTFAILUREMSG_LENGTH];
- FAILURE_TYPE FailureType;
- UNIT_TEST_STATUS Result;
- CHAR8 Log[];
+ UINT32 Size; // Size of the UNIT_TEST_SAVE_TEST including Log[]
+ UINT8 Fingerprint[UNIT_TEST_FINGERPRINT_SIZE]; // Fingerprint of the test itself.
+ CHAR8 FailureMessage[UNIT_TEST_TESTFAILUREMSG_LENGTH];
+ FAILURE_TYPE FailureType;
+ UNIT_TEST_STATUS Result;
+ CHAR8 Log[];
} UNIT_TEST_SAVE_TEST;
///
/// Serialized version of a unit test context
///
typedef struct {
- UINT32 Size; // Size of the UNIT_TEST_SAVE_CONTEXT including Data[]
- UINT8 Fingerprint[UNIT_TEST_FINGERPRINT_SIZE]; // Fingerprint of the corresponding test.
- UINT8 Data[]; // Actual data of the context.
+ UINT32 Size; // Size of the UNIT_TEST_SAVE_CONTEXT including Data[]
+ UINT8 Fingerprint[UNIT_TEST_FINGERPRINT_SIZE]; // Fingerprint of the corresponding test.
+ UINT8 Data[]; // Actual data of the context.
} UNIT_TEST_SAVE_CONTEXT;
///
/// Serialized version of unit test framework
///
typedef struct {
- UINT8 Version;
- UINT32 SaveStateSize; // Size of the entire serialized buffer.
- UINT8 Fingerprint[UNIT_TEST_FINGERPRINT_SIZE]; // Fingerprint of the framework that has been saved.
- EFI_TIME StartTime;
- UINT32 TestCount;
- BOOLEAN HasSavedContext;
+ UINT8 Version;
+ UINT32 SaveStateSize; // Size of the entire serialized buffer.
+ UINT8 Fingerprint[UNIT_TEST_FINGERPRINT_SIZE]; // Fingerprint of the framework that has been saved.
+ EFI_TIME StartTime;
+ UINT32 TestCount;
+ BOOLEAN HasSavedContext;
// UNIT_TEST_SAVE_TEST Tests[]; // Array of structures starts here.
// UNIT_TEST_SAVE_CONTEXT SavedContext[]; // Saved context for the currently running test.
// CHAR8 Log[]; // NOTE: Not yet implemented!!
diff --git a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTest/SampleUnitTest.c b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTest/SampleUnitTest.c
index cb50f45391..c02a2dba98 100644
--- a/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTest/SampleUnitTest.c
+++ b/UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTest/SampleUnitTest.c
@@ -664,14 +664,14 @@ UefiTestMain (
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.
//
Status = InitUnitTestFramework (&Framework, UNIT_TEST_NAME, gEfiCallerBaseName, UNIT_TEST_VERSION);
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;
}
@@ -684,6 +684,7 @@ UefiTestMain (
Status = EFI_OUT_OF_RESOURCES;
goto EXIT;
}
+
AddTestCase (SimpleMathTests, "Adding 1 to 1 should produce 2", "Addition", OnePlusOneShouldEqualTwo, NULL, NULL, NULL);
//
@@ -695,6 +696,7 @@ UefiTestMain (
Status = EFI_OUT_OF_RESOURCES;
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 pointer", "Pointer", GlobalPointerShouldBeChangeable, MakeSureThatPointerIsNull, ClearThePointer, NULL);
@@ -707,19 +709,20 @@ UefiTestMain (
Status = EFI_OUT_OF_RESOURCES;
goto EXIT;
}
- 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_EQUAL() macro", "MacroUtAssertEqual", MacroUtAssertEqual, NULL, NULL, NULL);
- AddTestCase (MacroTestsAssertsEnabled, "Test UT_ASSERT_MEM_EQUAL() macro", "MacroUtAssertMemEqual", MacroUtAssertMemEqual, NULL, NULL, NULL);
- AddTestCase (MacroTestsAssertsEnabled, "Test UT_ASSERT_NOT_EQUAL() macro", "MacroUtAssertNotEqual", MacroUtAssertNotEqual, NULL, NULL, NULL);
- AddTestCase (MacroTestsAssertsEnabled, "Test UT_ASSERT_NOT_EFI_ERROR() macro", "MacroUtAssertNotEfiError", MacroUtAssertNotEfiError, NULL, NULL, NULL);
- AddTestCase (MacroTestsAssertsEnabled, "Test UT_ASSERT_STATUS_EQUAL() macro", "MacroUtAssertStatusEqual", MacroUtAssertStatusEqual, NULL, NULL, NULL);
- AddTestCase (MacroTestsAssertsEnabled, "Test UT_ASSERT_NOT_NULL() macro", "MacroUtAssertNotNull", MacroUtAssertNotNull, 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_EQUAL() macro", "MacroUtAssertEqual", MacroUtAssertEqual, NULL, NULL, NULL);
+ AddTestCase (MacroTestsAssertsEnabled, "Test UT_ASSERT_MEM_EQUAL() macro", "MacroUtAssertMemEqual", MacroUtAssertMemEqual, NULL, NULL, NULL);
+ AddTestCase (MacroTestsAssertsEnabled, "Test UT_ASSERT_NOT_EQUAL() macro", "MacroUtAssertNotEqual", MacroUtAssertNotEqual, NULL, NULL, NULL);
+ AddTestCase (MacroTestsAssertsEnabled, "Test UT_ASSERT_NOT_EFI_ERROR() macro", "MacroUtAssertNotEfiError", MacroUtAssertNotEfiError, NULL, NULL, NULL);
+ AddTestCase (MacroTestsAssertsEnabled, "Test UT_ASSERT_STATUS_EQUAL() macro", "MacroUtAssertStatusEqual", MacroUtAssertStatusEqual, NULL, NULL, NULL);
+ AddTestCase (MacroTestsAssertsEnabled, "Test UT_ASSERT_NOT_NULL() macro", "MacroUtAssertNotNull", MacroUtAssertNotNull, NULL, NULL, NULL);
AddTestCase (MacroTestsAssertsEnabled, "Test UT_EXPECT_ASSERT_FAILURE() macro", "MacroUtExpectAssertFailure", MacroUtExpectAssertFailure, NULL, NULL, NULL);
- AddTestCase (MacroTestsAssertsEnabled, "Test UT_LOG_ERROR() macro", "MacroUtLogError", MacroUtLogError, NULL, NULL, NULL);
+ AddTestCase (MacroTestsAssertsEnabled, "Test UT_LOG_ERROR() macro", "MacroUtLogError", MacroUtLogError, NULL, NULL, NULL);
AddTestCase (MacroTestsAssertsEnabled, "Test UT_LOG_WARNING() macro", "MacroUtLogWarning", MacroUtLogWarning, NULL, NULL, NULL);
- AddTestCase (MacroTestsAssertsEnabled, "Test UT_LOG_INFO() macro", "MacroUtLogInfo", MacroUtLogInfo, NULL, NULL, NULL);
+ AddTestCase (MacroTestsAssertsEnabled, "Test UT_LOG_INFO() macro", "MacroUtLogInfo", MacroUtLogInfo, NULL, NULL, NULL);
AddTestCase (MacroTestsAssertsEnabled, "Test UT_LOG_VERBOSE() macro", "MacroUtLogVerbose", MacroUtLogVerbose, NULL, NULL, NULL);
//
@@ -731,19 +734,20 @@ UefiTestMain (
Status = EFI_OUT_OF_RESOURCES;
goto EXIT;
}
- 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_EQUAL() macro", "MacroUtAssertEqual", MacroUtAssertEqual, NULL, NULL, NULL);
- AddTestCase (MacroTestsAssertsDisabled, "Test UT_ASSERT_MEM_EQUAL() macro", "MacroUtAssertMemEqual", MacroUtAssertMemEqual, NULL, NULL, NULL);
- AddTestCase (MacroTestsAssertsDisabled, "Test UT_ASSERT_NOT_EQUAL() macro", "MacroUtAssertNotEqual", MacroUtAssertNotEqual, NULL, NULL, NULL);
- AddTestCase (MacroTestsAssertsDisabled, "Test UT_ASSERT_NOT_EFI_ERROR() macro", "MacroUtAssertNotEfiError", MacroUtAssertNotEfiError, NULL, NULL, NULL);
- AddTestCase (MacroTestsAssertsDisabled, "Test UT_ASSERT_STATUS_EQUAL() macro", "MacroUtAssertStatusEqual", MacroUtAssertStatusEqual, NULL, NULL, NULL);
- AddTestCase (MacroTestsAssertsDisabled, "Test UT_ASSERT_NOT_NULL() macro", "MacroUtAssertNotNull", MacroUtAssertNotNull, 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_EQUAL() macro", "MacroUtAssertEqual", MacroUtAssertEqual, NULL, NULL, NULL);
+ AddTestCase (MacroTestsAssertsDisabled, "Test UT_ASSERT_MEM_EQUAL() macro", "MacroUtAssertMemEqual", MacroUtAssertMemEqual, NULL, NULL, NULL);
+ AddTestCase (MacroTestsAssertsDisabled, "Test UT_ASSERT_NOT_EQUAL() macro", "MacroUtAssertNotEqual", MacroUtAssertNotEqual, NULL, NULL, NULL);
+ AddTestCase (MacroTestsAssertsDisabled, "Test UT_ASSERT_NOT_EFI_ERROR() macro", "MacroUtAssertNotEfiError", MacroUtAssertNotEfiError, NULL, NULL, NULL);
+ AddTestCase (MacroTestsAssertsDisabled, "Test UT_ASSERT_STATUS_EQUAL() macro", "MacroUtAssertStatusEqual", MacroUtAssertStatusEqual, NULL, NULL, NULL);
+ AddTestCase (MacroTestsAssertsDisabled, "Test UT_ASSERT_NOT_NULL() macro", "MacroUtAssertNotNull", MacroUtAssertNotNull, NULL, NULL, NULL);
AddTestCase (MacroTestsAssertsDisabled, "Test UT_EXPECT_ASSERT_FAILURE() macro", "MacroUtExpectAssertFailure", MacroUtExpectAssertFailure, NULL, NULL, NULL);
- AddTestCase (MacroTestsAssertsDisabled, "Test UT_LOG_ERROR() macro", "MacroUtLogError", MacroUtLogError, NULL, NULL, NULL);
+ AddTestCase (MacroTestsAssertsDisabled, "Test UT_LOG_ERROR() macro", "MacroUtLogError", MacroUtLogError, NULL, NULL, NULL);
AddTestCase (MacroTestsAssertsDisabled, "Test UT_LOG_WARNING() macro", "MacroUtLogWarning", MacroUtLogWarning, NULL, NULL, NULL);
- AddTestCase (MacroTestsAssertsDisabled, "Test UT_LOG_INFO() macro", "MacroUtLogInfo", MacroUtLogInfo, NULL, NULL, NULL);
+ AddTestCase (MacroTestsAssertsDisabled, "Test UT_LOG_INFO() macro", "MacroUtLogInfo", MacroUtLogInfo, NULL, NULL, NULL);
AddTestCase (MacroTestsAssertsDisabled, "Test UT_LOG_VERBOSE() macro", "MacroUtLogVerbose", MacroUtLogVerbose, NULL, NULL, NULL);
//
@@ -791,8 +795,8 @@ DxeEntryPoint (
**/
int
main (
- int argc,
- char *argv[]
+ int argc,
+ char *argv[]
)
{
return UefiTestMain ();