Skip to content

Commit

Permalink
Fix #1408, Use LogFullFlag instead of checking LogCount
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Mar 29, 2023
1 parent 7c03369 commit 2056112
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/evs/fsw/src/cfe_evs_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ int32 CFE_EVS_WriteLogDataFileCmd(const CFE_EVS_WriteLogDataFileCmd_t *data)
OS_MutSemTake(CFE_EVS_Global.EVS_SharedDataMutexID);

/* Is the log full? -- Doesn't matter if wrap mode is enabled */
if (CFE_EVS_Global.EVS_LogPtr->LogCount == CFE_PLATFORM_EVS_LOG_MAX)
if (CFE_EVS_Global.EVS_LogPtr->LogFullFlag == true)
{
/* Start with log entry that will be overwritten next (oldest) */
LogIndex = CFE_EVS_Global.EVS_LogPtr->Next;
Expand Down
4 changes: 2 additions & 2 deletions modules/evs/ut-coverage/evs_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -1024,14 +1024,14 @@ void Test_Logging(void)
/* Test successfully writing all log entries */
UT_InitData();
UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS);
CFE_EVS_Global.EVS_LogPtr->LogCount = CFE_PLATFORM_EVS_LOG_MAX;
CFE_EVS_Global.EVS_LogPtr->LogFullFlag = true;
CFE_UtAssert_SUCCESS(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd));

/* Test writing a log entry with a write failure */
UT_InitData();
UT_SetDeferredRetcode(UT_KEY(OS_MutSemCreate), 1, OS_SUCCESS);
UT_SetDefaultReturnValue(UT_KEY(OS_write), OS_ERROR);
CFE_EVS_Global.EVS_LogPtr->LogCount = CFE_PLATFORM_EVS_LOG_MAX;
CFE_EVS_Global.EVS_LogPtr->LogFullFlag = true;
UtAssert_INT32_EQ(CFE_EVS_WriteLogDataFileCmd(&CmdBuf.logfilecmd), CFE_EVS_FILE_WRITE_ERROR);

/* Test successfully writing a single event log entry using a specified
Expand Down

0 comments on commit 2056112

Please sign in to comment.