Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cFE Integration candidate: Caelum-rc4+dev10 #2111

Merged
merged 8 commits into from
May 31, 2022
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@ This repository contains NASA's Core Flight Executive (cFE), which is a framewor

This is a collection of services and associated framework to be located in the `cfe` subdirectory of a cFS Mission Tree. The Core Flight System is bundled at <https://github.com/nasa/cFS>, which includes build and execution instructions.

The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob/gh-pages/cFE_Users_Guide.pdf>.
The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFE/blob/gh-pages/cfe-usersguide.pdf>.

## Changelog

### Development Build: v7.0.0-rc4+dev136

- Resolve UT uninit var static analysis warnings
- Resolve fsw uninit var static analysis warnings
- Resolve UT non-distinct identifier warnings
- Resolve UT buffer underflow warning
- Fix cFE_Users_guide url 404 error'
- See <https://github.com/nasa/cFE/pull/2111> and <https://github.com/nasa/cFS/pull/492>

### Development Build: v7.0.0-rc4+dev127

- Update RTEMS toolchain files
Expand Down
4 changes: 4 additions & 0 deletions modules/cfe_testcase/src/es_cds_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ void TestCDSName(void)
CFE_ES_CDSHandle_t IdByName;
char CDSNameBuf[CFE_MISSION_ES_CDS_MAX_FULL_NAME_LEN];

memset(CDSNameBuf, 0, sizeof(CDSNameBuf));

UtPrintf("Testing: CFE_ES_GetCDSBlockIDByName, CFE_ES_GetCDSBlockName");

UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandlePtr, BlockSize, Name), CFE_ES_CDS_ALREADY_EXISTS);
Expand Down Expand Up @@ -119,6 +121,8 @@ void TestCopyRestoreCDS(void)
char Data[BlockSize];
char DataBuff[BlockSize];

memset(DataBuff, 0, sizeof(DataBuff));

UtPrintf("Testing: CFE_ES_CopyToCDS, CFE_ES_RestoreFromCDS");

snprintf(Data, BlockSize, "Test Data");
Expand Down
7 changes: 7 additions & 0 deletions modules/cfe_testcase/src/es_counter_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ void TestCounterCreateDelete(void)
CFE_Assert_STATUS_MAY_BE(CFE_SUCCESS);
}

/* If no counters were available skip the rest of the test */
if (NumCounters == 0)
{
UtAssert_MIR("No ES generic counters available for testing, skipping");
return;
}

/* Confirm that the expected number of counters were created */
UtAssert_UINT32_LTEQ(NumCounters, CFE_PLATFORM_ES_MAX_GEN_COUNTERS);

Expand Down
20 changes: 12 additions & 8 deletions modules/cfe_testcase/src/es_info_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const char TEST_EXPECTED_FILE_NAME[] = "cfe_testcase";
const char ES_APP_EXPECTED_NAME[] = "CFE_ES";
const char INVALID_APP_NAME[] = "INVALID_NAME";

void TestAppInfo(void)
void TestGetAppInfo(void)
{
CFE_ES_AppId_t TestAppId;
CFE_ES_AppId_t ESAppId;
Expand Down Expand Up @@ -129,7 +129,7 @@ void TestAppInfo(void)
UtAssert_INT32_EQ(CFE_ES_GetAppInfo(NULL, TestAppId), CFE_ES_BAD_ARGUMENT);
}

void TestTaskInfo(void)
void TestGetTaskInfo(void)
{
CFE_ES_AppId_t AppId;
CFE_ES_AppInfo_t AppInfo;
Expand Down Expand Up @@ -159,7 +159,7 @@ void TestTaskInfo(void)
UtAssert_INT32_EQ(CFE_ES_GetTaskID(NULL), CFE_ES_BAD_ARGUMENT);
}

void TestLibInfo(void)
void TestGetLibInfo(void)
{
CFE_ES_LibId_t LibId;
CFE_ES_LibId_t CheckId;
Expand Down Expand Up @@ -238,7 +238,7 @@ void TestResetType(void)
UtAssert_True((rSubType > 0) && (rSubType < 10), "Reset Sub-Type = %d", (int)rSubType);
}

