diff --git a/modules/core_private/ut-stubs/inc/ut_support.h b/modules/core_private/ut-stubs/inc/ut_support.h index 06e97b54a..3ddd6b3db 100644 --- a/modules/core_private/ut-stubs/inc/ut_support.h +++ b/modules/core_private/ut-stubs/inc/ut_support.h @@ -507,6 +507,12 @@ bool UT_EventIsInHistory(uint16 EventIDToSearchFor); ******************************************************************************/ uint32 UT_SyslogIsInHistory(const char *LogMsgToSearchFor); +/** + * Macro to aid in checking if a printf message was generated during a test + */ +#define CFE_UtAssert_SyslogIsInHistory(str) \ + UtAssert_True(UT_SyslogIsInHistory(str), "%s syslog generated (%s)", #str, str) + /*****************************************************************************/ /** ** \brief Search the printf history for a specified message template @@ -522,6 +528,12 @@ uint32 UT_SyslogIsInHistory(const char *LogMsgToSearchFor); ******************************************************************************/ uint32 UT_PrintfIsInHistory(const char *MsgToSearchFor); +/** + * Macro to aid in checking if a printf message was generated during a test + */ +#define CFE_UtAssert_PrintfIsInHistory(str) \ + UtAssert_True(UT_PrintfIsInHistory(str), "%s printf generated (%s)", #str, str) + /*****************************************************************************/ /** ** \brief Return number of events issued @@ -700,7 +712,8 @@ void UT_EVTCNT_impl(const char *FileName, int LineNum, const char *TestName, int #define EVTCNT(EXP) (UT_EVTCNT_impl(__FILE__, __LINE__, __func__, (EXP))) /** \brief Function to be called by the EVTSENT() macro */ -void UT_EVTSENT_impl(const char *FileName, int LineNum, const char *TestName, const char *EvtName, int32 EvtId); +void UT_EVTSENT_impl(const char *FileName, int LineNum, const char *TestName, bool invert, const char *EvtName, + int32 EvtId); /*****************************************************************************/ /** @@ -716,7 +729,8 @@ void UT_EVTSENT_impl(const char *FileName, int LineNum, const char *TestName, co ** \sa #START, #SETUP, #ASSERT, #ASSERT_EQ, #ASSERT_TRUE, #EVTCNT, #REPORT, #TEARDOWN ** ******************************************************************************/ -#define EVTSENT(EVT) (UT_EVTSENT_impl(__FILE__, __LINE__, __func__, (#EVT), (EVT))) +#define EVTSENT(EVT) (UT_EVTSENT_impl(__FILE__, __LINE__, __func__, false, (#EVT), (EVT))) +#define EVTNOTSENT(EVT) (UT_EVTSENT_impl(__FILE__, __LINE__, __func__, true, (#EVT), (EVT))) /** \brief Function to be called by the TEARDOWN() macro */ void UT_TEARDOWN_impl(const char *FileName, int LineNum, const char *TestName, const char *FnName, int32 FnRet); @@ -737,4 +751,18 @@ void UT_TEARDOWN_impl(const char *FileName, int LineNum, const char *TestName, c ******************************************************************************/ #define TEARDOWN(FN) (UT_TEARDOWN_impl(__FILE__, __LINE__, __func__, (#FN), (FN))) +/** + * \brief Macro for logging calls to a "void" function + * + * A macro that invokes a function with no return value. This should be used when + * no actual condition/result to check for/assert on, but the call should still be + * logged to the output to record the fact that the function was invoked. + */ +#define CFE_UtAssert_VOIDCALL(func) \ + do \ + { \ + func; \ + UtAssert(true, #func, __FILE__, __LINE__); \ + } while (0) + #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 a8ddc15e3..6eb8baeac 100644 --- a/modules/core_private/ut-stubs/src/ut_support.c +++ b/modules/core_private/ut-stubs/src/ut_support.c @@ -726,10 +726,22 @@ void UT_EVTCNT_impl(const char *FileName, int LineNum, const char *TestName, int TestName, (long int)CntSent, (long int)CntExp); } -void UT_EVTSENT_impl(const char *FileName, int LineNum, const char *TestName, const char *EvtName, int32 EvtId) +void UT_EVTSENT_impl(const char *FileName, int LineNum, const char *TestName, bool invert, const char *EvtName, + int32 EvtId) { - UtAssertEx(UT_EventIsInHistory(EvtId), UtAssert_GetContext(), FileName, LineNum, "%s - sent event %s [%ld]", - TestName, EvtName, (long int)EvtId); + bool result = UT_EventIsInHistory(EvtId); + const char *text; + if (invert) + { + text = "did not send"; + result = !result; + } + else + { + text = "sent"; + } + UtAssertEx(result, UtAssert_GetContext(), FileName, LineNum, "%s - %s event %s [%ld]", text, TestName, EvtName, + (long int)EvtId); } void UT_TEARDOWN_impl(const char *FileName, int LineNum, const char *TestName, const char *FnName, int32 FnRet) diff --git a/modules/es/ut-coverage/es_UT.c b/modules/es/ut-coverage/es_UT.c index f788e2704..bc952bbd0 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_PrintfIsInHistory(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_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_STARTUP_SYNC_FAIL_1]); + CFE_UtAssert_PrintfIsInHistory(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_PrintfIsInHistory(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_PrintfIsInHistory(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_PrintfIsInHistory(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_PrintfIsInHistory(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_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CREATE_VOLATILE]); + CFE_UtAssert_PrintfIsInHistory(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_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]); + CFE_UtAssert_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CREATE_VOLATILE]); + CFE_UtAssert_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INIT_VOLATILE]); + CFE_UtAssert_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]); + CFE_UtAssert_PrintfIsInHistory(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_PrintfIsInHistory(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_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]); + CFE_UtAssert_PrintfIsInHistory(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_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]); + CFE_UtAssert_PrintfIsInHistory(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_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]); + CFE_UtAssert_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]); + CFE_UtAssert_PrintfIsInHistory(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_PrintfIsInHistory(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_PrintfIsInHistory(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_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_RECORD_USED]); + CFE_UtAssert_PrintfIsInHistory(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_PrintfIsInHistory(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_PrintfIsInHistory(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_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_NO_FREE_CORE_APP_SLOTS]); + CFE_UtAssert_PrintfIsInHistory(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_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INSUFF_FREE_SPACE]); + CFE_UtAssert_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_INIT_VOLATILE]); + CFE_UtAssert_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MOUNT_VOLATILE]); + CFE_UtAssert_PrintfIsInHistory(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_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_FILE_LINE_TOO_LONG]); + CFE_UtAssert_PrintfIsInHistory(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_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_FILE_LINE_TOO_LONG]); + CFE_UtAssert_PrintfIsInHistory(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_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_STARTUP_READ]); + CFE_UtAssert_PrintfIsInHistory(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_PrintfIsInHistory(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_PrintfIsInHistory(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_PrintfIsInHistory(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_PrintfIsInHistory(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"); + UtAssert_INT32_EQ(CFE_ES_AppCreate(&AppId, "AppName", &StartParams), CFE_SUCCESS); /* 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_PrintfIsInHistory(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_PrintfIsInHistory(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"); + UtAssert_INT32_EQ(CFE_ES_CheckAppIdSlotUsed(ES_UT_MakeAppIdForIndex(1)), true); + UtAssert_INT32_EQ(CFE_ES_CheckAppIdSlotUsed(ES_UT_MakeAppIdForIndex(2)), false); /* 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_PrintfIsInHistory(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_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CANNOT_FIND_SYMBOL]); + CFE_UtAssert_PrintfIsInHistory(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); + EVTSENT(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); + EVTSENT(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); + EVTCNT(0); /* Test a control action request on an application with an * undefined control request state @@ -1277,8 +1211,7 @@ void TestApps(void) 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)"); + EVTSENT(CFE_ES_PCR_ERR2_EID); /* Test a successful control action request to exit an application */ ES_ResetUnitTest(); @@ -1287,8 +1220,7 @@ void TestApps(void) 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"); + EVTSENT(CFE_ES_EXIT_APP_INF_EID); /* Test a control action request to exit an application where the * request fails @@ -1299,8 +1231,7 @@ void TestApps(void) 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"); + EVTSENT(CFE_ES_EXIT_APP_ERR_EID); /* Test a control action request to stop an application where the * request fails @@ -1311,8 +1242,7 @@ void TestApps(void) 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"); + EVTSENT(CFE_ES_STOP_ERR3_EID); /* Test a control action request to restart an application where the * request fails due to a CleanUpApp error @@ -1323,8 +1253,7 @@ void TestApps(void) 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"); + EVTSENT(CFE_ES_RESTART_APP_ERR4_EID); /* Test a control action request to restart an application where the * request fails due to an AppCreate error @@ -1336,8 +1265,7 @@ void TestApps(void) 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"); + EVTSENT(CFE_ES_RESTART_APP_ERR3_EID); /* Test a control action request to reload an application where the * request fails due to a CleanUpApp error @@ -1348,8 +1276,7 @@ void TestApps(void) 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"); + EVTSENT(CFE_ES_RELOAD_APP_ERR4_EID); /* Test a control action request to reload an application where the * request fails due to an AppCreate error @@ -1361,8 +1288,7 @@ void TestApps(void) 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"); + EVTSENT(CFE_ES_RELOAD_APP_ERR3_EID); /* Test a successful control action request to exit an application that * has an error @@ -1374,8 +1300,7 @@ 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"); + EVTSENT(CFE_ES_ERREXIT_APP_INF_EID); /* Test a control action request to exit an application that * has an error where the request fails @@ -1386,8 +1311,7 @@ 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_ERR_EID), "CFE_ES_ProcessControlRequest", - "Exit application on error failure"); + EVTSENT(CFE_ES_ERREXIT_APP_ERR_EID); /* Test a successful control action request to stop an application */ ES_ResetUnitTest(); @@ -1396,8 +1320,7 @@ void TestApps(void) 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"); + EVTSENT(CFE_ES_STOP_INF_EID); /* Test a successful control action request to restart an application */ ES_ResetUnitTest(); @@ -1406,8 +1329,7 @@ void TestApps(void) 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"); + EVTSENT(CFE_ES_RESTART_APP_INF_EID); /* Test a successful control action request to reload an application */ ES_ResetUnitTest(); @@ -1416,8 +1338,7 @@ void TestApps(void) 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"); + EVTSENT(CFE_ES_RELOAD_APP_INF_EID); /* Test a control action request for an application that has an invalid * state (exception) @@ -1428,15 +1349,13 @@ void TestApps(void) 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"); + EVTSENT(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"); + UtAssert_INT32_EQ(CFE_ES_GetAppInfo(&AppInfo, AppId), CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_GetAppInfo(&AppInfo, AppId), CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_CleanupTaskResources(TaskId), CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_ParseFileEntry(TokenList, 8), CFE_SUCCESS); } /* 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); + EVTCNT(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); + EVTCNT(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"); + UtAssert_INT32_EQ(CFE_ES_CleanUpApp(AppId), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr), true); + UtAssert_INT32_EQ(CFE_ES_MemPoolRecordIsUsed(UtPoolRecPtr), false); /* 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); + UtAssert_INT32_EQ(CFE_ES_MemPoolRecordIsUsed(UtPoolRecPtr), true); /* 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); + UtAssert_INT32_EQ(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr), true); /* 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"); + UtAssert_INT32_EQ(CFE_ES_CleanUpApp(AppId), CFE_SUCCESS); - 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"); + UtAssert_INT32_EQ(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr), true); + 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"); + UtAssert_INT32_EQ(CFE_ES_CleanUpApp(AppId), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_TaskRecordIsUsed(UtTaskRecPtr), false); + 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"); + UtAssert_INT32_EQ(CFE_ES_CleanupTaskResources(TaskId), CFE_SUCCESS); } void TestResourceID(void) @@ -1787,7 +1677,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,39 +1685,29 @@ 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_PrintfIsInHistory(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"); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams), CFE_SUCCESS); 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); + UtAssert_INT32_EQ(CFE_ES_LibRecordIsUsed(UtLibRecPtr), true); /* 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_INT32_EQ(CFE_ES_LoadLibrary(&Id, "TST_LIB", &LoadParams), CFE_ES_ERR_DUPLICATE_NAME); UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(Id, CFE_ES_LibRecordGetID(UtLibRecPtr)), "CFE_ES_LoadLibrary() returned previous ID"); @@ -1837,16 +1716,14 @@ void TestLibs(void) */ 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 +1732,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); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, "TST_LIB1", &LoadParams), CFE_SUCCESS); 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); + UtAssert_INT32_EQ(CFE_ES_LoadLibrary(&Id, "TST_LIB2", &LoadParams), CFE_SUCCESS); UtAssert_STUB_COUNT(OS_ModuleSymbolLookup, 0); /* should NOT have been called */ /* Test shared library loading and initialization where the library @@ -1872,24 +1747,21 @@ 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_PrintfIsInHistory(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"); + UtAssert_INT32_EQ(CFE_ES_CheckLibIdSlotUsed(ES_UT_MakeLibIdForIndex(1)), true); + UtAssert_INT32_EQ(CFE_ES_CheckLibIdSlotUsed(ES_UT_MakeLibIdForIndex(2)), false); /* * Test public Name+ID query/lookup API */ @@ -1908,7 +1780,6 @@ void TestLibs(void) void TestERLog(void) { - int Return; void * LocalBuffer; size_t LocalBufSize; CFE_ES_BackgroundLogDumpGlobal_t State; @@ -1921,12 +1792,10 @@ 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"); + UtAssert_INT32_EQ(CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, 1, NULL), CFE_SUCCESS); + UtAssert_UINT32_EQ(CFE_ES_Global.ResetDataPtr->ERLogIndex, 1); + UtAssert_StrCmp(CFE_ES_Global.ResetDataPtr->ERLog[0].BaseInfo.Description, "No Description String Given.", + "Log entries exceeded; no description; valid context size"); /* Test non-rolling over log entry, * null description, @@ -1934,9 +1803,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"); + UtAssert_INT32_EQ(CFE_ES_WriteToERLog(CFE_ES_LogEntryType_CORE, CFE_PSP_RST_TYPE_POWERON, 1, NULL), CFE_SUCCESS); + UtAssert_UINT32_EQ(CFE_ES_Global.ResetDataPtr->ERLogIndex, 1); /* Test ER log background write functions */ memset(&State, 0, sizeof(State)); @@ -1944,47 +1812,44 @@ 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_INT32_EQ(CFE_ES_BackgroundERLogFileDataGetter(&State, 0, &LocalBuffer, &LocalBufSize), false); UtAssert_UINT32_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( + UtAssert_INT32_EQ( CFE_ES_BackgroundERLogFileDataGetter(&State, CFE_PLATFORM_ES_ER_LOG_ENTRIES - 1, &LocalBuffer, &LocalBufSize), - "CFE_ES_BackgroundERLogFileDataGetter at EOF, no context"); + true); UtAssert_ZERO(State.EntryBuffer.ContextSize); - UtAssert_True( + UtAssert_INT32_EQ( CFE_ES_BackgroundERLogFileDataGetter(&State, CFE_PLATFORM_ES_ER_LOG_ENTRIES, &LocalBuffer, &LocalBufSize), - "CFE_ES_BackgroundERLogFileDataGetter beyond EOF"); + true); 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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(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"); + EVTCNT(0); } void TestGenericPool(void) @@ -2030,20 +1895,20 @@ void TestGenericPool(void) /* 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_NONZERO(Offset1); + UtAssert_True(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); 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 > Offset1, "%lu > Offset(%lu)", (unsigned long)Offset2, (unsigned long)Offset1); + UtAssert_True(Offset2 < OffsetEnd, "Offset(%lu) < %lu", (unsigned long)Offset2, (unsigned long)OffsetEnd); UtAssert_True((Offset2 & 0x1F) == 0, "Offset(%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 > Offset2, "%lu < Offset(%lu)", (unsigned long)Offset2, (unsigned long)Offset3); + UtAssert_True(Offset3 < OffsetEnd, "Offset(%lu) < %lu", (unsigned long)Offset3, (unsigned long)OffsetEnd); UtAssert_True((Offset3 & 0x1F) == 0, "Offset(%lu) 32 byte alignment", (unsigned long)Offset3); /* Free a buffer and attempt to reallocate */ @@ -2190,10 +2055,10 @@ void TestGenericPool(void) * 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"); + UtAssert_INT32_EQ(CFE_ES_GenPoolValidateState(&Pool1), "Nominal Handle validation", true); Pool1.TailPosition = 0xFFFFFF; - UtAssert_True(!CFE_ES_GenPoolValidateState(&Pool1), "Validate Corrupt handle"); + UtAssert_INT32_EQ(CFE_ES_GenPoolValidateState(&Pool1), "Validate Corrupt handle"), false); } void TestTask(void) @@ -2247,71 +2112,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_PrintfIsInHistory(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"); + UtAssert_INT32_EQ(CFE_ES_TaskInit(), CFE_SUCCESS); + 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"); + UtAssert_INT32_EQ(CFE_ES_TaskInit(), CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_TaskInit(), CFE_SUCCESS); /* 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 +2180,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"); + EVTSENT(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"); + EVTSENT(CFE_ES_RESET_INF_EID); /* Test successful cFE restart */ ES_ResetUnitTest(); @@ -2349,16 +2204,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"); + EVTSENT(CFE_ES_BOOT_ERR_EID); /* Test successful app create */ ES_ResetUnitTest(); @@ -2374,15 +2227,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"); + EVTSENT(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"); + EVTSENT(CFE_ES_START_ERR_EID); /* Test app create with an invalid file name */ ES_ResetUnitTest(); @@ -2399,8 +2250,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"); + EVTSENT(CFE_ES_START_INVALID_FILENAME_ERR_EID); /* Test app create with a null application entry point */ ES_ResetUnitTest(); @@ -2414,8 +2264,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"); + EVTSENT(CFE_ES_START_INVALID_ENTRY_POINT_ERR_EID); /* Test app create with a null application name */ ES_ResetUnitTest(); @@ -2430,8 +2279,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"); + EVTSENT(CFE_ES_START_NULL_APP_NAME_ERR_EID); /* Test app create with with an invalid exception action */ ES_ResetUnitTest(); @@ -2447,8 +2295,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"); + EVTSENT(CFE_ES_START_EXC_ACTION_ERR_EID); /* Test app create with a default stack size */ ES_ResetUnitTest(); @@ -2464,8 +2311,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"); + EVTSENT(CFE_ES_START_INF_EID); /* Test app create with a bad priority */ ES_ResetUnitTest(); @@ -2481,8 +2327,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"); + EVTSENT(CFE_ES_START_PRIORITY_ERR_EID); /* Test successful app stop */ ES_ResetUnitTest(); @@ -2490,15 +2335,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"); + EVTSENT(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"); + EVTSENT(CFE_ES_STOP_ERR1_EID); /* Test app stop with a bad app name */ ES_ResetUnitTest(); @@ -2506,8 +2349,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"); + EVTSENT(CFE_ES_STOP_ERR2_EID); /* Test successful app restart */ ES_ResetUnitTest(); @@ -2516,8 +2358,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"); + EVTSENT(CFE_ES_RESTART_APP_DBG_EID); /* Test app restart with failed file check */ ES_ResetUnitTest(); @@ -2527,8 +2368,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"); + EVTSENT(CFE_ES_RESTART_APP_ERR1_EID); /* Test app restart with a bad app name */ ES_ResetUnitTest(); @@ -2537,8 +2377,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"); + EVTSENT(CFE_ES_RESTART_APP_ERR2_EID); /* Test failed app restart, core app */ ES_ResetUnitTest(); @@ -2547,8 +2386,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"); + EVTSENT(CFE_ES_RESTART_APP_ERR1_EID); /* Test failed app restart, not running */ ES_ResetUnitTest(); @@ -2557,8 +2395,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"); + EVTSENT(CFE_ES_RESTART_APP_ERR1_EID); /* Test successful app reload */ ES_ResetUnitTest(); @@ -2569,8 +2406,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"); + EVTSENT(CFE_ES_RELOAD_APP_DBG_EID); /* Test app reload with missing file */ ES_ResetUnitTest(); @@ -2582,8 +2418,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"); + EVTSENT(CFE_ES_RELOAD_APP_ERR1_EID); /* Test app reload with a bad app name */ ES_ResetUnitTest(); @@ -2592,8 +2427,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"); + EVTSENT(CFE_ES_RELOAD_APP_ERR2_EID); /* Test failed app reload, core app */ ES_ResetUnitTest(); @@ -2602,8 +2436,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"); + EVTSENT(CFE_ES_RELOAD_APP_ERR1_EID); /* Test failed app reload, not RUNNING */ ES_ResetUnitTest(); @@ -2612,8 +2445,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"); + EVTSENT(CFE_ES_RELOAD_APP_ERR1_EID); /* Test successful telemetry packet request for single app data */ ES_ResetUnitTest(); @@ -2622,8 +2454,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"); + EVTSENT(CFE_ES_ONE_APP_EID); /* Test telemetry packet request for single app data with send message failure */ ES_ResetUnitTest(); @@ -2633,8 +2464,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"); + EVTSENT(CFE_ES_ONE_ERR_EID); /* Test telemetry packet request for single app data with a bad app name */ ES_ResetUnitTest(); @@ -2643,8 +2473,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"); + EVTSENT(CFE_ES_ONE_APPID_ERR_EID); /* Test successful write of all app data to file */ ES_ResetUnitTest(); @@ -2653,31 +2482,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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(CFE_ES_WRHDR_ERR_EID); /* Test write of all app data to file with a file write failure */ ES_ResetUnitTest(); @@ -2685,8 +2510,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"); + EVTSENT(CFE_ES_TASKWR_ERR_EID); /* Test write of all app data to file with a file create failure */ ES_ResetUnitTest(); @@ -2694,8 +2518,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"); + EVTSENT(CFE_ES_OSCREATE_ERR_EID); /* Test successful write of all task data to a file */ ES_ResetUnitTest(); @@ -2703,8 +2526,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"); + EVTSENT(CFE_ES_TASKINFO_EID); /* Test write of all task data to a file with file name validation failure */ ES_ResetUnitTest(); @@ -2712,8 +2534,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"); + EVTSENT(CFE_ES_TASKINFO_OSCREATE_ERR_EID); /* Test write of all task data to a file with write header failure */ ES_ResetUnitTest(); @@ -2723,8 +2544,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"); + EVTSENT(CFE_ES_TASKINFO_WRHDR_ERR_EID); /* Test write of all task data to a file with a task write failure */ ES_ResetUnitTest(); @@ -2733,8 +2553,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"); + EVTSENT(CFE_ES_TASKINFO_WR_ERR_EID); /* Test write of all task data to a file with an OS create failure */ ES_ResetUnitTest(); @@ -2742,15 +2561,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"); + EVTSENT(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"); + EVTSENT(CFE_ES_SYSLOG1_INF_EID); /* Test successful overwriting of the system log using discard mode */ ES_ResetUnitTest(); @@ -2758,8 +2575,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)"); + EVTSENT(CFE_ES_SYSLOGMODE_EID); /* Test overwriting the system log using an invalid mode */ ES_ResetUnitTest(); @@ -2767,8 +2583,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"); + EVTSENT(CFE_ES_ERR_SYSLOGMODE_EID); /* Test successful writing of the system log */ ES_ResetUnitTest(); @@ -2777,24 +2592,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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(CFE_ES_SYSLOG2_EID); /* Test writing the system log with an OS create failure */ ES_ResetUnitTest(); @@ -2802,8 +2614,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"); + EVTSENT(CFE_ES_SYSLOG2_ERR_EID); /* Test writing the system log with an OS write failure */ ES_ResetUnitTest(); @@ -2815,21 +2626,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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(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 +2649,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); + EVTCNT(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"); + EVTSENT(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)"); + EVTSENT(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)"); + EVTSENT(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 +2682,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 +2699,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 +2711,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"); + EVTSENT(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"); + EVTSENT(CFE_ES_RESET_PR_COUNT_EID); /* Test setting the maximum processor reset count */ ES_ResetUnitTest(); @@ -2942,8 +2737,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"); + EVTSENT(CFE_ES_SET_MAX_PR_COUNT_EID); /* Test failed deletion of specified CDS */ ES_ResetUnitTest(); @@ -2953,16 +2747,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"); + EVTSENT(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"); + EVTSENT(CFE_ES_CDS_DELETE_TBL_ERR_EID); /* Test successful deletion of a specified CDS */ ES_ResetUnitTest(); @@ -2971,16 +2763,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"); + EVTSENT(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"); + EVTSENT(CFE_ES_CDS_OWNER_ACTIVE_EID); /* Test deletion of a specified CDS with the name not found */ ES_ResetUnitTest(); @@ -2988,16 +2778,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"); + EVTSENT(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)"); + EVTSENT(CFE_ES_CDS_REG_DUMP_INF_EID); /* Test dumping of the CDS to a file with a bad file name */ ES_ResetUnitTest(); @@ -3005,8 +2793,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"); + EVTSENT(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 +2801,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"); + EVTSENT(CFE_ES_WRITE_CFE_HDR_ERR_EID); /* Test dumping of the CDS to a file with an OS create failure */ ES_ResetUnitTest(); @@ -3023,8 +2809,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"); + EVTSENT(CFE_ES_CREATING_CDS_DUMP_ERR_EID); /* Test dumping of the CDS to a file with an OS write failure */ ES_ResetUnitTest(); @@ -3033,16 +2818,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"); + EVTSENT(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"); + EVTSENT(CFE_ES_INVALID_POOL_HANDLE_ERR_EID); /* Test successful telemetry pool statistics retrieval */ ES_ResetUnitTest(); @@ -3050,47 +2833,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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(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"); + EVTNOTSENT(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"); + EVTSENT(CFE_ES_LEN_ERR_EID); /* Test start application command with a processor restart on application * exception @@ -3108,80 +2885,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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(CFE_ES_LEN_ERR_EID); /* Test successful overwriting of the system log using overwrite mode */ ES_ResetUnitTest(); @@ -3189,49 +2956,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)"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(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"); + EVTSENT(CFE_ES_LEN_ERR_EID); /* Test successful dump of CDS to file using a specified dump file name */ ES_ResetUnitTest(); @@ -3243,8 +3003,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)"); + EVTSENT(CFE_ES_CDS_REG_DUMP_INF_EID); } /* end TestTask */ void TestPerf(void) @@ -3273,8 +3032,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 +3041,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"); + EVTSENT(CFE_ES_PERF_STARTCMD_EID); /* Test successful performance data collection start in CENTER * trigger mode @@ -3293,8 +3050,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"); + EVTSENT(CFE_ES_PERF_STARTCMD_EID); /* Test successful performance data collection start in END * trigger mode @@ -3303,8 +3059,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"); + EVTSENT(CFE_ES_PERF_STARTCMD_EID); /* Test performance data collection start with an invalid trigger mode * (too high) @@ -3313,8 +3068,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)"); + EVTSENT(CFE_ES_PERF_STARTCMD_TRIG_ERR_EID); /* Test performance data collection start with an invalid trigger mode * (too low) @@ -3323,8 +3077,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)"); + EVTSENT(CFE_ES_PERF_STARTCMD_TRIG_ERR_EID); /* Test performance data collection start with a file write in progress */ ES_ResetUnitTest(); @@ -3334,8 +3087,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"); + EVTSENT(CFE_ES_PERF_STARTCMD_ERR_EID); /* Test performance data collection by sending another valid * start command @@ -3345,16 +3097,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"); + EVTSENT(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"); + EVTSENT(CFE_ES_PERF_STOPCMD_EID); /* Test performance data collection stop with a file name validation issue */ ES_ResetUnitTest(); @@ -3362,8 +3112,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"); + EVTSENT(CFE_ES_PERF_LOG_ERR_EID); /* Test successful performance data collection stop with a non-default file name */ @@ -3374,15 +3123,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)"); + EVTSENT(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"); + EVTSENT(CFE_ES_PERF_STOPCMD_ERR2_EID); /* Test performance filter mask command with out of range filter mask value */ @@ -3391,8 +3138,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"); + EVTSENT(CFE_ES_PERF_FILTMSKERR_EID); /* Test successful performance filter mask command */ ES_ResetUnitTest(); @@ -3400,8 +3146,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"); + EVTSENT(CFE_ES_PERF_FILTMSKCMD_EID); /* Test successful performance filter mask command with minimum filter mask value */ @@ -3410,8 +3155,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"); + EVTSENT(CFE_ES_PERF_TRIGMSKCMD_EID); /* Test successful performance filter mask command with maximum filter * mask value @@ -3421,8 +3165,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"); + EVTSENT(CFE_ES_PERF_TRIGMSKCMD_EID); /* Test successful performance filter mask command with a greater than the * maximum filter mask value @@ -3432,8 +3175,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"); + EVTSENT(CFE_ES_PERF_TRIGMSKERR_EID); /* Test successful addition of a new entry to the performance log */ ES_ResetUnitTest(); @@ -3442,8 +3184,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 +3195,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 +3206,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 +3216,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 +3226,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 +3236,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 +3246,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 +3255,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 +3266,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 +3276,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 +3286,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"); + EVTNOTSENT(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"); + EVTNOTSENT(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"); + EVTNOTSENT(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"); + EVTNOTSENT(CFE_ES_PERF_TRIGMSKCMD_EID); /* Test perf log dump state machine */ /* Nominal call 1 - should go through up to the DELAY state */ @@ -3586,17 +3314,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 +3327,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); + EVTSENT(CFE_ES_PERF_LOG_ERR_EID); /* Test a failure to write to the output file */ ES_ResetUnitTest(); @@ -3618,19 +3336,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); + EVTSENT(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 +3356,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 +3370,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 +3381,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 +3401,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_PrintfIsInHistory(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_PrintfIsInHistory(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_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_CORE_INIT]); + CFE_UtAssert_PrintfIsInHistory(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_PrintfIsInHistory(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 +3463,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_PrintfIsInHistory(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 +3484,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"); + UtAssert_INT32_EQ(CFE_ES_RunLoop(&RunStatus), true); /* 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"); + UtAssert_INT32_EQ(CFE_ES_RunLoop(&RunStatus), false); /* 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"); + UtAssert_INT32_EQ(CFE_ES_RunLoop(&RunStatus), false); /* Test run loop with bad app ID */ ES_ResetUnitTest(); @@ -3823,133 +3506,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"); + UtAssert_INT32_EQ(CFE_ES_RunLoop(&RunStatus), false); /* 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"); + UtAssert_INT32_EQ(CFE_ES_RunLoop(&RunStatus), false); /* 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"); + UtAssert_INT32_EQ(CFE_ES_RunLoop(NULL), true); /* 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"); + UtAssert_INT32_EQ(CFE_ES_RunLoop(&RunStatus), true); + 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"); + UtAssert_INT32_EQ(CFE_ES_GetAppID(&AppId), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_GetTaskID(&TaskId), CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_GetAppName(AppName, AppId, sizeof(AppName)), CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(&TaskInfo, TaskId), CFE_SUCCESS); /* 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 +3626,14 @@ 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"); + UtAssert_INT32_EQ(CFE_ES_CreateChildTask(&TaskId, "TaskName", TestAPI, StackBuf, sizeof(StackBuf), 400, 0), + CFE_SUCCESS); /* Test common entry point */ ES_ResetUnitTest(); @@ -3991,13 +3659,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 +3671,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); + UtAssert_INT32_EQ(CFE_ES_GetAppInfo(&AppInfo, AppId), CFE_SUCCESS); + UtAssert_UINT32_EQ(AppInfo.NumOfChildTasks, 1); + UtAssert_INT32_EQ(CFE_ES_DeleteChildTask(TaskId), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_GetAppInfo(&AppInfo, AppId), CFE_SUCCESS); + UtAssert_UINT32_EQ(AppInfo.NumOfChildTasks, 0); /* Test deleting a child task with an OS task delete failure */ ES_ResetUnitTest(); @@ -4023,14 +3684,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 +3698,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_PrintfIsInHistory(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_PrintfIsInHistory(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 +3719,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 +3731,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 +3747,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_PrintfIsInHistory(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_PrintfIsInHistory(UT_OSP_MESSAGES[UT_OSP_MUTEX_GIVE]); /* Test waiting for apps to initialize before continuing; transition from * initializing to running @@ -4126,8 +3775,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 +3783,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_Assert_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_Assert_VOIDCALL(CFE_ES_WaitForStartupSync(99)); /* Test adding a time-stamped message to the system log using an invalid * log mode @@ -4168,8 +3814,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 +3823,17 @@ 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"); + UtAssert_INT32_EQ(CFE_ES_WriteToSysLog("SysLogText"), CFE_SUCCESS); + UtAssert_True(CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx < CFE_PLATFORM_ES_SYSTEM_LOG_SIZE, + "Add message to log that resets the log index (%lu)", + (unsigned long)CFE_ES_Global.ResetDataPtr->SystemLogWriteIdx); /* 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"); + UtAssert_INT32_EQ(CFE_ES_RunLoop(&RunStatus), false); /* * Test public Name+ID query/lookup API for tasks @@ -4221,12 +3865,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"); + UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(&CounterId, "Counter1"), CFE_SUCCESS); /* 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,109 +3881,88 @@ 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"); + UtAssert_INT32_EQ(CFE_ES_CheckCounterIdSlotUsed(ES_UT_MakeCounterIdForIndex(1)), true); + UtAssert_INT32_EQ(CFE_ES_CheckCounterIdSlotUsed(ES_UT_MakeCounterIdForIndex(2)), false); /* 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"); + UtAssert_INT32_EQ(CFE_ES_GetGenCounterIDByName(&CounterId, "Counter5"), CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_DeleteGenCounter(CounterId), CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_RegisterGenCounter(&CounterId, "CounterX"), CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_IncrementGenCounter(CounterId), CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_SetGenCount(CounterId, 5), CFE_SUCCESS); /* 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 @@ -4373,82 +3994,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"); + UtAssert_INT32_EQ(CFE_ES_CDS_CachePreload(&CFE_ES_Global.CDSVars.Cache, &TempSize, 4, 4), CFE_SUCCESS); 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"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, 4, "Name"), CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandle, 6, "Name"), CFE_SUCCESS); /* 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 +4061,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"); + UtAssert_INT32_EQ(CFE_ES_CheckCDSHandleSlotUsed(ES_UT_MakeCDSIdForIndex(1)), true); + UtAssert_INT32_EQ(CFE_ES_CheckCDSHandleSlotUsed(ES_UT_MakeCDSIdForIndex(2)), false); /* 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"); + UtAssert_INT32_EQ(CFE_ES_CopyToCDS(CDSHandle, &BlockData), CFE_SUCCESS); /* Test successfully restoring from a CDS */ - UT_Report(__FILE__, __LINE__, CFE_ES_RestoreFromCDS(&BlockData, CDSHandle) == CFE_SUCCESS, "CFE_ES_RestoreFromCDS", - "Restore from CDS successful"); + UtAssert_INT32_EQ(CFE_ES_RestoreFromCDS(&BlockData, CDSHandle), CFE_SUCCESS); /* Test CDS registering using a name longer than the maximum allowed */ ES_ResetUnitTest(); @@ -4503,58 +4102,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"); + UtAssert_INT32_EQ(CFE_ES_CDS_EarlyInit(), CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_CDS_EarlyInit(), CFE_SUCCESS); + 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 +4149,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"); + UtAssert_INT32_EQ(CFE_ES_CDS_EarlyInit(), CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_ClearCDS(), CFE_SUCCESS); /* * To prepare for the rebuild tests, set up a clean area in PSP mem, @@ -4631,7 +4209,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"); + UtAssert_INT32_EQ(CFE_ES_CDS_EarlyInit(), CFE_SUCCESS); /* Check that the registry entry exists again (was recovered) */ UtAssert_NONZERO(UtCDSRegRecPtr->BlockOffset); @@ -4640,18 +4218,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 +4234,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 +4243,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"); + UtAssert_INT32_EQ(CFE_ES_CDS_EarlyInit(), CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_CDS_EarlyInit(), CFE_SUCCESS); /* 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 +4265,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 @@ -4731,12 +4300,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 */ /* @@ -4758,21 +4325,17 @@ void TestCDSMempool(void) /* 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 +4345,51 @@ void TestCDSMempool(void) Data = 42; /* Basic success path */ - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockWrite(BlockHandle, &Data) == CFE_SUCCESS, "CFE_ES_CDSBlockWrite", - "Nominal"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockWrite(BlockHandle, &Data), CFE_SUCCESS); Data = 0; - UT_Report(__FILE__, __LINE__, CFE_ES_CDSBlockRead(&Data, BlockHandle) == CFE_SUCCESS, "CFE_ES_CDSBlockRead", - "Nominal"); + UtAssert_INT32_EQ(CFE_ES_CDSBlockRead(&Data, BlockHandle), CFE_SUCCESS); 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 +4415,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"); + UtAssert_INT32_EQ(CFE_ES_PoolCreateNoSem(&PoolID1, Buffer1, sizeof(Buffer1)), CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID2, Buffer2, sizeof(Buffer2)), CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_ValidateHandle(PoolID2), false); /* Test handle validation using a handle where the first pool structure * field is not the pool start address @@ -4931,103 +4468,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"); + UtAssert_INT32_EQ(CFE_ES_ValidateHandle(PoolID2), false); /* 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"); + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), 0, NULL, CFE_ES_USE_MUTEX), CFE_SUCCESS); /* * 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"); + UtAssert_INT32_EQ(CFE_ES_CheckMemPoolSlotUsed(ES_UT_MakePoolIdForIndex(1)), true); + UtAssert_INT32_EQ(CFE_ES_CheckMemPoolSlotUsed(ES_UT_MakePoolIdForIndex(2)), false); /* * 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 +4558,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"); + UtAssert_INT32_EQ(CFE_ES_PoolDelete(PoolID1), CFE_SUCCESS); /* Test initializing a pre-allocated pool specifying * the block size with one block size set to zero @@ -5049,46 +4568,36 @@ 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"); + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID1, Buffer1, sizeof(Buffer1), 2, BlockSizes, CFE_ES_USE_MUTEX), + CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID1, Buffer1, sizeof(Buffer1)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID2, Buffer2, sizeof(Buffer2)), CFE_SUCCESS); /* 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 +4606,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 +4614,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 +4635,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 +4643,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"); + UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID1, Buffer1, sizeof(Buffer1)), CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID2, Buffer2, sizeof(Buffer2)), CFE_SUCCESS); /* 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"); + UtAssert_INT32_EQ(CFE_ES_ValidateHandle(CFE_ES_MEMHANDLE_UNDEFINED), false); /* 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"); + UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID1, Buffer1, 128, 1, BlockSizes, CFE_ES_USE_MUTEX), CFE_SUCCESS); /* 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 +4726,15 @@ void TestESMempool(void) } } - UT_Report(__FILE__, __LINE__, i >= 1 && i <= 20, "CFE_ES_GetPoolBuf", "Pool fully allocated"); + UtAssert_NONZERO(i); + UtAssert_True(i <= 20, "Pool fully allocated (%u)", (unsigned int)i); /* 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 +4758,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"); + UtAssert_UINT32_EQ(SysLogBuffer.EndIdx, sizeof(CFE_ES_Global.ResetDataPtr->SystemLog) - 1); + UtAssert_UINT32_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"); + UtAssert_INT32_EQ(CFE_ES_SysLogAppend_Unsync(LogString), CFE_SUCCESS); /* Test Reading space between the current read offset and end of the log buffer */ ES_ResetUnitTest(); @@ -5306,10 +4785,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); + UtAssert_UINT32_EQ(SysLogBuffer.LastOffset, 1); + UtAssert_UINT32_EQ(SysLogBuffer.BlockSize, 1); + UtAssert_ZERO(SysLogBuffer.SizeLeft); /* Test nominal flow through CFE_ES_SysLogDump * with multiple reads and writes */ @@ -5317,30 +4796,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"); + UtAssert_INT32_EQ(CFE_ES_WriteToSysLog("%s", TmpString), CFE_SUCCESS); } 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 +4821,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 +4836,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_PrintfIsInHistory(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); }