Skip to content

Commit

Permalink
Merge pull request nasa#88 from thnkslprpt/fix-87-change-EVS_Register…
Browse files Browse the repository at this point in the history
…-failure-to-WriteToSysLog

Fix nasa#87, Change EVS_Register failure from SendEvent to WriteToSysLog
  • Loading branch information
dzbaker authored Mar 30, 2023
2 parents 87c2647 + 9d5d771 commit 274c8bf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
3 changes: 1 addition & 2 deletions fsw/src/fm_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ int32 FM_AppInit(void)

if (Result != CFE_SUCCESS)
{
CFE_EVS_SendEvent(FM_STARTUP_EVENTS_ERR_EID, CFE_EVS_EventType_ERROR,
"%s register for event services: result = 0x%08X", ErrText, (unsigned int)Result);
CFE_ES_WriteToSysLog("FM App: Error registering for Event Services, RC = 0x%08X\n", (unsigned int)Result);
}
else
{
Expand Down
10 changes: 3 additions & 7 deletions unit-test/fm_app_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,11 @@ void Test_FM_AppMain_AppInitNotSuccess(void)

/* Assert */
UtAssert_STUB_COUNT(CFE_ES_RunLoop, 1);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 2);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 2);
UtAssert_STUB_COUNT(CFE_ES_ExitApp, 1);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_STARTUP_EVENTS_ERR_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_EXIT_ERR_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventID, FM_EXIT_ERR_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[1].EventType, CFE_EVS_EventType_ERROR);
}

void Test_FM_AppMain_SBReceiveBufferDefaultOption(void)
Expand Down Expand Up @@ -188,9 +187,6 @@ void Test_FM_AppInit_EVSRegisterNotSuccess(void)

/* Assert */
UtAssert_STUB_COUNT(CFE_EVS_Register, 1);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, FM_STARTUP_EVENTS_ERR_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
}

void Test_FM_AppInit_CreatePipeFail(void)
Expand Down
8 changes: 5 additions & 3 deletions unit-test/fm_child_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -1683,9 +1683,11 @@ void Test_FM_ChildDirListPktCmd_DirListOffsetNotExceeded(void)
FM_DirListPkt_Payload_t *ReportPtr;

/* Arrange */
FM_ChildQueueEntry_t queue_entry = {
.CommandCode = FM_GET_DIR_LIST_PKT_CC, .Source1 = "dummy_source1", .Source2 = "dummy_source2", .DirListOffset = 1};
os_dirent_t direntry = {.FileName = "filename"};
FM_ChildQueueEntry_t queue_entry = {.CommandCode = FM_GET_DIR_LIST_PKT_CC,
.Source1 = "dummy_source1",
.Source2 = "dummy_source2",
.DirListOffset = 1};
os_dirent_t direntry = {.FileName = "filename"};

UT_SetDeferredRetcode(UT_KEY(OS_DirectoryRead), 2, !OS_SUCCESS);
UT_SetDataBuffer(UT_KEY(OS_DirectoryRead), &direntry, sizeof(direntry), false);
Expand Down

0 comments on commit 274c8bf

Please sign in to comment.