void TestModuleInfo(void)
void TestGetModuleInfo(void)
{
CFE_ES_AppInfo_t ModuleInfo;
CFE_ES_LibId_t LibIdByName;
Expand All @@ -247,6 +247,10 @@ void TestModuleInfo(void)
CFE_ES_AppInfo_t TestAppInfo;
const char * LibName = "ASSERT_LIB";

memset(&ModuleInfo, 0, sizeof(ModuleInfo));
memset(&LibInfo, 0, sizeof(LibInfo));
memset(&TestAppInfo, 0, sizeof(TestAppInfo));

UtPrintf("Testing: CFE_ES_GetModuleInfo");

UtAssert_INT32_EQ(CFE_ES_GetAppID(&TestAppId), CFE_SUCCESS);
Expand All @@ -267,9 +271,9 @@ void TestModuleInfo(void)

void ESInfoTestSetup(void)
{
UtTest_Add(TestAppInfo, NULL, NULL, "Test App Info");
UtTest_Add(TestTaskInfo, NULL, NULL, "Test Task Info");
UtTest_Add(TestLibInfo, NULL, NULL, "Test Lib Info");
UtTest_Add(TestGetAppInfo, NULL, NULL, "Test App Info");
UtTest_Add(TestGetTaskInfo, NULL, NULL, "Test Task Info");
UtTest_Add(TestGetLibInfo, NULL, NULL, "Test Lib Info");
UtTest_Add(TestResetType, NULL, NULL, "Test Reset Type");
UtTest_Add(TestModuleInfo, NULL, NULL, "Test Module Info");
UtTest_Add(TestGetModuleInfo, NULL, NULL, "Test Module Info");
}
12 changes: 7 additions & 5 deletions modules/cfe_testcase/src/es_mempool_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static CFE_FT_PoolMemBlock_t CFE_FT_PoolMemBlock[CFE_PLATFORM_ES_MAX_MEMORY_POOL

void TestMemPoolCreate(void)
{
CFE_ES_MemHandle_t PoolID;
CFE_ES_MemHandle_t PoolID = CFE_ES_MEMHANDLE_UNDEFINED;

UtPrintf("Testing: CFE_ES_PoolCreateNoSem, CFE_ES_PoolCreate, CFE_ES_PoolCreateEx");

Expand Down Expand Up @@ -102,7 +102,7 @@ void TestMemPoolCreateMax(void)

void TestMemPoolGetBuf(void)
{
CFE_ES_MemHandle_t PoolID;
CFE_ES_MemHandle_t PoolID = CFE_ES_MEMHANDLE_UNDEFINED;
int8 Pool[1024];
size_t BufferSize = 512;
size_t BufferBig = 2048;
Expand All @@ -127,7 +127,7 @@ void TestMemPoolGetBuf(void)

void TestMemPoolBufInfo(void)
{
CFE_ES_MemHandle_t PoolID;
CFE_ES_MemHandle_t PoolID = CFE_ES_MEMHANDLE_UNDEFINED;
int8 Pool[1024];
size_t Buffer = 512;
CFE_ES_MemPoolBuf_t addressp = CFE_ES_MEMPOOLBUF_C(0);
Expand All @@ -152,7 +152,7 @@ void TestMemPoolBufInfo(void)

void TestMemPoolPutBuf(void)
{
CFE_ES_MemHandle_t PoolID;
CFE_ES_MemHandle_t PoolID = CFE_ES_MEMHANDLE_UNDEFINED;
int8 Pool[1024];
size_t Buffer = 512;
CFE_ES_MemPoolBuf_t addressp = CFE_ES_MEMPOOLBUF_C(0);
Expand All @@ -174,10 +174,12 @@ void TestMemPoolPutBuf(void)

void TestMemPoolDelete(void)
{
CFE_ES_MemHandle_t PoolID; /* Poo1 1 handle, no mutex */
CFE_ES_MemHandle_t PoolID = CFE_ES_MEMHANDLE_UNDEFINED; /* Poo1 1 handle, no mutex */
uint8 Buffer[1024];
CFE_ES_MemPoolStats_t Stats;

memset(&Stats, 0, sizeof(Stats));

UtPrintf("Testing: CFE_ES_PoolDelete, CFE_ES_GetMemPoolStats, CFE_ES_PoolCreateEx");

UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID, Buffer, sizeof(Buffer), 0, NULL, CFE_ES_NO_MUTEX), CFE_SUCCESS);
Expand Down
13 changes: 8 additions & 5 deletions modules/cfe_testcase/src/es_resource_id_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ void TestLibIDToIndex(void)
UtPrintf("Testing: CFE_ES_LibID_ToIndex");
const char * LibName = "ASSERT_LIB";
CFE_ES_LibId_t LibId;
uint32 LibIdx;
uint32 idx;
uint32 LibIdx = 0;
uint32 idx = 0;

UtAssert_INT32_EQ(CFE_ES_GetLibIDByName(&LibId, LibName), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_LibID_ToIndex(LibId, &LibIdx), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_LibID_ToIndex(LibId, &idx), CFE_SUCCESS);
Expand All @@ -64,10 +65,12 @@ void TestLibIDToIndex(void)

void TestTaskIDToIndex(void)
{
CFE_ES_TaskId_t TaskId = CFE_ES_TASKID_UNDEFINED;
uint32 TaskIdx = 0;
uint32 idx = 0;

UtPrintf("Testing: CFE_ES_TaskID_ToIndex");
CFE_ES_TaskId_t TaskId;
uint32 TaskIdx;
uint32 idx;

UtAssert_INT32_EQ(CFE_ES_GetTaskID(&TaskId), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_TaskID_ToIndex(TaskId, &TaskIdx), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_TaskID_ToIndex(TaskId, &idx), CFE_SUCCESS);
Expand Down
12 changes: 7 additions & 5 deletions modules/cfe_testcase/src/es_task_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ void TestCreateChild(void)
{
UtPrintf("Testing: CFE_ES_CreateChildTask");

CFE_ES_TaskId_t TaskId;
CFE_ES_TaskId_t TaskId2;
CFE_ES_TaskId_t TaskId = CFE_ES_TASKID_UNDEFINED;
CFE_ES_TaskId_t TaskId2 = CFE_ES_TASKID_UNDEFINED;
const char * TaskName = "CHILD_TASK_1";
CFE_ES_StackPointer_t StackPointer = CFE_ES_TASK_STACK_ALLOCATE;
size_t StackSize = CFE_PLATFORM_ES_PERF_CHILD_STACK_SIZE;
Expand All @@ -106,7 +106,7 @@ void TestCreateChild(void)
int32 ExpectedCount = 5;
int32 RetryCount;
char TaskNameBuf[16];
osal_id_t OtherTaskId;
osal_id_t OtherTaskId = OS_OBJECT_ID_UNDEFINED;
OS_task_prop_t task_prop;

CFE_FT_Global.Count = 0;
Expand Down Expand Up @@ -187,7 +187,7 @@ void TestChildTaskName(void)
{
UtPrintf("Testing: CFE_ES_GetTaskIDByName, CFE_ES_GetTaskName");

CFE_ES_TaskId_t TaskId;
CFE_ES_TaskId_t TaskId = CFE_ES_TASKID_UNDEFINED;
const char TaskName[] = "CHILD_TASK_1";
CFE_ES_TaskId_t TaskIdByName;
char TaskNameBuf[OS_MAX_API_NAME + 4];
Expand All @@ -196,6 +196,8 @@ void TestChildTaskName(void)
CFE_ES_TaskPriority_Atom_t Priority = CFE_PLATFORM_ES_PERF_CHILD_PRIORITY;
uint32 Flags = 0;

memset(TaskNameBuf, 0, sizeof(TaskNameBuf));

UtAssert_INT32_EQ(CFE_ES_CreateChildTask(&TaskId, TaskName, TaskFunction, StackPointer, StackSize, Priority, Flags),
CFE_SUCCESS);

Expand Down Expand Up @@ -223,7 +225,7 @@ void TestChildTaskDelete(void)
{
UtPrintf("Testing: CFE_ES_DeleteChildTask");

CFE_ES_TaskId_t TaskId;
CFE_ES_TaskId_t TaskId = CFE_ES_TASKID_UNDEFINED;
const char * TaskName = "CHILD_TASK_1";
CFE_ES_StackPointer_t StackPointer = CFE_ES_TASK_STACK_ALLOCATE;
size_t StackSize = CFE_PLATFORM_ES_PERF_CHILD_STACK_SIZE;
Expand Down
8 changes: 7 additions & 1 deletion modules/cfe_testcase/src/fs_header_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ char *fsAddrPtr = NULL;

static osal_id_t setup_file(void)
{
osal_id_t id;
osal_id_t id = OS_OBJECT_ID_UNDEFINED;

UtAssert_INT32_EQ(OS_OpenCreate(&id, OS_TEST_HEADER_FILENAME, OS_FILE_FLAG_CREATE, OS_READ_WRITE), OS_SUCCESS);

return id;
}

Expand Down Expand Up @@ -70,6 +72,8 @@ void TestReadHeader(void)
const char * TestDescription = "TEST_HEADER";
osal_id_t fd = setup_file();

memset(&ReadHeader, 0, sizeof(ReadHeader));

UtPrintf("Testing: CFE_FS_ReadHeader");

UtAssert_VOIDCALL(CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG));
Expand All @@ -96,6 +100,8 @@ void TestTimeStamp(void)
CFE_TIME_SysTime_t NewTimestamp = {0xFFFFFFFF, 0xFFFFFFFF};
osal_id_t fd = setup_file();

memset(&ReadHeader, 0, sizeof(ReadHeader));

UtPrintf("Testing: CFE_FS_SetTimestamp");

UtAssert_VOIDCALL(CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG));
Expand Down
2 changes: 2 additions & 0 deletions modules/cfe_testcase/src/fs_util_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ void TestFileName(void)
char Name[OS_MAX_FILE_NAME];
const char ExpectedName[] = "FileName.test";

memset(Name, 0, sizeof(Name));

UtPrintf("Testing: CFE_FS_ExtractFilenameFromPath");

snprintf(Path, sizeof(Path), "/func/FileName.test");
Expand Down
7 changes: 7 additions & 0 deletions modules/cfe_testcase/src/resource_id_misc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ void TestGetBaseSerial(void)
CFE_ResourceId_t ResourceID;
} CDSHandleIdBuf;

memset(&AppIdBuf, 0, sizeof(AppIdBuf));
memset(&LibIdBuf, 0, sizeof(LibIdBuf));
memset(&TaskIdBuf, 0, sizeof(TaskIdBuf));
memset(&CounterIdBuf, 0, sizeof(CounterIdBuf));
memset(&PoolIdBuf, 0, sizeof(PoolIdBuf));
memset(&CDSHandleIdBuf, 0, sizeof(CDSHandleIdBuf));

/* Referenced from cfe_core_resourceid_basevalues.h */
int TASKID_BASE = CFE_RESOURCEID_MAKE_BASE(OS_OBJECT_TYPE_OS_TASK);
int APPID_BASE = CFE_RESOURCEID_MAKE_BASE(OS_OBJECT_TYPE_USER + 1);
Expand Down
12 changes: 6 additions & 6 deletions modules/cfe_testcase/src/sb_pipe_mang_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

void TestPipeCreate(void)
{
CFE_SB_PipeId_t PipeId1;
CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE;
uint16 PipeDepth = 10;
const char PipeName[] = "Test Pipe";

Expand Down Expand Up @@ -100,7 +100,7 @@ void TestPipeCreateMax(void)

void TestPipeIndex(void)
{
CFE_SB_PipeId_t PipeId;
CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE;
uint16 PipeDepth = 10;
const char PipeName[] = "Test Pipe";
uint32 Idx;
Expand All @@ -119,11 +119,11 @@ void TestPipeIndex(void)

void TestPipeOptions(void)
{
CFE_SB_PipeId_t PipeId;
CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE;
uint16 PipeDepth = 10;
const char PipeName[] = "Test Pipe";
uint8 Opts = 2;
uint8 OptsBuff;
uint8 OptsBuff = 0;

UtPrintf("Testing: CFE_SB_SetPipeOpts, CFE_SB_GetPipeOpts");

Expand All @@ -143,11 +143,11 @@ void TestPipeOptions(void)

void TestPipeName(void)
{
CFE_SB_PipeId_t PipeId;
CFE_SB_PipeId_t PipeId = CFE_SB_INVALID_PIPE;
uint16 PipeDepth = 10;
const char PipeName[] = "Test Pipe";
char PipeNameBuf[OS_MAX_API_NAME];
CFE_SB_PipeId_t PipeIdBuff;
CFE_SB_PipeId_t PipeIdBuff = CFE_SB_INVALID_PIPE;
const char InvalidPipeName[] = "Invalid Pipe";

UtPrintf("Testing: CFE_SB_GetPipeName, CFE_SB_GetPipeIdByName");
Expand Down
23 changes: 14 additions & 9 deletions modules/cfe_testcase/src/sb_sendrecv_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ static CFE_FT_TestBigMessage_t CFE_FT_BigMsg;

void TestBasicTransmitRecv(void)
{
CFE_SB_PipeId_t PipeId1;
CFE_SB_PipeId_t PipeId2;
CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE;
CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE;
CFE_FT_TestCmdMessage_t CmdMsg;
CFE_FT_TestTlmMessage_t TlmMsg;
CFE_SB_MsgId_t MsgId;
Expand All @@ -77,6 +77,9 @@ void TestBasicTransmitRecv(void)
const CFE_FT_TestCmdMessage_t *CmdPtr;
const CFE_FT_TestTlmMessage_t *TlmPtr;

memset(&CmdMsg, 0, sizeof(CmdMsg));
memset(&TlmMsg, 0, sizeof(TlmMsg));

UtPrintf("Testing: CFE_SB_TransmitMsg");

/* Setup, create a pipe and subscribe (one cmd, one tlm) */
Expand Down Expand Up @@ -218,10 +221,10 @@ void TestBasicTransmitRecv(void)
*/
void TestMsgBroadcast(void)
{
CFE_SB_PipeId_t PipeId1;
CFE_SB_PipeId_t PipeId2;
CFE_SB_PipeId_t PipeId3;
CFE_SB_PipeId_t PipeId4;
CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE;
CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE;
CFE_SB_PipeId_t PipeId3 = CFE_SB_INVALID_PIPE;
CFE_SB_PipeId_t PipeId4 = CFE_SB_INVALID_PIPE;
CFE_FT_TestCmdMessage_t CmdMsg;
CFE_SB_MsgId_t MsgId;
CFE_SB_Buffer_t * MsgBuf1;
Expand All @@ -230,6 +233,8 @@ void TestMsgBroadcast(void)
CFE_SB_Buffer_t * MsgBuf4;
const CFE_FT_TestCmdMessage_t *CmdPtr;

memset(&CmdMsg, 0, sizeof(CmdMsg));

UtPrintf("Testing: MsgLimit enforcement");

/* Setup - subscribe same MsgId to multiple different pipes with different limits */
Expand Down Expand Up @@ -373,12 +378,12 @@ void TestMsgBroadcast(void)
/* This is a variant of the message transmit API that does not copy */
void TestZeroCopyTransmitRecv(void)
{
CFE_SB_PipeId_t PipeId1;
CFE_SB_PipeId_t PipeId2;
CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE;
CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE;
CFE_SB_Buffer_t * CmdBuf;
CFE_SB_Buffer_t * TlmBuf;
CFE_SB_Buffer_t * MsgBuf;
CFE_SB_MsgId_t MsgId;
CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID;
CFE_MSG_SequenceCount_t SeqCmd1;
CFE_MSG_SequenceCount_t SeqTlm1;
CFE_MSG_SequenceCount_t SeqCmd2;
Expand Down
Loading