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: 2021-06-29 #1654

Merged
merged 12 commits into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob

## Version History

### Development Build: v6.8.0-rc1+dev739

- Change index type to resolve infinite loop warning
- Adding coverage for cfe_es_task.c
- Expand FS Header Functional tests.
- See <https://github.com/nasa/cfe/pull/1654> and <https://github.com/nasa/cfs/pull/287>

### Development Build: v6.8.0-rc1+dev726

- correct path to users guide warning log
Expand Down
15 changes: 13 additions & 2 deletions modules/cfe_testcase/src/cfe_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,25 @@
#define CFE_ASSERT_LOG_FILE_NAME "/cf/cfe_test.log"

/* Compare two Resource IDs */
#define UtAssert_ResourceID_EQ(actual, expect) \
#define cFE_FTAssert_ResourceID_EQ(actual, expect) \
UtAssert_True(CFE_RESOURCEID_TEST_EQUAL(actual, expect), "%s (%lu) == %s (%lu)", #actual, \
CFE_RESOURCEID_TO_ULONG(actual), #expect, CFE_RESOURCEID_TO_ULONG(expect))

/* Check if a Resource ID is Undefined */
#define UtAssert_ResourceID_Undefined(id) \
#define cFE_FTAssert_ResourceID_Undefined(id) \
UtAssert_True(!CFE_RESOURCEID_TEST_DEFINED(id), "%s (%lu) not defined", #id, CFE_RESOURCEID_TO_ULONG(id))

/* Assert a return code is not equal to cfe_success */
#define cFE_FTAssert_NOT_CFE_SUCCESS(actual) \
do \
{ \
int32 rcact = (int32)(actual); \
UtAssert_True(rcact < CFE_SUCCESS, "%s == (%ld) ", #actual, (long)rcact); \
} while (0)

/* Log calls to void functions */
#define cFE_FTAssert_VOIDCALL(func) (func, UtAssert(true, #func, __FILE__, __LINE__))

void CFE_TestMain(void);
void ESInfoTestSetup(void);
void ESTaskTestSetup(void);
Expand Down
2 changes: 1 addition & 1 deletion modules/cfe_testcase/src/es_cds_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void TestCDSName(void)
UtAssert_INT32_EQ(CFE_ES_GetCDSBlockName(CDSNameBuf, CDSHandlePtr, sizeof(CDSNameBuf)), CFE_SUCCESS);
UtAssert_StrCmp(CDSNameBuf, CDSName, "CFE_ES_GetCDSBlockName() = %s", CDSNameBuf);
UtAssert_INT32_EQ(CFE_ES_GetCDSBlockIDByName(&IdByName, CDSNameBuf), CFE_SUCCESS);
UtAssert_ResourceID_EQ(CDSHandlePtr, IdByName);
cFE_FTAssert_ResourceID_EQ(CDSHandlePtr, IdByName);

UtAssert_INT32_EQ(CFE_ES_GetCDSBlockName(NULL, CDSHandlePtr, sizeof(CDSNameBuf)), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetCDSBlockName(CDSNameBuf, CFE_ES_CDS_BAD_HANDLE, sizeof(CDSNameBuf)),
Expand Down
12 changes: 6 additions & 6 deletions modules/cfe_testcase/src/es_info_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void TestAppInfo(void)

UtAssert_INT32_EQ(CFE_ES_GetAppIDByName(&AppIdByName, TEST_EXPECTED_APP_NAME), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_GetAppID(&TestAppId), CFE_SUCCESS);
UtAssert_ResourceID_EQ(TestAppId, AppIdByName);
cFE_FTAssert_ResourceID_EQ(TestAppId, AppIdByName);
UtAssert_INT32_EQ(CFE_ES_GetAppName(AppNameBuf, TestAppId, sizeof(AppNameBuf)), CFE_SUCCESS);
UtAssert_StrCmp(AppNameBuf, TEST_EXPECTED_APP_NAME, "CFE_ES_GetAppName() = %s", AppNameBuf);

Expand Down Expand Up @@ -122,7 +122,7 @@ void TestAppInfo(void)
UtAssert_True(ESAppInfo.NumOfChildTasks > 0, "ES App Info -> Child Tasks = %d", (int)ESAppInfo.NumOfChildTasks);

UtAssert_INT32_EQ(CFE_ES_GetAppIDByName(&AppIdByName, INVALID_APP_NAME), CFE_ES_ERR_NAME_NOT_FOUND);
UtAssert_ResourceID_Undefined(AppIdByName);
cFE_FTAssert_ResourceID_Undefined(AppIdByName);
UtAssert_INT32_EQ(CFE_ES_GetAppID(NULL), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetAppIDByName(NULL, TEST_EXPECTED_APP_NAME), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetAppName(AppNameBuf, CFE_ES_APPID_UNDEFINED, sizeof(AppNameBuf)),
Expand All @@ -146,15 +146,15 @@ void TestTaskInfo(void)

UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(&TaskInfo, AppInfo.MainTaskId), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_ES_GetTaskID(&TaskId), CFE_SUCCESS);
UtAssert_ResourceID_EQ(TaskId, AppInfo.MainTaskId);
cFE_FTAssert_ResourceID_EQ(TaskId, AppInfo.MainTaskId);

UtAssert_StrCmp(TaskInfo.AppName, AppInfo.Name, "TaskInfo.AppName (%s) = AppInfo.name (%s)", TaskInfo.AppName,
AppInfo.Name);
UtAssert_StrCmp(TaskInfo.TaskName, AppInfo.MainTaskName, "TaskInfo.TaskName (%s) = AppInfo.MainTaskName (%s)",
TaskInfo.TaskName, AppInfo.MainTaskName);

UtAssert_ResourceID_EQ(TaskInfo.TaskId, AppInfo.MainTaskId);
UtAssert_ResourceID_EQ(TaskInfo.AppId, AppId);
cFE_FTAssert_ResourceID_EQ(TaskInfo.TaskId, AppInfo.MainTaskId);
cFE_FTAssert_ResourceID_EQ(TaskInfo.AppId, AppId);
UtAssert_INT32_EQ(TaskInfo.ExecutionCounter, AppInfo.ExecutionCounter);

UtAssert_INT32_EQ(CFE_ES_GetTaskInfo(&TaskInfo, CFE_ES_TASKID_UNDEFINED), CFE_ES_ERR_RESOURCEID_NOT_VALID);
Expand Down Expand Up @@ -205,7 +205,7 @@ void TestLibInfo(void)

UtAssert_INT32_EQ(LibInfo.ExceptionAction, 0);
UtAssert_True(LibInfo.Priority == 0, "Lib Info -> Priority = %d", (int)LibInfo.Priority);
UtAssert_ResourceID_Undefined(LibInfo.MainTaskId);
cFE_FTAssert_ResourceID_Undefined(LibInfo.MainTaskId);
UtAssert_True(LibInfo.ExecutionCounter == 0, "Lib Info -> ExecutionCounter = %d", (int)LibInfo.ExecutionCounter);
UtAssert_True(strlen(LibInfo.MainTaskName) == 0, "Lib Info -> Task Name = %s", LibInfo.MainTaskName);
UtAssert_True(LibInfo.NumOfChildTasks == 0, "Lib Info -> Child Tasks = %d", (int)LibInfo.NumOfChildTasks);
Expand Down
4 changes: 2 additions & 2 deletions modules/cfe_testcase/src/es_task_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ void TestChildTaskName(void)
CFE_SUCCESS);

UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskIdByName, TaskName), CFE_SUCCESS);
UtAssert_ResourceID_EQ(TaskIdByName, TaskId);
cFE_FTAssert_ResourceID_EQ(TaskIdByName, TaskId);

UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, TaskId, sizeof(TaskNameBuf)), CFE_SUCCESS);
UtAssert_StrCmp(TaskNameBuf, TaskName, "CFE_ES_GetTaskName() = %s", TaskNameBuf);

UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(NULL, TaskName), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskIdByName, INVALID_TASK_NAME), CFE_ES_ERR_NAME_NOT_FOUND);
UtAssert_ResourceID_Undefined(TaskIdByName);
cFE_FTAssert_ResourceID_Undefined(TaskIdByName);

UtAssert_INT32_EQ(CFE_ES_GetTaskName(NULL, TaskId, sizeof(TaskNameBuf)), CFE_ES_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, CFE_ES_TASKID_UNDEFINED, sizeof(TaskNameBuf)),
Expand Down
25 changes: 19 additions & 6 deletions modules/cfe_testcase/src/fs_header_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,22 @@ static osal_id_t setup_file(void)
void TestCreateHeader(void)
{
CFE_FS_Header_t Header;
CFE_FS_Header_t HeaderFail;
const char * TestDescription = "TEST_HEADER";
osal_id_t fd = setup_file();

UtPrintf("Testing: CFE_FS_InitHeader, CFE_FS_WriteHeader");

CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG);
cFE_FTAssert_VOIDCALL(CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG));
UtAssert_INT32_EQ(CFE_FS_WriteHeader(fd, &Header), sizeof(CFE_FS_Header_t));

UtAssert_INT32_EQ(CFE_FS_WriteHeader(fd, NULL), CFE_FS_BAD_ARGUMENT);
cFE_FTAssert_NOT_CFE_SUCCESS(CFE_FS_WriteHeader(OS_OBJECT_ID_UNDEFINED, &Header));

