From bf83a74591a6c21dee5e6886791cc4e599b606a6 Mon Sep 17 00:00:00 2001 From: Anh D Van Date: Tue, 14 Apr 2026 14:16:58 +0000 Subject: [PATCH] Fix #155, Add check for CFE_SB_NO_MESSAGE Fix #155, add check for CFE_SB_NO_MESSAGE. --- fsw/src/sc_app.c | 2 +- unit-test/sc_app_tests.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fsw/src/sc_app.c b/fsw/src/sc_app.c index 7b8c2f8..3242aff 100644 --- a/fsw/src/sc_app.c +++ b/fsw/src/sc_app.c @@ -105,7 +105,7 @@ void SC_AppMain(void) /* Invoke command handlers */ SC_ProcessRequest(BufPtr); } - else if (Result == CFE_SB_TIME_OUT) + else if (Result == CFE_SB_TIME_OUT || Result == CFE_SB_NO_MESSAGE) { /* no action, but also no error */ } diff --git a/unit-test/sc_app_tests.c b/unit-test/sc_app_tests.c index 35cb710..3e19c2c 100644 --- a/unit-test/sc_app_tests.c +++ b/unit-test/sc_app_tests.c @@ -70,12 +70,14 @@ void SC_AppMain_Test_Nominal(void) UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &MsgSize, sizeof(MsgSize), false); - /* Load return buffer to make loop execute twice */ + /* Load return buffer to make loop execute three times */ + UT_SetDeferredRetcode(UT_KEY(CFE_ES_RunLoop), 1, true); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RunLoop), 1, true); UT_SetDeferredRetcode(UT_KEY(CFE_ES_RunLoop), 1, true); - /* Return timeout first time through, will default to success on second */ + /* Return timeout first time through, no message on the second, will default to success on the third */ UT_SetDeferredRetcode(UT_KEY(CFE_SB_ReceiveBuffer), 1, CFE_SB_TIME_OUT); + UT_SetDeferredRetcode(UT_KEY(CFE_SB_ReceiveBuffer), 1, CFE_SB_NO_MESSAGE); /* Set table addresses */ UT_SetHandlerFunction(UT_KEY(CFE_TBL_GetAddress), UT_Handler_CFE_TBL_GetAddress, NULL);