From 1def3b562ee408f3ae295237fd8f6b3f92b9b2c9 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Fri, 22 Jan 2021 10:09:46 -0500 Subject: [PATCH] Fix #1071, Initialize Status in CFE_ES_WaitForSystemState --- fsw/cfe-core/src/es/cfe_es_api.c | 2 +- fsw/cfe-core/unit-test/es_UT.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/fsw/cfe-core/src/es/cfe_es_api.c b/fsw/cfe-core/src/es/cfe_es_api.c index 15a3a8163..c4fe33963 100644 --- a/fsw/cfe-core/src/es/cfe_es_api.c +++ b/fsw/cfe-core/src/es/cfe_es_api.c @@ -545,7 +545,7 @@ bool CFE_ES_RunLoop(uint32 *RunStatus) */ int32 CFE_ES_WaitForSystemState(uint32 MinSystemState, uint32 TimeOutMilliseconds) { - int32 Status; + int32 Status = CFE_SUCCESS; CFE_ES_AppRecord_t *AppRecPtr; uint32 RequiredAppState; uint32 WaitTime; diff --git a/fsw/cfe-core/unit-test/es_UT.c b/fsw/cfe-core/unit-test/es_UT.c index 483a8ea43..abdaaf714 100644 --- a/fsw/cfe-core/unit-test/es_UT.c +++ b/fsw/cfe-core/unit-test/es_UT.c @@ -1142,6 +1142,14 @@ void TestStartupErrorPaths(void) CFE_ES_AppState_LATE_INIT, "CFE_ES_WaitForSystemState", "Min System State is CFE_ES_SystemState_APPS_INIT"); + + /* Test success */ + ES_ResetUnitTest(); + /* This prep is necessary so GetAppId works */ + ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppType_CORE, NULL, &AppRecPtr, NULL); + CFE_ES_Global.SystemState = CFE_ES_SystemState_CORE_READY; + ASSERT(CFE_ES_WaitForSystemState(CFE_ES_SystemState_CORE_READY, 0)); + } void TestApps(void)