cFE_FTAssert_VOIDCALL(CFE_FS_InitHeader(NULL, TestDescription, CFE_FS_SubType_ES_ERLOG));
cFE_FTAssert_VOIDCALL(CFE_FS_InitHeader(&HeaderFail, NULL, CFE_FS_SubType_ES_ERLOG));
cFE_FTAssert_VOIDCALL(CFE_FS_InitHeader(&HeaderFail, TestDescription, 256));

OS_close(fd);
OS_remove(OS_TEST_HEADER_FILENAME);
}
Expand All @@ -69,14 +77,17 @@ void TestReadHeader(void)

UtPrintf("Testing: CFE_FS_ReadHeader");

CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG);
cFE_FTAssert_VOIDCALL(CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG));
UtAssert_INT32_EQ(CFE_FS_WriteHeader(fd, &Header), sizeof(CFE_FS_Header_t));
UtAssert_INT32_EQ(CFE_FS_ReadHeader(&ReadHeader, fd), sizeof(CFE_FS_Header_t));

UtAssert_INT32_EQ(Header.ContentType, ReadHeader.ContentType);
UtAssert_INT32_EQ(Header.SubType, ReadHeader.SubType);
UtAssert_StrCmp(TestDescription, ReadHeader.Description, "ReadHeader.Description = %s", ReadHeader.Description);

UtAssert_INT32_EQ(CFE_FS_ReadHeader(NULL, fd), CFE_FS_BAD_ARGUMENT);
cFE_FTAssert_NOT_CFE_SUCCESS(CFE_FS_ReadHeader(&ReadHeader, OS_OBJECT_ID_UNDEFINED));

OS_close(fd);
OS_remove(OS_TEST_HEADER_FILENAME);
}
Expand All @@ -86,18 +97,20 @@ void TestTimeStamp(void)
CFE_FS_Header_t Header;
CFE_FS_Header_t ReadHeader;
const char * TestDescription = "TEST_HEADER";
CFE_TIME_SysTime_t NewTimestamp = {10, 10};
CFE_TIME_SysTime_t NewTimestamp = {0xFFFFFFFF, 0xFFFFFFFF};
osal_id_t fd = setup_file();

UtPrintf("Testing: CFE_FS_SetTimestamp");

CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG);
cFE_FTAssert_VOIDCALL(CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG));
UtAssert_INT32_EQ(CFE_FS_WriteHeader(fd, &Header), sizeof(CFE_FS_Header_t));
UtAssert_INT32_EQ(CFE_FS_SetTimestamp(fd, NewTimestamp), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_FS_ReadHeader(&ReadHeader, fd), sizeof(CFE_FS_Header_t));

UtAssert_INT32_EQ(10, ReadHeader.TimeSeconds);
UtAssert_INT32_EQ(10, ReadHeader.TimeSubSeconds);
UtAssert_UINT32_EQ(0xFFFFFFFF, ReadHeader.TimeSeconds);
UtAssert_UINT32_EQ(0xFFFFFFFF, ReadHeader.TimeSubSeconds);

cFE_FTAssert_NOT_CFE_SUCCESS(CFE_FS_SetTimestamp(OS_OBJECT_ID_UNDEFINED, NewTimestamp));

OS_close(fd);
OS_remove(OS_TEST_HEADER_FILENAME);
Expand Down
2 changes: 1 addition & 1 deletion modules/core_api/fsw/inc/cfe_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define CFE_VERSION_H

