From 9d5d77172668c5b44dfd1e1fc51c7cd971091f19 Mon Sep 17 00:00:00 2001 From: Avi Date: Sun, 5 Mar 2023 06:23:42 +1000 Subject: [PATCH] Fix #87, Change EVS_Register failure from SendEvent to WriteToSysLog --- fsw/src/fm_app.c | 3 +-- unit-test/fm_app_tests.c | 10 +++------- unit-test/fm_child_tests.c | 8 +++++--- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/fsw/src/fm_app.c b/fsw/src/fm_app.c index a00def3..1cc4d33 100644 --- a/fsw/src/fm_app.c +++ b/fsw/src/fm_app.c @@ -177,8 +177,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 { diff --git a/unit-test/fm_app_tests.c b/unit-test/fm_app_tests.c index 28556a1..f22c874 100644 --- a/unit-test/fm_app_tests.c +++ b/unit-test/fm_app_tests.c @@ -71,12 +71,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) @@ -242,9 +241,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) diff --git a/unit-test/fm_child_tests.c b/unit-test/fm_child_tests.c index 5233524..54179c7 100644 --- a/unit-test/fm_child_tests.c +++ b/unit-test/fm_child_tests.c @@ -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);