From ac99686e13a6d55770e3308c49b7570ba5f16fd2 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Tue, 22 Jun 2021 09:04:24 -0400 Subject: [PATCH] Partial #596, UtAssert macros for ES test Update ES coverage test to use preferred macros. Adds dedicated assert macros for checking fixed-length string buffers, and for checking memory offsets. Also adds an improved implemention of the syslog/printf check which filters out newlines (keeps log more parseable). --- .../core_private/ut-stubs/inc/ut_support.h | 83 +- .../core_private/ut-stubs/src/ut_support.c | 129 ++ modules/es/ut-coverage/es_UT.c | 1944 ++++++----------- 3 files changed, 907 insertions(+), 1249 deletions(-) diff --git a/modules/core_private/ut-stubs/inc/ut_support.h b/modules/core_private/ut-stubs/inc/ut_support.h index 0c6ca99c5..b14ca27f7 100644 --- a/modules/core_private/ut-stubs/inc/ut_support.h +++ b/modules/core_private/ut-stubs/inc/ut_support.h @@ -648,6 +648,44 @@ void UT_AddSubTest(void (*Test)(void), void (*Setup)(void), void (*Teardown)(voi bool CFE_UtAssert_SuccessCheck_Impl(CFE_Status_t Status, UtAssert_CaseType_t CaseType, const char *File, uint32 Line, const char *Text); +/*****************************************************************************/ +/** +** \brief Helper function for message check (printf/syslog) verifications +** +** \par Description +** This helper function wraps the normal UtAssert function, intended for verifying +** CFE API calls that are expected to generate printf or syslog messages. This +** includes the actual message in the log, but scrubs it for newlines and other +** items that may affect the ability to parse the log file via a script. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns Test pass status, returns true if status was successful, false if it failed. +** +******************************************************************************/ +bool CFE_UtAssert_MessageCheck_Impl(bool Status, const char *File, uint32 Line, const char *Desc, + const char *FormatString); + +/*****************************************************************************/ +/** +** \brief Helper function for string buffer check verifications +** +** \par Description +** This helper function wraps the normal UtAssert function, intended for verifying +** the contents of string buffer(s). This also includes the actual message in the log, +** but scrubs it for newlines and other items that may affect the ability to parse +** the log file via a script. +** +** \par Assumptions, External Events, and Notes: +** None +** +** \returns Test pass status, returns true if status was successful, false if it failed. +** +******************************************************************************/ +bool CFE_UtAssert_StringBufCheck_Impl(const char *String1, size_t String1Max, const char *String2, size_t String2Max, + const char *File, uint32 Line); + /*****************************************************************************/ /** ** \brief Helper function for generic unsigned integer value checks @@ -860,9 +898,8 @@ bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Comp ** is potentially useful to confirm a specific code path was followed. ** ******************************************************************************/ -#define CFE_UtAssert_SYSLOG(str) \ - CFE_UtAssert_GenericSignedCompare_Impl(UT_SyslogIsInHistory(str), CFE_UtAssert_Compare_GT, 0, __FILE__, __LINE__, \ - "Syslog generated: ", #str, "") +#define CFE_UtAssert_SYSLOG(str) \ + CFE_UtAssert_MessageCheck_Impl(UT_SyslogIsInHistory(str), __FILE__, __LINE__, "Syslog generated: ", str) /*****************************************************************************/ /** @@ -876,9 +913,8 @@ bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Comp ** is potentially useful to confirm a specific code path was followed. ** ******************************************************************************/ -#define CFE_UtAssert_PRINTF(str) \ - CFE_UtAssert_GenericSignedCompare_Impl(UT_PrintfIsInHistory(str), CFE_UtAssert_Compare_GT, 0, __FILE__, __LINE__, \ - "Printf generated: ", #str, "") +#define CFE_UtAssert_PRINTF(str) \ + CFE_UtAssert_MessageCheck_Impl(UT_PrintfIsInHistory(str), __FILE__, __LINE__, "Printf generated: ", str) /*****************************************************************************/ /** @@ -927,4 +963,39 @@ bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Comp CFE_RESOURCEID_TO_ULONG(id2), __FILE__, __LINE__, \ "Resource ID Check: ", #id1, #id2) +/*****************************************************************************/ +/** +** \brief Macro to check CFE memory size/offset for equality +** +** \par Description +** A macro that checks two memory offset/size values for equality. +** +** \par Assumptions, External Events, and Notes: +** This is a simple unsigned comparison which logs the values as hexadecimal +** +******************************************************************************/ +#define CFE_UtAssert_MEMOFFSET_EQ(off1, off2) \ + CFE_UtAssert_GenericUnsignedCompare_Impl(off1, CFE_UtAssert_Compare_EQ, off2, __FILE__, __LINE__, \ + "Offset Check: ", #off1, #off2) + +/*****************************************************************************/ +/** +** \brief Macro to check string buffers for equality +** +** \par Description +** A macro that checks two string buffers for equality. Both buffer maximum sizes are explicitly +** specified, so that strings may reside in a fixed length buffer. The function will never +** check beyond the specified length, regardless of termination. +** +** \par Assumptions, External Events, and Notes: +** The generic #UtAssert_StrCmp macro requires both arguments to be NULL terminated. This also +** includes the actual string in the log, but filters embedded newlines to keep the log clean. +** +** If the string arguments are guaranteed to be NULL terminated and/or the max size is +** not known, then the SIZE_MAX constant may be passed for the respective string. +** +******************************************************************************/ +#define CFE_UtAssert_STRINGBUF_EQ(str1, size1, str2, size2) \ + CFE_UtAssert_StringBufCheck_Impl(str1, size1, str2, size2, __FILE__, __LINE__) + #endif /* UT_SUPPORT_H */ diff --git a/modules/core_private/ut-stubs/src/ut_support.c b/modules/core_private/ut-stubs/src/ut_support.c index d8728e3da..b8820fb77 100644 --- a/modules/core_private/ut-stubs/src/ut_support.c +++ b/modules/core_private/ut-stubs/src/ut_support.c @@ -826,3 +826,132 @@ bool CFE_UtAssert_GenericSignedCompare_Impl(int32 ActualValue, CFE_UtAssert_Comp return UtAssertEx(Result, UTASSERT_CASETYPE_FAILURE, File, Line, "%s%s (%ld) %s %s (%ld)", Desc, ActualText, (long)ActualValue, CFE_UtAssert_GetOpText(CompareType), ReferenceText, (long)ReferenceValue); } + +bool CFE_UtAssert_MessageCheck_Impl(bool Status, const char *File, uint32 Line, const char *Desc, + const char *FormatString) +{ + char ScrubbedFormat[256]; + const char *EndPtr; + size_t FormatLen; + + /* Locate the actual end of the string, but limited to length of local buffer */ + /* Reserve two extra chars for quotes */ + EndPtr = memchr(FormatString, 0, sizeof(ScrubbedFormat) - 2); + if (EndPtr != NULL) + { + FormatLen = EndPtr - FormatString; + } + else + { + FormatLen = sizeof(ScrubbedFormat) - 3; + } + + /* Check for a newline within that range, and if present, end the string there instead */ + EndPtr = memchr(FormatString, '\n', FormatLen); + if (EndPtr != NULL) + { + FormatLen = EndPtr - FormatString; + } + + /* Need to make a copy, as the input string is "const" */ + ScrubbedFormat[0] = '\''; + memcpy(&ScrubbedFormat[1], FormatString, FormatLen); + ScrubbedFormat[FormatLen] = '\''; + ScrubbedFormat[FormatLen + 1] = 0; + + return CFE_UtAssert_GenericSignedCompare_Impl(Status, CFE_UtAssert_Compare_GT, 0, File, Line, Desc, ScrubbedFormat, + ""); +} + +bool CFE_UtAssert_StringBufCheck_Impl(const char *String1, size_t String1Max, const char *String2, size_t String2Max, + const char *File, uint32 Line) +{ + char ScrubbedString1[256]; + char ScrubbedString2[256]; + const char *EndPtr1; + const char *EndPtr2; + size_t FormatLen1; + size_t FormatLen2; + bool Result; + + /* Locate the actual end of both strings */ + if (String1 == NULL) + { + EndPtr1 = NULL; + } + else + { + EndPtr1 = memchr(String1, 0, String1Max); + } + + if (EndPtr1 != NULL) + { + FormatLen1 = EndPtr1 - String1; + } + else + { + FormatLen1 = String1Max; + } + + if (String2 == NULL) + { + EndPtr2 = NULL; + } + else + { + EndPtr2 = memchr(String2, 0, String2Max); + } + + if (EndPtr2 != NULL) + { + FormatLen2 = EndPtr2 - String2; + } + else + { + FormatLen2 = String2Max; + } + + if (FormatLen1 != FormatLen2) + { + /* This means the strings have different termination/length, and therefore must not be equal (content doesn't + * matter) */ + Result = false; + } + else if (FormatLen1 == 0) + { + /* Two empty strings are considered equal */ + Result = true; + } + else + { + /* If the effective lengths are the same, use memcmp to check content */ + Result = (memcmp(String1, String2, FormatLen1) == 0); + } + + /* Now make "safe" copies of the strings */ + /* Check for a newline within the string, and if present, end the string there instead */ + if (FormatLen1 > 0) + { + EndPtr1 = memchr(String1, '\n', FormatLen1); + if (EndPtr1 != NULL) + { + FormatLen1 = EndPtr1 - String1; + } + memcpy(ScrubbedString1, String1, FormatLen1); + } + ScrubbedString1[FormatLen1] = 0; + + if (FormatLen2 > 0) + { + EndPtr2 = memchr(String2, '\n', FormatLen2); + if (EndPtr2 != NULL) + { + FormatLen2 = EndPtr2 - String2; + } + memcpy(ScrubbedString2, String2, FormatLen2); + } + ScrubbedString2[FormatLen2] = 0; + + return UtAssertEx(Result, UTASSERT_CASETYPE_FAILURE, File, Line, "String: \'%s\' == \'%s\'", ScrubbedString1, + ScrubbedString2); +} diff --git a/modules/es/ut-coverage/es_UT.c b/modules/es/ut-coverage/es_UT.c index d430fe261..e35519fe4 100644 --- a/modules/es/ut-coverage/es_UT.c +++ b/modules/es/ut-coverage/es_UT.c @@ -655,7 +655,7 @@ void TestInit(void) UT_SetDummyFuncRtn(OS_SUCCESS); UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); CFE_ES_Main(CFE_PSP_RST_TYPE_POWERON, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1, "ut_startup"); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 0, "CFE_ES_Main", "Normal startup"); + UtAssert_STUB_COUNT(CFE_PSP_Panic, 0); } void TestStartupErrorPaths(void) @@ -693,9 +693,8 @@ void TestStartupErrorPaths(void) UT_SetReadBuffer(StartupScript, strlen(StartupScript)); UT_SetDataBuffer(UT_KEY(CFE_PSP_Panic), &PanicStatus, sizeof(PanicStatus), false); CFE_ES_Main(CFE_PSP_RST_TYPE_POWERON, 1, 1, "ut_startup"); - UT_Report(__FILE__, __LINE__, - PanicStatus == CFE_PSP_PANIC_STARTUP_SEM && UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 1, "CFE_ES_Main", - "Mutex create failure"); + UtAssert_STUB_COUNT(CFE_PSP_Panic, 1); + UtAssert_UINT32_EQ(PanicStatus, CFE_PSP_PANIC_STARTUP_SEM); /* Perform ES main startup with a file open failure */ ES_ResetUnitTest(); @@ -703,8 +702,7 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); CFE_ES_Main(CFE_PSP_RST_TYPE_POWERON, 1, 1, "ut_startup"); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_OPEN_ES_APP_STARTUP]), - "CFE_ES_Main", "File open failure"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CANNOT_OPEN_ES_APP_STARTUP]); /* Perform ES main startup with a startup sync failure */ ES_ResetUnitTest(); @@ -714,28 +712,23 @@ void TestStartupErrorPaths(void) UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, &StateHook); UT_SetReadBuffer(StartupScript, strlen(StartupScript)); CFE_ES_Main(CFE_PSP_RST_TYPE_POWERON, 1, 1, "ut_startup"); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_STARTUP_SYNC_FAIL_1]), "CFE_ES_Main", - "Startup sync failure 1"); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_STARTUP_SYNC_FAIL_2]), "CFE_ES_Main", - "Startup sync failure 2"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_STARTUP_SYNC_FAIL_1]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_STARTUP_SYNC_FAIL_2]); /* Perform a power on reset with a hardware special sub-type */ ES_ResetUnitTest(); CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_POWERON, CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND, 1); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_HW_SPECIAL]), - "CFE_ES_SetupResetVariables", "Power on reset - Hardware special command"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_POR_HW_SPECIAL]); /* Perform a processor reset with a hardware special sub-type */ ES_ResetUnitTest(); CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND, 1); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_PROC_RESET_MAX_HW_SPECIAL]), - "CFE_ES_SetupResetVariables", "Processor reset - hardware special command"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_PROC_RESET_MAX_HW_SPECIAL]); /* Perform a power on reset with an "other cause" sub-type */ ES_ResetUnitTest(); CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_POWERON, -1, 1); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_OTHER]), "CFE_ES_SetupResetVariables", - "Other cause reset"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_POR_OTHER]); /* Perform the maximum number of processor resets */ ES_ResetUnitTest(); @@ -747,28 +740,21 @@ void TestStartupErrorPaths(void) CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); } - UT_Report(__FILE__, __LINE__, - CFE_ES_Global.ResetDataPtr->ResetVars.ProcessorResetCount == CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS, - "CFE_ES_SetupResetVariables", "Maximum processor resets"); + UtAssert_UINT32_EQ(CFE_ES_Global.ResetDataPtr->ResetVars.ProcessorResetCount, CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS); /* Attempt another processor reset after the maximum have occurred */ ES_ResetUnitTest(); UT_SetDataBuffer(UT_KEY(CFE_PSP_Restart), &ResetType, sizeof(ResetType), false); CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); - UT_Report(__FILE__, __LINE__, - CFE_ES_Global.ResetDataPtr->ResetVars.ProcessorResetCount == CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS + 1 && - ResetType == CFE_PSP_RST_TYPE_POWERON && UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, - "CFE_ES_SetupResetVariables", - "Processor reset - power cycle; exceeded maximum " - "processor resets"); + UtAssert_UINT32_EQ(CFE_ES_Global.ResetDataPtr->ResetVars.ProcessorResetCount, + CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS + 1); + UtAssert_UINT32_EQ(ResetType, CFE_PSP_RST_TYPE_POWERON); + UtAssert_STUB_COUNT(CFE_PSP_Restart, 1); /* Perform a power on reset with a hardware special sub-type */ ES_ResetUnitTest(); CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND, 1); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_MAX_HW_SPECIAL]), - "CFE_ES_SetupResetVariables", - "Processor reset - hardware special command; exceeded maximum " - "processor resets"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_POR_MAX_HW_SPECIAL]); /* Perform a processor reset with an reset area failure */ ES_ResetUnitTest(); @@ -776,17 +762,15 @@ void TestStartupErrorPaths(void) UT_SetDataBuffer(UT_KEY(CFE_PSP_Panic), &PanicStatus, sizeof(PanicStatus), false); CFE_ES_Global.ResetDataPtr->ResetVars.ES_CausedReset = true; CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); - UT_Report(__FILE__, __LINE__, - PanicStatus == CFE_PSP_PANIC_MEMORY_ALLOC && UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 1, - "CFE_ES_SetupResetVariables", "Get reset area error"); + UtAssert_UINT32_EQ(PanicStatus, CFE_PSP_PANIC_MEMORY_ALLOC); + UtAssert_STUB_COUNT(CFE_PSP_Panic, 1); /* Perform a processor reset triggered by ES */ /* Added for coverage, as the "panic" case will should not cover this one */ ES_ResetUnitTest(); CFE_ES_Global.ResetDataPtr->ResetVars.ES_CausedReset = true; CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 0, "CFE_ES_SetupResetVariables", - "Processor Reset caused by ES"); + UtAssert_STUB_COUNT(CFE_PSP_Panic, 0); /* Perform a processor reset with the size of the reset area too small */ ES_ResetUnitTest(); @@ -794,9 +778,8 @@ void TestStartupErrorPaths(void) UT_SetDataBuffer(UT_KEY(CFE_PSP_Panic), &PanicStatus, sizeof(PanicStatus), false); UT_SetStatusBSPResetArea(OS_SUCCESS, 0, CFE_TIME_ToneSignalSelect_PRIMARY); CFE_ES_SetupResetVariables(CFE_PSP_RST_TYPE_PROCESSOR, CFE_PSP_RST_SUBTYPE_POWER_CYCLE, 1); - UT_Report(__FILE__, __LINE__, - PanicStatus == CFE_PSP_PANIC_MEMORY_ALLOC && UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 1, - "CFE_ES_SetupResetVariables", "Reset area too small"); + UtAssert_UINT32_EQ(PanicStatus, CFE_PSP_PANIC_MEMORY_ALLOC); + UtAssert_STUB_COUNT(CFE_PSP_Panic, 1); /* Test initialization of the file systems specifying a power on reset * following a failure to create the RAM volume @@ -806,10 +789,8 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(OS_mount), OS_ERROR); UT_SetDefaultReturnValue(UT_KEY(OS_mkfs), OS_ERROR); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_POWERON); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CREATE_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]), - "CFE_ES_InitializeFileSystems", "Power on reset; error creating volatile (RAM) volume"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CREATE_VOLATILE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]); /* prepare the StatBuf to reflect a RAM disk that is 99% full */ StatBuf.block_size = 1024; @@ -825,13 +806,11 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(OS_mkfs), OS_ERROR); UT_SetDataBuffer(UT_KEY(OS_FileSysStatVolume), &StatBuf, sizeof(StatBuf), false); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CREATE_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INIT_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_REFORMAT_VOLATILE]), - "CFE_ES_InitializeFileSystems", "Processor reset; error reformatting volatile (RAM) volume"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CREATE_VOLATILE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_INIT_VOLATILE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_REFORMAT_VOLATILE]); /* Test initialization of the file systems specifying a processor reset * following failure to get the volatile disk memory @@ -840,8 +819,7 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_GetVolatileDiskMem), CFE_PSP_ERROR); UT_SetDataBuffer(UT_KEY(OS_FileSysStatVolume), &StatBuf, sizeof(StatBuf), false); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]), - "CFE_ES_InitializeFileSystems", "Processor reset; cannot get memory for volatile disk"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]); /* Test initialization of the file systems specifying a processor reset * following a failure to remove the RAM volume @@ -850,10 +828,8 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(OS_rmfs), OS_ERROR); UT_SetDataBuffer(UT_KEY(OS_FileSysStatVolume), &StatBuf, sizeof(StatBuf), false); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_REMOVE_VOLATILE]), - "CFE_ES_InitializeFileSystems", "Processor reset; error removing volatile (RAM) volume"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_REMOVE_VOLATILE]); /* Test initialization of the file systems specifying a processor reset * following a failure to unmount the RAM volume @@ -862,16 +838,13 @@ void TestStartupErrorPaths(void) UT_SetDeferredRetcode(UT_KEY(OS_unmount), 1, -1); UT_SetDataBuffer(UT_KEY(OS_FileSysStatVolume), &StatBuf, sizeof(StatBuf), false); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_UNMOUNT_VOLATILE]), - "CFE_ES_InitializeFileSystems", "Processor reset; error unmounting volatile (RAM) volume"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_UNMOUNT_VOLATILE]); /* Test successful initialization of the file systems */ ES_ResetUnitTest(); CFE_ES_InitializeFileSystems(4564564); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Panic)) == 0, "CFE_ES_InitializeFileSystems", - "Initialize file systems; successful"); + UtAssert_STUB_COUNT(CFE_PSP_Panic, 0); /* Test initialization of the file systems specifying a processor reset * following a failure to remount the RAM volume @@ -880,11 +853,9 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(OS_mount), OS_ERROR); UT_SetDataBuffer(UT_KEY(OS_FileSysStatVolume), &StatBuf, sizeof(StatBuf), false); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_REMOUNT_VOLATILE]), - "CFE_ES_InitializeFileSystems", "Processor reset; error remounting volatile (RAM) volume"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_REMOUNT_VOLATILE]); /* Test initialization of the file systems with an error determining the * number of blocks that are free on the volume @@ -892,8 +863,7 @@ void TestStartupErrorPaths(void) ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_FileSysStatVolume), 1, -1); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_DETERMINE_BLOCKS]), - "CFE_ES_InitializeFileSystems", "Processor reset; error determining blocks free on volume"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_DETERMINE_BLOCKS]); /* Test reading the object table where a record used error occurs */ ES_ResetUnitTest(); @@ -909,8 +879,7 @@ void TestStartupErrorPaths(void) UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); CFE_ES_CreateObjects(); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_RECORD_USED]), "CFE_ES_CreateObjects", - "Record used error"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_RECORD_USED]); /* Test reading the object table where an error occurs when * calling a function @@ -929,10 +898,8 @@ void TestStartupErrorPaths(void) UT_SetDeferredRetcode(UT_KEY(CFE_TBL_EarlyInit), 1, -1); UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); CFE_ES_CreateObjects(); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_RECORD_USED]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_EARLYINIT]), - "CFE_ES_CreateObjects", "Error returned when calling function"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_RECORD_USED]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_EARLYINIT]); /* Test reading the object table where an error occurs when * creating a core app @@ -942,33 +909,28 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(OS_BinSemCreate), OS_ERROR); UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); CFE_ES_CreateObjects(); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CORE_APP_CREATE]), "CFE_ES_CreateObjects", - "Error creating core application"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CORE_APP_CREATE]); /* Test reading the object table where all app slots are taken */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); CFE_ES_CreateObjects(); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_NO_FREE_CORE_APP_SLOTS]) == 5, - "CFE_ES_CreateObjects", "No free application slots available, message"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_NO_FREE_CORE_APP_SLOTS]); /* Test reading the object table with a NULL function pointer */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); CFE_ES_ObjectTable[1].ObjectType = CFE_ES_FUNCTION_CALL; CFE_ES_CreateObjects(); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_NO_FREE_CORE_APP_SLOTS]) == 5, - "CFE_ES_CreateObjects", "Bad function pointer, app slots message"); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_FUNCTION_POINTER]), - "CFE_ES_CreateObjects", "Bad function pointer message"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_NO_FREE_CORE_APP_SLOTS]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_FUNCTION_POINTER]); /* Test response to an invalid startup type */ ES_ResetUnitTest(); CFE_ES_Global.DebugVars.DebugFlag = 1; CFE_ES_SetupResetVariables(-1, CFE_PSP_RST_SUBTYPE_HW_SPECIAL_COMMAND, 1); - UT_Report(__FILE__, __LINE__, CFE_ES_Global.DebugVars.DebugFlag == 1, "CFE_ES_SetupResetVariables", - "Invalid startup type"); + UtAssert_UINT32_EQ(CFE_ES_Global.DebugVars.DebugFlag, 1); CFE_ES_Global.DebugVars.DebugFlag = 0; /* Test initialization of the file systems specifying a processor reset @@ -979,24 +941,19 @@ void TestStartupErrorPaths(void) UT_SetDefaultReturnValue(UT_KEY(OS_mount), OS_ERROR); UT_SetDataBuffer(UT_KEY(OS_FileSysStatVolume), &StatBuf, sizeof(StatBuf), false); CFE_ES_InitializeFileSystems(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INIT_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_REMOUNT_VOLATILE]), - "CFE_ES_InitializeFileSystems", - "Processor reset; error initializing and mounting volatile " - "(RAM) volume"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_INIT_VOLATILE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_REMOUNT_VOLATILE]); /* Test application sync delay where the operation times out */ ES_ResetUnitTest(); /* This prep is necessary so GetAppId works */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppType_CORE, NULL, &AppRecPtr, NULL); CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_READY; - UT_Report(__FILE__, __LINE__, - CFE_ES_WaitForSystemState(CFE_ES_SystemState_OPERATIONAL, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC) == - CFE_ES_OPERATION_TIMED_OUT, - "CFE_ES_ApplicationSyncDelay", "Operation timed out"); + UtAssert_INT32_EQ( + CFE_ES_WaitForSystemState(CFE_ES_SystemState_OPERATIONAL, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC), + CFE_ES_OPERATION_TIMED_OUT); /* Test startup sync with alternate minimum system state * of CFE_ES_SystemState_SHUTDOWN @@ -1005,11 +962,10 @@ void TestStartupErrorPaths(void) /* This prep is necessary so GetAppId works */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppType_CORE, NULL, &AppRecPtr, NULL); CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_READY; - UT_Report(__FILE__, __LINE__, - CFE_ES_WaitForSystemState(CFE_ES_SystemState_SHUTDOWN, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC) == - CFE_ES_OPERATION_TIMED_OUT && - AppRecPtr->AppState == CFE_ES_AppState_STOPPED, - "CFE_ES_WaitForSystemState", "Min System State is CFE_ES_SystemState_SHUTDOWN"); + UtAssert_INT32_EQ( + CFE_ES_WaitForSystemState(CFE_ES_SystemState_SHUTDOWN, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC), + CFE_ES_OPERATION_TIMED_OUT); + UtAssert_UINT32_EQ(AppRecPtr->AppState, CFE_ES_AppState_STOPPED); /* Test startup sync with alternate minimum system state * of CFE_ES_SystemState_APPS_INIT @@ -1019,11 +975,10 @@ void TestStartupErrorPaths(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppType_CORE, NULL, &AppRecPtr, NULL); CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_READY; - UT_Report(__FILE__, __LINE__, - CFE_ES_WaitForSystemState(CFE_ES_SystemState_APPS_INIT, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC) == - CFE_ES_OPERATION_TIMED_OUT && - AppRecPtr->AppState == CFE_ES_AppState_LATE_INIT, - "CFE_ES_WaitForSystemState", "Min System State is CFE_ES_SystemState_APPS_INIT"); + UtAssert_INT32_EQ( + CFE_ES_WaitForSystemState(CFE_ES_SystemState_APPS_INIT, CFE_PLATFORM_ES_STARTUP_SCRIPT_TIMEOUT_MSEC), + CFE_ES_OPERATION_TIMED_OUT); + UtAssert_UINT32_EQ(AppRecPtr->AppState, CFE_ES_AppState_LATE_INIT); /* Test success */ ES_ResetUnitTest(); @@ -1036,7 +991,6 @@ void TestStartupErrorPaths(void) void TestApps(void) { int NumBytes; - int Return; CFE_ES_AppInfo_t AppInfo; CFE_ES_AppId_t AppId; CFE_ES_TaskId_t TaskId; @@ -1062,8 +1016,8 @@ void TestApps(void) NumBytes = strlen(StartupScript); UT_SetReadBuffer(StartupScript, NumBytes); CFE_ES_StartApplications(CFE_PSP_RST_TYPE_PROCESSOR, "ut_startup"); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_FILE_LINE_TOO_LONG])); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN])); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_FILE_LINE_TOO_LONG]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN]); /* Test starting an application where the startup script has extra tokens */ ES_ResetUnitTest(); @@ -1072,8 +1026,8 @@ void TestApps(void) NumBytes = strlen(StartupScript); UT_SetReadBuffer(StartupScript, NumBytes); CFE_ES_StartApplications(CFE_PSP_RST_TYPE_PROCESSOR, "ut_startup"); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_FILE_LINE_TOO_LONG])); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN])); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_FILE_LINE_TOO_LONG]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN]); /* Create a valid startup script for subsequent tests */ strncpy(StartupScript, @@ -1090,10 +1044,8 @@ void TestApps(void) ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_read), 1, -1); CFE_ES_StartApplications(CFE_PSP_RST_TYPE_PROCESSOR, "ut_startup"); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_STARTUP_READ]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN]), - "CFE_ES_StartApplications", "Error reading startup file"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_STARTUP_READ]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN]); /* Test starting an application with an end-of-file returned by the * OS read @@ -1101,96 +1053,82 @@ void TestApps(void) ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_read), 1, 0); CFE_ES_StartApplications(CFE_PSP_RST_TYPE_PROCESSOR, "ut_startup"); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN]), - "CFE_ES_StartApplications", "End of file reached"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN]); /* Test starting an application with an open failure */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); CFE_ES_StartApplications(CFE_PSP_RST_TYPE_PROCESSOR, "ut_startup"); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_OPEN_ES_APP_STARTUP]), - "CFE_ES_StartApplications", "Can't open ES application startup file"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CANNOT_OPEN_ES_APP_STARTUP]); /* Test successfully starting an application */ ES_ResetUnitTest(); UT_SetReadBuffer(StartupScript, NumBytes); UT_SetHookFunction(UT_KEY(OS_TaskCreate), ES_UT_SetAppStateHook, NULL); CFE_ES_StartApplications(CFE_PSP_RST_TYPE_PROCESSOR, "ut_startup"); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN])); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_ES_APP_STARTUP_OPEN]); /* Test parsing the startup script with an unknown entry type */ ES_ResetUnitTest(); { const char *TokenList[] = {"UNKNOWN", "/cf/apps/tst_lib.bundle", "TST_LIB_Init", "TST_LIB", "0", "0", "0x0", "1"}; - UT_Report(__FILE__, __LINE__, CFE_ES_ParseFileEntry(TokenList, 8) == CFE_ES_ERR_APP_CREATE, - "CFE_ES_ParseFileEntry", "Unknown entry type"); + UtAssert_INT32_EQ(CFE_ES_ParseFileEntry(TokenList, 8), CFE_ES_ERR_APP_CREATE); /* Test parsing the startup script with an invalid file name */ UT_SetDefaultReturnValue(UT_KEY(CFE_FS_ParseInputFileName), CFE_FS_INVALID_PATH); - UT_Report(__FILE__, __LINE__, CFE_ES_ParseFileEntry(TokenList, 8) == CFE_FS_INVALID_PATH, - "CFE_ES_ParseFileEntry", "Invalid file name"); + UtAssert_INT32_EQ(CFE_ES_ParseFileEntry(TokenList, 8), CFE_FS_INVALID_PATH); } /* Test parsing the startup script with an invalid argument passed in */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_ParseFileEntry(NULL, 0) == CFE_ES_BAD_ARGUMENT, "CFE_ES_ParseFileEntry", - "Invalid argument"); + UtAssert_INT32_EQ(CFE_ES_ParseFileEntry(NULL, 0), CFE_ES_BAD_ARGUMENT); /* Test application loading and creation with a task creation failure */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); ES_UT_SetupAppStartParams(&StartParams, "ut/filename", "EntryPoint", 170, 4096, 1); - Return = CFE_ES_AppCreate(&AppId, "AppName", &StartParams); - UtAssert_INT32_EQ(Return, CFE_STATUS_EXTERNAL_RESOURCE_FAIL); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_APP_CREATE])); + UtAssert_INT32_EQ(CFE_ES_AppCreate(&AppId, "AppName", &StartParams), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_APP_CREATE]); /* Test application creation with NULL parameters */ ES_ResetUnitTest(); - Return = CFE_ES_AppCreate(&AppId, "AppName", NULL); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_AppCreate", "NULL file name"); + UtAssert_INT32_EQ(CFE_ES_AppCreate(&AppId, "AppName", NULL), CFE_ES_BAD_ARGUMENT); /* Test application creation with name too long */ memset(NameBuffer, 'x', sizeof(NameBuffer) - 1); NameBuffer[sizeof(NameBuffer) - 1] = 0; ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 4096, 1); - Return = CFE_ES_AppCreate(&AppId, NameBuffer, &StartParams); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_AppCreate", "Name too long"); + UtAssert_INT32_EQ(CFE_ES_AppCreate(&AppId, NameBuffer, &StartParams), CFE_ES_BAD_ARGUMENT); /* Test successful application loading and creation */ ES_ResetUnitTest(); ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 8192, 1); - Return = CFE_ES_AppCreate(&AppId, "AppName", &StartParams); - UT_Report(__FILE__, __LINE__, Return == CFE_SUCCESS, "CFE_ES_AppCreate", "Application load/create; successful"); + CFE_UtAssert_SUCCESS(CFE_ES_AppCreate(&AppId, "AppName", &StartParams)); /* Test application loading of the same name again */ ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 8192, 1); - Return = CFE_ES_AppCreate(&AppId, "AppName", &StartParams); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_ERR_DUPLICATE_NAME, "CFE_ES_AppCreate", "Duplicate name"); + UtAssert_INT32_EQ(CFE_ES_AppCreate(&AppId, "AppName", &StartParams), CFE_ES_ERR_DUPLICATE_NAME); /* Test application loading and creation where the file cannot be loaded */ UT_InitData(); UT_SetDeferredRetcode(UT_KEY(OS_ModuleLoad), 1, -1); ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 8192, 1); - Return = CFE_ES_AppCreate(&AppId, "AppName2", &StartParams); - UtAssert_INT32_EQ(Return, CFE_STATUS_EXTERNAL_RESOURCE_FAIL); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_EXTRACT_FILENAME_UT55])); + UtAssert_INT32_EQ(CFE_ES_AppCreate(&AppId, "AppName2", &StartParams), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_EXTRACT_FILENAME_UT55]); /* Test application loading and creation where all app slots are taken */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 8192, 1); - Return = CFE_ES_AppCreate(&AppId, "AppName", &StartParams); - UT_Report(__FILE__, __LINE__, - Return == CFE_ES_NO_RESOURCE_IDS_AVAILABLE && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_NO_FREE_APP_SLOTS]), - "CFE_ES_AppCreate", "No free application slots available"); + UtAssert_INT32_EQ(CFE_ES_AppCreate(&AppId, "AppName", &StartParams), CFE_ES_NO_RESOURCE_IDS_AVAILABLE); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_NO_FREE_APP_SLOTS]); /* Check operation of the CFE_ES_CheckAppIdSlotUsed() helper function */ CFE_ES_Global.AppTable[1].AppId = CFE_ES_APPID_C(ES_UT_MakeAppIdForIndex(1)); CFE_ES_Global.AppTable[2].AppId = CFE_ES_APPID_UNDEFINED; - UtAssert_True(CFE_ES_CheckAppIdSlotUsed(ES_UT_MakeAppIdForIndex(1)), "App Slot Used"); - UtAssert_True(!CFE_ES_CheckAppIdSlotUsed(ES_UT_MakeAppIdForIndex(2)), "App Slot Unused"); + CFE_UtAssert_TRUE(CFE_ES_CheckAppIdSlotUsed(ES_UT_MakeAppIdForIndex(1))); + CFE_UtAssert_FALSE(CFE_ES_CheckAppIdSlotUsed(ES_UT_MakeAppIdForIndex(2))); /* Test application loading and creation where the entry point symbol * cannot be found @@ -1198,9 +1136,8 @@ void TestApps(void) ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_ModuleSymbolLookup), 1, -1); ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 8192, 1); - Return = CFE_ES_AppCreate(&AppId, "AppName", &StartParams); - UtAssert_INT32_EQ(Return, CFE_STATUS_EXTERNAL_RESOURCE_FAIL); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_FIND_SYMBOL])); + UtAssert_INT32_EQ(CFE_ES_AppCreate(&AppId, "AppName", &StartParams), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CANNOT_FIND_SYMBOL]); /* Test application loading and creation where the entry point symbol * cannot be found and module unload fails @@ -1209,10 +1146,9 @@ void TestApps(void) UT_SetDeferredRetcode(UT_KEY(OS_ModuleSymbolLookup), 1, -1); UT_SetDeferredRetcode(UT_KEY(OS_ModuleUnload), 1, -1); ES_UT_SetupAppStartParams(&StartParams, "ut/filename.x", "EntryPoint", 170, 8192, 1); - Return = CFE_ES_AppCreate(&AppId, "AppName", &StartParams); - UtAssert_INT32_EQ(Return, CFE_STATUS_EXTERNAL_RESOURCE_FAIL); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_FIND_SYMBOL])); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MODULE_UNLOAD_FAILED])); + UtAssert_INT32_EQ(CFE_ES_AppCreate(&AppId, "AppName", &StartParams), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CANNOT_FIND_SYMBOL]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_MODULE_UNLOAD_FAILED]); /* * Set up a situation where attempting to get appID by context, @@ -1232,8 +1168,8 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppTimerMsec = 0; memset(&CFE_ES_Global.BackgroundAppScanState, 0, sizeof(CFE_ES_Global.BackgroundAppScanState)); CFE_ES_RunAppTableScan(0, &CFE_ES_Global.BackgroundAppScanState); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PCR_ERR2_EID) && UtAppRecPtr->ControlReq.AppTimerMsec == 0, - "CFE_ES_RunAppTableScan", "Waiting; process control request"); + UtAssert_INT32_EQ(UtAppRecPtr->ControlReq.AppTimerMsec, 0); + CFE_UtAssert_EVENTSENT(CFE_ES_PCR_ERR2_EID); /* Test scanning and acting on the application table where the timer * has not expired for a waiting application @@ -1243,10 +1179,8 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; UtAppRecPtr->ControlReq.AppTimerMsec = 5000; CFE_ES_RunAppTableScan(1000, &CFE_ES_Global.BackgroundAppScanState); - UT_Report(__FILE__, __LINE__, - UtAppRecPtr->ControlReq.AppTimerMsec == 4000 && - UtAppRecPtr->ControlReq.AppControlRequest == CFE_ES_RunStatus_APP_EXIT, - "CFE_ES_RunAppTableScan", "Decrement timer"); + UtAssert_INT32_EQ(UtAppRecPtr->ControlReq.AppTimerMsec, 4000); + UtAssert_UINT32_EQ(UtAppRecPtr->ControlReq.AppControlRequest, CFE_ES_RunStatus_APP_EXIT); /* Test scanning and acting on the application table where the application * has stopped and is ready to be acted on @@ -1256,8 +1190,8 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; UtAppRecPtr->ControlReq.AppTimerMsec = 0; CFE_ES_RunAppTableScan(0, &CFE_ES_Global.BackgroundAppScanState); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PCR_ERR2_EID) && UtAppRecPtr->ControlReq.AppTimerMsec == 0, - "CFE_ES_RunAppTableScan", "Stopped; process control request"); + UtAssert_INT32_EQ(UtAppRecPtr->ControlReq.AppTimerMsec, 0); + CFE_UtAssert_EVENTSENT(CFE_ES_PCR_ERR2_EID); /* Test scanning and acting on the application table where the application * has stopped and is ready to be acted on @@ -1266,8 +1200,8 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_EARLY_INIT, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppTimerMsec = 5000; CFE_ES_RunAppTableScan(0, &CFE_ES_Global.BackgroundAppScanState); - UT_Report(__FILE__, __LINE__, UT_GetNumEventsSent() == 0 && UtAppRecPtr->ControlReq.AppTimerMsec == 5000, - "CFE_ES_RunAppTableScan", "Initializing; process control request"); + UtAssert_INT32_EQ(UtAppRecPtr->ControlReq.AppTimerMsec, 5000); + CFE_UtAssert_EVENTCOUNT(0); /* Test a control action request on an application with an * undefined control request state @@ -1276,9 +1210,8 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = 0x12345; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PCR_ERR2_EID), "CFE_ES_ProcessControlRequest", - "Unknown state (default)"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_PCR_ERR2_EID); /* Test a successful control action request to exit an application */ ES_ResetUnitTest(); @@ -1286,9 +1219,8 @@ void TestApps(void) ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/Filename", "NotNULL", 8192, 255, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_EXIT_APP_INF_EID), "CFE_ES_ProcessControlRequest", - "Exit application; successful"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_EXIT_APP_INF_EID); /* Test a control action request to exit an application where the * request fails @@ -1298,9 +1230,8 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_EXIT_APP_ERR_EID), "CFE_ES_ProcessControlRequest", - "Exit application failure"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_EXIT_APP_ERR_EID); /* Test a control action request to stop an application where the * request fails @@ -1310,9 +1241,8 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_DELETE; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_STOP_ERR3_EID), "CFE_ES_ProcessControlRequest", - "Stop application failure"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_STOP_ERR3_EID); /* Test a control action request to restart an application where the * request fails due to a CleanUpApp error @@ -1322,9 +1252,8 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_ERR4_EID), "CFE_ES_ProcessControlRequest", - "Restart application failure; CleanUpApp error"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_ERR4_EID); /* Test a control action request to restart an application where the * request fails due to an AppCreate error @@ -1335,9 +1264,8 @@ void TestApps(void) OS_ModuleLoad(&UtAppRecPtr->LoadStatus.ModuleId, NULL, NULL, 0); UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_ERR3_EID), "CFE_ES_ProcessControlRequest", - "Restart application failure; AppCreate error"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_ERR3_EID); /* Test a control action request to reload an application where the * request fails due to a CleanUpApp error @@ -1347,9 +1275,8 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_ERR4_EID), "CFE_ES_ProcessControlRequest", - "Reload application failure; CleanUpApp error"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_ERR4_EID); /* Test a control action request to reload an application where the * request fails due to an AppCreate error @@ -1360,9 +1287,8 @@ void TestApps(void) OS_ModuleLoad(&UtAppRecPtr->LoadStatus.ModuleId, NULL, NULL, 0); UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_ERR3_EID), "CFE_ES_ProcessControlRequest", - "Reload application failure; AppCreate error"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_ERR3_EID); /* Test a successful control action request to exit an application that * has an error @@ -1373,9 +1299,8 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_ERROR; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERREXIT_APP_INF_EID), "CFE_ES_ProcessControlRequest", - "Exit application on error; successful"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_ERREXIT_APP_INF_EID); /* Test a control action request to exit an application that * has an error where the request fails @@ -1385,9 +1310,8 @@ void TestApps(void) UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_ERROR; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERREXIT_APP_ERR_EID), "CFE_ES_ProcessControlRequest", - "Exit application on error failure"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_ERREXIT_APP_ERR_EID); /* Test a successful control action request to stop an application */ ES_ResetUnitTest(); @@ -1395,9 +1319,8 @@ void TestApps(void) ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/FileName", "NULL", 8192, 255, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_DELETE; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_STOP_INF_EID), "CFE_ES_ProcessControlRequest", - "Stop application; successful"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_STOP_INF_EID); /* Test a successful control action request to restart an application */ ES_ResetUnitTest(); @@ -1405,9 +1328,8 @@ void TestApps(void) ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/FileName", "NULL", 8192, 255, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_INF_EID), "CFE_ES_ProcessControlRequest", - "Restart application; successful"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_INF_EID); /* Test a successful control action request to reload an application */ ES_ResetUnitTest(); @@ -1415,9 +1337,8 @@ void TestApps(void) ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/FileName", "NULL", 8192, 255, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_INF_EID), "CFE_ES_ProcessControlRequest", - "Reload application; successful"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_INF_EID); /* Test a control action request for an application that has an invalid * state (exception) @@ -1427,16 +1348,14 @@ void TestApps(void) ES_UT_SetupAppStartParams(&UtAppRecPtr->StartParams, "/ram/FileName", "NULL", 8192, 255, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_EXCEPTION; AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - CFE_ES_ProcessControlRequest(AppId); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PCR_ERR1_EID), "CFE_ES_ProcessControlRequest", - "Invalid state"); + CFE_UtAssert_VOIDCALL(CFE_ES_ProcessControlRequest(AppId)); + CFE_UtAssert_EVENTSENT(CFE_ES_PCR_ERR1_EID); /* Test populating the application information structure with data */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_GetAppInfo(&AppInfo, AppId) == CFE_SUCCESS, "CFE_ES_GetAppInfo", - "Get application information; successful"); + CFE_UtAssert_SUCCESS(CFE_ES_GetAppInfo(&AppInfo, AppId)); /* Test populating the application information structure with data using * a null application information pointer @@ -1444,8 +1363,7 @@ void TestApps(void) ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_GetAppInfo(NULL, AppId) == CFE_ES_BAD_ARGUMENT, "CFE_ES_GetAppInfo", - "Null application information pointer"); + UtAssert_INT32_EQ(CFE_ES_GetAppInfo(NULL, AppId), CFE_ES_BAD_ARGUMENT); /* Test populating the application information structure using an * inactive application ID @@ -1454,16 +1372,14 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_AppRecordSetFree(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_GetAppInfo(&AppInfo, AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetAppInfo", "Application ID not active"); + UtAssert_INT32_EQ(CFE_ES_GetAppInfo(&AppInfo, AppId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test populating the application information structure using an * application ID value greater than the maximum allowed */ ES_ResetUnitTest(); AppId = CFE_ES_APPID_C(ES_UT_MakeAppIdForIndex(99999)); - UT_Report(__FILE__, __LINE__, CFE_ES_GetAppInfo(&AppInfo, AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetAppInfo", "Application ID exceeds maximum"); + UtAssert_INT32_EQ(CFE_ES_GetAppInfo(&AppInfo, AppId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test populating the application information structure using a valid * application ID, but with a failure to retrieve the module information @@ -1472,8 +1388,7 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); UT_SetDeferredRetcode(UT_KEY(OS_ModuleInfo), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_GetAppInfo(&AppInfo, AppId) == CFE_SUCCESS, "CFE_ES_GetAppInfo", - "Module not found"); + CFE_UtAssert_SUCCESS(CFE_ES_GetAppInfo(&AppInfo, AppId)); /* Test deleting an application and cleaning up its resources with OS * delete and close failures @@ -1486,8 +1401,7 @@ void TestApps(void) UT_SetDefaultReturnValue(UT_KEY(OS_TaskDelete), OS_ERROR); UT_SetDefaultReturnValue(UT_KEY(OS_close), OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, "CFE_ES_CleanUpApp", - "Task OS delete and close failure"); + UtAssert_INT32_EQ(CFE_ES_CleanUpApp(AppId), CFE_ES_APP_CLEANUP_ERR); /* Test deleting an application and cleaning up its resources with a * mutex delete failure @@ -1498,8 +1412,7 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemDelete), 1, OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, "CFE_ES_CleanUpApp", - "Task mutex delete failure"); + UtAssert_INT32_EQ(CFE_ES_CleanUpApp(AppId), CFE_ES_APP_CLEANUP_ERR); /* Test deleting an application and cleaning up its resources with a * failure to unload the module @@ -1508,8 +1421,7 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UT_SetDeferredRetcode(UT_KEY(OS_ModuleUnload), 1, OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, "CFE_ES_CleanUpApp", - "Module unload failure"); + UtAssert_INT32_EQ(CFE_ES_CleanUpApp(AppId), CFE_ES_APP_CLEANUP_ERR); /* Test deleting an application and cleaning up its resources where the * EVS application cleanup fails @@ -1518,8 +1430,7 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, "CFE_ES_CleanUpApp", - "EVS application cleanup failure"); + UtAssert_INT32_EQ(CFE_ES_CleanUpApp(AppId), CFE_ES_APP_CLEANUP_ERR); /* Test cleaning up the OS resources for a task with a failure * deleting mutexes @@ -1529,8 +1440,7 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); UT_SetDeferredRetcode(UT_KEY(OS_MutSemDelete), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_MUT_SEM_DELETE_ERR, - "CFE_ES_CleanupTaskResources", "Mutex delete failure"); + UtAssert_INT32_EQ(CFE_ES_CleanupTaskResources(TaskId), CFE_ES_MUT_SEM_DELETE_ERR); /* Test cleaning up the OS resources for a task with a failure deleting * binary semaphores @@ -1540,8 +1450,7 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); UT_SetDeferredRetcode(UT_KEY(OS_BinSemDelete), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_BIN_SEM_DELETE_ERR, - "CFE_ES_CleanupTaskResources", "Binary semaphore delete failure"); + UtAssert_INT32_EQ(CFE_ES_CleanupTaskResources(TaskId), CFE_ES_BIN_SEM_DELETE_ERR); /* Test cleaning up the OS resources for a task with a failure deleting * counting semaphores @@ -1551,8 +1460,7 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); UT_SetDeferredRetcode(UT_KEY(OS_CountSemDelete), 1, OS_ERROR); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_COUNT_SEM_DELETE_ERR, - "CFE_ES_CleanupTaskResources", "Counting semaphore failure"); + UtAssert_INT32_EQ(CFE_ES_CleanupTaskResources(TaskId), CFE_ES_COUNT_SEM_DELETE_ERR); /* Test cleaning up the OS resources for a task with a failure * deleting queues @@ -1562,8 +1470,7 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); UT_SetDeferredRetcode(UT_KEY(OS_QueueDelete), 1, OS_ERROR); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_QUEUE_DELETE_ERR, - "CFE_ES_CleanupTaskResources", "Queue delete failure"); + UtAssert_INT32_EQ(CFE_ES_CleanupTaskResources(TaskId), CFE_ES_QUEUE_DELETE_ERR); /* Test cleaning up the OS resources for a task with a failure * deleting timers @@ -1576,8 +1483,7 @@ void TestApps(void) * that the code call OS_TimerGetInfo first. */ UT_SetDeferredRetcode(UT_KEY(OS_TimerDelete), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_TIMER_DELETE_ERR, - "CFE_ES_CleanupTaskResources", "Timer delete failure"); + UtAssert_INT32_EQ(CFE_ES_CleanupTaskResources(TaskId), CFE_ES_TIMER_DELETE_ERR); /* Test cleaning up the OS resources for a task with a failure * closing files @@ -1588,8 +1494,7 @@ void TestApps(void) ES_UT_SetupForOSCleanup(); UT_SetDeferredRetcode(UT_KEY(OS_TimerGetInfo), 1, OS_ERROR); UT_SetDefaultReturnValue(UT_KEY(OS_close), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) != CFE_SUCCESS, "CFE_ES_CleanupTaskResources", - "File close failure"); + UtAssert_INT32_EQ(CFE_ES_CleanupTaskResources(TaskId), CFE_ES_APP_CLEANUP_ERR); /* Test cleaning up the OS resources for a task with a failure * to delete the task @@ -1599,16 +1504,14 @@ void TestApps(void) TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); UT_SetDeferredRetcode(UT_KEY(OS_TimerGetInfo), 1, OS_ERROR); UT_SetDefaultReturnValue(UT_KEY(OS_TaskDelete), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_ES_TASK_DELETE_ERR, - "CFE_ES_CleanupTaskResources", "Task delete failure"); + UtAssert_INT32_EQ(CFE_ES_CleanupTaskResources(TaskId), CFE_ES_TASK_DELETE_ERR); /* Test successfully cleaning up the OS resources for a task */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, NULL, &UtTaskRecPtr); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); UT_SetDeferredRetcode(UT_KEY(OS_TimerGetInfo), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_SUCCESS, "CFE_ES_CleanupTaskResources", - "Clean up task OS resources; successful"); + CFE_UtAssert_SUCCESS(CFE_ES_CleanupTaskResources(TaskId)); /* Test parsing the startup script for a cFE application and a restart * application exception action @@ -1617,8 +1520,7 @@ void TestApps(void) { const char *TokenList[] = {"CFE_APP", "/cf/apps/tst_lib.bundle", "TST_LIB_Init", "TST_LIB", "0", "0", "0x0", "0"}; - UT_Report(__FILE__, __LINE__, CFE_ES_ParseFileEntry(TokenList, 8) == CFE_SUCCESS, "CFE_ES_ParseFileEntry", - "CFE application; restart application on exception"); + CFE_UtAssert_SUCCESS(CFE_ES_ParseFileEntry(TokenList, 8)); } /* Test scanning and acting on the application table where the timer @@ -1628,8 +1530,8 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_WAITING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppTimerMsec = 0; CFE_ES_RunAppTableScan(0, &CFE_ES_Global.BackgroundAppScanState); - UT_Report(__FILE__, __LINE__, UT_GetNumEventsSent() == 0 && UtAppRecPtr->ControlReq.AppTimerMsec == 0, - "CFE_ES_RunAppTableScan", "Waiting; process control request"); + UtAssert_INT32_EQ(UtAppRecPtr->ControlReq.AppTimerMsec, 0); + CFE_UtAssert_EVENTCOUNT(0); /* Test scanning and acting on the application table where the application * is already running @@ -1638,8 +1540,8 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppTimerMsec = 0; CFE_ES_RunAppTableScan(0, &CFE_ES_Global.BackgroundAppScanState); - UT_Report(__FILE__, __LINE__, UT_GetNumEventsSent() == 0 && UtAppRecPtr->ControlReq.AppTimerMsec == 0, - "CFE_ES_RunAppTableScan", "Running; process control request"); + UtAssert_INT32_EQ(UtAppRecPtr->ControlReq.AppTimerMsec, 0); + CFE_UtAssert_EVENTCOUNT(0); /* Test deleting an application and cleaning up its resources where the * application ID matches the main task ID @@ -1654,12 +1556,9 @@ void TestApps(void) /* Associate a child task with the app to be deleted */ ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_SUCCESS, "CFE_ES_CleanUpApp", - "Main task ID matches task ID, nominal"); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskRecordIsUsed(UtTaskRecPtr), "CFE_ES_CleanUpApp", - "Main task ID matches task ID, other task unaffected"); - UT_Report(__FILE__, __LINE__, !CFE_ES_MemPoolRecordIsUsed(UtPoolRecPtr), "CFE_ES_CleanUpApp", - "Main task ID matches task ID, memory pool deleted"); + CFE_UtAssert_SUCCESS(CFE_ES_CleanUpApp(AppId)); + CFE_UtAssert_TRUE(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr)); + CFE_UtAssert_FALSE(CFE_ES_MemPoolRecordIsUsed(UtPoolRecPtr)); /* Test deleting an application and cleaning up its resources where the * memory pool deletion fails @@ -1671,9 +1570,8 @@ void TestApps(void) UtPoolRecPtr->OwnerAppID = CFE_ES_AppRecordGetID(UtAppRecPtr); UtPoolRecPtr->PoolID = CFE_ES_MEMHANDLE_C(CFE_ResourceId_FromInteger(99999)); /* Mismatch */ AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, "CFE_ES_CleanUpApp", - "Mem Pool delete error"); - UT_Report(__FILE__, __LINE__, CFE_ES_MemPoolRecordIsUsed(UtPoolRecPtr), "CFE_ES_CleanUpApp", "Mem Pool not freed"); + UtAssert_INT32_EQ(CFE_ES_CleanUpApp(AppId), CFE_ES_APP_CLEANUP_ERR); + CFE_UtAssert_TRUE(CFE_ES_MemPoolRecordIsUsed(UtPoolRecPtr)); /* Test deleting an application and cleaning up its resources where the * application ID doesn't match the main task ID @@ -1692,10 +1590,8 @@ void TestApps(void) UT_SetDefaultReturnValue(UT_KEY(OS_TaskDelete), OS_ERROR); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_ES_APP_CLEANUP_ERR, "CFE_ES_CleanUpApp", - "Main task ID doesn't match task ID, CFE_ES_APP_CLEANUP_ERR"); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskRecordIsUsed(UtTaskRecPtr), "CFE_ES_CleanUpApp", - "Main task ID doesn't match task ID, second task unchanged"); + UtAssert_INT32_EQ(CFE_ES_CleanUpApp(AppId), CFE_ES_APP_CLEANUP_ERR); + CFE_UtAssert_TRUE(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr)); /* Test deleting an application and cleaning up its resources where the * application ID doesn't match and the application is a core application @@ -1712,14 +1608,10 @@ void TestApps(void) UtAppRecPtr->MainTaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(AppId) == CFE_SUCCESS, "CFE_ES_CleanUpApp", - "Application ID mismatch; core application"); + CFE_UtAssert_SUCCESS(CFE_ES_CleanUpApp(AppId)); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskRecordIsUsed(UtTaskRecPtr), "CFE_ES_CleanUpApp", - "Application ID mismatch; core application"); - - UT_Report(__FILE__, __LINE__, CFE_ES_Global.RegisteredExternalApps == 1, "CFE_ES_CleanUpApp", - "Application ID mismatch; core application"); + CFE_UtAssert_TRUE(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr)); + UtAssert_UINT32_EQ(CFE_ES_Global.RegisteredExternalApps, 1); /* Test successfully deleting an application and cleaning up its resources * and the application is an external application @@ -1729,10 +1621,9 @@ void TestApps(void) /* Setup an entry which will be deleted */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, &UtTaskRecPtr); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, - CFE_ES_CleanUpApp(AppId) == CFE_SUCCESS && !CFE_ES_TaskRecordIsUsed(UtTaskRecPtr) && - CFE_ES_Global.RegisteredExternalApps == 0, - "CFE_ES_CleanUpApp", "Successful application cleanup; external application"); + CFE_UtAssert_SUCCESS(CFE_ES_CleanUpApp(AppId)); + CFE_UtAssert_FALSE(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr)); + UtAssert_UINT32_EQ(CFE_ES_Global.RegisteredExternalApps, 0); /* Test cleaning up the OS resources for a task with failure to * obtain information on mutex, binary, and counter semaphores, and @@ -1747,8 +1638,7 @@ void TestApps(void) UT_SetDeferredRetcode(UT_KEY(OS_QueueGetInfo), 1, OS_ERROR); UT_SetDeferredRetcode(UT_KEY(OS_TimerGetInfo), 1, OS_ERROR); UT_SetDeferredRetcode(UT_KEY(OS_FDGetInfo), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CleanupTaskResources(TaskId) == CFE_SUCCESS, "CFE_ES_CleanupTaskResources", - "Get OS information failures"); + CFE_UtAssert_SUCCESS(CFE_ES_CleanupTaskResources(TaskId)); } void TestResourceID(void) @@ -1777,9 +1667,7 @@ void TestResourceID(void) cfe_id1 = CFE_ES_TASKID_C(ES_UT_MakeTaskIdForIndex(0)); osal_id = CFE_ES_TaskId_ToOSAL(cfe_id1); cfe_id2 = CFE_ES_TaskId_FromOSAL(osal_id); - UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(cfe_id1, cfe_id2), - "CFE_ES_TaskId_ToOSAL()/FromOSAL(): before=%lx, after=%lx", CFE_RESOURCEID_TO_ULONG(cfe_id1), - CFE_RESOURCEID_TO_ULONG(cfe_id2)); + CFE_UtAssert_RESOURCEID_EQ(cfe_id1, cfe_id2); } void TestLibs(void) @@ -1787,7 +1675,6 @@ void TestLibs(void) CFE_ES_LibRecord_t * UtLibRecPtr; char LongLibraryName[sizeof(UtLibRecPtr->LibName) + 1]; CFE_ES_LibId_t Id; - int32 Return; CFE_ES_ModuleLoadParams_t LoadParams; /* Test shared library loading and initialization where the initialization @@ -1796,57 +1683,44 @@ void TestLibs(void) ES_ResetUnitTest(); UT_SetDummyFuncRtn(-444); ES_UT_SetupModuleLoadParams(&LoadParams, "filename", "entrypt"); - Return = CFE_ES_LoadLibrary(&Id, "LibName", &LoadParams); - UtAssert_INT32_EQ(Return, -444); - UtAssert_NONZERO(UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_SHARED_LIBRARY_INIT])); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, "LibName", &LoadParams), -444); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_SHARED_LIBRARY_INIT]); /* Test Load library returning an error on a null pointer argument */ - Return = CFE_ES_LoadLibrary(&Id, "LibName", NULL); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_LoadLibrary", - "Load shared library bad argument (NULL filename)"); - - Return = CFE_ES_LoadLibrary(&Id, NULL, &LoadParams); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_LoadLibrary", - "Load shared library bad argument (NULL library name)"); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, "LibName", NULL), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, NULL, &LoadParams), CFE_ES_BAD_ARGUMENT); /* Test Load library returning an error on a too long library name */ memset(LongLibraryName, 'a', sizeof(LongLibraryName) - 1); LongLibraryName[sizeof(LongLibraryName) - 1] = '\0'; - Return = CFE_ES_LoadLibrary(&Id, LongLibraryName, &LoadParams); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_LoadLibrary", - "Load shared library bad argument (library name too long)"); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, LongLibraryName, &LoadParams), CFE_ES_BAD_ARGUMENT); /* Test successful shared library loading and initialization */ UT_InitData(); UT_SetDummyFuncRtn(OS_SUCCESS); - Return = CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams); - UT_Report(__FILE__, __LINE__, Return == CFE_SUCCESS, "CFE_ES_LoadLibrary", "successful"); + CFE_UtAssert_SUCCESS(CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams)); UtLibRecPtr = CFE_ES_LocateLibRecordByID(Id); - UtAssert_True(UtLibRecPtr != NULL, "CFE_ES_LoadLibrary() return valid ID"); - UtAssert_True(CFE_ES_LibRecordIsUsed(UtLibRecPtr), "CFE_ES_LoadLibrary() record used"); + UtAssert_NOT_NULL(UtLibRecPtr); + CFE_UtAssert_TRUE(CFE_ES_LibRecordIsUsed(UtLibRecPtr)); /* Try loading same library again, should return the DUPLICATE code */ - Return = CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_ERR_DUPLICATE_NAME, "CFE_ES_LoadLibrary", "Duplicate"); - UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(Id, CFE_ES_LibRecordGetID(UtLibRecPtr)), - "CFE_ES_LoadLibrary() returned previous ID"); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams), CFE_ES_ERR_DUPLICATE_NAME); + CFE_UtAssert_RESOURCEID_EQ(Id, CFE_ES_LibRecordGetID(UtLibRecPtr)); /* Test shared library loading and initialization where the library * fails to load */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_ModuleLoad), 1, -1); - Return = CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams); - UtAssert_INT32_EQ(Return, CFE_STATUS_EXTERNAL_RESOURCE_FAIL); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* Test shared library loading and initialization where the library * entry point symbol cannot be found */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_ModuleSymbolLookup), 1, -1); - Return = CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams); - UtAssert_INT32_EQ(Return, CFE_STATUS_EXTERNAL_RESOURCE_FAIL); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* * Test shared library loading and initialization where the library @@ -1855,14 +1729,12 @@ void TestLibs(void) */ ES_ResetUnitTest(); ES_UT_SetupModuleLoadParams(&LoadParams, "nullep", "NULL"); - Return = CFE_ES_LoadLibrary(&Id, "TST_LIB1", &LoadParams); - UtAssert_INT32_EQ(Return, CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_LoadLibrary(&Id, "TST_LIB1", &LoadParams)); UtAssert_STUB_COUNT(OS_ModuleSymbolLookup, 0); /* should NOT have been called */ /* Likewise for a entry point where the string is empty */ LoadParams.InitSymbolName[0] = 0; - Return = CFE_ES_LoadLibrary(&Id, "TST_LIB2", &LoadParams); - UtAssert_INT32_EQ(Return, CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_LoadLibrary(&Id, "TST_LIB2", &LoadParams)); UtAssert_STUB_COUNT(OS_ModuleSymbolLookup, 0); /* should NOT have been called */ /* Test shared library loading and initialization where the library @@ -1872,34 +1744,31 @@ void TestLibs(void) UT_SetDefaultReturnValue(UT_KEY(OS_remove), OS_ERROR); /* for coverage of error path */ UT_SetDefaultReturnValue(UT_KEY(dummy_function), -555); ES_UT_SetupModuleLoadParams(&LoadParams, "filename", "dummy_function"); - Return = CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams); - UT_Report(__FILE__, __LINE__, Return == -555, "CFE_ES_LoadLibrary", "Library initialization function failure"); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams), -555); /* Test shared library loading and initialization where there are no * library slots available */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); - Return = CFE_ES_LoadLibrary(&Id, "LibName", &LoadParams); - UT_Report(__FILE__, __LINE__, - Return == CFE_ES_NO_RESOURCE_IDS_AVAILABLE && UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_LIBRARY_SLOTS]), - "CFE_ES_LoadLibrary", "No free library slots"); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, "LibName", &LoadParams), CFE_ES_NO_RESOURCE_IDS_AVAILABLE); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_LIBRARY_SLOTS]); /* check operation of the CFE_ES_CheckLibIdSlotUsed() function */ CFE_ES_Global.LibTable[1].LibId = CFE_ES_LIBID_C(ES_UT_MakeLibIdForIndex(1)); CFE_ES_Global.LibTable[2].LibId = CFE_ES_LIBID_UNDEFINED; - UtAssert_True(CFE_ES_CheckLibIdSlotUsed(ES_UT_MakeLibIdForIndex(1)), "Lib Slot Used"); - UtAssert_True(!CFE_ES_CheckLibIdSlotUsed(ES_UT_MakeLibIdForIndex(2)), "Lib Slot Unused"); + CFE_UtAssert_TRUE(CFE_ES_CheckLibIdSlotUsed(ES_UT_MakeLibIdForIndex(1))); + CFE_UtAssert_FALSE(CFE_ES_CheckLibIdSlotUsed(ES_UT_MakeLibIdForIndex(2))); /* * Test public Name+ID query/lookup API */ ES_ResetUnitTest(); ES_UT_SetupSingleLibId("UT", &UtLibRecPtr); Id = CFE_ES_LibRecordGetID(UtLibRecPtr); - UtAssert_INT32_EQ(CFE_ES_GetLibName(LongLibraryName, Id, sizeof(LongLibraryName)), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GetLibName(LongLibraryName, Id, sizeof(LongLibraryName))); UtAssert_INT32_EQ(CFE_ES_GetLibIDByName(&Id, "Nonexistent"), CFE_ES_ERR_NAME_NOT_FOUND); - UtAssert_INT32_EQ(CFE_ES_GetLibIDByName(&Id, LongLibraryName), CFE_SUCCESS); - UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(Id, CFE_ES_LibRecordGetID(UtLibRecPtr)), "Library IDs Match"); + CFE_UtAssert_SUCCESS(CFE_ES_GetLibIDByName(&Id, LongLibraryName)); + CFE_UtAssert_RESOURCEID_EQ(Id, CFE_ES_LibRecordGetID(UtLibRecPtr)); UtAssert_INT32_EQ(CFE_ES_GetLibName(LongLibraryName, CFE_ES_LIBID_UNDEFINED, sizeof(LongLibraryName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_ES_GetLibName(NULL, Id, sizeof(LongLibraryName)), CFE_ES_BAD_ARGUMENT); @@ -1908,7 +1777,6 @@ void TestLibs(void) void TestERLog(void) { - int Return; void * LocalBuffer; size_t LocalBufSize; CFE_ES_BackgroundLogDumpGlobal_t State; @@ -1921,12 +1789,11 @@ void TestERLog(void) */ ES_ResetUnitTest(); CFE_ES_Global.ResetDataPtr->ERLogIndex = CFE_PLATFORM_ES_ER_LOG_ENTRIES + 1; - Return = CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, 1, NULL); - UT_Report(__FILE__, __LINE__, - Return == CFE_SUCCESS && - !strcmp(CFE_ES_Global.ResetDataPtr->ERLog[0].BaseInfo.Description, "No Description String Given.") && - CFE_ES_Global.ResetDataPtr->ERLogIndex == 1, - "CFE_ES_WriteToERLog", "Log entries exceeded; no description; valid context size"); + CFE_UtAssert_SUCCESS(CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, 1, NULL)); + UtAssert_UINT32_EQ(CFE_ES_Global.ResetDataPtr->ERLogIndex, 1); + CFE_UtAssert_STRINGBUF_EQ(CFE_ES_Global.ResetDataPtr->ERLog[0].BaseInfo.Description, + sizeof(CFE_ES_Global.ResetDataPtr->ERLog[0].BaseInfo.Description), + "No Description String Given.", SIZE_MAX); /* Test non-rolling over log entry, * null description, @@ -1934,9 +1801,8 @@ void TestERLog(void) */ ES_ResetUnitTest(); CFE_ES_Global.ResetDataPtr->ERLogIndex = 0; - Return = CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, 1, NULL); - UT_Report(__FILE__, __LINE__, Return == CFE_SUCCESS && CFE_ES_Global.ResetDataPtr->ERLogIndex == 1, - "CFE_ES_WriteToERLog", "No log entry rollover; no description; no context"); + CFE_UtAssert_SUCCESS(CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, 1, NULL)); + UtAssert_UINT32_EQ(CFE_ES_Global.ResetDataPtr->ERLogIndex, 1); /* Test ER log background write functions */ memset(&State, 0, sizeof(State)); @@ -1944,47 +1810,42 @@ void TestERLog(void) LocalBufSize = 0; UT_SetDeferredRetcode(UT_KEY(CFE_PSP_Exception_CopyContext), 1, 128); - UtAssert_True(!CFE_ES_BackgroundERLogFileDataGetter(&State, 0, &LocalBuffer, &LocalBufSize), - "CFE_ES_BackgroundERLogFileDataGetter at start, with context"); - UtAssert_UINT32_EQ(State.EntryBuffer.ContextSize, 128); + CFE_UtAssert_FALSE(CFE_ES_BackgroundERLogFileDataGetter(&State, 0, &LocalBuffer, &LocalBufSize)); + CFE_UtAssert_MEMOFFSET_EQ(State.EntryBuffer.ContextSize, 128); UtAssert_NOT_NULL(LocalBuffer); UtAssert_NONZERO(LocalBufSize); memset(&State.EntryBuffer, 0xEE, sizeof(State.EntryBuffer)); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_Exception_CopyContext), 1, -1); - UtAssert_True( - CFE_ES_BackgroundERLogFileDataGetter(&State, CFE_PLATFORM_ES_ER_LOG_ENTRIES - 1, &LocalBuffer, &LocalBufSize), - "CFE_ES_BackgroundERLogFileDataGetter at EOF, no context"); + CFE_UtAssert_TRUE( + CFE_ES_BackgroundERLogFileDataGetter(&State, CFE_PLATFORM_ES_ER_LOG_ENTRIES - 1, &LocalBuffer, &LocalBufSize)); UtAssert_ZERO(State.EntryBuffer.ContextSize); - UtAssert_True( - CFE_ES_BackgroundERLogFileDataGetter(&State, CFE_PLATFORM_ES_ER_LOG_ENTRIES, &LocalBuffer, &LocalBufSize), - "CFE_ES_BackgroundERLogFileDataGetter beyond EOF"); + CFE_UtAssert_TRUE( + CFE_ES_BackgroundERLogFileDataGetter(&State, CFE_PLATFORM_ES_ER_LOG_ENTRIES, &LocalBuffer, &LocalBufSize)); UtAssert_NULL(LocalBuffer); UtAssert_ZERO(LocalBufSize); /* Test ER log background write event handling */ UT_ClearEventHistory(); CFE_ES_BackgroundERLogFileEventHandler(&State, CFE_FS_FileWriteEvent_COMPLETE, CFE_SUCCESS, 10, 0, 100); - UtAssert_True(UT_EventIsInHistory(CFE_ES_ERLOG2_EID), "COMPLETE: CFE_ES_ERLOG2_EID generated"); + CFE_UtAssert_EVENTSENT(CFE_ES_ERLOG2_EID); UT_ClearEventHistory(); CFE_ES_BackgroundERLogFileEventHandler(&State, CFE_FS_FileWriteEvent_HEADER_WRITE_ERROR, -1, 10, 10, 100); - UtAssert_True(UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), - "HEADER_WRITE_ERROR: CFE_ES_FILEWRITE_ERR_EID generated"); + CFE_UtAssert_EVENTSENT(CFE_ES_FILEWRITE_ERR_EID); UT_ClearEventHistory(); CFE_ES_BackgroundERLogFileEventHandler(&State, CFE_FS_FileWriteEvent_RECORD_WRITE_ERROR, -1, 10, 10, 100); - UtAssert_True(UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), - "RECORD_WRITE_ERROR: CFE_ES_FILEWRITE_ERR_EID generated"); + CFE_UtAssert_EVENTSENT(CFE_ES_FILEWRITE_ERR_EID); UT_ClearEventHistory(); CFE_ES_BackgroundERLogFileEventHandler(&State, CFE_FS_FileWriteEvent_CREATE_ERROR, -1, 10, 10, 100); - UtAssert_True(UT_EventIsInHistory(CFE_ES_ERLOG2_ERR_EID), "CREATE_ERROR: CFE_ES_ERLOG2_ERR_EID generated"); + CFE_UtAssert_EVENTSENT(CFE_ES_ERLOG2_ERR_EID); UT_ClearEventHistory(); CFE_ES_BackgroundERLogFileEventHandler(&State, CFE_FS_FileWriteEvent_UNDEFINED, CFE_SUCCESS, 10, 0, 100); - UtAssert_True(UT_GetNumEventsSent() == 0, "UNDEFINED: No event generated"); + CFE_UtAssert_EVENTCOUNT(0); } void TestGenericPool(void) @@ -2024,31 +1885,31 @@ void TestGenericPool(void) /* Test successfully creating direct access pool, with alignment, no mutex */ memset(&UT_MemPoolDirectBuffer, 0xee, sizeof(UT_MemPoolDirectBuffer)); OffsetEnd = sizeof(UT_MemPoolDirectBuffer.Data); - UtAssert_INT32_EQ(CFE_ES_GenPoolInitialize(&Pool1, 0, OffsetEnd, 32, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, - UT_POOL_BLOCK_SIZES, ES_UT_PoolDirectRetrieve, ES_UT_PoolDirectCommit), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolInitialize(&Pool1, 0, OffsetEnd, 32, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, + UT_POOL_BLOCK_SIZES, ES_UT_PoolDirectRetrieve, + ES_UT_PoolDirectCommit)); /* Allocate buffers until no space left */ - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset1, 44), CFE_SUCCESS); - UtAssert_True(Offset1 > 0 && Offset1 < OffsetEnd, "0 < Offset(%lu) < %lu", (unsigned long)Offset1, - (unsigned long)OffsetEnd); - UtAssert_True((Offset1 & 0x1F) == 0, "Offset(%lu) 32 byte alignment", (unsigned long)Offset1); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool1, &Offset1, 44)); + UtAssert_NONZERO(Offset1); + CFE_UtAssert_ATMOST(Offset1, OffsetEnd - 44); + UtAssert_True((Offset1 & 0x1F) == 0, "Offset1(%lu) 32 byte alignment", (unsigned long)Offset1); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset2, 72), CFE_SUCCESS); - UtAssert_True(Offset2 > Offset1 && Offset2 < OffsetEnd, "%lu < Offset(%lu) < %lu", (unsigned long)Offset1, - (unsigned long)Offset2, (unsigned long)OffsetEnd); - UtAssert_True((Offset2 & 0x1F) == 0, "Offset(%lu) 32 byte alignment", (unsigned long)Offset2); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool1, &Offset2, 72)); + CFE_UtAssert_ATLEAST(Offset2, Offset1 + 44); + CFE_UtAssert_ATMOST(Offset2, OffsetEnd - 72); + UtAssert_True((Offset2 & 0x1F) == 0, "Offset2(%lu) 32 byte alignment", (unsigned long)Offset2); UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset3, 72), CFE_ES_ERR_MEM_BLOCK_SIZE); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset3, 6), CFE_SUCCESS); - UtAssert_True(Offset3 > Offset2 && Offset3 < OffsetEnd, "%lu < Offset(%lu) < %lu", (unsigned long)Offset2, - (unsigned long)Offset3, (unsigned long)OffsetEnd); - UtAssert_True((Offset3 & 0x1F) == 0, "Offset(%lu) 32 byte alignment", (unsigned long)Offset3); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool1, &Offset3, 6)); + CFE_UtAssert_ATLEAST(Offset3, Offset2 + 72); + CFE_UtAssert_ATMOST(Offset3, OffsetEnd - 6); + UtAssert_True((Offset3 & 0x1F) == 0, "Offset3(%lu) 32 byte alignment", (unsigned long)Offset3); /* Free a buffer and attempt to reallocate */ - UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, Offset2), CFE_SUCCESS); - UtAssert_UINT32_EQ(BlockSize, 72); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, Offset2)); + CFE_UtAssert_MEMOFFSET_EQ(BlockSize, 72); /* Should not be able to free more than once */ /* This should increment the validation error count */ @@ -2056,9 +1917,8 @@ void TestGenericPool(void) UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, Offset2), CFE_ES_POOL_BLOCK_INVALID); UtAssert_NONZERO(Pool1.ValidationErrorCount); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset4, 100), CFE_SUCCESS); - UtAssert_True(Offset4 == Offset2, "New Offset(%lu) == Old Offset(%lu)", (unsigned long)Offset4, - (unsigned long)Offset2); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool1, &Offset4, 100)); + CFE_UtAssert_MEMOFFSET_EQ(Offset4, Offset2); /* Attempt Bigger than the largest bucket */ UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset1, 1000), CFE_ES_ERR_MEM_BLOCK_SIZE); @@ -2069,23 +1929,23 @@ void TestGenericPool(void) CFE_ES_GenPoolGetBucketUsage(&Pool1, 1, &BlockStats); /* Check various outputs to ensure correctness */ - UtAssert_UINT32_EQ(TotalSize, OffsetEnd); + CFE_UtAssert_MEMOFFSET_EQ(TotalSize, OffsetEnd); UtAssert_UINT32_EQ(CountBuf, 3); - UtAssert_True(FreeSize > 0, "FreeSize(%lu) > 0", (unsigned long)FreeSize); + UtAssert_NONZERO(FreeSize); /* put blocks so the pool has a mixture of allocated an deallocated blocks */ - UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, Offset1), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, Offset2), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, Offset1)); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, Offset2)); /* Now wipe the pool management structure, and attempt to rebuild it. */ - UtAssert_INT32_EQ(CFE_ES_GenPoolInitialize(&Pool2, 0, OffsetEnd, 32, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, - UT_POOL_BLOCK_SIZES, ES_UT_PoolDirectRetrieve, ES_UT_PoolDirectCommit), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolInitialize(&Pool2, 0, OffsetEnd, 32, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, + UT_POOL_BLOCK_SIZES, ES_UT_PoolDirectRetrieve, + ES_UT_PoolDirectCommit)); - UtAssert_INT32_EQ(CFE_ES_GenPoolRebuild(&Pool2), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolRebuild(&Pool2)); /* After rebuilding, Pool2 should have similar state data to Pool1. */ - UtAssert_UINT32_EQ(Pool1.TailPosition, Pool2.TailPosition); + CFE_UtAssert_MEMOFFSET_EQ(Pool1.TailPosition, Pool2.TailPosition); UtAssert_UINT32_EQ(Pool1.AllocationCount, Pool2.AllocationCount); for (i = 0; i < Pool1.NumBuckets; ++i) @@ -2103,59 +1963,58 @@ void TestGenericPool(void) /* Get blocks again, from the recovered pool, to demonstrate that * the pool is functional after recovery. */ - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 44), CFE_SUCCESS); - UtAssert_UINT32_EQ(Offset3, Offset1); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 44)); + CFE_UtAssert_MEMOFFSET_EQ(Offset3, Offset1); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset4, 72), CFE_SUCCESS); - UtAssert_UINT32_EQ(Offset4, Offset2); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset4, 72)); + CFE_UtAssert_MEMOFFSET_EQ(Offset4, Offset2); /* Test successfully creating indirect memory pool, no alignment, with mutex */ memset(&UT_MemPoolIndirectBuffer, 0xee, sizeof(UT_MemPoolIndirectBuffer)); OffsetEnd = sizeof(UT_MemPoolIndirectBuffer.Data); - UtAssert_INT32_EQ(CFE_ES_GenPoolInitialize(&Pool2, 2, OffsetEnd - 2, 0, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, - UT_POOL_BLOCK_SIZES, ES_UT_PoolIndirectRetrieve, - ES_UT_PoolIndirectCommit), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolInitialize(&Pool2, 2, OffsetEnd - 2, 0, CFE_PLATFORM_ES_POOL_MAX_BUCKETS, + UT_POOL_BLOCK_SIZES, ES_UT_PoolIndirectRetrieve, + ES_UT_PoolIndirectCommit)); /* Do Series of allocations - confirm that the implementation is * properly adhering to the block sizes specified. */ - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset1, 1), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset1, 1)); /* With no alignment adjustments, the result offset should be exactly matching */ - UtAssert_True(Offset1 == 2 + sizeof(CFE_ES_GenPoolBD_t), "Offset(%lu) match", (unsigned long)Offset1); + CFE_UtAssert_MEMOFFSET_EQ(Offset1, 2 + sizeof(CFE_ES_GenPoolBD_t)); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset2, 55), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset2, 55)); /* the previous block should be 4 in size (smallest block) */ - UtAssert_True(Offset2 == Offset1 + 4 + sizeof(CFE_ES_GenPoolBD_t), "Offset(%lu) match", (unsigned long)Offset2); + CFE_UtAssert_MEMOFFSET_EQ(Offset2, Offset1 + 4 + sizeof(CFE_ES_GenPoolBD_t)); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 15), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 15)); /* the previous block should be 56 in size */ - UtAssert_True(Offset3 == Offset2 + 56 + sizeof(CFE_ES_GenPoolBD_t), "Offset(%lu) match", (unsigned long)Offset3); + CFE_UtAssert_MEMOFFSET_EQ(Offset3, Offset2 + 56 + sizeof(CFE_ES_GenPoolBD_t)); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset4, 54), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset4, 54)); /* the previous block should be 16 in size */ - UtAssert_True(Offset4 == Offset3 + 16 + sizeof(CFE_ES_GenPoolBD_t), "Offset(%lu) match", (unsigned long)Offset4); + CFE_UtAssert_MEMOFFSET_EQ(Offset4, Offset3 + 16 + sizeof(CFE_ES_GenPoolBD_t)); - UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset1), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset2), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset3), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset4), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset1, 56), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset1)); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset2)); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset3)); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset4)); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset1, 56)); /* should re-issue previous block */ - UtAssert_True(Offset4 == Offset1, "Offset(%lu) match", (unsigned long)Offset1); + CFE_UtAssert_MEMOFFSET_EQ(Offset4, Offset1); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 56), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 56)); /* should re-issue previous block */ - UtAssert_True(Offset3 == Offset2, "Offset(%lu) match", (unsigned long)Offset3); + CFE_UtAssert_MEMOFFSET_EQ(Offset3, Offset2); /* Getting another will fail, despite being enough space, * because its now fragmented. */ UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset2, 12), CFE_ES_ERR_MEM_BLOCK_SIZE); /* Put the buffer, then corrupt the memory and try to recycle */ - UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset3), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolPutBlock(&Pool2, &BlockSize, Offset3)); memset(UT_MemPoolIndirectBuffer.Data, 0xee, sizeof(UT_MemPoolIndirectBuffer.Data)); UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool2, &Offset3, 56), CFE_ES_ERR_MEM_BLOCK_SIZE); @@ -2165,35 +2024,34 @@ void TestGenericPool(void) /* Calculate exact (predicted) pool consumption per block */ OffsetEnd = (sizeof(CFE_ES_GenPoolBD_t) + 31) & 0xFFF0; OffsetEnd *= 2; /* make enough for 2 */ - UtAssert_INT32_EQ(CFE_ES_GenPoolInitialize(&Pool1, 0, OffsetEnd, 16, 1, UT_POOL_BLOCK_SIZES, - ES_UT_PoolDirectRetrieve, ES_UT_PoolDirectCommit), - CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolInitialize(&Pool1, 0, OffsetEnd, 16, 1, UT_POOL_BLOCK_SIZES, + ES_UT_PoolDirectRetrieve, ES_UT_PoolDirectCommit)); /* * This should be exactly enough for 2 allocations. * Allocation larger than 16 should fail. */ UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset1, 32), CFE_ES_ERR_MEM_BLOCK_SIZE); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset2, 1), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_ES_GenPoolGetBlock(&Pool1, &Offset3, 16), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool1, &Offset2, 1)); + CFE_UtAssert_SUCCESS(CFE_ES_GenPoolGetBlock(&Pool1, &Offset3, 16)); /* Call stats functions for coverage (no return code) */ CFE_ES_GenPoolGetUsage(&Pool1, &FreeSize, &TotalSize); CFE_ES_GenPoolGetCounts(&Pool1, &NumBlocks, &CountBuf, &ErrBuf); /* Check various outputs to ensure correctness */ - UtAssert_UINT32_EQ(TotalSize, OffsetEnd); - UtAssert_UINT32_EQ(FreeSize, 0); + CFE_UtAssert_MEMOFFSET_EQ(TotalSize, OffsetEnd); + CFE_UtAssert_MEMOFFSET_EQ(FreeSize, 0); UtAssert_UINT32_EQ(CountBuf, 2); /* * Check other validation */ UtAssert_INT32_EQ(CFE_ES_GenPoolPutBlock(&Pool1, &BlockSize, 0), CFE_ES_BUFFER_NOT_IN_POOL); - UtAssert_True(CFE_ES_GenPoolValidateState(&Pool1), "Nominal Handle validation"); + CFE_UtAssert_TRUE(CFE_ES_GenPoolValidateState(&Pool1)); Pool1.TailPosition = 0xFFFFFF; - UtAssert_True(!CFE_ES_GenPoolValidateState(&Pool1), "Validate Corrupt handle"); + CFE_UtAssert_FALSE(CFE_ES_GenPoolValidateState(&Pool1)); } void TestTask(void) @@ -2247,71 +2105,64 @@ void TestTask(void) /* Set up buffer for first cycle, pipe failure is on 2nd */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false); CFE_ES_TaskMain(); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_COMMAND_PIPE]), "CFE_ES_TaskMain", - "Command pipe error, UT_OSP_COMMAND_PIPE message"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_COMMAND_PIPE]); /* Test task main process loop with bad checksum information */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_GetCFETextSegmentInfo), 1, -1); /* this is needed so CFE_ES_GetAppId works */ ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, NULL, NULL, NULL); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == CFE_SUCCESS, "CFE_ES_TaskInit", - "Checksum fail, task init result"); - UT_Report(__FILE__, __LINE__, CFE_ES_Global.TaskData.HkPacket.Payload.CFECoreChecksum == 0xFFFF, "CFE_ES_TaskInit", - "Checksum fail, checksum value"); + CFE_UtAssert_SUCCESS(CFE_ES_TaskInit()); + UtAssert_UINT32_EQ(CFE_ES_Global.TaskData.HkPacket.Payload.CFECoreChecksum, 0xFFFF); /* Test successful task main process loop - Power On Reset Path */ ES_ResetUnitTest(); /* this is needed so CFE_ES_GetAppId works */ ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, NULL, NULL, NULL); CFE_ES_Global.ResetDataPtr->ResetVars.ResetType = 2; - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskInit() == CFE_SUCCESS && CFE_ES_Global.TaskData.HkPacket.Payload.CFECoreChecksum != 0xFFFF, - "CFE_ES_TaskInit", "Checksum success, POR Path"); + CFE_UtAssert_SUCCESS(CFE_ES_TaskInit()); /* Test successful task main process loop - Processor Reset Path */ ES_ResetUnitTest(); /* this is needed so CFE_ES_GetAppId works */ ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, NULL, NULL, NULL); CFE_ES_Global.ResetDataPtr->ResetVars.ResetType = 1; - UT_Report(__FILE__, __LINE__, - CFE_ES_TaskInit() == CFE_SUCCESS && CFE_ES_Global.TaskData.HkPacket.Payload.CFECoreChecksum != 0xFFFF, - "CFE_ES_TaskInit", "Checksum success, PR Path"); + CFE_UtAssert_SUCCESS(CFE_ES_TaskInit()); /* Test task main process loop with a with an EVS register failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_Register), 1, -1); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -1, "CFE_ES_TaskInit", "EVS register fail"); + UtAssert_INT32_EQ(CFE_ES_TaskInit(), -1); /* Test task main process loop with a SB pipe create failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_CreatePipe), 1, -2); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -2, "CFE_ES_TaskInit", "SB pipe create fail"); + UtAssert_INT32_EQ(CFE_ES_TaskInit(), -2); /* Test task main process loop with a HK packet subscribe failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 1, -3); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -3, "CFE_ES_TaskInit", "HK packet subscribe fail"); + UtAssert_INT32_EQ(CFE_ES_TaskInit(), -3); /* Test task main process loop with a ground command subscribe failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 2, -4); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -4, "CFE_ES_TaskInit", "Ground command subscribe fail"); + UtAssert_INT32_EQ(CFE_ES_TaskInit(), -4); /* Test task main process loop with an init event send failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_SendEvent), 1, -5); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -5, "CFE_ES_TaskInit", "Initialization event send fail"); + UtAssert_INT32_EQ(CFE_ES_TaskInit(), -5); /* Test task main process loop with version event send failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_SendEvent), 2, -6); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -6, "CFE_ES_TaskInit", "Version event send fail"); + UtAssert_INT32_EQ(CFE_ES_TaskInit(), -6); /* Test task init with background init fail */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_BinSemCreate), 1, -7); - UT_Report(__FILE__, __LINE__, CFE_ES_TaskInit() == -7, "CFE_ES_TaskInit", "Background init fail"); + UtAssert_INT32_EQ(CFE_ES_TaskInit(), -7); /* Set the log mode to OVERWRITE; CFE_ES_TaskInit() sets SystemLogMode to * DISCARD, which can result in a log overflow depending on the value that @@ -2322,26 +2173,23 @@ void TestTask(void) /* Test a successful HK request */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_ES_SEND_HK); - UT_Report(__FILE__, __LINE__, CFE_ES_Global.TaskData.HkPacket.Payload.HeapBytesFree > 0, "CFE_ES_HousekeepingCmd", - "HK packet - get heap successful"); + UtAssert_NONZERO(CFE_ES_Global.TaskData.HkPacket.Payload.HeapBytesFree); /* Test the HK request with a get heap failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_HeapGetInfo), 1, -1); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_ES_SEND_HK); - UT_Report(__FILE__, __LINE__, CFE_ES_Global.TaskData.HkPacket.Payload.HeapBytesFree == 0, "CFE_ES_HousekeepingCmd", - "HK packet - get heap fail"); + UtAssert_ZERO(CFE_ES_Global.TaskData.HkPacket.Payload.HeapBytesFree); /* Test successful no-op command */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_ES_CMD_NOOP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_NOOP_INF_EID), "CFE_ES_NoopCmd", "No-op"); + CFE_UtAssert_EVENTSENT(CFE_ES_NOOP_INF_EID); /* Test successful reset counters command */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_ES_CMD_RESET_COUNTERS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESET_INF_EID), "CFE_ES_ResetCountersCmd", - "Reset counters"); + CFE_UtAssert_EVENTSENT(CFE_ES_RESET_INF_EID); /* Test successful cFE restart */ ES_ResetUnitTest(); @@ -2349,16 +2197,14 @@ void TestTask(void) CmdBuf.RestartCmd.Payload.RestartType = CFE_PSP_RST_TYPE_PROCESSOR; UT_SetDataBuffer(UT_KEY(CFE_PSP_Restart), &ResetType, sizeof(ResetType), false); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartCmd), UT_TPID_CFE_ES_CMD_RESTART_CC); - UT_Report(__FILE__, __LINE__, - ResetType == CFE_PSP_RST_TYPE_PROCESSOR && UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, - "CFE_ES_RestartCmd", "Restart cFE"); + UtAssert_UINT32_EQ(ResetType, CFE_PSP_RST_TYPE_PROCESSOR); + UtAssert_STUB_COUNT(CFE_PSP_Restart, 1); /* Test cFE restart with bad restart type */ ES_ResetUnitTest(); CmdBuf.RestartCmd.Payload.RestartType = 4524; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartCmd), UT_TPID_CFE_ES_CMD_RESTART_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_BOOT_ERR_EID), "CFE_ES_RestartCmd", - "Invalid restart type"); + CFE_UtAssert_EVENTSENT(CFE_ES_BOOT_ERR_EID); /* Test successful app create */ ES_ResetUnitTest(); @@ -2374,15 +2220,13 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(8192); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_INF_EID), "CFE_ES_StartAppCmd", - "Start application from file name"); + CFE_UtAssert_EVENTSENT(CFE_ES_START_INF_EID); /* Test app create with an OS task create failure */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_ERR_EID), "CFE_ES_StartAppCmd", - "Start application from file name fail"); + CFE_UtAssert_EVENTSENT(CFE_ES_START_ERR_EID); /* Test app create with an invalid file name */ ES_ResetUnitTest(); @@ -2399,8 +2243,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_INVALID_FILENAME_ERR_EID), "CFE_ES_StartAppCmd", - "Invalid file name"); + CFE_UtAssert_EVENTSENT(CFE_ES_START_INVALID_FILENAME_ERR_EID); /* Test app create with a null application entry point */ ES_ResetUnitTest(); @@ -2414,8 +2257,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_INVALID_ENTRY_POINT_ERR_EID), "CFE_ES_StartAppCmd", - "Application entry point null"); + CFE_UtAssert_EVENTSENT(CFE_ES_START_INVALID_ENTRY_POINT_ERR_EID); /* Test app create with a null application name */ ES_ResetUnitTest(); @@ -2430,8 +2272,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_NULL_APP_NAME_ERR_EID), "CFE_ES_StartAppCmd", - "Application name null"); + CFE_UtAssert_EVENTSENT(CFE_ES_START_NULL_APP_NAME_ERR_EID); /* Test app create with with an invalid exception action */ ES_ResetUnitTest(); @@ -2447,8 +2288,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); CmdBuf.StartAppCmd.Payload.ExceptionAction = 255; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_EXC_ACTION_ERR_EID), "CFE_ES_StartAppCmd", - "Invalid exception action"); + CFE_UtAssert_EVENTSENT(CFE_ES_START_EXC_ACTION_ERR_EID); /* Test app create with a default stack size */ ES_ResetUnitTest(); @@ -2464,8 +2304,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(0); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_INF_EID), "CFE_ES_StartAppCmd", - "Default Stack Size"); + CFE_UtAssert_EVENTSENT(CFE_ES_START_INF_EID); /* Test app create with a bad priority */ ES_ResetUnitTest(); @@ -2481,8 +2320,7 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(12096); CmdBuf.StartAppCmd.Payload.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_PRIORITY_ERR_EID), "CFE_ES_StartAppCmd", - "Priority is too large"); + CFE_UtAssert_EVENTSENT(CFE_ES_START_PRIORITY_ERR_EID); /* Test successful app stop */ ES_ResetUnitTest(); @@ -2490,15 +2328,13 @@ void TestTask(void) strncpy(CmdBuf.StopAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.StopAppCmd.Payload.Application) - 1); CmdBuf.StopAppCmd.Payload.Application[sizeof(CmdBuf.StopAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StopAppCmd), UT_TPID_CFE_ES_CMD_STOP_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_STOP_DBG_EID), "CFE_ES_StopAppCmd", - "Stop application initiated"); + CFE_UtAssert_EVENTSENT(CFE_ES_STOP_DBG_EID); /* Test app stop failure */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_WAITING, "CFE_ES", NULL, NULL); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StopAppCmd), UT_TPID_CFE_ES_CMD_STOP_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_STOP_ERR1_EID), "CFE_ES_StopAppCmd", - "Stop application failed"); + CFE_UtAssert_EVENTSENT(CFE_ES_STOP_ERR1_EID); /* Test app stop with a bad app name */ ES_ResetUnitTest(); @@ -2506,8 +2342,7 @@ void TestTask(void) strncpy(CmdBuf.StopAppCmd.Payload.Application, "BAD_APP_NAME", sizeof(CmdBuf.StopAppCmd.Payload.Application) - 1); CmdBuf.StopAppCmd.Payload.Application[sizeof(CmdBuf.StopAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StopAppCmd), UT_TPID_CFE_ES_CMD_STOP_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_STOP_ERR2_EID), "CFE_ES_StopAppCmd", - "Stop application bad name"); + CFE_UtAssert_EVENTSENT(CFE_ES_STOP_ERR2_EID); /* Test successful app restart */ ES_ResetUnitTest(); @@ -2516,8 +2351,7 @@ void TestTask(void) strncpy(CmdBuf.RestartAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1); CmdBuf.RestartAppCmd.Payload.Application[sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartAppCmd), UT_TPID_CFE_ES_CMD_RESTART_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_DBG_EID), "CFE_ES_RestartAppCmd", - "Restart application initiated"); + CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_DBG_EID); /* Test app restart with failed file check */ ES_ResetUnitTest(); @@ -2527,8 +2361,7 @@ void TestTask(void) strncpy(CmdBuf.RestartAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.RestartAppCmd.Payload.Application)); CmdBuf.RestartAppCmd.Payload.Application[sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartAppCmd), UT_TPID_CFE_ES_CMD_RESTART_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_ERR1_EID), "CFE_ES_RestartAppCmd", - "Restart application failed"); + CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_ERR1_EID); /* Test app restart with a bad app name */ ES_ResetUnitTest(); @@ -2537,8 +2370,7 @@ void TestTask(void) sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1); CmdBuf.RestartAppCmd.Payload.Application[sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartAppCmd), UT_TPID_CFE_ES_CMD_RESTART_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_ERR2_EID), "CFE_ES_RestartAppCmd", - "Restart application bad name"); + CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_ERR2_EID); /* Test failed app restart, core app */ ES_ResetUnitTest(); @@ -2547,8 +2379,7 @@ void TestTask(void) strncpy(CmdBuf.RestartAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1); CmdBuf.RestartAppCmd.Payload.Application[sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartAppCmd), UT_TPID_CFE_ES_CMD_RESTART_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_ERR1_EID), "CFE_ES_RestartAppCmd", - "Restart application failed"); + CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_ERR1_EID); /* Test failed app restart, not running */ ES_ResetUnitTest(); @@ -2557,8 +2388,7 @@ void TestTask(void) strncpy(CmdBuf.RestartAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.RestartAppCmd.Payload.Application)); CmdBuf.RestartAppCmd.Payload.Application[sizeof(CmdBuf.RestartAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartAppCmd), UT_TPID_CFE_ES_CMD_RESTART_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESTART_APP_ERR1_EID), "CFE_ES_RestartAppCmd", - "Restart application failed"); + CFE_UtAssert_EVENTSENT(CFE_ES_RESTART_APP_ERR1_EID); /* Test successful app reload */ ES_ResetUnitTest(); @@ -2569,8 +2399,7 @@ void TestTask(void) strncpy(CmdBuf.ReloadAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1); CmdBuf.ReloadAppCmd.Payload.Application[sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ReloadAppCmd), UT_TPID_CFE_ES_CMD_RELOAD_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_DBG_EID), "CFE_ES_ReloadAppCmd", - "Reload application initiated"); + CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_DBG_EID); /* Test app reload with missing file */ ES_ResetUnitTest(); @@ -2582,8 +2411,7 @@ void TestTask(void) strncpy(CmdBuf.ReloadAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.ReloadAppCmd.Payload.Application)); CmdBuf.ReloadAppCmd.Payload.Application[sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ReloadAppCmd), UT_TPID_CFE_ES_CMD_RELOAD_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_ERR1_EID), "CFE_ES_ReloadAppCmd", - "Reload application failed"); + CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_ERR1_EID); /* Test app reload with a bad app name */ ES_ResetUnitTest(); @@ -2592,8 +2420,7 @@ void TestTask(void) sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1); CmdBuf.ReloadAppCmd.Payload.Application[sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ReloadAppCmd), UT_TPID_CFE_ES_CMD_RELOAD_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_ERR2_EID), "CFE_ES_ReloadAppCmd", - "Reload application bad name"); + CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_ERR2_EID); /* Test failed app reload, core app */ ES_ResetUnitTest(); @@ -2602,8 +2429,7 @@ void TestTask(void) strncpy(CmdBuf.ReloadAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.ReloadAppCmd.Payload.Application)); CmdBuf.ReloadAppCmd.Payload.Application[sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ReloadAppCmd), UT_TPID_CFE_ES_CMD_RELOAD_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_ERR1_EID), "CFE_ES_ReloadAppCmd", - "Reload application failed"); + CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_ERR1_EID); /* Test failed app reload, not RUNNING */ ES_ResetUnitTest(); @@ -2612,8 +2438,7 @@ void TestTask(void) strncpy(CmdBuf.ReloadAppCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.ReloadAppCmd.Payload.Application)); CmdBuf.ReloadAppCmd.Payload.Application[sizeof(CmdBuf.ReloadAppCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ReloadAppCmd), UT_TPID_CFE_ES_CMD_RELOAD_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RELOAD_APP_ERR1_EID), "CFE_ES_ReloadAppCmd", - "Reload application failed"); + CFE_UtAssert_EVENTSENT(CFE_ES_RELOAD_APP_ERR1_EID); /* Test successful telemetry packet request for single app data */ ES_ResetUnitTest(); @@ -2622,8 +2447,7 @@ void TestTask(void) strncpy(CmdBuf.QueryOneCmd.Payload.Application, "CFE_ES", sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1); CmdBuf.QueryOneCmd.Payload.Application[sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryOneCmd), UT_TPID_CFE_ES_CMD_QUERY_ONE_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ONE_APP_EID), "CFE_ES_QueryOneCmd", - "Query application - success"); + CFE_UtAssert_EVENTSENT(CFE_ES_ONE_APP_EID); /* Test telemetry packet request for single app data with send message failure */ ES_ResetUnitTest(); @@ -2633,8 +2457,7 @@ void TestTask(void) CmdBuf.QueryOneCmd.Payload.Application[sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1] = '\0'; UT_SetDeferredRetcode(UT_KEY(CFE_SB_TransmitMsg), 1, -1); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryOneCmd), UT_TPID_CFE_ES_CMD_QUERY_ONE_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ONE_ERR_EID), "CFE_ES_QueryOneCmd", - "Query application - SB send message fail"); + CFE_UtAssert_EVENTSENT(CFE_ES_ONE_ERR_EID); /* Test telemetry packet request for single app data with a bad app name */ ES_ResetUnitTest(); @@ -2643,8 +2466,7 @@ void TestTask(void) strncpy(CmdBuf.QueryOneCmd.Payload.Application, "BAD_APP_NAME", sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1); CmdBuf.QueryOneCmd.Payload.Application[sizeof(CmdBuf.QueryOneCmd.Payload.Application) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryOneCmd), UT_TPID_CFE_ES_CMD_QUERY_ONE_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ONE_APPID_ERR_EID), "CFE_ES_QueryOneCmd", - "Query application - bad application name"); + CFE_UtAssert_EVENTSENT(CFE_ES_ONE_APPID_ERR_EID); /* Test successful write of all app data to file */ ES_ResetUnitTest(); @@ -2653,31 +2475,27 @@ void TestTask(void) strncpy(CmdBuf.QueryAllCmd.Payload.FileName, "AllFilename", sizeof(CmdBuf.QueryAllCmd.Payload.FileName) - 1); CmdBuf.QueryAllCmd.Payload.FileName[sizeof(CmdBuf.QueryAllCmd.Payload.FileName) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ALL_APPS_EID), "CFE_ES_QueryAllCmd", - "Query all applications - success"); + CFE_UtAssert_EVENTSENT(CFE_ES_ALL_APPS_EID); /* Test write of all app data to file with a null file name */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ALL_APPS_EID), "CFE_ES_QueryAllCmd", - "Query all applications - null file name"); + CFE_UtAssert_EVENTSENT(CFE_ES_ALL_APPS_EID); /* Test write of all app data to file with a bad file name */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_OSCREATE_ERR_EID), "CFE_ES_QueryAllCmd", - "Query all applications - bad file name"); + CFE_UtAssert_EVENTSENT(CFE_ES_OSCREATE_ERR_EID); /* Test write of all app data to file with a write header failure */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_WRHDR_ERR_EID), "CFE_ES_QueryAllCmd", - "Write application information file fail; write header"); + CFE_UtAssert_EVENTSENT(CFE_ES_WRHDR_ERR_EID); /* Test write of all app data to file with a file write failure */ ES_ResetUnitTest(); @@ -2685,8 +2503,7 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKWR_ERR_EID), "CFE_ES_QueryAllCmd", - "Write application information file fail; task write"); + CFE_UtAssert_EVENTSENT(CFE_ES_TASKWR_ERR_EID); /* Test write of all app data to file with a file create failure */ ES_ResetUnitTest(); @@ -2694,8 +2511,7 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_OSCREATE_ERR_EID), "CFE_ES_QueryAllCmd", - "Write application information file fail; OS create"); + CFE_UtAssert_EVENTSENT(CFE_ES_OSCREATE_ERR_EID); /* Test successful write of all task data to a file */ ES_ResetUnitTest(); @@ -2703,8 +2519,7 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllTasksCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_EID), "CFE_ES_QueryAllTasksCmd", - "Task information file written"); + CFE_UtAssert_EVENTSENT(CFE_ES_TASKINFO_EID); /* Test write of all task data to a file with file name validation failure */ ES_ResetUnitTest(); @@ -2712,8 +2527,7 @@ void TestTask(void) UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllTasksCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_OSCREATE_ERR_EID), "CFE_ES_QueryAllTasksCmd", - "Task information file write fail; OS create"); + CFE_UtAssert_EVENTSENT(CFE_ES_TASKINFO_OSCREATE_ERR_EID); /* Test write of all task data to a file with write header failure */ ES_ResetUnitTest(); @@ -2723,8 +2537,7 @@ void TestTask(void) UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, -1); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllTasksCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_WRHDR_ERR_EID), "CFE_ES_QueryAllTasksCmd", - "Task information file write fail; write header"); + CFE_UtAssert_EVENTSENT(CFE_ES_TASKINFO_WRHDR_ERR_EID); /* Test write of all task data to a file with a task write failure */ ES_ResetUnitTest(); @@ -2733,8 +2546,7 @@ void TestTask(void) UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllTasksCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_WR_ERR_EID), "CFE_ES_QueryAllTasksCmd", - "Task information file write fail; task write"); + CFE_UtAssert_EVENTSENT(CFE_ES_TASKINFO_WR_ERR_EID); /* Test write of all task data to a file with an OS create failure */ ES_ResetUnitTest(); @@ -2742,15 +2554,13 @@ void TestTask(void) UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllTasksCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TASKINFO_OSCREATE_ERR_EID), "CFE_ES_QueryAllTasksCmd", - "Task information file write fail; OS create"); + CFE_UtAssert_EVENTSENT(CFE_ES_TASKINFO_OSCREATE_ERR_EID); /* Test successful clearing of the system log */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ClearSysLogCmd), UT_TPID_CFE_ES_CMD_CLEAR_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOG1_INF_EID), "CFE_ES_ClearSysLogCmd", - "Clear ES log data"); + CFE_UtAssert_EVENTSENT(CFE_ES_SYSLOG1_INF_EID); /* Test successful overwriting of the system log using discard mode */ ES_ResetUnitTest(); @@ -2758,8 +2568,7 @@ void TestTask(void) CmdBuf.OverwriteSysLogCmd.Payload.Mode = CFE_ES_LogMode_OVERWRITE; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.OverwriteSysLogCmd), UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOGMODE_EID), "CFE_ES_OverWriteSysLogCmd", - "Overwrite system log received (discard mode)"); + CFE_UtAssert_EVENTSENT(CFE_ES_SYSLOGMODE_EID); /* Test overwriting the system log using an invalid mode */ ES_ResetUnitTest(); @@ -2767,8 +2576,7 @@ void TestTask(void) CmdBuf.OverwriteSysLogCmd.Payload.Mode = 255; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.OverwriteSysLogCmd), UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERR_SYSLOGMODE_EID), "CFE_ES_OverWriteSysLogCmd", - "Overwrite system log using invalid mode"); + CFE_UtAssert_EVENTSENT(CFE_ES_ERR_SYSLOGMODE_EID); /* Test successful writing of the system log */ ES_ResetUnitTest(); @@ -2777,24 +2585,21 @@ void TestTask(void) CmdBuf.WriteSysLogCmd.Payload.FileName[sizeof(CmdBuf.WriteSysLogCmd.Payload.FileName) - 1] = '\0'; CFE_ES_Global.TaskData.HkPacket.Payload.SysLogEntries = 123; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteSysLogCmd), UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOG2_EID), "CFE_ES_WriteSysLogCmd", - "Write system log; success"); + CFE_UtAssert_EVENTSENT(CFE_ES_SYSLOG2_EID); /* Test writing the system log using a bad file name */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteSysLogCmd), UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOG2_ERR_EID), "CFE_ES_WriteSysLogCmd", - "Write system log; bad file name"); + CFE_UtAssert_EVENTSENT(CFE_ES_SYSLOG2_ERR_EID); /* Test writing the system log using a null file name */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.WriteSysLogCmd.Payload.FileName[0] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteSysLogCmd), UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOG2_EID), "CFE_ES_WriteSysLogCmd", - "Write system log; null file name"); + CFE_UtAssert_EVENTSENT(CFE_ES_SYSLOG2_EID); /* Test writing the system log with an OS create failure */ ES_ResetUnitTest(); @@ -2802,8 +2607,7 @@ void TestTask(void) UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); CmdBuf.WriteSysLogCmd.Payload.FileName[0] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteSysLogCmd), UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOG2_ERR_EID), "CFE_ES_WriteSysLogCmd", - "Write system log; OS create"); + CFE_UtAssert_EVENTSENT(CFE_ES_SYSLOG2_ERR_EID); /* Test writing the system log with an OS write failure */ ES_ResetUnitTest(); @@ -2815,21 +2619,19 @@ void TestTask(void) CFE_ES_Global.ResetDataPtr->SystemLogEndIdx = CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx; CmdBuf.WriteSysLogCmd.Payload.FileName[0] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteSysLogCmd), UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), "CFE_ES_WriteSysLogCmd", - "Write system log; OS write"); + CFE_UtAssert_EVENTSENT(CFE_ES_FILEWRITE_ERR_EID); /* Test writing the system log with a write header failure */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteSysLogCmd), UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), "CFE_ES_WriteSysLogCmd", - "Write system log; write header"); + CFE_UtAssert_EVENTSENT(CFE_ES_FILEWRITE_ERR_EID); /* Test successful clearing of the E&R log */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ClearERLogCmd), UT_TPID_CFE_ES_CMD_CLEAR_ER_LOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERLOG1_INF_EID), "CFE_ES_ClearERLogCmd", "Clear E&R log"); + CFE_UtAssert_EVENTSENT(CFE_ES_ERLOG1_INF_EID); /* Test successful writing of the E&R log */ /* In the current implementation, it does not directly write the file, @@ -2840,38 +2642,32 @@ void TestTask(void) CmdBuf.WriteERLogCmd.Payload.FileName[sizeof(CmdBuf.WriteERLogCmd.Payload.FileName) - 1] = '\0'; UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), false); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteERLogCmd), UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_FS_BackgroundFileDumpRequest)) == 1, - "CFE_ES_WriteERLogCmd", "Write E&R log command; pending"); - UT_Report(__FILE__, __LINE__, !UT_EventIsInHistory(CFE_ES_ERLOG_PENDING_ERR_EID), "CFE_ES_WriteERLogCmd", - "Write E&R log command; no events"); + UtAssert_STUB_COUNT(CFE_FS_BackgroundFileDumpRequest, 1); + CFE_UtAssert_EVENTCOUNT(0); /* Failure of parsing the file name */ UT_ClearEventHistory(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteERLogCmd), UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERLOG2_ERR_EID), "CFE_ES_WriteERLogCmd", - "Write E&R log command; bad file name"); + CFE_UtAssert_EVENTSENT(CFE_ES_ERLOG2_ERR_EID); /* Failure from CFE_FS_BackgroundFileDumpRequest() should send the pending error event ID */ UT_ClearEventHistory(); UT_SetDeferredRetcode(UT_KEY(CFE_FS_BackgroundFileDumpRequest), 1, CFE_STATUS_REQUEST_ALREADY_PENDING); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteERLogCmd), UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERLOG_PENDING_ERR_EID), "CFE_ES_WriteERLogCmd", - "Write E&R log command; already pending event (from FS)"); + CFE_UtAssert_EVENTSENT(CFE_ES_ERLOG_PENDING_ERR_EID); /* Same event but pending locally */ UT_ClearEventHistory(); UT_SetDefaultReturnValue(UT_KEY(CFE_FS_BackgroundFileDumpIsPending), true); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.WriteERLogCmd), UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_ERLOG_PENDING_ERR_EID), "CFE_ES_WriteERLogCmd", - "Write E&R log command; already pending event (local)"); + CFE_UtAssert_EVENTSENT(CFE_ES_ERLOG_PENDING_ERR_EID); /* Test scan for exceptions in the PSP, should invoke a Processor Reset */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_Exception_GetCount), 1); CFE_ES_RunExceptionScan(0, NULL); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, "CFE_ES_RunExceptionScan", - "Scan for exceptions; processor restart"); + UtAssert_STUB_COUNT(CFE_PSP_Restart, 1); ES_ResetUnitTest(); CFE_ES_Global.ResetDataPtr->ResetVars.ProcessorResetCount = 0; @@ -2879,12 +2675,11 @@ void TestTask(void) UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_Exception_GetCount), 1); CFE_ES_RunExceptionScan(0, NULL); /* first time should do a processor restart (limit reached) */ - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, "CFE_ES_RunExceptionScan", - "Scan for exceptions; processor restart"); + UtAssert_STUB_COUNT(CFE_PSP_Restart, 1); + /* next time should do a poweron restart (limit reached) */ CFE_ES_RunExceptionScan(0, NULL); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 2, "CFE_ES_RunExceptionScan", - "Scan for exceptions; poweron restart"); + UtAssert_STUB_COUNT(CFE_PSP_Restart, 2); /* nominal for app restart - associate exception with a task ID */ ES_ResetUnitTest(); @@ -2897,11 +2692,8 @@ void TestTask(void) CFE_ES_RunExceptionScan(0, NULL); /* should have changed AppControlRequest from RUN to SYS_RESTART, * and the call to CFE_PSP_Restart should NOT increment */ - UT_Report(__FILE__, __LINE__, UtAppRecPtr->ControlReq.AppControlRequest == CFE_ES_RunStatus_SYS_RESTART, - "CFE_ES_RunExceptionScan", "Scan for exceptions; app restart request pending"); - - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 0, "CFE_ES_RunExceptionScan", - "Scan for exceptions; no psp restart"); + UtAssert_INT32_EQ(UtAppRecPtr->ControlReq.AppControlRequest, CFE_ES_RunStatus_SYS_RESTART); + UtAssert_STUB_COUNT(CFE_PSP_Restart, 0); /* repeat, but for a CORE app, which cannot be restarted */ ES_ResetUnitTest(); @@ -2912,29 +2704,25 @@ void TestTask(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; UtAppRecPtr->StartParams.ExceptionAction = CFE_ES_ExceptionAction_RESTART_APP; CFE_ES_RunExceptionScan(0, NULL); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 1, "CFE_ES_RunExceptionScan", - "Scan for exceptions; core app, psp restart"); + UtAssert_STUB_COUNT(CFE_PSP_Restart, 1); /* check failure of getting summary data */ UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_Exception_GetSummary), CFE_PSP_NO_EXCEPTION_DATA); CFE_ES_RunExceptionScan(0, NULL); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(CFE_PSP_Restart)) == 2, "CFE_ES_RunExceptionScan", - "Scan for exceptions; fail to get context"); + UtAssert_STUB_COUNT(CFE_PSP_Restart, 2); /* Test clearing the log with a bad size in the verify command * length call */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_CLEAR_ER_LOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_ClearERLogCmd", - "Packet length error"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test resetting and setting the max for the processor reset count */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.ResetPRCountCmd), UT_TPID_CFE_ES_CMD_RESET_PR_COUNT_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_RESET_PR_COUNT_EID), "CFE_ES_ResetPRCountCmd", - "Set processor reset count to zero"); + CFE_UtAssert_EVENTSENT(CFE_ES_RESET_PR_COUNT_EID); /* Test setting the maximum processor reset count */ ES_ResetUnitTest(); @@ -2942,8 +2730,7 @@ void TestTask(void) CmdBuf.SetMaxPRCountCmd.Payload.MaxPRCount = 3; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.SetMaxPRCountCmd), UT_TPID_CFE_ES_CMD_SET_MAX_PR_COUNT_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SET_MAX_PR_COUNT_EID), "CFE_ES_SetMaxPRCountCmd", - "Set maximum processor reset count"); + CFE_UtAssert_EVENTSENT(CFE_ES_SET_MAX_PR_COUNT_EID); /* Test failed deletion of specified CDS */ ES_ResetUnitTest(); @@ -2953,16 +2740,14 @@ void TestTask(void) strncpy(CmdBuf.DeleteCDSCmd.Payload.CdsName, "CFE_ES.CDS_NAME", sizeof(CmdBuf.DeleteCDSCmd.Payload.CdsName) - 1); CmdBuf.DeleteCDSCmd.Payload.CdsName[sizeof(CmdBuf.DeleteCDSCmd.Payload.CdsName) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DeleteCDSCmd), UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_DELETE_ERR_EID), "CFE_ES_DeleteCDSCmd", - "Delete from CDS; error"); + CFE_UtAssert_EVENTSENT(CFE_ES_CDS_DELETE_ERR_EID); /* Test failed deletion of specified critical table CDS */ /* NOTE - reuse command from previous test */ ES_ResetUnitTest(); ES_UT_SetupSingleCDSRegistry("CFE_ES.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, true, NULL); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DeleteCDSCmd), UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_DELETE_TBL_ERR_EID), "CFE_ES_DeleteCDSCmd", - "Delete from CDS; wrong type"); + CFE_UtAssert_EVENTSENT(CFE_ES_CDS_DELETE_TBL_ERR_EID); /* Test successful deletion of a specified CDS */ ES_ResetUnitTest(); @@ -2971,16 +2756,14 @@ void TestTask(void) /* Set up the block to read what we need to from the CDS */ UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DeleteCDSCmd), UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_DELETED_INFO_EID), "CFE_ES_DeleteCDSCmd", - "Delete from CDS; success"); + CFE_UtAssert_EVENTSENT(CFE_ES_CDS_DELETED_INFO_EID); /* Test deletion of a specified CDS with the owning app being active */ ES_ResetUnitTest(); ES_UT_SetupSingleCDSRegistry("CFE_ES.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, false, NULL); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DeleteCDSCmd), UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_OWNER_ACTIVE_EID), "CFE_ES_DeleteCDSCmd", - "Delete from CDS; owner active"); + CFE_UtAssert_EVENTSENT(CFE_ES_CDS_OWNER_ACTIVE_EID); /* Test deletion of a specified CDS with the name not found */ ES_ResetUnitTest(); @@ -2988,16 +2771,14 @@ void TestTask(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_BAD", NULL, NULL); CFE_ES_CDSBlockRecordSetFree(UtCDSRegRecPtr); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DeleteCDSCmd), UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_NAME_ERR_EID), "CFE_ES_DeleteCDSCmd", - "Delete from CDS; not found"); + CFE_UtAssert_EVENTSENT(CFE_ES_CDS_NAME_ERR_EID); /* Test successful dump of CDS to file using the default dump file name */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DumpCDSRegistryCmd), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_REG_DUMP_INF_EID), "CFE_ES_DumpCDSRegistryCmd", - "Dump CDS; success (default dump file)"); + CFE_UtAssert_EVENTSENT(CFE_ES_CDS_REG_DUMP_INF_EID); /* Test dumping of the CDS to a file with a bad file name */ ES_ResetUnitTest(); @@ -3005,8 +2786,7 @@ void TestTask(void) UT_SetDeferredRetcode(UT_KEY(CFE_FS_ParseInputFileNameEx), 1, CFE_FS_INVALID_PATH); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DumpCDSRegistryCmd), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CREATING_CDS_DUMP_ERR_EID), "CFE_ES_DumpCDSRegistryCmd", - "Dump CDS; bad file name"); + CFE_UtAssert_EVENTSENT(CFE_ES_CREATING_CDS_DUMP_ERR_EID); /* Test dumping of the CDS to a file with a bad FS write header */ ES_ResetUnitTest(); @@ -3014,8 +2794,7 @@ void TestTask(void) UT_SetDeferredRetcode(UT_KEY(CFE_FS_WriteHeader), 1, -1); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DumpCDSRegistryCmd), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_WRITE_CFE_HDR_ERR_EID), "CFE_ES_DumpCDSRegistryCmd", - "Dump CDS; write header"); + CFE_UtAssert_EVENTSENT(CFE_ES_WRITE_CFE_HDR_ERR_EID); /* Test dumping of the CDS to a file with an OS create failure */ ES_ResetUnitTest(); @@ -3023,8 +2802,7 @@ void TestTask(void) UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DumpCDSRegistryCmd), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CREATING_CDS_DUMP_ERR_EID), "CFE_ES_DumpCDSRegistryCmd", - "Dump CDS; OS create"); + CFE_UtAssert_EVENTSENT(CFE_ES_CREATING_CDS_DUMP_ERR_EID); /* Test dumping of the CDS to a file with an OS write failure */ ES_ResetUnitTest(); @@ -3033,16 +2811,14 @@ void TestTask(void) ES_UT_SetupSingleCDSRegistry("CFE_ES.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, false, NULL); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DumpCDSRegistryCmd), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_DUMP_ERR_EID), "CFE_ES_DumpCDSRegistryCmd", - "Dump CDS; OS write"); + CFE_UtAssert_EVENTSENT(CFE_ES_CDS_DUMP_ERR_EID); /* Test telemetry pool statistics retrieval with an invalid handle */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.SendMemPoolStatsCmd), UT_TPID_CFE_ES_CMD_SEND_MEM_POOL_STATS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_INVALID_POOL_HANDLE_ERR_EID), "CFE_ES_SendMemPoolStatsCmd", - "Telemetry pool; bad handle"); + CFE_UtAssert_EVENTSENT(CFE_ES_INVALID_POOL_HANDLE_ERR_EID); /* Test successful telemetry pool statistics retrieval */ ES_ResetUnitTest(); @@ -3050,47 +2826,41 @@ void TestTask(void) CmdBuf.SendMemPoolStatsCmd.Payload.PoolHandle = CFE_ES_MemPoolRecordGetID(UtPoolRecPtr); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.SendMemPoolStatsCmd), UT_TPID_CFE_ES_CMD_SEND_MEM_POOL_STATS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_TLM_POOL_STATS_INFO_EID), "CFE_ES_SendMemPoolStatsCmd", - "Telemetry pool; success"); + CFE_UtAssert_EVENTSENT(CFE_ES_TLM_POOL_STATS_INFO_EID); /* Test the command pipe message process with an invalid command */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_ES_CMD_INVALID_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CC1_ERR_EID), "CFE_ES_TaskPipe", "Invalid ground command"); + CFE_UtAssert_EVENTSENT(CFE_ES_CC1_ERR_EID); /* Test sending a no-op command with an invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_NOOP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_NoopCmd", - "No-op; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a reset counters command with an invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RESET_COUNTERS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_ResetCountersCmd", - "Reset counters; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a cFE restart command with an invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RESTART_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_RestartCmd", - "Restart cFE; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test cFE restart with a power on reset */ ES_ResetUnitTest(); memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.RestartCmd.Payload.RestartType = CFE_PSP_RST_TYPE_POWERON; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.RestartCmd), UT_TPID_CFE_ES_CMD_RESTART_CC); - UT_Report(__FILE__, __LINE__, !UT_EventIsInHistory(CFE_ES_BOOT_ERR_EID), "CFE_ES_RestartCmd", - "Power on reset restart type"); + CFE_UtAssert_EVENTNOTSENT(CFE_ES_BOOT_ERR_EID); /* Test sending a start application command with an invalid command * length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_StartAppCmd", - "Start application command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test start application command with a processor restart on application * exception @@ -3108,80 +2878,70 @@ void TestTask(void) CmdBuf.StartAppCmd.Payload.Priority = 160; CmdBuf.StartAppCmd.Payload.StackSize = CFE_ES_MEMOFFSET_C(CFE_PLATFORM_ES_DEFAULT_STACK_SIZE); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.StartAppCmd), UT_TPID_CFE_ES_CMD_START_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_START_INF_EID), "CFE_ES_StartAppCmd", - "Processor restart on application exception"); + CFE_UtAssert_EVENTSENT(CFE_ES_START_INF_EID); /* Test sending a stop application command with an invalid command * length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_STOP_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_StopAppCmd", - "Stop application command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a restart application command with an invalid command * length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RESTART_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_RestartAppCmd", - "Restart application command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a reload application command with an invalid command * length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RELOAD_APP_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_ReloadAppCmd", - "Reload application command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a write request for a single application with an * invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_QUERY_ONE_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_QueryOneAppCmd", - "Query one application command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a write request for all applications with an * invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_QUERY_ALL_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_QueryAllAppCmd", - "Query all applications command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a write request for all tasks with an * invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_QueryAllAppCmd", - "Query all tasks command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a request to clear the system log with an * invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_CLEAR_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_ClearSysLogCmd", - "Clear system log command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a request to overwrite the system log with an * invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_OverwriteSysLogCmd", - "Overwrite system log command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a request to write the system log with an * invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_WriteSysLogCmd", - "Write system log command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test successful overwriting of the system log using overwrite mode */ ES_ResetUnitTest(); @@ -3189,49 +2949,42 @@ void TestTask(void) CmdBuf.OverwriteSysLogCmd.Payload.Mode = CFE_ES_LogMode_OVERWRITE; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.OverwriteSysLogCmd), UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_SYSLOGMODE_EID), "CFE_ES_OverWriteSysLogCmd", - "Overwrite system log received (overwrite mode)"); + CFE_UtAssert_EVENTSENT(CFE_ES_SYSLOGMODE_EID); /* Test sending a request to write the error log with an * invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_WriteErrlogCmd", - "Write error log command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a request to reset the processor reset count with an * invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RESET_PR_COUNT_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_ResetPRCountCmd", - "Reset processor reset count command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a request to set the maximum processor reset count with * an invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_SET_MAX_PR_COUNT_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_SetMaxPRCountCmd", - "Set maximum processor reset count command; invalid " - "command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a request to delete the CDS with an invalid command * length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_DELETE_CDS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_DeleteCDSCmd", - "Delete CDS command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test sending a telemetry pool statistics retrieval command with an * invalid command length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_SEND_MEM_POOL_STATS_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_LEN_ERR_EID), "CFE_ES_DeleteCDSCmd", - "Telemetry pool command; invalid command length"); + CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID); /* Test successful dump of CDS to file using a specified dump file name */ ES_ResetUnitTest(); @@ -3243,8 +2996,7 @@ void TestTask(void) CmdBuf.DumpCDSRegistryCmd.Payload.DumpFilename[sizeof(CmdBuf.DumpCDSRegistryCmd.Payload.DumpFilename) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DumpCDSRegistryCmd), UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_CDS_REG_DUMP_INF_EID), "CFE_ES_DumpCDSRegistryCmd", - "Dump CDS; success (dump file specified)"); + CFE_UtAssert_EVENTSENT(CFE_ES_CDS_REG_DUMP_INF_EID); } /* end TestTask */ void TestPerf(void) @@ -3273,8 +3025,7 @@ void TestPerf(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); Perf->MetaData.State = CFE_ES_PERF_MAX_STATES; CFE_ES_SetupPerfVariables(CFE_PSP_RST_TYPE_PROCESSOR); - UT_Report(__FILE__, __LINE__, Perf->MetaData.State == CFE_ES_PERF_IDLE, "CFE_ES_SetupPerfVariables", - "Idle data collection"); + UtAssert_UINT32_EQ(Perf->MetaData.State, CFE_ES_PERF_IDLE); /* Test successful performance data collection start in START * trigger mode @@ -3283,8 +3034,7 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfStartCmd.Payload.TriggerMode = CFE_ES_PERF_TRIGGER_START; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), "CFE_ES_StartPerfDataCmd", - "Collect performance data; mode START"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STARTCMD_EID); /* Test successful performance data collection start in CENTER * trigger mode @@ -3293,8 +3043,7 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfStartCmd.Payload.TriggerMode = CFE_ES_PERF_TRIGGER_CENTER; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), "CFE_ES_StartPerfDataCmd", - "Collect performance data; mode CENTER"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STARTCMD_EID); /* Test successful performance data collection start in END * trigger mode @@ -3303,8 +3052,7 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfStartCmd.Payload.TriggerMode = CFE_ES_PERF_TRIGGER_END; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), "CFE_ES_StartPerfDataCmd", - "Collect performance data; mode END"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STARTCMD_EID); /* Test performance data collection start with an invalid trigger mode * (too high) @@ -3313,8 +3061,7 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfStartCmd.Payload.TriggerMode = (CFE_ES_PERF_TRIGGER_END + 1); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_TRIG_ERR_EID), "CFE_ES_StartPerfDataCmd", - "Trigger mode out of range (high)"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STARTCMD_TRIG_ERR_EID); /* Test performance data collection start with an invalid trigger mode * (too low) @@ -3323,8 +3070,7 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfStartCmd.Payload.TriggerMode = 0xffffffff; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_TRIG_ERR_EID), "CFE_ES_StartPerfDataCmd", - "Trigger mode out of range (low)"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STARTCMD_TRIG_ERR_EID); /* Test performance data collection start with a file write in progress */ ES_ResetUnitTest(); @@ -3334,8 +3080,7 @@ void TestPerf(void) CFE_ES_Global.BackgroundPerfDumpState.CurrentState = CFE_ES_PerfDumpState_INIT; CmdBuf.PerfStartCmd.Payload.TriggerMode = CFE_ES_PERF_TRIGGER_START; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_ERR_EID), "CFE_ES_StartPerfDataCmd", - "Cannot collect performance data; write in progress"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STARTCMD_ERR_EID); /* Test performance data collection by sending another valid * start command @@ -3345,16 +3090,14 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); CmdBuf.PerfStartCmd.Payload.TriggerMode = CFE_ES_PERF_TRIGGER_START; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStartCmd), UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), "CFE_ES_StartPerfDataCmd", - "Start collecting performance data"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STARTCMD_EID); /* Test successful performance data collection stop */ ES_ResetUnitTest(); memset(&CFE_ES_Global.BackgroundPerfDumpState, 0, sizeof(CFE_ES_Global.BackgroundPerfDumpState)); memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStopCmd), UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STOPCMD_EID), "CFE_ES_StopPerfDataCmd", - "Stop collecting performance data"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STOPCMD_EID); /* Test performance data collection stop with a file name validation issue */ ES_ResetUnitTest(); @@ -3362,8 +3105,7 @@ void TestPerf(void) memset(&CmdBuf, 0, sizeof(CmdBuf)); UT_SetDefaultReturnValue(UT_KEY(CFE_FS_ParseInputFileNameEx), CFE_FS_INVALID_PATH); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStopCmd), UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_LOG_ERR_EID), "CFE_ES_StopPerfDataCmd", - "Stop performance data command bad file name"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_LOG_ERR_EID); /* Test successful performance data collection stop with a non-default file name */ @@ -3374,15 +3116,13 @@ void TestPerf(void) strncpy(CmdBuf.PerfStopCmd.Payload.DataFileName, "filename", sizeof(CmdBuf.PerfStopCmd.Payload.DataFileName) - 1); CmdBuf.PerfStopCmd.Payload.DataFileName[sizeof(CmdBuf.PerfStopCmd.Payload.DataFileName) - 1] = '\0'; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStopCmd), UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STOPCMD_EID), "CFE_ES_StopPerfDataCmd", - "Stop collecting performance data (non-default file name)"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STOPCMD_EID); /* Test performance data collection stop with a file write in progress */ ES_ResetUnitTest(); CFE_ES_Global.BackgroundPerfDumpState.CurrentState = CFE_ES_PerfDumpState_INIT; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfStopCmd), UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_STOPCMD_ERR2_EID), "CFE_ES_StopPerfDataCmd", - "Stop performance data command ignored"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_STOPCMD_ERR2_EID); /* Test performance filter mask command with out of range filter mask value */ @@ -3391,8 +3131,7 @@ void TestPerf(void) CmdBuf.PerfSetFilterMaskCmd.Payload.FilterMaskNum = CFE_ES_PERF_32BIT_WORDS_IN_MASK; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfSetFilterMaskCmd), UT_TPID_CFE_ES_CMD_SET_PERF_FILTER_MASK_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_FILTMSKERR_EID), "CFE_ES_SetPerfFilterMaskCmd", - "Performance filter mask command error; index out of range"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_FILTMSKERR_EID); /* Test successful performance filter mask command */ ES_ResetUnitTest(); @@ -3400,8 +3139,7 @@ void TestPerf(void) CmdBuf.PerfSetFilterMaskCmd.Payload.FilterMaskNum = CFE_ES_PERF_32BIT_WORDS_IN_MASK / 2; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfSetFilterMaskCmd), UT_TPID_CFE_ES_CMD_SET_PERF_FILTER_MASK_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_FILTMSKCMD_EID), "CFE_ES_SetPerfFilterMaskCmd", - "Set performance filter mask command received"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_FILTMSKCMD_EID); /* Test successful performance filter mask command with minimum filter mask value */ @@ -3410,8 +3148,7 @@ void TestPerf(void) CmdBuf.PerfSetTrigMaskCmd.Payload.TriggerMaskNum = 0; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfSetTrigMaskCmd), UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_TRIGMSKCMD_EID), "CFE_ES_SetPerfTriggerMaskCmd", - "Set performance trigger mask command received; minimum index"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_TRIGMSKCMD_EID); /* Test successful performance filter mask command with maximum filter * mask value @@ -3421,8 +3158,7 @@ void TestPerf(void) CmdBuf.PerfSetTrigMaskCmd.Payload.TriggerMaskNum = CFE_ES_PERF_32BIT_WORDS_IN_MASK - 1; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfSetTrigMaskCmd), UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_TRIGMSKCMD_EID), "CFE_ES_SetPerfTriggerMaskCmd", - "Set performance trigger mask command received; maximum index"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_TRIGMSKCMD_EID); /* Test successful performance filter mask command with a greater than the * maximum filter mask value @@ -3432,8 +3168,7 @@ void TestPerf(void) CmdBuf.PerfSetTrigMaskCmd.Payload.TriggerMaskNum = CFE_ES_PERF_32BIT_WORDS_IN_MASK + 1; UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.PerfSetTrigMaskCmd), UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC); - UT_Report(__FILE__, __LINE__, UT_EventIsInHistory(CFE_ES_PERF_TRIGMSKERR_EID), "CFE_ES_SetPerfTriggerMaskCmd", - "Performance trigger mask command error; index out of range"); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_TRIGMSKERR_EID); /* Test successful addition of a new entry to the performance log */ ES_ResetUnitTest(); @@ -3442,8 +3177,7 @@ void TestPerf(void) Perf->MetaData.InvalidMarkerReported = false; Perf->MetaData.DataEnd = CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE + 1; CFE_ES_PerfLogAdd(CFE_MISSION_ES_PERF_MAX_IDS, 0); - UT_Report(__FILE__, __LINE__, Perf->MetaData.InvalidMarkerReported == true, "CFE_ES_PerfLogAdd", - "Invalid performance marker"); + UtAssert_UINT32_EQ(Perf->MetaData.InvalidMarkerReported, true); /* Test addition of a new entry to the performance log with START * trigger mode @@ -3454,9 +3188,8 @@ void TestPerf(void) Perf->MetaData.DataCount = CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE + 1; Perf->MetaData.TriggerMask[0] = 0xFFFF; CFE_ES_PerfLogAdd(1, 0); - UT_Report(__FILE__, __LINE__, - Perf->MetaData.Mode == CFE_ES_PERF_TRIGGER_START && Perf->MetaData.State == CFE_ES_PERF_IDLE, - "CFE_ES_PerfLogAdd", "Triggered; START"); + UtAssert_UINT32_EQ(Perf->MetaData.Mode, CFE_ES_PERF_TRIGGER_START); + UtAssert_UINT32_EQ(Perf->MetaData.State, CFE_ES_PERF_IDLE); /* Test addition of a new entry to the performance log with CENTER * trigger mode @@ -3466,9 +3199,8 @@ void TestPerf(void) Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_CENTER; Perf->MetaData.TriggerCount = CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE / 2 + 1; CFE_ES_PerfLogAdd(1, 0); - UT_Report(__FILE__, __LINE__, - Perf->MetaData.Mode == CFE_ES_PERF_TRIGGER_CENTER && Perf->MetaData.State == CFE_ES_PERF_IDLE, - "CFE_ES_PerfLogAdd", "Triggered; CENTER"); + UtAssert_UINT32_EQ(Perf->MetaData.Mode, CFE_ES_PERF_TRIGGER_CENTER); + UtAssert_UINT32_EQ(Perf->MetaData.State, CFE_ES_PERF_IDLE); /* Test addition of a new entry to the performance log with END * trigger mode @@ -3477,9 +3209,8 @@ void TestPerf(void) Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_END; CFE_ES_PerfLogAdd(1, 0); - UT_Report(__FILE__, __LINE__, - Perf->MetaData.Mode == CFE_ES_PERF_TRIGGER_END && Perf->MetaData.State == CFE_ES_PERF_IDLE, - "CFE_ES_PerfLogAdd", "Triggered; END"); + UtAssert_UINT32_EQ(Perf->MetaData.Mode, CFE_ES_PERF_TRIGGER_END); + UtAssert_UINT32_EQ(Perf->MetaData.State, CFE_ES_PERF_IDLE); /* Test addition of a new entry to the performance log with an invalid * marker after an invalid marker has already been reported @@ -3488,8 +3219,7 @@ void TestPerf(void) Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; Perf->MetaData.InvalidMarkerReported = 2; CFE_ES_PerfLogAdd(CFE_MISSION_ES_PERF_MAX_IDS + 1, 0); - UT_Report(__FILE__, __LINE__, Perf->MetaData.InvalidMarkerReported == 2, "CFE_ES_PerfLogAdd", - "Invalid marker after previous invalid marker"); + UtAssert_UINT32_EQ(Perf->MetaData.InvalidMarkerReported, 2); /* Test addition of a new entry to the performance log with a marker that * is not in the filter mask @@ -3499,7 +3229,7 @@ void TestPerf(void) Perf->MetaData.FilterMask[0] = 0x0; Perf->MetaData.DataEnd = 0; CFE_ES_PerfLogAdd(0x1, 0); - UT_Report(__FILE__, __LINE__, Perf->MetaData.DataEnd == 0, "CFE_ES_PerfLogAdd", "Marker not in filter mask"); + UtAssert_UINT32_EQ(Perf->MetaData.DataEnd, 0); /* Test addition of a new entry to the performance log with the data count * below the maximum allowed @@ -3509,7 +3239,7 @@ void TestPerf(void) Perf->MetaData.DataCount = 0; Perf->MetaData.FilterMask[0] = 0xffff; CFE_ES_PerfLogAdd(0x1, 0); - UT_Report(__FILE__, __LINE__, Perf->MetaData.DataCount == 1, "CFE_ES_PerfLogAdd", "Data count below maximum"); + UtAssert_UINT32_EQ(Perf->MetaData.DataCount, 1); /* Test addition of a new entry to the performance log with a marker that * is not in the trigger mask @@ -3518,8 +3248,7 @@ void TestPerf(void) Perf->MetaData.State = CFE_ES_PERF_WAITING_FOR_TRIGGER; Perf->MetaData.TriggerMask[0] = 0x0; CFE_ES_PerfLogAdd(0x1, 0); - UT_Report(__FILE__, __LINE__, Perf->MetaData.State != CFE_ES_PERF_TRIGGERED, "CFE_ES_PerfLogAdd", - "Marker not in trigger mask"); + UtAssert_UINT32_EQ(Perf->MetaData.State, CFE_ES_PERF_WAITING_FOR_TRIGGER); /* Test addition of a new entry to the performance log with a start * trigger mode and the trigger count is less the buffer size @@ -3530,8 +3259,7 @@ void TestPerf(void) Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_START; Perf->MetaData.TriggerMask[0] = 0xffff; CFE_ES_PerfLogAdd(0x1, 0); - UT_Report(__FILE__, __LINE__, Perf->MetaData.TriggerCount == 1, "CFE_ES_PerfLogAdd", - "Start trigger mode; trigger count less than the buffer size"); + UtAssert_UINT32_EQ(Perf->MetaData.TriggerCount, 1); /* Test addition of a new entry to the performance log with a center * trigger mode and the trigger count is less than half the buffer size @@ -3541,9 +3269,7 @@ void TestPerf(void) Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; Perf->MetaData.Mode = CFE_ES_PERF_TRIGGER_CENTER; CFE_ES_PerfLogAdd(0x1, 0); - UT_Report(__FILE__, __LINE__, Perf->MetaData.State != CFE_ES_PERF_IDLE, "CFE_ES_PerfLogAdd", - "Center trigger mode; trigger count less than half the " - "buffer size"); + UtAssert_UINT32_EQ(Perf->MetaData.State, CFE_ES_PERF_TRIGGERED); /* Test addition of a new entry to the performance log with an invalid * trigger mode @@ -3553,32 +3279,27 @@ void TestPerf(void) Perf->MetaData.State = CFE_ES_PERF_TRIGGERED; Perf->MetaData.Mode = -1; CFE_ES_PerfLogAdd(0x1, 0); - UT_Report(__FILE__, __LINE__, Perf->MetaData.State != CFE_ES_PERF_IDLE, "CFE_ES_PerfLogAdd", - "Invalid trigger mode"); + UtAssert_UINT32_EQ(Perf->MetaData.State, CFE_ES_PERF_TRIGGERED); /* Test performance data collection start with an invalid message length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_START_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, !UT_EventIsInHistory(CFE_ES_PERF_STARTCMD_EID), "CFE_ES_StartPerfDataCmd", - "Invalid message length"); + CFE_UtAssert_EVENTNOTSENT(CFE_ES_PERF_STARTCMD_EID); /* Test performance data collection stop with an invalid message length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_STOP_PERF_DATA_CC); - UT_Report(__FILE__, __LINE__, !UT_EventIsInHistory(CFE_ES_PERF_STOPCMD_EID), "CFE_ES_StopPerfDataCmd", - "Invalid message length"); + CFE_UtAssert_EVENTNOTSENT(CFE_ES_PERF_STOPCMD_EID); /* Test performance data filer mask with an invalid message length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_SET_PERF_FILTER_MASK_CC); - UT_Report(__FILE__, __LINE__, !UT_EventIsInHistory(CFE_ES_PERF_FILTMSKCMD_EID), "CFE_ES_SetPerfFilterMaskCmd", - "Invalid message length"); + CFE_UtAssert_EVENTNOTSENT(CFE_ES_PERF_FILTMSKCMD_EID); /* Test performance data trigger mask with an invalid message length */ ES_ResetUnitTest(); UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_SET_PERF_TRIGGER_MASK_CC); - UT_Report(__FILE__, __LINE__, !UT_EventIsInHistory(CFE_ES_PERF_TRIGMSKCMD_EID), "CFE_ES_SetPerfTriggerMaskCmd", - "Invalid message length"); + CFE_UtAssert_EVENTNOTSENT(CFE_ES_PERF_TRIGMSKCMD_EID); /* Test perf log dump state machine */ /* Nominal call 1 - should go through up to the DELAY state */ @@ -3586,17 +3307,11 @@ void TestPerf(void) memset(&CFE_ES_Global.BackgroundPerfDumpState, 0, sizeof(CFE_ES_Global.BackgroundPerfDumpState)); CFE_ES_Global.BackgroundPerfDumpState.PendingState = CFE_ES_PerfDumpState_INIT; CFE_ES_RunPerfLogDump(1000, &CFE_ES_Global.BackgroundPerfDumpState); - UtAssert_True(CFE_ES_Global.BackgroundPerfDumpState.CurrentState == CFE_ES_PerfDumpState_DELAY, - "CFE_ES_RunPerfLogDump - CFE_ES_Global.BackgroundPerfDumpState.CurrentState (%d) == DELAY (%d)", - (int)CFE_ES_Global.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_DELAY); - UtAssert_True(UT_GetStubCount(UT_KEY(OS_OpenCreate)) == 1, "CFE_ES_RunPerfLogDump - OS_OpenCreate() called"); + UtAssert_UINT32_EQ(CFE_ES_Global.BackgroundPerfDumpState.CurrentState, CFE_ES_PerfDumpState_DELAY); /* Nominal call 2 - should go through up to the remainder of states, back to IDLE */ CFE_ES_RunPerfLogDump(1000, &CFE_ES_Global.BackgroundPerfDumpState); - UtAssert_True(CFE_ES_Global.BackgroundPerfDumpState.CurrentState == CFE_ES_PerfDumpState_IDLE, - "CFE_ES_RunPerfLogDump - CFE_ES_Global.BackgroundPerfDumpState.CurrentState (%d) == IDLE (%d)", - (int)CFE_ES_Global.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_IDLE); - UtAssert_True(UT_GetStubCount(UT_KEY(OS_close)) == 1, "CFE_ES_RunPerfLogDump - OS_close() called"); + UtAssert_UINT32_EQ(CFE_ES_Global.BackgroundPerfDumpState.CurrentState, CFE_ES_PerfDumpState_IDLE); /* Test a failure to open the output file */ /* This should go immediately back to idle, and generate CFE_ES_PERF_LOG_ERR_EID */ @@ -3605,12 +3320,8 @@ void TestPerf(void) CFE_ES_Global.BackgroundPerfDumpState.PendingState = CFE_ES_PerfDumpState_INIT; UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), -10); CFE_ES_RunPerfLogDump(1000, &CFE_ES_Global.BackgroundPerfDumpState); - UtAssert_True(CFE_ES_Global.BackgroundPerfDumpState.CurrentState == CFE_ES_PerfDumpState_IDLE, - "CFE_ES_RunPerfLogDump - OS create fail, CFE_ES_Global.BackgroundPerfDumpState.CurrentState (%d) " - "== IDLE (%d)", - (int)CFE_ES_Global.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_IDLE); - UtAssert_True(UT_EventIsInHistory(CFE_ES_PERF_LOG_ERR_EID), - "CFE_ES_RunPerfLogDump - OS create fail, generated CFE_ES_PERF_LOG_ERR_EID"); + UtAssert_UINT32_EQ(CFE_ES_Global.BackgroundPerfDumpState.CurrentState, CFE_ES_PerfDumpState_IDLE); + CFE_UtAssert_EVENTSENT(CFE_ES_PERF_LOG_ERR_EID); /* Test a failure to write to the output file */ ES_ResetUnitTest(); @@ -3618,19 +3329,12 @@ void TestPerf(void) UT_SetDefaultReturnValue(UT_KEY(OS_write), -10); CFE_ES_Global.BackgroundPerfDumpState.PendingState = CFE_ES_PerfDumpState_INIT; CFE_ES_RunPerfLogDump(1000, &CFE_ES_Global.BackgroundPerfDumpState); - UtAssert_True(CFE_ES_Global.BackgroundPerfDumpState.CurrentState == CFE_ES_PerfDumpState_DELAY, - "CFE_ES_RunPerfLogDump - OS_write fail, CFE_ES_Global.BackgroundPerfDumpState.CurrentState (%d) == " - "DELAY (%d)", - (int)CFE_ES_Global.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_DELAY); + UtAssert_UINT32_EQ(CFE_ES_Global.BackgroundPerfDumpState.CurrentState, CFE_ES_PerfDumpState_DELAY); /* This will trigger the OS_write() failure, which should go through up to the remainder of states, back to IDLE */ CFE_ES_RunPerfLogDump(1000, &CFE_ES_Global.BackgroundPerfDumpState); - UtAssert_True( - CFE_ES_Global.BackgroundPerfDumpState.CurrentState == CFE_ES_PerfDumpState_IDLE, - "CFE_ES_RunPerfLogDump - OS_write fail, CFE_ES_Global.BackgroundPerfDumpState.CurrentState (%d) == IDLE (%d)", - (int)CFE_ES_Global.BackgroundPerfDumpState.CurrentState, (int)CFE_ES_PerfDumpState_IDLE); - UtAssert_True(UT_EventIsInHistory(CFE_ES_FILEWRITE_ERR_EID), - "CFE_ES_RunPerfLogDump - OS_write fail, generated CFE_ES_FILEWRITE_ERR_EID"); + UtAssert_UINT32_EQ(CFE_ES_Global.BackgroundPerfDumpState.CurrentState, CFE_ES_PerfDumpState_IDLE); + CFE_UtAssert_EVENTSENT(CFE_ES_FILEWRITE_ERR_EID); /* Test the ability of the file writer to handle the "wrap around" from the end of * the perflog buffer back to the beginning. Just need to set up the metadata @@ -3645,13 +3349,9 @@ void TestPerf(void) CFE_ES_Global.BackgroundPerfDumpState.StateCounter = 4; CFE_ES_RunPerfLogDump(1000, &CFE_ES_Global.BackgroundPerfDumpState); /* check that the wraparound occurred */ - UtAssert_True(CFE_ES_Global.BackgroundPerfDumpState.DataPos == 2, - "CFE_ES_RunPerfLogDump - wraparound, DataPos (%u) == 2", - (unsigned int)CFE_ES_Global.BackgroundPerfDumpState.DataPos); + UtAssert_UINT32_EQ(CFE_ES_Global.BackgroundPerfDumpState.DataPos, 2); /* should have written 4 entries to the log */ - UtAssert_True(CFE_ES_Global.BackgroundPerfDumpState.FileSize == sizeof(CFE_ES_PerfDataEntry_t) * 4, - "CFE_ES_RunPerfLogDump - wraparound, FileSize (%u) == sizeof(CFE_ES_PerfDataEntry_t) * 4", - (unsigned int)CFE_ES_Global.BackgroundPerfDumpState.FileSize); + UtAssert_UINT32_EQ(CFE_ES_Global.BackgroundPerfDumpState.FileSize, sizeof(CFE_ES_PerfDataEntry_t) * 4); /* Confirm that the "CFE_ES_GetPerfLogDumpRemaining" function works. * This requires that the state is not idle, in order to get nonzero results. @@ -3663,10 +3363,10 @@ void TestPerf(void) CFE_ES_Global.BackgroundPerfDumpState.StateCounter = 10; Perf->MetaData.DataCount = 100; /* in states other than WRITE_PERF_ENTRIES, it should report the full size of the log */ - UtAssert_True(CFE_ES_GetPerfLogDumpRemaining() == 100, " CFE_ES_GetPerfLogDumpRemaining - Setup Phase"); + UtAssert_UINT32_EQ(CFE_ES_GetPerfLogDumpRemaining(), 100); /* in WRITE_PERF_ENTRIES, it should report the StateCounter */ CFE_ES_Global.BackgroundPerfDumpState.CurrentState = CFE_ES_PerfDumpState_WRITE_PERF_ENTRIES; - UtAssert_True(CFE_ES_GetPerfLogDumpRemaining() == 10, " CFE_ES_GetPerfLogDumpRemaining - Active Phase"); + UtAssert_UINT32_EQ(CFE_ES_GetPerfLogDumpRemaining(), 10); } void TestAPI(void) @@ -3674,10 +3374,8 @@ void TestAPI(void) osal_id_t TestObjId; char AppName[OS_MAX_API_NAME + 12]; uint32 StackBuf[8]; - int32 Return; uint8 Data[12]; uint32 ResetType; - uint32 * ResetTypePtr; CFE_ES_AppId_t AppId; CFE_ES_TaskId_t TaskId; uint32 RunStatus; @@ -3696,77 +3394,59 @@ void TestAPI(void) CFE_ES_ResetCFE(ResetType); CFE_ES_Global.ResetDataPtr->ResetVars.ProcessorResetCount = CFE_ES_Global.ResetDataPtr->ResetVars.MaxProcessorResetCount; - UT_Report(__FILE__, __LINE__, - CFE_ES_ResetCFE(ResetType) == CFE_ES_NOT_IMPLEMENTED && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_MAX_PROC_RESETS]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_PROC_RESET_COMMANDED]), - "CFE_ES_ResetCFE", "Processor reset"); + UtAssert_INT32_EQ(CFE_ES_ResetCFE(ResetType), CFE_ES_NOT_IMPLEMENTED); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_POR_MAX_PROC_RESETS]); /* Test getting the reset type using a valid pointer and a null pointer */ ES_ResetUnitTest(); - Return = CFE_ES_GetResetType(&ResetType); - ResetTypePtr = NULL; - CFE_ES_GetResetType(ResetTypePtr); - UT_Report(__FILE__, __LINE__, Return == CFE_PSP_RST_TYPE_PROCESSOR && ResetTypePtr == NULL, "CFE_ES_GetResetType", - "Get reset type successful"); + UtAssert_INT32_EQ(CFE_ES_GetResetType(&ResetType), CFE_PSP_RST_TYPE_PROCESSOR); + UtAssert_INT32_EQ(CFE_ES_GetResetType(NULL), CFE_PSP_RST_TYPE_PROCESSOR); /* Test resetting the cFE with a power on reset */ ES_ResetUnitTest(); - ResetType = CFE_PSP_RST_TYPE_POWERON; - UT_Report(__FILE__, __LINE__, - CFE_ES_ResetCFE(ResetType) == CFE_ES_NOT_IMPLEMENTED && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_COMMANDED]), - "CFE_ES_ResetCFE", "Power on reset"); + UtAssert_INT32_EQ(CFE_ES_ResetCFE(CFE_PSP_RST_TYPE_POWERON), CFE_ES_NOT_IMPLEMENTED); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_POR_COMMANDED]); /* Test resetting the cFE with an invalid argument */ ES_ResetUnitTest(); - ResetType = CFE_PSP_RST_TYPE_POWERON + 3; - UT_Report(__FILE__, __LINE__, CFE_ES_ResetCFE(ResetType) == CFE_ES_BAD_ARGUMENT, "CFE_ES_ResetCFE", - "Bad reset type"); + UtAssert_INT32_EQ(CFE_ES_ResetCFE(CFE_PSP_RST_TYPE_POWERON + 3), CFE_ES_BAD_ARGUMENT); /* Test restarting an app that doesn't exist */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_STOPPED, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_APPID_C( ES_UT_MakeAppIdForIndex(CFE_PLATFORM_ES_MAX_APPLICATIONS - 1)); /* Should be within range, but not used */ - UT_Report(__FILE__, __LINE__, CFE_ES_RestartApp(AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, "CFE_ES_RestartApp", - "Bad application ID"); + UtAssert_INT32_EQ(CFE_ES_RestartApp(AppId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test restarting an app with an ID out of range (high) */ ES_ResetUnitTest(); AppId = CFE_ES_APPID_C(ES_UT_MakeAppIdForIndex(99999)); - UT_Report(__FILE__, __LINE__, CFE_ES_RestartApp(AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, "CFE_ES_RestartApp", - "Application ID too large"); + UtAssert_INT32_EQ(CFE_ES_RestartApp(AppId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test reloading an app that doesn't exist */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_STOPPED, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_ReloadApp(AppId, "filename") == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_ReloadApp", "Bad application ID"); + UtAssert_INT32_EQ(CFE_ES_ReloadApp(AppId, "filename"), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test deleting an app that doesn't exist */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_STOPPED, NULL, &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteApp(AppId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, "CFE_ES_DeleteApp", - "Bad application ID"); + UtAssert_INT32_EQ(CFE_ES_DeleteApp(AppId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test exiting an app with an init error */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_STOPPED, NULL, &UtAppRecPtr, NULL); CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_INIT_ERROR); - UT_Report(__FILE__, __LINE__, - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CORE_INIT]) && - UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_POR_MAX_PROC_RESETS]), - "CFE_ES_ExitApp", "Application initialization error"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CORE_INIT]); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_POR_MAX_PROC_RESETS]); /* Test exiting an app with a runtime error */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_STOPPED, NULL, &UtAppRecPtr, NULL); CFE_ES_ExitApp(CFE_ES_RunStatus_CORE_APP_RUNTIME_ERROR); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CORE_RUNTIME]), "CFE_ES_ExitApp", - "Application runtime error"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CORE_RUNTIME]); /* Test exiting an app with an exit error */ /* Note - this exit code of 1000 is invalid, which causes @@ -3776,11 +3456,8 @@ void TestAPI(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_STOPPED, "UT", &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; CFE_ES_ExitApp(1000); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CORE_APP_EXIT]), "CFE_ES_ExitApp", - "Application exit error"); - UtAssert_True(UtAppRecPtr->ControlReq.AppControlRequest == CFE_ES_RunStatus_APP_ERROR, - "CFE_ES_ExitApp - AppControlRequest (%u) == CFE_ES_RunStatus_APP_ERROR (%u)", - (unsigned int)UtAppRecPtr->ControlReq.AppControlRequest, (unsigned int)CFE_ES_RunStatus_APP_ERROR); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CORE_APP_EXIT]); + UtAssert_UINT32_EQ(UtAppRecPtr->ControlReq.AppControlRequest, CFE_ES_RunStatus_APP_ERROR); #if 0 /* Can't cover this path since it contains a while(1) (i.e., @@ -3800,22 +3477,21 @@ void TestAPI(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); RunStatus = CFE_ES_RunStatus_APP_RUN; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; - UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == true, "CFE_ES_RunLoop", "Request to run application"); + CFE_UtAssert_TRUE(CFE_ES_RunLoop(&RunStatus)); /* Test successful run loop app stop request */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); RunStatus = CFE_ES_RunStatus_APP_RUN; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; - UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == false, "CFE_ES_RunLoop", - "Request to stop running application"); + CFE_UtAssert_FALSE(CFE_ES_RunLoop(&RunStatus)); /* Test successful run loop app exit request */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); RunStatus = CFE_ES_RunStatus_APP_EXIT; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; - UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == false, "CFE_ES_RunLoop", "Request to exit application"); + CFE_UtAssert_FALSE(CFE_ES_RunLoop(&RunStatus)); /* Test run loop with bad app ID */ ES_ResetUnitTest(); @@ -3823,133 +3499,119 @@ void TestAPI(void) RunStatus = CFE_ES_RunStatus_APP_RUN; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; CFE_ES_TaskRecordSetFree(UtTaskRecPtr); /* make it so task ID is bad */ - UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == false, "CFE_ES_RunLoop", "Bad internal application ID"); + CFE_UtAssert_FALSE(CFE_ES_RunLoop(&RunStatus)); /* Test run loop with an invalid run status */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); RunStatus = 1000; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; - UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == false, "CFE_ES_RunLoop", "Invalid run status"); + CFE_UtAssert_FALSE(CFE_ES_RunLoop(&RunStatus)); /* Test run loop with a NULL run status */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; - UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(NULL), "CFE_ES_RunLoop", "Nominal, NULL output pointer"); + CFE_UtAssert_TRUE(CFE_ES_RunLoop(NULL)); /* Test run loop with startup sync code */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_LATE_INIT, NULL, &UtAppRecPtr, NULL); RunStatus = CFE_ES_RunStatus_APP_RUN; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_RUN; - UT_Report(__FILE__, __LINE__, - CFE_ES_RunLoop(&RunStatus) == true && UtAppRecPtr->AppState == CFE_ES_AppState_RUNNING, "CFE_ES_RunLoop", - "Status change from initializing to run"); + CFE_UtAssert_TRUE(CFE_ES_RunLoop(&RunStatus)); + UtAssert_UINT32_EQ(UtAppRecPtr->AppState, CFE_ES_AppState_RUNNING); /* Test getting the cFE application and task ID by context */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); - UT_Report(__FILE__, __LINE__, CFE_ES_GetAppID(&AppId) == CFE_SUCCESS, "CFE_ES_GetAppID", - "Get application ID by context successful"); - UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskID(&TaskId) == CFE_SUCCESS, "CFE_ES_GetTaskID", - "Get task ID by context successful"); + CFE_UtAssert_SUCCESS(CFE_ES_GetAppID(&AppId)); + CFE_UtAssert_SUCCESS(CFE_ES_GetTaskID(&TaskId)); /* Test getting the app name with a bad app ID */ ES_ResetUnitTest(); AppId = CFE_ES_APPID_C(ES_UT_MakeAppIdForIndex(99999)); - UT_Report(__FILE__, __LINE__, CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetAppName", "Get application name by ID; bad application ID"); + UtAssert_INT32_EQ(CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test getting the app name with that app ID out of range */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); AppId = CFE_ES_APPID_C(ES_UT_MakeAppIdForIndex(99999)); - UT_Report(__FILE__, __LINE__, CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetAppName", "Get application name by ID; ID out of range"); + UtAssert_INT32_EQ(CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test successfully getting the app name using the app ID */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", &UtAppRecPtr, NULL); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)) == CFE_SUCCESS, - "CFE_ES_GetAppName", "Get application name by ID successful"); + CFE_UtAssert_SUCCESS(CFE_ES_GetAppName(AppName, AppId, sizeof(AppName))); /* Test getting task information using the task ID - NULL buffer */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, &UtTaskRecPtr); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(NULL, TaskId) == CFE_ES_BAD_ARGUMENT, "CFE_ES_GetTaskInfo", - "Get task info by ID; NULL buffer"); + UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(NULL, TaskId), CFE_ES_BAD_ARGUMENT); /* Test getting task information using the task ID - bad task ID */ UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdToArrayIndex), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetTaskInfo", "Get task info by ID; bad task ID"); + UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(&TaskInfo, TaskId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test getting task information using the task ID */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, &UtTaskRecPtr); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); UtAppRecPtr->AppState = CFE_ES_AppState_RUNNING; - UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_SUCCESS, "CFE_ES_GetTaskInfo", - "Get task info by ID successful"); + CFE_UtAssert_SUCCESS(CFE_ES_GetTaskInfo(&TaskInfo, TaskId)); /* Test getting task information using the task ID with parent inactive */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", &UtAppRecPtr, &UtTaskRecPtr); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); CFE_ES_AppRecordSetFree(UtAppRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetTaskInfo", "Get task info by ID; parent application not active"); + UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(&TaskInfo, TaskId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test getting task information using the task ID with task inactive */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", NULL, &UtTaskRecPtr); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); CFE_ES_TaskRecordSetFree(UtTaskRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetTaskInfo", "Get task info by ID; task not active"); + UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(&TaskInfo, TaskId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test getting task information using the task ID with invalid task ID */ ES_ResetUnitTest(); TaskId = CFE_ES_TASKID_UNDEFINED; - UT_Report(__FILE__, __LINE__, CFE_ES_GetTaskInfo(&TaskInfo, TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetTaskInfo", "Get task info by ID; invalid task ID"); + UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(&TaskInfo, TaskId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test creating a child task with a bad app ID */ ES_ResetUnitTest(); - Return = CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_ERR_RESOURCEID_NOT_VALID, "CFE_ES_ChildTaskCreate", - "Bad application ID"); + UtAssert_INT32_EQ(CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0), + CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test creating a child task with an OS task create failure */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, NULL, NULL); UT_SetDefaultReturnValue(UT_KEY(OS_TaskCreate), OS_ERROR); - Return = CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0); - UT_Report(__FILE__, __LINE__, Return == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, "CFE_ES_ChildTaskCreate", - "OS task create failed"); + UtAssert_INT32_EQ(CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0), + CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* Test creating a child task with a null task ID */ ES_ResetUnitTest(); - Return = CFE_ES_CreateChildTask(NULL, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_ChildTaskCreate", "Task ID null"); + UtAssert_INT32_EQ(CFE_ES_CreateChildTask(NULL, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0), + CFE_ES_BAD_ARGUMENT); /* Test creating a child task with a null task name */ ES_ResetUnitTest(); - Return = CFE_ES_CreateChildTask(&TaskId, NULL, TestAPI, StackBuf, sizeof(StackBuf), 400, 0); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_ChildTaskCreate", "Task name null"); + UtAssert_INT32_EQ(CFE_ES_CreateChildTask(&TaskId, NULL, TestAPI, StackBuf, sizeof(StackBuf), 400, 0), + CFE_ES_BAD_ARGUMENT); /* Test creating a child task with a null task ID and name */ ES_ResetUnitTest(); - Return = CFE_ES_CreateChildTask(NULL, NULL, TestAPI, StackBuf, sizeof(StackBuf), 400, 0); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_ChildTaskCreate", "Task name and ID null"); + UtAssert_INT32_EQ(CFE_ES_CreateChildTask(NULL, NULL, TestAPI, StackBuf, sizeof(StackBuf), 400, 0), + CFE_ES_BAD_ARGUMENT); /* Test creating a child task with a null function pointer */ ES_ResetUnitTest(); - Return = CFE_ES_CreateChildTask(&TaskId, "TaskName", NULL, StackBuf, sizeof(StackBuf), 2, 0); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_BAD_ARGUMENT, "CFE_ES_ChildTaskCreate", "Function pointer null"); + UtAssert_INT32_EQ(CFE_ES_CreateChildTask(&TaskId, "TaskName", NULL, StackBuf, sizeof(StackBuf), 2, 0), + CFE_ES_BAD_ARGUMENT); /* Test creating a child task within a child task */ ES_ResetUnitTest(); @@ -3957,15 +3619,13 @@ void TestAPI(void) ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, &UtTaskRecPtr); TestObjId = CFE_ES_TaskId_ToOSAL(CFE_ES_TaskRecordGetID(UtTaskRecPtr)); UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId), OS_ObjectIdToInteger(TestObjId)); /* Set context to that of child */ - Return = CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0); - UT_Report(__FILE__, __LINE__, Return == CFE_ES_ERR_CHILD_TASK_CREATE, "CFE_ES_CreateChildTask", - "Cannot call from a child task"); + UtAssert_INT32_EQ(CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0), + CFE_ES_ERR_CHILD_TASK_CREATE); /* Test successfully creating a child task */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - Return = CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0); - UT_Report(__FILE__, __LINE__, Return == CFE_SUCCESS, "CFE_ES_CreateChildTask", "Create child task successful"); + CFE_UtAssert_SUCCESS(CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0)); /* Test common entry point */ ES_ResetUnitTest(); @@ -3991,13 +3651,11 @@ void TestAPI(void) ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, "UT", NULL, &UtTaskRecPtr); TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteChildTask(TaskId) == CFE_ES_ERR_CHILD_TASK_DELETE_MAIN_TASK, - "CFE_ES_DeleteChildTask", "Task ID belongs to a main task"); + UtAssert_INT32_EQ(CFE_ES_DeleteChildTask(TaskId), CFE_ES_ERR_CHILD_TASK_DELETE_MAIN_TASK); /* Test deleting a child task with an invalid task ID */ UT_SetDefaultReturnValue(UT_KEY(OS_ObjectIdToArrayIndex), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteChildTask(TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_DeleteChildTask", "Task ID invalid"); + UtAssert_INT32_EQ(CFE_ES_DeleteChildTask(TaskId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test successfully deleting a child task */ ES_ResetUnitTest(); @@ -4005,16 +3663,11 @@ void TestAPI(void) ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, &UtTaskRecPtr); AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); /* the app ID */ TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); /* the child task ID */ - Return = CFE_ES_GetAppInfo(&AppInfo, AppId); - UtAssert_True(Return == CFE_SUCCESS, "CFE_ES_GetAppInfo() return=%x", (unsigned int)Return); - UtAssert_True(AppInfo.NumOfChildTasks == 1, "AppInfo.NumOfChildTaskss == %u", - (unsigned int)AppInfo.NumOfChildTasks); - Return = CFE_ES_DeleteChildTask(TaskId); - UtAssert_True(Return == CFE_SUCCESS, "DeleteChildResult() return=%x", (unsigned int)Return); - Return = CFE_ES_GetAppInfo(&AppInfo, AppId); - UtAssert_True(Return == CFE_SUCCESS, "CFE_ES_GetAppInfo() return=%x", (unsigned int)Return); - UtAssert_True(AppInfo.NumOfChildTasks == 0, "AppInfo.NumOfChildTaskss == %u", - (unsigned int)AppInfo.NumOfChildTasks); + CFE_UtAssert_SUCCESS(CFE_ES_GetAppInfo(&AppInfo, AppId)); + UtAssert_UINT32_EQ(AppInfo.NumOfChildTasks, 1); + CFE_UtAssert_SUCCESS(CFE_ES_DeleteChildTask(TaskId)); + CFE_UtAssert_SUCCESS(CFE_ES_GetAppInfo(&AppInfo, AppId)); + UtAssert_UINT32_EQ(AppInfo.NumOfChildTasks, 0); /* Test deleting a child task with an OS task delete failure */ ES_ResetUnitTest(); @@ -4023,14 +3676,12 @@ void TestAPI(void) AppId = CFE_ES_AppRecordGetID(UtAppRecPtr); /* the app ID */ TaskId = CFE_ES_TaskRecordGetID(UtTaskRecPtr); /* the child task ID */ UT_SetDefaultReturnValue(UT_KEY(OS_TaskDelete), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteChildTask(TaskId) <= 0, "CFE_ES_DeleteChildTask", - "OS task delete failure"); + UtAssert_INT32_EQ(CFE_ES_DeleteChildTask(TaskId), CFE_ES_ERR_CHILD_TASK_DELETE); /* Test deleting a child task with the task ID out of range */ ES_ResetUnitTest(); TaskId = CFE_ES_TASKID_UNDEFINED; - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteChildTask(TaskId) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_DeleteChildTask", "Task ID too large"); + UtAssert_INT32_EQ(CFE_ES_DeleteChildTask(TaskId), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test successfully exiting a child task */ ES_ResetUnitTest(); @@ -4039,22 +3690,19 @@ void TestAPI(void) TestObjId = CFE_ES_TaskId_ToOSAL(CFE_ES_TaskRecordGetID(UtTaskRecPtr)); UT_SetDefaultReturnValue(UT_KEY(OS_TaskGetId), OS_ObjectIdToInteger(TestObjId)); /* Set context to that of child */ CFE_ES_ExitChildTask(); - UT_Report(__FILE__, __LINE__, UT_GetStubCount(UT_KEY(OS_TaskExit)) == 1, "CFE_ES_ExitChildTask", - "Exit child task successful"); + UtAssert_STUB_COUNT(OS_TaskExit, 1); /* Test exiting a child task within an app main task */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, &UtTaskRecPtr); CFE_ES_ExitChildTask(); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_CALL_APP_MAIN]), - "CFE_ES_ExitChildTask", "Cannot call from a cFE application main task"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_CANNOT_CALL_APP_MAIN]); /* Test exiting a child task with an error retrieving the app ID */ ES_ResetUnitTest(); CFE_ES_ExitChildTask(); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_TASKEXIT_BAD_CONTEXT]), - "CFE_ES_ExitChildTask", "Invalid context"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_TASKEXIT_BAD_CONTEXT]); /* Test successfully adding a time-stamped message to the system log that * must be truncated @@ -4063,9 +3711,8 @@ void TestAPI(void) CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx = CFE_PLATFORM_ES_SYSTEM_LOG_SIZE - CFE_TIME_PRINTED_STRING_SIZE - 4; CFE_ES_Global.ResetDataPtr->SystemLogEndIdx = CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx; CFE_ES_Global.ResetDataPtr->SystemLogMode = CFE_ES_LogMode_DISCARD; - UT_Report(__FILE__, __LINE__, - CFE_ES_SysLogWrite_Unsync("SysLogText This message should be truncated") == CFE_ES_ERR_SYS_LOG_TRUNCATED, - "CFE_ES_SysLogWrite_Internal", "Add message to log that must be truncated"); + UtAssert_INT32_EQ(CFE_ES_SysLogWrite_Unsync("SysLogText This message should be truncated"), + CFE_ES_ERR_SYS_LOG_TRUNCATED); /* Reset the system log index to prevent an overflow in later tests */ CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx = 0; @@ -4076,13 +3723,11 @@ void TestAPI(void) */ memset(Data, 1, sizeof(Data)); ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_CalculateCRC(&Data, 12, 345353, CFE_MISSION_ES_CRC_8) == 0, - "CFE_ES_CalculateCRC", "*Not implemented* CRC-8 algorithm"); + UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(&Data, 12, 345353, CFE_MISSION_ES_CRC_8), 0); /* Test calculating a CRC on a range of memory using CRC type 16 */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_CalculateCRC(&Data, 12, 345353, CFE_MISSION_ES_CRC_16) == 2688, - "CFE_ES_CalculateCRC", "CRC-16 algorithm - memory read successful"); + UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(&Data, 12, 345353, CFE_MISSION_ES_CRC_16), 2688); /* * CRC memory read failure test case removed in #322 - @@ -4094,30 +3739,26 @@ void TestAPI(void) * NOTE: This capability is not currently implemented in cFE */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_CalculateCRC(&Data, 12, 345353, CFE_MISSION_ES_CRC_32) == 0, - "CFE_ES_CalculateCRC", "*Not implemented* CRC-32 algorithm"); + UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(&Data, 12, 345353, CFE_MISSION_ES_CRC_32), 0); /* Test calculating a CRC on a range of memory using an invalid CRC type */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_CalculateCRC(&Data, 12, 345353, -1) == 0, "CFE_ES_CalculateCRC", - "Invalid CRC type"); + UtAssert_UINT32_EQ(CFE_ES_CalculateCRC(&Data, 12, 345353, -1), 0); /* Test shared mutex take with a take error */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); UT_SetDeferredRetcode(UT_KEY(OS_MutSemTake), 1, -1); CFE_ES_LockSharedData(__func__, 12345); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MUTEX_TAKE]), "CFE_ES_LockSharedData", - "Mutex take error"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_MUTEX_TAKE]); /* Test shared mutex release with a release error */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); UT_SetDeferredRetcode(UT_KEY(OS_MutSemGive), 1, -1); CFE_ES_UnlockSharedData(__func__, 98765); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MUTEX_GIVE]), "CFE_ES_UnlockSharedData", - "Mutex release error"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_MUTEX_GIVE]); /* Test waiting for apps to initialize before continuing; transition from * initializing to running @@ -4126,8 +3767,7 @@ void TestAPI(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_EARLY_INIT, "UT", &UtAppRecPtr, NULL); CFE_ES_Global.SystemState = CFE_ES_SystemState_OPERATIONAL; CFE_ES_WaitForStartupSync(0); - UT_Report(__FILE__, __LINE__, UtAppRecPtr->AppState == CFE_ES_AppState_RUNNING, "CFE_ES_WaitForStartupSync", - "Transition from initializing to running"); + UtAssert_INT32_EQ(UtAppRecPtr->AppState, CFE_ES_AppState_RUNNING); /* Test waiting for apps to initialize before continuing with the semaphore * already released @@ -4135,24 +3775,22 @@ void TestAPI(void) ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", &UtAppRecPtr, NULL); CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_READY; - CFE_ES_WaitForStartupSync(99); /* Note - CFE_ES_WaitForStartupSync() returns void, nothing to check for * here. This is for code coverage */ - UT_Report(__FILE__, __LINE__, 1, "CFE_ES_WaitForStartupSync", "System state core ready"); + CFE_UtAssert_VOIDCALL(CFE_ES_WaitForStartupSync(99)); /* Test waiting for apps to initialize as an external app */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_EARLY_INIT, "UT", &UtAppRecPtr, NULL); CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_READY; - CFE_ES_WaitForStartupSync(99); /* Note - CFE_ES_WaitForStartupSync() returns void, nothing to check for * here. This is for code coverage */ - UT_Report(__FILE__, __LINE__, 1, "CFE_ES_WaitForStartupSync", "System state operational"); + CFE_UtAssert_VOIDCALL(CFE_ES_WaitForStartupSync(99)); /* Test adding a time-stamped message to the system log using an invalid * log mode @@ -4168,8 +3806,7 @@ void TestAPI(void) CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx = CFE_PLATFORM_ES_SYSTEM_LOG_SIZE; CFE_ES_Global.ResetDataPtr->SystemLogEndIdx = CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx; CFE_ES_Global.ResetDataPtr->SystemLogMode = CFE_ES_LogMode_DISCARD; - UT_Report(__FILE__, __LINE__, CFE_ES_WriteToSysLog("SysLogText") == CFE_ES_ERR_SYS_LOG_FULL, "CFE_ES_WriteToSysLog", - "Add message to log that resets the log index"); + UtAssert_INT32_EQ(CFE_ES_WriteToSysLog("SysLogText"), CFE_ES_ERR_SYS_LOG_FULL); /* Test successfully adding a time-stamped message to the system log that * causes the log index to be reset @@ -4178,18 +3815,15 @@ void TestAPI(void) CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx = CFE_PLATFORM_ES_SYSTEM_LOG_SIZE; CFE_ES_Global.ResetDataPtr->SystemLogEndIdx = CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx; CFE_ES_Global.ResetDataPtr->SystemLogMode = CFE_ES_LogMode_OVERWRITE; - UT_Report(__FILE__, __LINE__, - CFE_ES_WriteToSysLog("SysLogText") == CFE_SUCCESS && - CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx < CFE_PLATFORM_ES_SYSTEM_LOG_SIZE, - "CFE_ES_WriteToSysLog", "Add message to log that resets the log index"); + CFE_UtAssert_SUCCESS(CFE_ES_WriteToSysLog("SysLogText")); + CFE_UtAssert_ATMOST(CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx, CFE_PLATFORM_ES_SYSTEM_LOG_SIZE - 1); /* Test run loop with an application error status */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", &UtAppRecPtr, NULL); RunStatus = CFE_ES_RunStatus_APP_ERROR; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_ERROR; - UT_Report(__FILE__, __LINE__, CFE_ES_RunLoop(&RunStatus) == false, "CFE_ES_RunLoop", - "Application error run status"); + CFE_UtAssert_FALSE(CFE_ES_RunLoop(&RunStatus)); /* * Test public Name+ID query/lookup API for tasks @@ -4201,12 +3835,12 @@ void TestAPI(void) UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, CFE_ES_TASKID_UNDEFINED, sizeof(AppName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_ES_GetTaskName(NULL, TaskId, sizeof(AppName)), CFE_ES_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, TaskId, sizeof(AppName)), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GetTaskName(AppName, TaskId, sizeof(AppName))); UT_SetDeferredRetcode(UT_KEY(OS_GetResourceName), 1, OS_ERROR); UtAssert_INT32_EQ(CFE_ES_GetTaskName(AppName, TaskId, sizeof(AppName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskId, NULL), CFE_ES_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskId, AppName), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GetTaskIDByName(&TaskId, AppName)); UT_SetDeferredRetcode(UT_KEY(OS_TaskGetIdByName), 1, OS_ERROR); UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskId, "Nonexistent"), CFE_ES_ERR_NAME_NOT_FOUND); } @@ -4221,12 +3855,10 @@ void TestGenericCounterAPI(void) /* Test successfully registering a generic counter */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterGenCounter(&CounterId, "Counter1") == CFE_SUCCESS, - "CFE_ES_RegisterGenCounter", "Register counter successful"); + CFE_UtAssert_SUCCESS(CFE_ES_RegisterGenCounter(&CounterId, "Counter1")); /* Test registering a generic counter that is already registered */ - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterGenCounter(&CounterId, "Counter1") == CFE_ES_ERR_DUPLICATE_NAME, - "CFE_ES_RegisterGenCounter", "Attempt to register an existing counter"); + UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(&CounterId, "Counter1"), CFE_ES_ERR_DUPLICATE_NAME); /* Test registering the maximum number of generic counters */ for (i = 1; i < CFE_PLATFORM_ES_MAX_GEN_COUNTERS; i++) @@ -4239,119 +3871,98 @@ void TestGenericCounterAPI(void) } } - UT_Report(__FILE__, __LINE__, i == CFE_PLATFORM_ES_MAX_GEN_COUNTERS, "CFE_ES_RegisterGenCounter", - "Register maximum number of counters"); + UtAssert_INT32_EQ(i, CFE_PLATFORM_ES_MAX_GEN_COUNTERS); /* Test registering a generic counter after the maximum are registered */ UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterGenCounter(&CounterId, "Counter999") == CFE_ES_NO_RESOURCE_IDS_AVAILABLE, - "CFE_ES_RegisterGenCounter", "Maximum number of counters exceeded"); + UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(&CounterId, "Counter999"), CFE_ES_NO_RESOURCE_IDS_AVAILABLE); UT_ResetState(UT_KEY(CFE_ResourceId_FindNext)); /* Check operation of the CFE_ES_CheckCounterIdSlotUsed() helper function */ CFE_ES_Global.CounterTable[1].CounterId = CFE_ES_COUNTERID_C(ES_UT_MakeCounterIdForIndex(1)); CFE_ES_Global.CounterTable[2].CounterId = CFE_ES_COUNTERID_UNDEFINED; - UtAssert_True(CFE_ES_CheckCounterIdSlotUsed(ES_UT_MakeCounterIdForIndex(1)), "Counter Slot Used"); - UtAssert_True(!CFE_ES_CheckCounterIdSlotUsed(ES_UT_MakeCounterIdForIndex(2)), "Counter Slot Unused"); + CFE_UtAssert_TRUE(CFE_ES_CheckCounterIdSlotUsed(ES_UT_MakeCounterIdForIndex(1))); + CFE_UtAssert_FALSE(CFE_ES_CheckCounterIdSlotUsed(ES_UT_MakeCounterIdForIndex(2))); /* Test getting a registered generic counter that doesn't exist */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCounterIDByName(&CounterId, "Counter999") == CFE_ES_ERR_NAME_NOT_FOUND, - "CFE_ES_GetGenCounterIDByName", "Cannot get counter that does not exist"); + UtAssert_INT32_EQ(CFE_ES_GetGenCounterIDByName(&CounterId, "Counter999"), CFE_ES_ERR_NAME_NOT_FOUND); /* Test successfully getting a registered generic counter ID by name */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCounterIDByName(&CounterId, "Counter5") == CFE_SUCCESS, - "CFE_ES_GetGenCounterIDByName", "Get generic counter ID successful"); + CFE_UtAssert_SUCCESS(CFE_ES_GetGenCounterIDByName(&CounterId, "Counter5")); /* Test deleting a registered generic counter that doesn't exist */ - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteGenCounter(CFE_ES_COUNTERID_UNDEFINED) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_DeleteGenCounter", "Cannot delete counter that does not exist"); + UtAssert_INT32_EQ(CFE_ES_DeleteGenCounter(CFE_ES_COUNTERID_UNDEFINED), CFE_ES_BAD_ARGUMENT); /* Test successfully deleting a registered generic counter by ID */ - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteGenCounter(CounterId) == CFE_SUCCESS, "CFE_ES_DeleteGenCounter", - "Successful"); + CFE_UtAssert_SUCCESS(CFE_ES_DeleteGenCounter(CounterId)); /* Test successfully registering a generic counter to verify a place for * it is now available and to provide an ID for subsequent tests */ - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterGenCounter(&CounterId, "CounterX") == CFE_SUCCESS, - "CFE_ES_RegisterGenCounter", "Register counter; back to maximum number"); + CFE_UtAssert_SUCCESS(CFE_ES_RegisterGenCounter(&CounterId, "CounterX")); /* Test incrementing a generic counter that doesn't exist */ - UT_Report(__FILE__, __LINE__, CFE_ES_IncrementGenCounter(CFE_ES_COUNTERID_UNDEFINED) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_IncrementGenCounter", "Bad counter ID"); + UtAssert_INT32_EQ(CFE_ES_IncrementGenCounter(CFE_ES_COUNTERID_UNDEFINED), CFE_ES_BAD_ARGUMENT); /* Test successfully incrementing a generic counter */ - UT_Report(__FILE__, __LINE__, CFE_ES_IncrementGenCounter(CounterId) == CFE_SUCCESS, "CFE_ES_IncrementGenCounter", - "Increment counter successful"); + CFE_UtAssert_SUCCESS(CFE_ES_IncrementGenCounter(CounterId)); /* Test getting a generic counter value for a counter that doesn't exist */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCount(CFE_ES_COUNTERID_UNDEFINED, &CounterCount) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_GetGenCount", "Bad counter ID"); + UtAssert_INT32_EQ(CFE_ES_GetGenCount(CFE_ES_COUNTERID_UNDEFINED, &CounterCount), CFE_ES_BAD_ARGUMENT); /* Test successfully getting a generic counter value */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCount(CounterId, &CounterCount) == CFE_SUCCESS && CounterCount == 1, - "CFE_ES_GetGenCount", "Get counter value successful"); + UtAssert_INT32_EQ(CFE_ES_GetGenCount(CounterId, &CounterCount) == CFE_SUCCESS && CounterCount, 1); /* Test setting a generic counter value for a counter that doesn't exist */ - UT_Report(__FILE__, __LINE__, CFE_ES_SetGenCount(CFE_ES_COUNTERID_UNDEFINED, 5) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_SetGenCount", "Bad counter ID"); + UtAssert_INT32_EQ(CFE_ES_SetGenCount(CFE_ES_COUNTERID_UNDEFINED, 5), CFE_ES_BAD_ARGUMENT); /* Test successfully setting a generic counter value */ - UT_Report(__FILE__, __LINE__, CFE_ES_SetGenCount(CounterId, 5) == CFE_SUCCESS, "CFE_ES_SetGenCount", - "Set counter value successful"); + CFE_UtAssert_SUCCESS(CFE_ES_SetGenCount(CounterId, 5)); /* Test value retrieved from a generic counter value */ CFE_ES_GetGenCount(CounterId, &CounterCount); - UT_Report(__FILE__, __LINE__, (CounterCount == 5), "CFE_ES_SetGenCount", "Check value for counter set"); + UtAssert_INT32_EQ(CounterCount, 5); /* Test registering a generic counter with a null counter ID pointer */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterGenCounter(NULL, "Counter1") == CFE_ES_BAD_ARGUMENT, - "CFE_ES_RegisterGenCounter", "Attempt to register using a null counter ID pointer"); + UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(NULL, "Counter1"), CFE_ES_BAD_ARGUMENT); /* Test registering a generic counter with a null counter name */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterGenCounter(&CounterId, NULL) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_RegisterGenCounter", "Attempt to register using a null counter name"); + UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(&CounterId, NULL), CFE_ES_BAD_ARGUMENT); /* Test incrementing a generic counter where the record is not in use */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_IncrementGenCounter(CounterId) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_IncrementGenCounter", "Record not in use"); + UtAssert_INT32_EQ(CFE_ES_IncrementGenCounter(CounterId), CFE_ES_BAD_ARGUMENT); /* Test setting a generic counter where the record is not in use */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_SetGenCount(CounterId, 0) == CFE_ES_BAD_ARGUMENT, "CFE_ES_SetGenCount", - "Record not in use"); + UtAssert_INT32_EQ(CFE_ES_SetGenCount(CounterId, 0), CFE_ES_BAD_ARGUMENT); /* Test getting a generic counter where the record is not in use */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCount(CounterId, &CounterCount) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_GetGenCount", "Record not in use"); + UtAssert_INT32_EQ(CFE_ES_GetGenCount(CounterId, &CounterCount), CFE_ES_BAD_ARGUMENT); /* Test getting a generic counter where the count is null */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCount(CounterId, NULL) == CFE_ES_BAD_ARGUMENT, "CFE_ES_GetGenCount", - "Null count"); + UtAssert_INT32_EQ(CFE_ES_GetGenCount(CounterId, NULL), CFE_ES_BAD_ARGUMENT); /* Test getting a registered generic counter ID using a null counter * pointer */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_GetGenCounterIDByName(NULL, "CounterX") == CFE_ES_BAD_ARGUMENT, - "CFE_ES_GetGenCounterIDByName", "Null name"); + UtAssert_INT32_EQ(CFE_ES_GetGenCounterIDByName(NULL, "CounterX"), CFE_ES_BAD_ARGUMENT); /* * Test Name-ID query/conversion API */ ES_ResetUnitTest(); - UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(&CounterId, "Counter1"), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_ES_GetGenCounterName(CounterName, CounterId, sizeof(CounterName)), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_RegisterGenCounter(&CounterId, "Counter1")); + CFE_UtAssert_SUCCESS(CFE_ES_GetGenCounterName(CounterName, CounterId, sizeof(CounterName))); UtAssert_INT32_EQ(CFE_ES_GetGenCounterIDByName(&CounterId2, "Nonexistent"), CFE_ES_ERR_NAME_NOT_FOUND); - UtAssert_INT32_EQ(CFE_ES_GetGenCounterIDByName(&CounterId2, CounterName), CFE_SUCCESS); - UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(CounterId, CounterId2), "Counter IDs Match"); + CFE_UtAssert_SUCCESS(CFE_ES_GetGenCounterIDByName(&CounterId2, CounterName)); + CFE_UtAssert_RESOURCEID_EQ(CounterId, CounterId2); UtAssert_INT32_EQ(CFE_ES_GetGenCounterName(CounterName, CFE_ES_COUNTERID_UNDEFINED, sizeof(CounterName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_ES_GetGenCounterName(NULL, CounterId, sizeof(CounterName)), CFE_ES_BAD_ARGUMENT); @@ -4373,82 +3984,65 @@ void TestCDS() /* Test init with a mutex create failure */ UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, "CFE_ES_CDS_EarlyInit", - "Mutex create failed"); + UtAssert_INT32_EQ(CFE_ES_CDS_EarlyInit(), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* Test locking the CDS registry with a mutex take failure */ UT_SetDeferredRetcode(UT_KEY(OS_MutSemTake), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_LockCDS() == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, "CFE_ES_LockCDS", - "Mutex take failed"); + UtAssert_INT32_EQ(CFE_ES_LockCDS(), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* Test unlocking the CDS registry with a mutex give failure */ UT_SetDeferredRetcode(UT_KEY(OS_MutSemGive), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_UnlockCDS() == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, "CFE_ES_UnlockCDS", - "Mutex give failed"); + UtAssert_INT32_EQ(CFE_ES_UnlockCDS(), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* Set up the PSP stubs for CDS testing */ UT_SetCDSSize(128 * 1024); /* Test the CDS Cache Fetch/Flush/Load routine error cases */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_CacheFetch(&CFE_ES_Global.CDSVars.Cache, 4, 0) == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_CDS_CacheFetch", "Invalid Size"); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_CacheFlush(&CFE_ES_Global.CDSVars.Cache) == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_CDS_CacheFlush", "Invalid Size"); + UtAssert_INT32_EQ(CFE_ES_CDS_CacheFetch(&CFE_ES_Global.CDSVars.Cache, 4, 0), CFE_ES_CDS_INVALID_SIZE); + UtAssert_INT32_EQ(CFE_ES_CDS_CacheFlush(&CFE_ES_Global.CDSVars.Cache), CFE_ES_CDS_INVALID_SIZE); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_CachePreload(&CFE_ES_Global.CDSVars.Cache, NULL, 4, 0) == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_CDS_CachePreload", "Invalid Size"); + UtAssert_INT32_EQ(CFE_ES_CDS_CachePreload(&CFE_ES_Global.CDSVars.Cache, NULL, 4, 0), CFE_ES_CDS_INVALID_SIZE); TempSize = 5; - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_CachePreload(&CFE_ES_Global.CDSVars.Cache, &TempSize, 4, 4) == CFE_SUCCESS, - "CFE_ES_CDS_CachePreload", "Nominal"); + CFE_UtAssert_SUCCESS(CFE_ES_CDS_CachePreload(&CFE_ES_Global.CDSVars.Cache, &TempSize, 4, 4)); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_CacheFetch(&CFE_ES_Global.CDSVars.Cache, 4, 4) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDS_CacheFetch", "Access error"); + UtAssert_INT32_EQ(CFE_ES_CDS_CacheFetch(&CFE_ES_Global.CDSVars.Cache, 4, 4), CFE_ES_CDS_ACCESS_ERROR); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_CacheFlush(&CFE_ES_Global.CDSVars.Cache) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDS_CacheFlush", "Access Error"); + UtAssert_INT32_EQ(CFE_ES_CDS_CacheFlush(&CFE_ES_Global.CDSVars.Cache), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS registering with a write CDS failure */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); ES_UT_SetupCDSGlobal(ES_UT_CDS_SMALL_TEST_SIZE); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name3") == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_RegisterCDS", "Writing to BSP CDS failure"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, 4, "Name3"), CFE_ES_CDS_ACCESS_ERROR); /* Test successful CDS registering */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); ES_UT_SetupCDSGlobal(ES_UT_CDS_SMALL_TEST_SIZE); - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name") == CFE_SUCCESS, "CFE_ES_RegisterCDS", - "Register CDS successful"); + CFE_UtAssert_SUCCESS(CFE_ES_RegisterCDS(&CDSHandle, 4, "Name")); /* Test CDS registering using an already registered name */ /* No reset here -- just attempt to register the same name again */ - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name") == CFE_ES_CDS_ALREADY_EXISTS, - "CFE_ES_RegisterCDS", "Retrieve existing CDS"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, 4, "Name"), CFE_ES_CDS_ALREADY_EXISTS); /* Test CDS registering using the same name, but a different size */ /* No reset here -- just attempt to register the same name again */ - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 6, "Name") == CFE_SUCCESS, "CFE_ES_RegisterCDS", - "Get CDS of same name, but new size"); + CFE_UtAssert_SUCCESS(CFE_ES_RegisterCDS(&CDSHandle, 6, "Name")); /* Test CDS registering using a null name */ - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "") == CFE_ES_CDS_INVALID_NAME, - "CFE_ES_RegisterCDS", "Invalid name size"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, 4, ""), CFE_ES_CDS_INVALID_NAME); /* Test CDS registering with a block size of zero */ - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 0, "Name") == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_RegisterCDS", "Block size zero"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, 0, "Name"), CFE_ES_CDS_INVALID_SIZE); /* Test CDS registering with no memory pool available */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "UT", NULL, NULL); - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name") == CFE_ES_NOT_IMPLEMENTED, - "CFE_ES_RegisterCDS", "No memory pool available"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, 4, "Name"), CFE_ES_NOT_IMPLEMENTED); /* Test CDS registering with all the CDS registries taken */ ES_ResetUnitTest(); @@ -4457,39 +4051,34 @@ void TestCDS() /* Set all the CDS registries to 'taken' */ UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name2") == CFE_ES_NO_RESOURCE_IDS_AVAILABLE, - "CFE_ES_RegisterCDS", "No available entries"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, 4, "Name2"), CFE_ES_NO_RESOURCE_IDS_AVAILABLE); /* Check operation of the CFE_ES_CheckCDSHandleSlotUsed() helper function */ CFE_ES_Global.CDSVars.Registry[1].BlockID = CFE_ES_CDSHANDLE_C(ES_UT_MakeCDSIdForIndex(1)); CFE_ES_Global.CDSVars.Registry[2].BlockID = CFE_ES_CDS_BAD_HANDLE; - UtAssert_True(CFE_ES_CheckCDSHandleSlotUsed(ES_UT_MakeCDSIdForIndex(1)), "CDS Slot Used"); - UtAssert_True(!CFE_ES_CheckCDSHandleSlotUsed(ES_UT_MakeCDSIdForIndex(2)), "CDS Slot Unused"); + CFE_UtAssert_TRUE(CFE_ES_CheckCDSHandleSlotUsed(ES_UT_MakeCDSIdForIndex(1))); + CFE_UtAssert_FALSE(CFE_ES_CheckCDSHandleSlotUsed(ES_UT_MakeCDSIdForIndex(2))); /* Test CDS registering using a bad app ID */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, "Name2") == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_RegisterCDS", "Bad application ID"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, 4, "Name2"), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test copying to CDS with bad handle */ CDSHandle = CFE_ES_CDS_BAD_HANDLE; - UT_Report(__FILE__, __LINE__, CFE_ES_CopyToCDS(CDSHandle, &TempSize) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_CopyToCDS", "Copy to CDS bad handle"); + UtAssert_INT32_EQ(CFE_ES_CopyToCDS(CDSHandle, &TempSize), CFE_ES_ERR_RESOURCEID_NOT_VALID); + /* Test restoring from a CDS with bad handle */ - UT_Report(__FILE__, __LINE__, CFE_ES_RestoreFromCDS(&TempSize, CDSHandle) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_RestoreFromCDS", "Restore from CDS bad handle"); + UtAssert_INT32_EQ(CFE_ES_RestoreFromCDS(&TempSize, CDSHandle), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test successfully copying to a CDS */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, OS_SUCCESS); ES_UT_SetupSingleCDSRegistry("UT", ES_UT_CDS_BLOCK_SIZE, false, &UtCDSRegRecPtr); CDSHandle = CFE_ES_CDSBlockRecordGetID(UtCDSRegRecPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_CopyToCDS(CDSHandle, &BlockData) == CFE_SUCCESS, "CFE_ES_CopyToCDS", - "Copy to CDS successful"); + CFE_UtAssert_SUCCESS(CFE_ES_CopyToCDS(CDSHandle, &BlockData)); /* Test successfully restoring from a CDS */ - UT_Report(__FILE__, __LINE__, CFE_ES_RestoreFromCDS(&BlockData, CDSHandle) == CFE_SUCCESS, "CFE_ES_RestoreFromCDS", - "Restore from CDS successful"); + CFE_UtAssert_SUCCESS(CFE_ES_RestoreFromCDS(&BlockData, CDSHandle)); /* Test CDS registering using a name longer than the maximum allowed */ ES_ResetUnitTest(); @@ -4503,58 +4092,45 @@ void TestCDS() CDSName[i] = '\0'; - UT_Report(__FILE__, __LINE__, CFE_ES_RegisterCDS(&CDSHandle, 4, CDSName) == CFE_ES_CDS_INVALID_NAME, - "CFE_ES_RegisterCDS", "Invalid name size"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, 4, CDSName), CFE_ES_CDS_INVALID_NAME); /* Test unsuccessful CDS registering */ - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterCDS(&CDSHandle, CDS_ABS_MAX_BLOCK_SIZE + 1, "Name") == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_RegisterCDS", "Register CDS unsuccessful"); - - UT_Report(__FILE__, __LINE__, - CFE_ES_RegisterCDS(&CDSHandle, CDS_ABS_MAX_BLOCK_SIZE - 1, "Name") == CFE_ES_ERR_MEM_BLOCK_SIZE, - "CFE_ES_RegisterCDS", "Register CDS unsuccessful"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, CDS_ABS_MAX_BLOCK_SIZE + 1, "Name"), CFE_ES_CDS_INVALID_SIZE); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, CDS_ABS_MAX_BLOCK_SIZE - 1, "Name"), CFE_ES_ERR_MEM_BLOCK_SIZE); /* Test memory pool rebuild and registry recovery with an * unreadable registry */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, -1); - UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDS() == CFE_ES_CDS_INVALID, "CFE_ES_RebuildCDS", - "First read from CDS bad"); + UtAssert_INT32_EQ(CFE_ES_RebuildCDS(), CFE_ES_CDS_INVALID); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 2, -1); - UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDS() == CFE_ES_CDS_INVALID, "CFE_ES_RebuildCDS", - "Second read from CDS bad"); + UtAssert_INT32_EQ(CFE_ES_RebuildCDS(), CFE_ES_CDS_INVALID); /* Test CDS registry initialization with a CDS write failure */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, -1); - UT_Report(__FILE__, __LINE__, CFE_ES_InitCDSRegistry() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_InitCDSRegistry", - "Failed to write registry size"); + UtAssert_INT32_EQ(CFE_ES_InitCDSRegistry(), CFE_ES_CDS_ACCESS_ERROR); /* Test successful CDS initialization */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, "CFE_ES_CDS_EarlyInit", - "Initialization successful"); + CFE_UtAssert_SUCCESS(CFE_ES_CDS_EarlyInit()); /* Test CDS initialization with a read error */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, -1); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_CDS_EarlyInit", - "Unrecoverable read error"); + UtAssert_INT32_EQ(CFE_ES_CDS_EarlyInit(), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS initialization with size below the minimum */ ES_ResetUnitTest(); UT_SetCDSSize(1024); - UT_Report(__FILE__, __LINE__, - CFE_ES_CDS_EarlyInit() == CFE_SUCCESS && UT_GetStubCount(UT_KEY(CFE_PSP_GetCDSSize)) == 1, - "CFE_ES_CDS_EarlyInit", "CDS size less than minimum"); + CFE_UtAssert_SUCCESS(CFE_ES_CDS_EarlyInit()); + UtAssert_STUB_COUNT(CFE_PSP_GetCDSSize, 1); /* Test CDS initialization with size not obtainable */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_PSP_GetCDSSize), -1); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == OS_ERROR, "CFE_ES_CDS_EarlyInit", - "Unable to obtain CDS size"); + UtAssert_INT32_EQ(CFE_ES_CDS_EarlyInit(), OS_ERROR); /* Reset back to a sufficient CDS size */ UT_SetCDSSize(128 * 1024); @@ -4563,56 +4139,48 @@ void TestCDS() /* Test CDS initialization with rebuilding not possible */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 3, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, "CFE_ES_CDS_EarlyInit", - "Rebuilding not possible; create new CDS"); + CFE_UtAssert_SUCCESS(CFE_ES_CDS_EarlyInit()); /* Test CDS validation with first CDS read call failure */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_ValidateCDS() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_ValidateCDS", - "CDS read (first call) failed"); + UtAssert_INT32_EQ(CFE_ES_ValidateCDS(), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS validation with second CDS read call failure */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_ValidateCDS() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_ValidateCDS", - "CDS read (second call) failed"); + UtAssert_INT32_EQ(CFE_ES_ValidateCDS(), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS validation with CDS read end check failure */ memset(CdsPtr + CdsSize - CFE_ES_CDS_SIGNATURE_LEN, 'x', CFE_ES_CDS_SIGNATURE_LEN); - UT_Report(__FILE__, __LINE__, CFE_ES_ValidateCDS() == CFE_ES_CDS_INVALID, "CFE_ES_ValidateCDS", - "Reading from CDS failed end check"); + UtAssert_INT32_EQ(CFE_ES_ValidateCDS(), CFE_ES_CDS_INVALID); /* Test CDS validation with CDS read begin check failure */ UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void **)&CdsPtr, &CdsSize, NULL); memset(CdsPtr, 'x', CFE_ES_CDS_SIGNATURE_LEN); - UT_Report(__FILE__, __LINE__, CFE_ES_ValidateCDS() == CFE_ES_CDS_INVALID, "CFE_ES_ValidateCDS", - "Reading from CDS failed begin check"); + UtAssert_INT32_EQ(CFE_ES_ValidateCDS(), CFE_ES_CDS_INVALID); /* Test CDS initialization where first write call to the CDS fails */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_InitCDSSignatures() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_InitCDSSignatures", - "CDS write (first call) failed"); + UtAssert_INT32_EQ(CFE_ES_InitCDSSignatures(), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS initialization where second write call to the CDS fails */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_InitCDSSignatures() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_InitCDSSignatures", - "CDS write (second call) failed"); + UtAssert_INT32_EQ(CFE_ES_InitCDSSignatures(), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS clear where write call to the CDS fails */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_ClearCDS() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_ClearCDS", "CDS write failed"); + UtAssert_INT32_EQ(CFE_ES_ClearCDS(), CFE_ES_CDS_ACCESS_ERROR); /* Test rebuilding the CDS where the registry is not the same size */ ES_ResetUnitTest(); UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void **)&CdsPtr, &CdsSize, NULL); TempSize = CFE_PLATFORM_ES_CDS_MAX_NUM_ENTRIES + 1; memcpy(CdsPtr + CDS_REG_SIZE_OFFSET, &TempSize, sizeof(TempSize)); - UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDS() == CFE_ES_CDS_INVALID, "CFE_ES_RebuildCDS", - "Registry too large to recover"); + UtAssert_INT32_EQ(CFE_ES_RebuildCDS(), CFE_ES_CDS_INVALID); /* Test clearing CDS where size is an odd number (requires partial write) */ ES_ResetUnitTest(); CFE_ES_Global.CDSVars.TotalSize = 53; - UT_Report(__FILE__, __LINE__, CFE_ES_ClearCDS() == CFE_SUCCESS, "CFE_ES_ClearCDS", "CDS write failed"); + CFE_UtAssert_SUCCESS(CFE_ES_ClearCDS()); /* * To prepare for the rebuild tests, set up a clean area in PSP mem, @@ -4622,7 +4190,7 @@ void TestCDS() ES_UT_SetupSingleCDSRegistry("UT", 8, false, &UtCDSRegRecPtr); UtAssert_NONZERO(UtCDSRegRecPtr->BlockOffset); UtAssert_NONZERO(UtCDSRegRecPtr->BlockSize); - UtAssert_INT32_EQ(CFE_ES_UpdateCDSRegistry(), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_UpdateCDSRegistry()); /* Test successfully rebuilding the CDS */ ES_ResetUnitTest(); @@ -4631,7 +4199,7 @@ void TestCDS() UtAssert_ZERO(UtCDSRegRecPtr->BlockOffset); UtAssert_ZERO(UtCDSRegRecPtr->BlockSize); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, "CFE_ES_RebuildCDS", "CDS rebuild successful"); + CFE_UtAssert_SUCCESS(CFE_ES_CDS_EarlyInit()); /* Check that the registry entry exists again (was recovered) */ UtAssert_NONZERO(UtCDSRegRecPtr->BlockOffset); @@ -4640,18 +4208,15 @@ void TestCDS() /* Test rebuilding the CDS with the registry unreadable */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDS() == CFE_ES_CDS_INVALID, "CFE_ES_RebuildCDS", - "CDS registry unreadable"); + UtAssert_INT32_EQ(CFE_ES_RebuildCDS(), CFE_ES_CDS_INVALID); /* Test deleting the CDS from the registry with a registry write failure */ ES_ResetUnitTest(); ES_UT_SetupSingleCDSRegistry("NO_APP.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, true, NULL); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteCDS("NO_APP.CDS_NAME", true) == -1, "CFE_ES_DeleteCDS", - "CDS block descriptor write failed"); + UtAssert_INT32_EQ(CFE_ES_DeleteCDS("NO_APP.CDS_NAME", true), -1); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteCDS("NO_APP.CDS_NAME", true) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_DeleteCDS", "CDS registry write failed"); + UtAssert_INT32_EQ(CFE_ES_DeleteCDS("NO_APP.CDS_NAME", true), CFE_ES_CDS_ACCESS_ERROR); /* Test deleting the CDS from the registry with the owner application * still active @@ -4659,8 +4224,7 @@ void TestCDS() ES_ResetUnitTest(); ES_UT_SetupSingleCDSRegistry("CFE_ES.CDS_NAME", ES_UT_CDS_BLOCK_SIZE, true, NULL); ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL); - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteCDS("CFE_ES.CDS_NAME", true) == CFE_ES_CDS_OWNER_ACTIVE_ERR, - "CFE_ES_DeleteCDS", "Owner application still active"); + UtAssert_INT32_EQ(CFE_ES_DeleteCDS("CFE_ES.CDS_NAME", true), CFE_ES_CDS_OWNER_ACTIVE_ERR); /* * To prepare for the rebuild tests, set up a clean area in PSP mem @@ -4669,24 +4233,20 @@ void TestCDS() /* Test CDS initialization where rebuilding the CDS is successful */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, "CFE_ES_CDS_EarlyInit", - "Initialization with successful rebuild"); + CFE_UtAssert_SUCCESS(CFE_ES_CDS_EarlyInit()); /* Test CDS initialization where rebuilding the CDS is unsuccessful */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 3, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDS_EarlyInit() == CFE_SUCCESS, "CFE_ES_CDS_EarlyInit", - "Initialization with unsuccessful rebuild"); + CFE_UtAssert_SUCCESS(CFE_ES_CDS_EarlyInit()); /* Test CDS initialization where initializing the CDS registry fails */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_InitCDSRegistry() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_InitCDSRegistry", - "CDS registry write size failed"); + UtAssert_INT32_EQ(CFE_ES_InitCDSRegistry(), CFE_ES_CDS_ACCESS_ERROR); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_InitCDSRegistry() == CFE_ES_CDS_ACCESS_ERROR, "CFE_ES_InitCDSRegistry", - "CDS registry write content failed"); + UtAssert_INT32_EQ(CFE_ES_InitCDSRegistry(), CFE_ES_CDS_ACCESS_ERROR); /* Test deleting the CDS from the registry with a CDS name longer than the * maximum allowed @@ -4695,8 +4255,7 @@ void TestCDS() memset(CDSName, 'a', sizeof(CDSName) - 1); CDSName[sizeof(CDSName) - 1] = '\0'; ES_UT_SetupSingleCDSRegistry(CDSName, ES_UT_CDS_BLOCK_SIZE, true, NULL); - UT_Report(__FILE__, __LINE__, CFE_ES_DeleteCDS(CDSName, true) == CFE_ES_ERR_NAME_NOT_FOUND, "CFE_ES_DeleteCDS", - "CDS name too long"); + UtAssert_INT32_EQ(CFE_ES_DeleteCDS(CDSName, true), CFE_ES_ERR_NAME_NOT_FOUND); /* * Test Name-ID query/conversion API @@ -4704,11 +4263,10 @@ void TestCDS() ES_ResetUnitTest(); ES_UT_SetupSingleCDSRegistry("CDS1", ES_UT_CDS_BLOCK_SIZE, false, &UtCDSRegRecPtr); CDSHandle = CFE_ES_CDSBlockRecordGetID(UtCDSRegRecPtr); - UtAssert_INT32_EQ(CFE_ES_GetCDSBlockName(CDSName, CDSHandle, sizeof(CDSName)), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_GetCDSBlockName(CDSName, CDSHandle, sizeof(CDSName))); UtAssert_INT32_EQ(CFE_ES_GetCDSBlockIDByName(&CDSHandle, "Nonexistent"), CFE_ES_ERR_NAME_NOT_FOUND); - UtAssert_INT32_EQ(CFE_ES_GetCDSBlockIDByName(&CDSHandle, CDSName), CFE_SUCCESS); - UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(CDSHandle, CFE_ES_CDSBlockRecordGetID(UtCDSRegRecPtr)), - "CDS Handle IDs Match"); + CFE_UtAssert_SUCCESS(CFE_ES_GetCDSBlockIDByName(&CDSHandle, CDSName)); + CFE_UtAssert_RESOURCEID_EQ(CDSHandle, CFE_ES_CDSBlockRecordGetID(UtCDSRegRecPtr)); UtAssert_INT32_EQ(CFE_ES_GetCDSBlockName(CDSName, CFE_ES_CDS_BAD_HANDLE, sizeof(CDSName)), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_ES_GetCDSBlockName(NULL, CDSHandle, sizeof(CDSName)), CFE_ES_BAD_ARGUMENT); @@ -4731,12 +4289,10 @@ void TestCDSMempool(void) /* Test creating the CDS pool with the pool size too small */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_CreateCDSPool(2, 1) == CFE_ES_CDS_INVALID_SIZE, "CFE_ES_CreateCDSPool", - "CDS pool size too small"); + UtAssert_INT32_EQ(CFE_ES_CreateCDSPool(2, 1), CFE_ES_CDS_INVALID_SIZE); /* Test rebuilding the CDS pool with the pool size too small */ - UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDSPool(2, 1) == CFE_ES_CDS_INVALID_SIZE, "CFE_ES_RebuildCDSPool", - "CDS pool size too small"); + UtAssert_INT32_EQ(CFE_ES_RebuildCDSPool(2, 1), CFE_ES_CDS_INVALID_SIZE); /* Test rebuilding CDS pool with CDS access errors */ /* @@ -4751,28 +4307,24 @@ void TestCDSMempool(void) UtAssert_NONZERO(UtCdsRegRecPtr->BlockOffset); UtAssert_NONZERO(UtCdsRegRecPtr->BlockSize); CFE_ES_DeleteCDS("UT", false); - UtAssert_INT32_EQ(CFE_ES_UpdateCDSRegistry(), CFE_SUCCESS); + CFE_UtAssert_SUCCESS(CFE_ES_UpdateCDSRegistry()); /* Clear/reset the global state */ ES_ResetUnitTest(); /* Test rebuilding the CDS pool with a descriptor retrieve error */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDSPool(SavedSize, SavedOffset) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_RebuildCDSPool", "CDS descriptor retrieve error"); + UtAssert_INT32_EQ(CFE_ES_RebuildCDSPool(SavedSize, SavedOffset), CFE_ES_CDS_ACCESS_ERROR); /* Test rebuilding the CDS pool with a descriptor commit error */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_RebuildCDSPool(SavedSize, SavedOffset) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_RebuildCDSPool", "CDS descriptor commit error"); + UtAssert_INT32_EQ(CFE_ES_RebuildCDSPool(SavedSize, SavedOffset), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS block write using an invalid memory handle */ ES_ResetUnitTest(); BlockHandle = CFE_ES_CDSHANDLE_C(CFE_ResourceId_FromInteger(7)); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_CDSBlockWrite", "Invalid memory handle"); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_CDSBlockRead", "Invalid memory handle"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockWrite(BlockHandle, &Data), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UtAssert_INT32_EQ(CFE_ES_CDSBlockRead(&Data, BlockHandle), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test CDS block access */ ES_ResetUnitTest(); @@ -4782,64 +4334,51 @@ void TestCDSMempool(void) Data = 42; /* Basic success path */ - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_SUCCESS, "CFE_ES_CDSBlockWrite", - "Nominal"); + CFE_UtAssert_SUCCESS(CFE_ES_CDSBlockWrite(BlockHandle, &Data)); Data = 0; - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_SUCCESS, "CFE_ES_CDSBlockRead", - "Nominal"); + CFE_UtAssert_SUCCESS(CFE_ES_CDSBlockRead(&Data, BlockHandle)); UtAssert_INT32_EQ(Data, 42); /* Corrupt/change the block offset, should fail validation */ --UtCdsRegRecPtr->BlockOffset; - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_CDSBlockWrite", "Block offset error"); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_CDSBlockRead", "Block offset error"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockWrite(BlockHandle, &Data), CFE_ES_POOL_BLOCK_INVALID); + UtAssert_INT32_EQ(CFE_ES_CDSBlockRead(&Data, BlockHandle), CFE_ES_POOL_BLOCK_INVALID); ++UtCdsRegRecPtr->BlockOffset; /* Corrupt/change the block size, should trigger invalid size error */ --UtCdsRegRecPtr->BlockSize; - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_CDSBlockWrite", "Block size error"); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_CDS_INVALID_SIZE, - "CFE_ES_CDSBlockRead", "Block size error"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockWrite(BlockHandle, &Data), CFE_ES_CDS_INVALID_SIZE); + UtAssert_INT32_EQ(CFE_ES_CDSBlockRead(&Data, BlockHandle), CFE_ES_CDS_INVALID_SIZE); ++UtCdsRegRecPtr->BlockSize; /* Test CDS block read/write with a CDS read error (block descriptor) */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDSBlockWrite", "Read error on descriptor"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockWrite(BlockHandle, &Data), CFE_ES_CDS_ACCESS_ERROR); UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDSBlockRead", "Read error on descriptor"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockRead(&Data, BlockHandle), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS block write with a CDS write error (block header) */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDSBlockWrite", "Write error on header"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockWrite(BlockHandle, &Data), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS block read with a CDS read error (block header) */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_CDS_ACCESS_ERROR, - "CFE_ES_CDSBlockRead", "Read error on header"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockRead(&Data, BlockHandle), CFE_ES_CDS_ACCESS_ERROR); /* Test CDS block write with a CDS write error (data content) */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_WriteToCDS), 2, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == OS_ERROR, "CFE_ES_CDSBlockWrite", - "Write error on content"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockWrite(BlockHandle, &Data), OS_ERROR); /* Test CDS block read with a CDS read error (data content) */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_ReadFromCDS), 3, OS_ERROR); - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == OS_ERROR, "CFE_ES_CDSBlockRead", - "Read error on content"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockRead(&Data, BlockHandle), OS_ERROR); /* Corrupt the data as to cause a CRC mismatch */ UT_GetDataBuffer(UT_KEY(CFE_PSP_ReadFromCDS), (void **)&CdsPtr, NULL, NULL); CdsPtr[UtCdsRegRecPtr->BlockOffset] ^= 0x02; /* Bit flip */ - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_ES_CDS_BLOCK_CRC_ERR, - "CFE_ES_CDSBlockRead", "CRC error on content"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockRead(&Data, BlockHandle), CFE_ES_CDS_BLOCK_CRC_ERR); CdsPtr[UtCdsRegRecPtr->BlockOffset] ^= 0x02; /* Fix Bit */ } @@ -4865,59 +4404,46 @@ void TestESMempool(void) * too small */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreateNoSem(&PoolID1, Buffer1, 0) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_PoolCreateNoSem", "Pool size too small"); + UtAssert_INT32_EQ(CFE_ES_PoolCreateNoSem(&PoolID1, Buffer1, 0), CFE_ES_BAD_ARGUMENT); /* Test successfully creating memory pool without using a mutex */ - UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreateNoSem(&PoolID1, Buffer1, sizeof(Buffer1)) == CFE_SUCCESS, - "CFE_ES_PoolCreateNoSem", "Memory pool create; successful"); + CFE_UtAssert_SUCCESS(CFE_ES_PoolCreateNoSem(&PoolID1, Buffer1, sizeof(Buffer1))); /* Test creating memory pool using a mutex with the pool size too small */ - UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreate(&PoolID2, Buffer2, 0) == CFE_ES_BAD_ARGUMENT, "CFE_ES_PoolCreate", - "Pool size too small"); + UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID2, Buffer2, 0), CFE_ES_BAD_ARGUMENT); /* Test successfully creating memory pool using a mutex */ - UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreate(&PoolID2, Buffer2, sizeof(Buffer2)) == CFE_SUCCESS, - "CFE_ES_PoolCreate", "Create memory pool (using mutex) [1]; successful"); + CFE_UtAssert_SUCCESS(CFE_ES_PoolCreate(&PoolID2, Buffer2, sizeof(Buffer2))); /* Test successfully allocating a pool buffer */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256) > 0, "CFE_ES_GetPoolBuf", - "Allocate pool buffer [1]; successful"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256), 256); - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, "CFE_ES_GetPoolBuf", - "Allocate pool buffer [2]; successful"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256), 256); /* Test successfully getting the size of an existing pool buffer */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID2, addressp2) > 0, "CFE_ES_GetPoolBufInfo", - "Get pool buffer size; successful"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID2, addressp2), 256); /* Test successfully getting the size of an existing pool buffer. Use no * mutex in order to get branch path coverage */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID1, addressp1) > 0, "CFE_ES_GetPoolBufInfo", - "Get pool buffer size; successful (no mutex)"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID1, addressp1), 256); /* Test successfully returning a pool buffer to the memory pool */ - UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID1, addressp1) > 0, "CFE_ES_PutPoolBuf", - "Return buffer to the memory pool; successful"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID1, addressp1), 256); - UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID2, addressp2) > 0, "CFE_ES_PutPoolBuf", - "Return buffer to the memory pool; successful"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID2, addressp2), 256); /* Test successfully allocating an additional pool buffer */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, "CFE_ES_GetPoolBuf", - "Allocate pool buffer [2]; successful"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256), 256); /* Test successfully returning a pool buffer to the second memory pool. * Use no mutex in order to get branch path coverage */ - UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID2, addressp2) > 0, "CFE_ES_PutPoolBuf", - "Return buffer to the second memory pool; successful"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID2, addressp2), 256); /* Test handle validation using a handle with an invalid memory address */ UT_SetDeferredRetcode(UT_KEY(CFE_PSP_MemValidateRange), 1, -1); - UT_Report(__FILE__, __LINE__, CFE_ES_ValidateHandle(PoolID2) == false, "CFE_ES_ValidateHandle", - "Invalid handle; bad memory address"); + CFE_UtAssert_FALSE(CFE_ES_ValidateHandle(PoolID2)); /* Test handle validation using a handle where the first pool structure * field is not the pool start address @@ -4931,103 +4457,86 @@ void TestESMempool(void) */ *((uint32 *)&PoolPtr->PoolID) ^= 10; /* cause it to fail validation */ - UT_Report(__FILE__, __LINE__, CFE_ES_ValidateHandle(PoolID2) == false, "CFE_ES_ValidateHandle", - "Invalid handle; not pool start address"); + CFE_UtAssert_FALSE(CFE_ES_ValidateHandle(PoolID2)); /* Test allocating a pool buffer where the memory handle is not the pool * start address */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetPoolBuf", "Invalid handle; not pool start address"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test getting memory pool statistics where the memory handle is not * the pool start address */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetMemPoolStats(&Stats, CFE_ES_MEMHANDLE_UNDEFINED) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetMemPoolStats", "Invalid handle; not pool start address"); + UtAssert_INT32_EQ(CFE_ES_GetMemPoolStats(&Stats, CFE_ES_MEMHANDLE_UNDEFINED), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test allocating a pool buffer where the memory block doesn't fit within * the remaining memory */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp1, PoolID1, 75000) == CFE_ES_ERR_MEM_BLOCK_SIZE, - "CFE_ES_GetPoolBuf", "Requested pool size too large"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp1, PoolID1, 75000), CFE_ES_ERR_MEM_BLOCK_SIZE); /* Test getting the size of an existing pool buffer using an * invalid handle */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID2, addressp2) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetPoolBufInfo", "Invalid memory pool handle"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID2, addressp2), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Undo the previous memory corruption */ *((uint32 *)&PoolPtr->PoolID) ^= 10; /* Repair Pool2 ID */ /* Test returning a pool buffer using an invalid memory block */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PutPoolBuf(PoolID2, CFE_ES_MEMPOOLBUF_C((cpuaddr)addressp2 - 40)) == CFE_ES_BUFFER_NOT_IN_POOL, - "CFE_ES_PutPoolBuf", "Invalid memory block"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID2, CFE_ES_MEMPOOLBUF_C((cpuaddr)addressp2 - 40)), + CFE_ES_BUFFER_NOT_IN_POOL); /* Test initializing a pre-allocated pool specifying a number of block * sizes greater than the maximum */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS + 2, BlockSizes, - CFE_ES_USE_MUTEX) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_PoolCreateEx", "Number of block sizes exceeds maximum"); + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS + 2, + BlockSizes, CFE_ES_USE_MUTEX), + CFE_ES_BAD_ARGUMENT); /* Test initializing a pre-allocated pool specifying a pool size that * is too small and using the default block size */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(CFE_ES_GenPoolBD_t) / 2, - CFE_PLATFORM_ES_POOL_MAX_BUCKETS - 2, BlockSizes, - CFE_ES_USE_MUTEX) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_PoolCreateEx", "Memory pool size too small (default block size)"); + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(CFE_ES_GenPoolBD_t) / 2, + CFE_PLATFORM_ES_POOL_MAX_BUCKETS - 2, BlockSizes, CFE_ES_USE_MUTEX), + CFE_ES_BAD_ARGUMENT); /* Test calling CFE_ES_PoolCreateEx() with NULL pointer arguments */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(NULL, Buffer1, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS, BlockSizes, - CFE_ES_USE_MUTEX) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_PoolCreateEx", "Memory pool bad arguments (NULL handle pointer)"); + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(NULL, Buffer1, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS, BlockSizes, + CFE_ES_USE_MUTEX), + CFE_ES_BAD_ARGUMENT); - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, NULL, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS, BlockSizes, - CFE_ES_USE_MUTEX) == CFE_ES_BAD_ARGUMENT, - "CFE_ES_PoolCreateEx", "Memory pool bad arguments (NULL mem pointer)"); + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID1, NULL, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS, BlockSizes, + CFE_ES_USE_MUTEX), + CFE_ES_BAD_ARGUMENT); /* * Test to use default block sizes if none are given */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), 0, NULL, CFE_ES_USE_MUTEX) == CFE_SUCCESS, - "CFE_ES_PoolCreateEx", "Use default block sizes when none are given"); + CFE_UtAssert_SUCCESS(CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), 0, NULL, CFE_ES_USE_MUTEX)); /* * Test creating a memory pool after the limit reached (no slots) */ ES_ResetUnitTest(); UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS, BlockSizes, - CFE_ES_USE_MUTEX) == CFE_ES_NO_RESOURCE_IDS_AVAILABLE, - "CFE_ES_PoolCreateEx", "Memory pool limit reached"); + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), CFE_PLATFORM_ES_POOL_MAX_BUCKETS, + BlockSizes, CFE_ES_USE_MUTEX), + CFE_ES_NO_RESOURCE_IDS_AVAILABLE); /* Check operation of the CFE_ES_CheckCounterIdSlotUsed() helper function */ CFE_ES_Global.MemPoolTable[1].PoolID = CFE_ES_MEMHANDLE_C(ES_UT_MakePoolIdForIndex(1)); CFE_ES_Global.MemPoolTable[2].PoolID = CFE_ES_MEMHANDLE_UNDEFINED; - UtAssert_True(CFE_ES_CheckMemPoolSlotUsed(ES_UT_MakePoolIdForIndex(1)), "MemPool Slot Used"); - UtAssert_True(!CFE_ES_CheckMemPoolSlotUsed(ES_UT_MakePoolIdForIndex(2)), "MemPool Slot Unused"); + CFE_UtAssert_TRUE(CFE_ES_CheckMemPoolSlotUsed(ES_UT_MakePoolIdForIndex(1))); + CFE_UtAssert_FALSE(CFE_ES_CheckMemPoolSlotUsed(ES_UT_MakePoolIdForIndex(2))); /* * Test creating a memory pool with a semaphore error */ ES_ResetUnitTest(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_ERROR); - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreate(&PoolID1, Buffer1, sizeof(Buffer1)) == CFE_STATUS_EXTERNAL_RESOURCE_FAIL, - "CFE_ES_PoolCreateEx", "Memory pool mutex create error"); + UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID1, Buffer1, sizeof(Buffer1)), CFE_STATUS_EXTERNAL_RESOURCE_FAIL); /* * Test creating a memory pool with a semaphore error @@ -5038,8 +4547,7 @@ void TestESMempool(void) OS_MutSemCreate(&PoolPtr->MutexId, "UT", 0); UT_SetDeferredRetcode(UT_KEY(OS_MutSemDelete), 1, OS_ERROR); PoolID1 = CFE_ES_MemPoolRecordGetID(PoolPtr); - UT_Report(__FILE__, __LINE__, CFE_ES_PoolDelete(PoolID1) == CFE_SUCCESS, "CFE_ES_PoolDelete", - "Memory pool delete with semaphore delete error"); + CFE_UtAssert_SUCCESS(CFE_ES_PoolDelete(PoolID1)); /* Test initializing a pre-allocated pool specifying * the block size with one block size set to zero @@ -5049,46 +4557,35 @@ void TestESMempool(void) BlockSizes[1] = 50; BlockSizes[2] = 100; BlockSizes[3] = 0; - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), 4, BlockSizes, CFE_ES_USE_MUTEX) == - CFE_ES_ERR_MEM_BLOCK_SIZE, - "CFE_ES_PoolCreateEx", "Memory pool block size zero (block size specified)"); + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), 4, BlockSizes, CFE_ES_USE_MUTEX), + CFE_ES_ERR_MEM_BLOCK_SIZE); BlockSizes[0] = 10; BlockSizes[1] = 50; - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), 2, BlockSizes, CFE_ES_USE_MUTEX) == CFE_SUCCESS, - "CFE_ES_PoolCreateEx", "Make space for new size"); + CFE_UtAssert_SUCCESS(CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), 2, BlockSizes, CFE_ES_USE_MUTEX)); /* Test successfully creating memory pool using a mutex for * subsequent tests */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreate(&PoolID1, Buffer1, sizeof(Buffer1)) == CFE_SUCCESS, - "CFE_ES_PoolCreate", "Create memory pool (using mutex) [2]; successful"); - UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreate(&PoolID2, Buffer2, sizeof(Buffer2)) == CFE_SUCCESS, - "CFE_ES_PoolCreate", "Create memory pool (no mutex) [2]; successful"); + CFE_UtAssert_SUCCESS(CFE_ES_PoolCreate(&PoolID1, Buffer1, sizeof(Buffer1))); + CFE_UtAssert_SUCCESS(CFE_ES_PoolCreate(&PoolID2, Buffer2, sizeof(Buffer2))); /* Test successfully allocating an additional pool buffer for * subsequent tests */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256) > 0, "CFE_ES_GetPoolBuf", - "Allocate pool buffer [3]; successful"); - - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, "CFE_ES_GetPoolBuf", - "Allocate pool buffer [3]; successful"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256), 256); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256), 256); /* Test getting the size of an existing pool buffer using an * unallocated block */ BdPtr = ((CFE_ES_GenPoolBD_t *)addressp1) - 1; BdPtr->Allocated ^= 717; - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID1, addressp1) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_GetPoolBufInfo", "Invalid memory pool handle; unallocated block"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID1, addressp1), CFE_ES_POOL_BLOCK_INVALID); /* Test returning a pool buffer using an unallocated block */ - UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID1, addressp1) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_PutPoolBuf", "Deallocate an unallocated block"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID1, addressp1), CFE_ES_POOL_BLOCK_INVALID); BdPtr->Allocated ^= 717; /* repair */ @@ -5097,8 +4594,7 @@ void TestESMempool(void) */ BdPtr->Allocated = 0xaaaa; BdPtr->CheckBits ^= 717; - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID1, addressp1) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_GetPoolBufInfo", "Invalid memory pool handle; check bit pattern"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID1, addressp1), CFE_ES_POOL_BLOCK_INVALID); BdPtr->CheckBits ^= 717; /* repair */ @@ -5106,22 +4602,19 @@ void TestESMempool(void) * memory descriptor */ BdPtr->ActualSize = 0xFFFFFFFF; - UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID1, addressp1) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_PutPoolBuf", "Invalid/corrupted memory descriptor"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID1, addressp1), CFE_ES_POOL_BLOCK_INVALID); /* Test getting the size of an existing pool buffer using an * unallocated block. Use no mutex in order to get branch path coverage */ BdPtr = ((CFE_ES_GenPoolBD_t *)addressp2) - 1; BdPtr->Allocated ^= 717; - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID2, addressp2) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_GetPoolBufInfo", "Invalid memory pool handle; unallocated block (no mutex)"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID2, addressp2), CFE_ES_POOL_BLOCK_INVALID); /* Test returning a pool buffer using an unallocated block. Use no mutex * in order to get branch path coverage */ - UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID2, addressp2) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_PutPoolBuf", "Deallocate an unallocated block (no mutex)"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID2, addressp2), CFE_ES_POOL_BLOCK_INVALID); BdPtr->Allocated ^= 717; /* repair */ @@ -5130,8 +4623,7 @@ void TestESMempool(void) * coverage */ BdPtr->CheckBits ^= 717; - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBufInfo(PoolID2, addressp2) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_GetPoolBufInfo", "Invalid memory pool handle; check bit pattern (no mutex)"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID2, addressp2), CFE_ES_POOL_BLOCK_INVALID); BdPtr->CheckBits ^= 717; /* repair */ @@ -5139,85 +4631,66 @@ void TestESMempool(void) * memory descriptor. Use no mutex in order to get branch path coverage */ BdPtr->ActualSize = 0xFFFFFFFF; - UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID2, addressp2) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_PutPoolBuf", "Invalid/corrupted memory descriptor (no mutex)"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID2, addressp2), CFE_ES_POOL_BLOCK_INVALID); /* Test successfully creating memory pool using a mutex for * subsequent tests */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreate(&PoolID1, Buffer1, sizeof(Buffer1)) == CFE_SUCCESS, - "CFE_ES_PoolCreate", "Create memory pool (using mutex) [3]; successful"); + CFE_UtAssert_SUCCESS(CFE_ES_PoolCreate(&PoolID1, Buffer1, sizeof(Buffer1))); /* Test successfully allocating an additional pool buffer for * subsequent tests. Use no mutex in order to get branch path coverage */ - UT_Report(__FILE__, __LINE__, CFE_ES_PoolCreate(&PoolID2, Buffer2, sizeof(Buffer2)) == CFE_SUCCESS, - "CFE_ES_PoolCreate", "Create memory pool (using mutex) [3]; successful"); + CFE_UtAssert_SUCCESS(CFE_ES_PoolCreate(&PoolID2, Buffer2, sizeof(Buffer2))); /* Test successfully allocating an additional pool buffer for * subsequent tests */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256) > 0, "CFE_ES_GetPoolBuf", - "Allocate pool buffer [3]; successful"); - - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256) > 0, "CFE_ES_GetPoolBuf", - "Allocate pool buffer [3]; successful"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp1, PoolID1, 256), 256); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp2, PoolID2, 256), 256); /* Test returning a pool buffer using a buffer size larger than * the maximum */ BdPtr = ((CFE_ES_GenPoolBD_t *)addressp1) - 1; BdPtr->ActualSize = CFE_PLATFORM_ES_MAX_BLOCK_SIZE + 1; - UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID1, addressp1) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_PutPoolBuf", "Pool buffer size exceeds maximum"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID1, addressp1), CFE_ES_POOL_BLOCK_INVALID); /* Test returning a pool buffer using a buffer size larger than * the maximum. Use no mutex in order to get branch path coverage */ BdPtr = ((CFE_ES_GenPoolBD_t *)addressp2) - 1; BdPtr->ActualSize = CFE_PLATFORM_ES_MAX_BLOCK_SIZE + 1; - UT_Report(__FILE__, __LINE__, CFE_ES_PutPoolBuf(PoolID2, addressp2) == CFE_ES_POOL_BLOCK_INVALID, - "CFE_ES_PutPoolBuf", "Pool buffer size exceeds maximum (no mutex)"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(PoolID2, addressp2), CFE_ES_POOL_BLOCK_INVALID); /* Test allocating an additional pool buffer using a buffer size larger * than the maximum */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp2, PoolID1, 99000) == CFE_ES_ERR_MEM_BLOCK_SIZE, - "CFE_ES_GetPoolBuf", "Pool buffer size exceeds maximum"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp2, PoolID1, 99000), CFE_ES_ERR_MEM_BLOCK_SIZE); /* Test handle validation using a null handle */ - UT_Report(__FILE__, __LINE__, CFE_ES_ValidateHandle(CFE_ES_MEMHANDLE_UNDEFINED) == false, "CFE_ES_ValidateHandle", - "NULL handle"); + CFE_UtAssert_FALSE(CFE_ES_ValidateHandle(CFE_ES_MEMHANDLE_UNDEFINED)); /* Test returning a pool buffer using a null handle */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PutPoolBuf(CFE_ES_MEMHANDLE_UNDEFINED, addressp2) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_PutPoolBuf", "NULL memory handle"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(CFE_ES_MEMHANDLE_UNDEFINED, addressp2), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test allocating a pool buffer using a null handle */ ES_ResetUnitTest(); - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBuf(&addressp2, CFE_ES_MEMHANDLE_UNDEFINED, 256) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetPoolBuf", "NULL memory handle"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp2, CFE_ES_MEMHANDLE_UNDEFINED, 256), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test getting the size of an existing pool buffer using a null handle */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBufInfo(CFE_ES_MEMHANDLE_UNDEFINED, addressp1) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_GetPoolBufInfo", "NULL memory handle"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(CFE_ES_MEMHANDLE_UNDEFINED, addressp1), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Test initializing a pre-allocated pool specifying a small block size */ ES_ResetUnitTest(); BlockSizes[0] = 16; - UT_Report(__FILE__, __LINE__, - CFE_ES_PoolCreateEx(&PoolID1, Buffer1, 128, 1, BlockSizes, CFE_ES_USE_MUTEX) == CFE_SUCCESS, - "CFE_ES_PoolCreateEx", "Allocate small memory pool"); + CFE_UtAssert_SUCCESS(CFE_ES_PoolCreateEx(&PoolID1, Buffer1, 128, 1, BlockSizes, CFE_ES_USE_MUTEX)); /* Test allocating an additional pool buffer using a buffer size larger * than the maximum. */ - UT_Report(__FILE__, __LINE__, CFE_ES_GetPoolBuf(&addressp1, PoolID1, 32) == CFE_ES_ERR_MEM_BLOCK_SIZE, - "CFE_ES_GetPoolBuf", "Pool buffer size exceeds maximum (no mutex)"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBuf(&addressp1, PoolID1, 32), CFE_ES_ERR_MEM_BLOCK_SIZE); /* * Test allocating a pool buffer where the memory block doesn't fit within @@ -5241,18 +4714,15 @@ void TestESMempool(void) } } - UT_Report(__FILE__, __LINE__, i >= 1 && i <= 20, "CFE_ES_GetPoolBuf", "Pool fully allocated"); + UtAssert_NONZERO(i); + CFE_UtAssert_ATMOST(i, 20); /* Test getting the size of a pool buffer that is not in the pool */ - UT_Report(__FILE__, __LINE__, - CFE_ES_GetPoolBufInfo(PoolID1, CFE_ES_MEMPOOLBUF_C((cpuaddr)addressp1 + 400)) == - CFE_ES_BUFFER_NOT_IN_POOL, - "CFE_ES_GetPoolBufInfo", "Invalid pool buffer"); + UtAssert_INT32_EQ(CFE_ES_GetPoolBufInfo(PoolID1, CFE_ES_MEMPOOLBUF_C((cpuaddr)addressp1 + 400)), + CFE_ES_BUFFER_NOT_IN_POOL); /* Test getting the size of a pool buffer with an invalid memory handle */ - UT_Report(__FILE__, __LINE__, - CFE_ES_PutPoolBuf(CFE_ES_MEMHANDLE_UNDEFINED, addressp1) == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_PutPoolBuf", "Invalid memory handle"); + UtAssert_INT32_EQ(CFE_ES_PutPoolBuf(CFE_ES_MEMHANDLE_UNDEFINED, addressp1), CFE_ES_ERR_RESOURCEID_NOT_VALID); } /* Tests to fill gaps in coverage in SysLog */ @@ -5276,26 +4746,23 @@ void TestSysLog(void) CFE_ES_SysLogReadStart_Unsync(&SysLogBuffer); - UT_Report(__FILE__, __LINE__, - SysLogBuffer.EndIdx == sizeof(CFE_ES_Global.ResetDataPtr->SystemLog) - 1 && - SysLogBuffer.LastOffset == sizeof(CFE_ES_Global.ResetDataPtr->SystemLog) - 1 && - SysLogBuffer.BlockSize == 0 && SysLogBuffer.SizeLeft == 0, - "CFE_ES_SysLogReadStart_Unsync(SysLogBuffer)", "ResetDataPtr pointing to an old fragment of a message"); + CFE_UtAssert_MEMOFFSET_EQ(SysLogBuffer.EndIdx, sizeof(CFE_ES_Global.ResetDataPtr->SystemLog) - 1); + CFE_UtAssert_MEMOFFSET_EQ(SysLogBuffer.LastOffset, sizeof(CFE_ES_Global.ResetDataPtr->SystemLog) - 1); + UtAssert_ZERO(SysLogBuffer.BlockSize); + UtAssert_ZERO(SysLogBuffer.SizeLeft); /* Test truncation of a sys log message that is over half * the size of the total log */ ES_ResetUnitTest(); memset(LogString, 'a', (CFE_PLATFORM_ES_SYSTEM_LOG_SIZE / 2) + 1); LogString[(CFE_PLATFORM_ES_SYSTEM_LOG_SIZE / 2) + 1] = '\0'; - UT_Report(__FILE__, __LINE__, CFE_ES_SysLogAppend_Unsync(LogString) == CFE_ES_ERR_SYS_LOG_TRUNCATED, - "CFE_ES_SysLogAppend_Unsync", "Truncated sys log message"); + UtAssert_INT32_EQ(CFE_ES_SysLogAppend_Unsync(LogString), CFE_ES_ERR_SYS_LOG_TRUNCATED); /* Test code that skips writing an empty string to the sys log */ ES_ResetUnitTest(); memset(LogString, 'a', (CFE_PLATFORM_ES_SYSTEM_LOG_SIZE / 2) + 1); LogString[0] = '\0'; - UT_Report(__FILE__, __LINE__, CFE_ES_SysLogAppend_Unsync(LogString) == CFE_SUCCESS, "CFE_ES_SysLogAppend_Unsync", - "Don't log an empty string"); + CFE_UtAssert_SUCCESS(CFE_ES_SysLogAppend_Unsync(LogString)); /* Test Reading space between the current read offset and end of the log buffer */ ES_ResetUnitTest(); @@ -5306,10 +4773,10 @@ void TestSysLog(void) CFE_ES_SysLogReadData(&SysLogBuffer); - UT_Report(__FILE__, __LINE__, - SysLogBuffer.EndIdx == 3 && SysLogBuffer.LastOffset == 1 && SysLogBuffer.BlockSize == 1 && - SysLogBuffer.SizeLeft == 0, - "CFE_ES_SysLogReadData", "Read space between current offset and end of log buffer"); + UtAssert_UINT32_EQ(SysLogBuffer.EndIdx, 3); + CFE_UtAssert_MEMOFFSET_EQ(SysLogBuffer.LastOffset, 1); + CFE_UtAssert_MEMOFFSET_EQ(SysLogBuffer.BlockSize, 1); + UtAssert_ZERO(SysLogBuffer.SizeLeft); /* Test nominal flow through CFE_ES_SysLogDump * with multiple reads and writes */ @@ -5317,30 +4784,23 @@ void TestSysLog(void) CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx = 0; CFE_ES_Global.ResetDataPtr->SystemLogEndIdx = sizeof(CFE_ES_Global.ResetDataPtr->SystemLog) - 1; - CFE_ES_SysLogDump("fakefilename"); - - UT_Report(__FILE__, __LINE__, true, "CFE_ES_SysLogDump", "Multiple reads and writes to sys log"); + CFE_UtAssert_VOIDCALL(CFE_ES_SysLogDump("fakefilename")); /* Test "message got truncated" */ ES_ResetUnitTest(); memset(TmpString, 'a', CFE_ES_MAX_SYSLOG_MSG_SIZE); TmpString[CFE_ES_MAX_SYSLOG_MSG_SIZE] = '\0'; - CFE_ES_WriteToSysLog("%s", TmpString); - UT_Report(__FILE__, __LINE__, true, "CFE_ES_WriteToSysLog", "Truncate message"); + CFE_UtAssert_SUCCESS(CFE_ES_WriteToSysLog("%s", TmpString)); } void TestBackground(void) { - int32 status; - /* CFE_ES_BackgroundInit() with default setup * causes CFE_ES_CreateChildTask to fail. */ ES_ResetUnitTest(); - status = CFE_ES_BackgroundInit(); - UtAssert_True(status == CFE_ES_ERR_RESOURCEID_NOT_VALID, - "CFE_ES_BackgroundInit - CFE_ES_CreateChildTask failure (%08x)", (unsigned int)status); + UtAssert_INT32_EQ(CFE_ES_BackgroundInit(), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* The CFE_ES_BackgroundCleanup() function has no conditionals - * it just needs to be executed as part of this routine, @@ -5349,7 +4809,7 @@ void TestBackground(void) ES_ResetUnitTest(); OS_BinSemCreate(&CFE_ES_Global.BackgroundTask.WorkSem, "UT", 0, 0); CFE_ES_BackgroundCleanup(); - UtAssert_True(UT_GetStubCount(UT_KEY(OS_BinSemDelete)) == 1, "CFE_ES_BackgroundCleanup - OS_BinSemDelete called"); + UtAssert_STUB_COUNT(OS_BinSemDelete, 1); /* * When testing the background task loop, it is normally an infinite loop, @@ -5364,10 +4824,8 @@ void TestBackground(void) CFE_ES_Global.BackgroundPerfDumpState.CurrentState = CFE_ES_PerfDumpState_INIT; UT_SetDeferredRetcode(UT_KEY(OS_BinSemTimedWait), 3, -4); CFE_ES_BackgroundTask(); - UT_Report(__FILE__, __LINE__, UT_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_BACKGROUND_TAKE]), - "CFE_ES_BackgroundTask", "Failed to take background sem"); + CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_BACKGROUND_TAKE]); + /* The number of jobs running should be 1 (perf log dump) */ - UtAssert_True(CFE_ES_Global.BackgroundTask.NumJobsRunning == 1, - "CFE_ES_BackgroundTask - Nominal, CFE_ES_Global.BackgroundTask.NumJobsRunning (%u) == 1", - (unsigned int)CFE_ES_Global.BackgroundTask.NumJobsRunning); + UtAssert_UINT32_EQ(CFE_ES_Global.BackgroundTask.NumJobsRunning, 1); }