/* Development Build Macro Definitions */
#define CFE_BUILD_NUMBER 726 /**< @brief Development: Number of development commits since baseline */
#define CFE_BUILD_NUMBER 739 /**< @brief Development: Number of development commits since baseline */
#define CFE_BUILD_BASELINE "v6.8.0-rc1" /**< @brief Development: Reference git tag for build number */

/* Version Macro Definitions updated for official releases only */
Expand Down
2 changes: 1 addition & 1 deletion modules/core_private/ut-stubs/src/ut_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ extern int32 dummy_function(void);
*/
void UT_Init(const char *subsys)
{
int8 i;
size_t i;

/* Copy the application name for later use */
strncpy(UT_subsys, subsys, sizeof(UT_subsys) - 1);
Expand Down
17 changes: 0 additions & 17 deletions modules/es/fsw/src/cfe_es_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,23 +263,6 @@ int32 CFE_ES_SysLogSetMode(CFE_ES_LogMode_Enum_t Mode);
*/
void CFE_ES_SysLog_vsnprintf(char *Buffer, size_t BufferSize, const char *SpecStringPtr, va_list ArgPtr);

/*---------------------------------------------------------------------------------------*/
/**
* \brief Format a message intended for output to the system log
*
* Identical to the CFE_ES_SysLog_vsnprintf() call but with a variable argument set,
* for use in functions that need to directly handle a log message string.
*
* Similar in definition to the "snprintf()" C library call.
*
* \param Buffer User supplied buffer to output formatted sting into
* \param BufferSize Size of "Buffer" parameter. Should be greater than (CFE_TIME_PRINTED_STRING_SIZE+2)
* \param SpecStringPtr Printf-style format string
*
* \sa CFE_ES_SysLogAppend_Unsync()
*/
void CFE_ES_SysLog_snprintf(char *Buffer, size_t BufferSize, const char *SpecStringPtr, ...) OS_PRINTF(3, 4);

/*---------------------------------------------------------------------------------------*/
/**
* \brief Write the contents of the syslog to a disk file
Expand Down
17 changes: 0 additions & 17 deletions modules/es/fsw/src/cfe_es_syslog.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,23 +442,6 @@ void CFE_ES_SysLog_vsnprintf(char *Buffer, size_t BufferSize, const char *SpecSt
}
}

/*----------------------------------------------------------------
*
* Function: CFE_ES_SysLog_snprintf
*
* Application-scope internal function
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
void CFE_ES_SysLog_snprintf(char *Buffer, size_t BufferSize, const char *SpecStringPtr, ...)
{
va_list ArgPtr;

va_start(ArgPtr, SpecStringPtr);
CFE_ES_SysLog_vsnprintf(Buffer, BufferSize, SpecStringPtr, ArgPtr);
va_end(ArgPtr);
}

/*----------------------------------------------------------------
*
* Function: CFE_ES_SysLogDump
Expand Down
60 changes: 58 additions & 2 deletions modules/es/ut-coverage/es_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,15 @@ void TestStartupErrorPaths(void)
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 */
/* Perform ES main startup with a ES Perf Data mutex creation failure */
ES_ResetUnitTest();
UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 2, OS_ERROR);
UT_SetDataBuffer(UT_KEY(CFE_PSP_Panic), &PanicStatus, sizeof(PanicStatus), false);
CFE_ES_Main(CFE_PSP_RST_TYPE_POWERON, 1, 1, "ut_startup");
UtAssert_UINT32_EQ(PanicStatus, CFE_PSP_PANIC_STARTUP_SEM);
UtAssert_UINT32_EQ(UT_GetStubCount(UT_KEY(CFE_PSP_Panic)), 1);

/* Perform ES main startup with a ES Shared Data mutex creation failure */
ES_ResetUnitTest();
UT_SetDummyFuncRtn(OS_SUCCESS);
UT_SetDefaultReturnValue(UT_KEY(OS_OpenCreate), OS_ERROR);
Expand Down Expand Up @@ -926,6 +934,13 @@ void TestStartupErrorPaths(void)
CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_NO_FREE_CORE_APP_SLOTS]);
CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_FUNCTION_POINTER]);

