Skip to content

Commit

Permalink
Merge pull request nasa#902 from skliper/fix900-rm-ut-text
Browse files Browse the repository at this point in the history
Fix nasa#900, Replace UT_Text with UtPrintf
  • Loading branch information
yammajamma authored Sep 24, 2020
2 parents 6d43c6e + 09e1b9c commit 2076991
Show file tree
Hide file tree
Showing 24 changed files with 398 additions and 615 deletions.
49 changes: 14 additions & 35 deletions fsw/cfe-core/unit-test/es_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ static int32 ES_UT_SetAppStateHook(void *UserObj, int32 StubRetcode,
void UtTest_Setup(void)
{
UT_Init("es");
UT_Text("cFE ES Unit Test Output File\n\n");
UtPrintf("cFE ES Unit Test Output File\n\n");

/* Set up the performance logging variable */
Perf = (CFE_ES_PerfData_t *) &CFE_ES_ResetDataPtr->Perf;
Expand Down Expand Up @@ -442,9 +442,7 @@ void ES_ResetUnitTest(void)

void TestInit(void)
{
#ifdef UT_VERBOSE
UT_Text("Begin Test Init\n");
#endif
UtPrintf("Begin Test Init");

UT_SetCDSSize(128 * 1024);
UT_SetSizeofESResetArea(sizeof(CFE_ES_ResetData_t));
Expand Down Expand Up @@ -483,9 +481,7 @@ void TestStartupErrorPaths(void)
CFE_ES_TaskRecord_t *TaskRecPtr;
CFE_ES_AppRecord_t *AppRecPtr;

#ifdef UT_VERBOSE
UT_Text("Begin Test Startup Error Paths\n");
#endif
UtPrintf("Begin Test Startup Error Paths");

/* Set up the startup script for reading */
strncpy(StartupScript,
Expand Down Expand Up @@ -942,9 +938,7 @@ void TestApps(void)
CFE_ES_TaskRecord_t *UtTaskRecPtr;
CFE_ES_AppRecord_t *UtAppRecPtr;

#ifdef UT_VERBOSE
UT_Text("Begin Test Apps\n");
#endif
UtPrintf("Begin Test Apps");

/* Test starting an application where the startup script is too long */
ES_ResetUnitTest();
Expand Down Expand Up @@ -1995,9 +1989,7 @@ void TestERLog(void)
{
int Return;

#ifdef UT_VERBOSE
UT_Text("Begin Test Exception and Reset Log\n");
#endif
UtPrintf("Begin Test Exception and Reset Log");

/* Test initial rolling over log entry,
* null description,
Expand Down Expand Up @@ -2064,9 +2056,8 @@ void TestTask(void)
CFE_ES_AppRecord_t *UtAppRecPtr;
CFE_ES_TaskRecord_t *UtTaskRecPtr;
CFE_ES_CDS_RegRec_t *UtCDSRegRecPtr;
#ifdef UT_VERBOSE
UT_Text("Begin Test Task\n");
#endif

UtPrintf("Begin Test Task");

/* Reset the log index; CFE_ES_TaskMain() calls CFE_ES_TaskInit() which
* sets SystemLogMode to DISCARD, which can result in a log overflow
Expand Down Expand Up @@ -3413,9 +3404,7 @@ void TestPerf(void)
CFE_ES_SetPerfTriggerMask_t PerfSetTrigMaskCmd;
} CmdBuf;

#ifdef UT_VERBOSE
UT_Text("Begin Test Performance Log\n");
#endif
UtPrintf("Begin Test Performance Log");

/* Test successful performance mask and value initialization */
ES_ResetUnitTest();
Expand Down Expand Up @@ -3915,9 +3904,7 @@ void TestAPI(void)
CFE_ES_AppRecord_t *UtAppRecPtr;
CFE_ES_TaskRecord_t *UtTaskRecPtr;

#ifdef UT_VERBOSE
UT_Text("Begin Test API\n");
#endif
UtPrintf("Begin Test API");

/* Test resetting the cFE with a processor reset */
ES_ResetUnitTest();
Expand Down Expand Up @@ -4805,10 +4792,7 @@ void TestCDS()
uint32 i;
uint32 TempSize;


#ifdef UT_VERBOSE
UT_Text("Begin Test CDS\n");
#endif
UtPrintf("Begin Test CDS");

/* Set up the PSP stubs for CDS testing */
UT_SetCDSSize(128 * 1024);
Expand Down Expand Up @@ -5185,9 +5169,8 @@ void TestCDSMempool(void)

extern uint32 CFE_ES_CDSMemPoolDefSize[];

#ifdef UT_VERBOSE
UT_Text("Begin Test CDS memory pool\n");
#endif
UtPrintf("Begin Test CDS memory pool");

UT_SetCDSSize(0);

/* Set up the CDS block to read in the following tests */
Expand Down Expand Up @@ -5604,9 +5587,7 @@ void TestESMempool(void)
CFE_ES_MemHandle_t HandlePtrSave;
uint32 i;

#ifdef UT_VERBOSE
UT_Text("Begin Test ES memory pool\n");
#endif
UtPrintf("Begin Test ES memory pool");

/* Test creating memory pool without using a mutex with the pool size
* too small
Expand Down Expand Up @@ -6137,10 +6118,8 @@ void TestSysLog(void)
char LogString[(CFE_PLATFORM_ES_SYSTEM_LOG_SIZE / 2) + 2];

char TmpString[CFE_ES_MAX_SYSLOG_MSG_SIZE + 1];
#ifdef UT_VERBOSE
UT_Text("Begin Test Sys Log\n");
#endif

UtPrintf("Begin Test Sys Log");

/* Test loop in CFE_ES_SysLogReadStart_Unsync that ensures
* reading at the start of a message */
Expand Down
20 changes: 10 additions & 10 deletions fsw/cfe-core/unit-test/es_UT.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
** \returns
** This function does not return a value.
**
** \sa #UT_Init, #UT_Text, #UT_SetCDSSize, #UT_SetSizeofESResetArea
** \sa #UT_Init, #UT_SetCDSSize, #UT_SetSizeofESResetArea
** \sa #UT_SetStatusBSPResetArea, #UT_SetReadBuffer, #UT_SetRtnCode
** \sa #UT_SetDummyFuncRtn, #UT_SetBSPloadAppFileResult, #CFE_ES_Main
** \sa #UT_Report
Expand All @@ -108,7 +108,7 @@ void TestInit(void);
** \returns
** This function does not return a value.
**
** \sa #UT_Text, #UT_SetRtnCode, #UT_SetOSFail, #CFE_ES_Main, #UT_Report
** \sa #UT_SetRtnCode, #UT_SetOSFail, #CFE_ES_Main, #UT_Report
** \sa #CFE_ES_SetupResetVariables, #UT_SetStatusBSPResetArea
** \sa #UT_SetSizeofESResetArea, #CFE_ES_InitializeFileSystems, #UT_SetBSPFail
** \sa #CFE_ES_CreateObjects
Expand All @@ -132,7 +132,7 @@ void TestStartupErrorPaths(void);
** \returns
** This function does not return a value.
**
** \sa #UT_Text, #UT_SetReadBuffer, #UT_SetRtnCode, #CFE_ES_StartApplications
** \sa #UT_SetReadBuffer, #UT_SetRtnCode, #CFE_ES_StartApplications
** \sa #UT_Report, #UT_SetOSFail, #CFE_ES_ParseFileEntry
** \sa #UT_SetBSPloadAppFileResult, #CFE_ES_AppCreate, #UT_SetDummyFuncRtn
** \sa #CFE_ES_LoadLibrary, #CFE_ES_ScanAppTable, #CFE_ES_ProcessControlRequest
Expand All @@ -158,7 +158,7 @@ void TestApps(void);
** \returns
** This function does not return a value.
**
** \sa #UT_Text, #CFE_ES_WriteToERLog, #UT_Report
** \sa #CFE_ES_WriteToERLog, #UT_Report
**
******************************************************************************/
void TestERLog(void);
Expand All @@ -178,7 +178,7 @@ void TestERLog(void);
** \returns
** This function does not return a value.
**
** \sa #UT_Text, #UT_SetRtnCode, #CFE_ES_TaskMain, #UT_Report, #UT_SetOSFail
** \sa #UT_SetRtnCode, #CFE_ES_TaskMain, #UT_Report, #UT_SetOSFail
** \sa #CFE_ES_TaskInit, #UT_SetSBTotalMsgLen, #UT_SendMsg
** \sa #UT_SetBSPloadAppFileResult, #UT_SetStatusBSPResetArea
** \sa #CFE_ES_HousekeepingCmd, #CFE_ES_NoopCmd, #CFE_ES_ResetCountersCmd
Expand Down Expand Up @@ -224,7 +224,7 @@ void TestBackground(void);
** \returns
** This function does not return a value.
**
** \sa #UT_Text, #CFE_ES_SetupPerfVariables, #UT_Report, #UT_SetRtnCode
** \sa #CFE_ES_SetupPerfVariables, #UT_Report, #UT_SetRtnCode
** \sa #UT_SetSBTotalMsgLen, #UT_SendMsg, #UT_SetBSPloadAppFileResult
** \sa #CFE_ES_PerfLogDump, #CFE_ES_PerfLogAdd, #CFE_ES_StartPerfDataCmd
** \sa #CFE_ES_StopPerfDataCmd, #CFE_ES_SetPerfFilterMaskCmd
Expand All @@ -246,7 +246,7 @@ void TestPerf(void);
** \returns
** This function does not return a value.
**
** \sa #UT_Text, #UT_SetRtnCode, #CFE_ES_ResetCFE, #UT_Report
** \sa #UT_SetRtnCode, #CFE_ES_ResetCFE, #UT_Report
** \sa #CFE_ES_GetResetType, #CFE_ES_RestartApp, #CFE_ES_ReloadApp
** \sa #CFE_ES_DeleteApp, #CFE_ES_ExitApp, #CFE_ES_RunLoop
** \sa #CFE_ES_RegisterApp, #CFE_ES_GetAppID, #CFE_ES_GetAppName
Expand Down Expand Up @@ -276,7 +276,7 @@ void TestAPI(void);
** \returns
** This function does not return a value.
**
** \sa #UT_Text, #UT_InitData, #UT_Report, #CFE_ES_CDS_ValidateAppID
** \sa #UT_InitData, #UT_Report, #CFE_ES_CDS_ValidateAppID
** \sa #UT_SetBSPFail, #CFE_ES_RebuildCDS, #UT_SetRtnCode
** \sa #CFE_ES_InitCDSRegistry, #UT_SetCDSSize, #CFE_ES_CDS_EarlyInit
** \sa #UT_SetCDSBSPCheckValidity, #CFE_ES_ValidateCDS, #UT_SetCDSReadGoodEnd
Expand All @@ -300,7 +300,7 @@ void TestCDS(void);
** \returns
** This function does not return a value.
**
** \sa #UT_Text, #UT_InitData, #UT_Report, #CFE_ES_CreateCDSPool
** \sa #UT_InitData, #UT_Report, #CFE_ES_CreateCDSPool
** \sa #CFE_ES_RebuildCDSPool, #UT_SetRtnCode, #UT_SetBSPFail
** \sa #CFE_ES_GetCDSBlock, #CFE_ES_PutCDSBlock, #CFE_ES_CDSBlockWrite
** \sa #CFE_ES_CDSBlockRead
Expand All @@ -323,7 +323,7 @@ void TestCDSMempool(void);
** \returns
** This function does not return a value.
**
** \sa #UT_Text, #UT_InitData, #UT_Report, #CFE_ES_PoolCreateNoSem
** \sa #UT_InitData, #UT_Report, #CFE_ES_PoolCreateNoSem
** \sa #CFE_ES_PoolCreate, #CFE_ES_GetPoolBuf, #CFE_ES_GetPoolBufInfo
** \sa #CFE_ES_PutPoolBuf, #CFE_ES_ValidateHandle, #UT_SetRtnCode
** \sa #CFE_ES_GetMemPoolStats, #CFE_ES_PoolCreateEx, #CFE_ES_PoolCreateNoSem
Expand Down
59 changes: 15 additions & 44 deletions fsw/cfe-core/unit-test/evs_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ void UtTest_Setup(void)
{
/* Initialize unit test */
UT_Init("evs");
UT_Text("cFE EVS Unit Test Output File\n\n");
UtPrintf("cFE EVS Unit Test Output File\n\n");

/* Test_Init is a test but also MUST be called first and only once */
UT_ADD_TEST(Test_Init);
Expand All @@ -280,9 +280,7 @@ void Test_Init(void)
CFE_EVS_BitMaskCmd_t bitmaskcmd;
CFE_EVS_AppNameBitMaskCmd_t appbitcmd;

#ifdef UT_VERBOSE
UT_Text("Begin Test Init\n");
#endif
UtPrintf("Begin Test Init");

UT_SetAppID(1); /*jphfix*/

Expand Down Expand Up @@ -494,9 +492,7 @@ void Test_IllegalAppID(void)
{
CFE_TIME_SysTime_t time = {0, 0};

#ifdef UT_VERBOSE
UT_Text("Begin Test Illegal App ID\n");
#endif
UtPrintf("Begin Test Illegal App ID");

/* Set test up with illegal application ID */
UT_InitData();
Expand Down Expand Up @@ -593,10 +589,7 @@ void Test_UnregisteredApp(void)
/* Get a local ref to the "current" AppData table entry */
EVS_GetCurrentContext(&AppDataPtr, &AppID);


#ifdef UT_VERBOSE
UT_Text("Begin Test Unregistered App\n");
#endif
UtPrintf("Begin Test Unregistered App");

UT_InitData();

Expand Down Expand Up @@ -680,9 +673,7 @@ void Test_FilterRegistration(void)
/* Get a local ref to the "current" AppData table entry */
EVS_GetCurrentContext(&AppDataPtr, &AppID);

#ifdef UT_VERBOSE
UT_Text("Begin Test Filter Registration\n");
#endif
UtPrintf("Begin Test Filter Registration");

CFE_EVS_GlobalData.EVS_AppID = AppID;
CFE_EVS_GlobalData.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG;
Expand Down Expand Up @@ -836,9 +827,7 @@ void Test_FilterReset(void)
{
CFE_EVS_BinFilter_t filter;

#ifdef UT_VERBOSE
UT_Text("Begin Test Filter Reset\n");
#endif
UtPrintf("Begin Test Filter Reset");

/* Test successful filter registration */
UT_InitData();
Expand Down Expand Up @@ -922,9 +911,7 @@ void Test_Format(void)
/* Get a local ref to the "current" AppData table entry */
EVS_GetCurrentContext(&AppDataPtr, &AppID);

#ifdef UT_VERBOSE
UT_Text("Begin Test Format\n");
#endif
UtPrintf("Begin Test Format");

CFE_EVS_GlobalData.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG;

Expand Down Expand Up @@ -1072,9 +1059,7 @@ void Test_Ports(void)
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID)
};

#ifdef UT_VERBOSE
UT_Text("Begin Test Ports\n");
#endif
UtPrintf("Begin Test Ports");

CFE_EVS_GlobalData.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG;

Expand Down Expand Up @@ -1218,9 +1203,7 @@ void Test_Logging(void)
cpuaddr TempAddr;
CFE_ES_ResetData_t *CFE_EVS_ResetDataPtr;

#ifdef UT_VERBOSE
UT_Text("Begin Test Logging\n");
#endif
UtPrintf("Begin Test Logging");

CFE_EVS_GlobalData.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG;

Expand Down Expand Up @@ -1434,9 +1417,7 @@ void Test_WriteApp(void)
CFE_EVS_AppNameBitMaskCmd_t appbitcmd;
} CmdBuf;

#ifdef UT_VERBOSE
UT_Text("Begin Test Write App\n");
#endif
UtPrintf("Begin Test Write App");

CFE_EVS_GlobalData.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG;

Expand Down Expand Up @@ -1538,9 +1519,7 @@ void Test_BadAppCmd(void)
CFE_EVS_AppNameEventIDCmd_t appcmdcmd;
uint32 TestAppIndex;

#ifdef UT_VERBOSE
UT_Text("Begin Test Bad App Command\n");
#endif
UtPrintf("Begin Test Bad App Command");

CFE_EVS_GlobalData.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG;

Expand Down Expand Up @@ -1945,9 +1924,7 @@ void Test_EventCmd(void)
.MsgId = CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID)
};

#ifdef UT_VERBOSE
UT_Text("Begin Test Event Command\n");
#endif
UtPrintf("Begin Test Event Command");

CFE_EVS_GlobalData.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG;

Expand Down Expand Up @@ -2188,9 +2165,7 @@ void Test_FilterCmd(void)
CFE_EVS_AppNameEventIDCmd_t appcmdcmd;
CFE_EVS_AppNameBitMaskCmd_t appbitcmd;

#ifdef UT_VERBOSE
UT_Text("Begin Test Filter Command\n");
#endif
UtPrintf("Begin Test Filter Command");

CFE_EVS_GlobalData.EVS_TlmPkt.Payload.MessageFormatMode = CFE_EVS_MsgFormat_LONG;

Expand Down Expand Up @@ -2422,9 +2397,7 @@ void Test_InvalidCmd(void)
{
CFE_EVS_NoArgsCmd_t cmd;

#ifdef UT_VERBOSE
UT_Text("Begin Test Invalid Command\n");
#endif
UtPrintf("Begin Test Invalid Command");

/* Test invalid msg id event */
UT_InitData();
Expand Down Expand Up @@ -2688,9 +2661,7 @@ void Test_Misc(void)

EVS_GetCurrentContext(&AppDataPtr, &AppID);

#ifdef UT_VERBOSE
UT_Text("Begin Test Miscellaneous\n");
#endif
UtPrintf("Begin Test Miscellaneous");

memset(&PktBuf, 0, sizeof(PktBuf));
CFE_EVS_GlobalData.EVS_AppID = AppID;
Expand Down
Loading

0 comments on commit 2076991

Please sign in to comment.