/* Test reading the object table with unknown object type */
ES_ResetUnitTest();
UT_SetDefaultReturnValue(UT_KEY(CFE_ResourceId_FindNext), OS_ERROR);
CFE_ES_ObjectTable[CFE_PLATFORM_ES_OBJECT_TABLE_SIZE - 1].ObjectType = -1;
CFE_ES_CreateObjects();
CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_NO_FREE_CORE_APP_SLOTS]);

/* Test response to an invalid startup type */
ES_ResetUnitTest();
CFE_ES_Global.DebugVars.DebugFlag = 1;
Expand Down Expand Up @@ -2104,9 +2119,15 @@ 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();
CFE_UtAssert_VOIDCALL(CFE_ES_TaskMain());
CFE_UtAssert_PRINTF(UT_OSP_MESSAGES[UT_OSP_COMMAND_PIPE]);

/* Test task main process with a CFE_ES_TaskInit() error */
ES_ResetUnitTest();
UT_SetDeferredRetcode(UT_KEY(CFE_EVS_Register), 1, -1);
CFE_UtAssert_VOIDCALL(CFE_ES_TaskMain());
CFE_UtAssert_PRINTF("Application Init Failed");

/* Test task main process loop with bad checksum information */
ES_ResetUnitTest();
UT_SetDeferredRetcode(UT_KEY(CFE_PSP_GetCFETextSegmentInfo), 1, -1);
Expand Down Expand Up @@ -2477,6 +2498,14 @@ void TestTask(void)
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_ALL_APPS_EID);

/* Test Query tasks command with valid lib ID */
ES_ResetUnitTest();
memset(&CmdBuf, 0, sizeof(CmdBuf));
ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, "CFE_ES", NULL, NULL);
CFE_ES_Global.LibTable[0].LibId = CFE_ES_LIBID_C(ES_UT_MakeLibIdForIndex(1));
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.QueryAllCmd), UT_TPID_CFE_ES_CMD_QUERY_ALL_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_ALL_APPS_EID);

/* Test write of all app data to file with a null file name */
ES_ResetUnitTest();
memset(&CmdBuf, 0, sizeof(CmdBuf));
Expand Down Expand Up @@ -2997,6 +3026,21 @@ void TestTask(void)
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.DumpCDSRegistryCmd),
UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_CDS_REG_DUMP_INF_EID);

/* Test error when sending Build Info event */
ES_ResetUnitTest();
UT_SetDeferredRetcode(UT_KEY(CFE_EVS_SendEvent), 1, CFE_EVS_INVALID_PARAMETER);
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoArgsCmd), UT_TPID_CFE_ES_CMD_NOOP_CC);
CFE_UtAssert_PRINTF("Error sending build info event");

/* Test CFE_ES_GenerateVersionEvents error when sending mission event */
ES_ResetUnitTest();
ES_UT_SetupSingleAppId(CFE_ES_AppType_CORE, CFE_ES_AppState_RUNNING, NULL, NULL, NULL);
CFE_ES_Global.ResetDataPtr->ResetVars.ResetType = 1;
UT_SetDeferredRetcode(UT_KEY(CFE_EVS_SendEvent), 3, CFE_EVS_INVALID_PARAMETER);
CFE_UtAssert_VOIDCALL(CFE_ES_TaskInit());
CFE_UtAssert_PRINTF("Error sending mission version event");

} /* end TestTask */

void TestPerf(void)
Expand Down Expand Up @@ -4829,6 +4873,18 @@ void TestSysLog(void)
CFE_UtAssert_MEMOFFSET_EQ(SysLogBuffer.BlockSize, 1);
UtAssert_ZERO(SysLogBuffer.SizeLeft);

/* Test case where calculated blocksize results in 0 */
ES_ResetUnitTest();
SysLogBuffer.EndIdx = 0;
SysLogBuffer.SizeLeft = 1;

CFE_ES_SysLogReadData(&SysLogBuffer);

UtAssert_UINT32_EQ(SysLogBuffer.EndIdx, 0);
CFE_UtAssert_MEMOFFSET_EQ(SysLogBuffer.LastOffset, 0);
CFE_UtAssert_MEMOFFSET_EQ(SysLogBuffer.BlockSize, 0);
UtAssert_INT32_EQ(SysLogBuffer.SizeLeft, 1);

/* Test nominal flow through CFE_ES_SysLogDump
* with multiple reads and writes */
ES_ResetUnitTest();
Expand Down