Skip to content

Commit

Permalink
Merge pull request #231 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
sample_app Integration candidate: Equuleus-rc1+dev8
  • Loading branch information
dzbaker authored Mar 21, 2024
2 parents ad59627 + 2a8a395 commit ceaf7ab
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 45 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Development Build: equuleus-rc1+dev46
- Convert remaining int32 CFE status variables to CFE_Status_t
- Convert syslog writes during initialization to events
- See <https://github.com/nasa/sample_app/pull/218> and <https://github.com/nasa/sample_app/pull/216>

## Development Build: equuleus-rc4+dev40
- apply name changes to EDS dispatcher
- See <https://github.com/nasa/sample_app/pull/229>
Expand Down
22 changes: 13 additions & 9 deletions fsw/inc/sample_app_eventids.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@
#ifndef SAMPLE_APP_EVENTS_H
#define SAMPLE_APP_EVENTS_H

#define SAMPLE_APP_RESERVED_EID 0
#define SAMPLE_APP_INIT_INF_EID 1
#define SAMPLE_APP_CC_ERR_EID 2
#define SAMPLE_APP_NOOP_INF_EID 3
#define SAMPLE_APP_RESET_INF_EID 4
#define SAMPLE_APP_MID_ERR_EID 5
#define SAMPLE_APP_CMD_LEN_ERR_EID 6
#define SAMPLE_APP_PIPE_ERR_EID 7
#define SAMPLE_APP_VALUE_INF_EID 8
#define SAMPLE_APP_RESERVED_EID 0
#define SAMPLE_APP_INIT_INF_EID 1
#define SAMPLE_APP_CC_ERR_EID 2
#define SAMPLE_APP_NOOP_INF_EID 3
#define SAMPLE_APP_RESET_INF_EID 4
#define SAMPLE_APP_MID_ERR_EID 5
#define SAMPLE_APP_CMD_LEN_ERR_EID 6
#define SAMPLE_APP_PIPE_ERR_EID 7
#define SAMPLE_APP_VALUE_INF_EID 8
#define SAMPLE_APP_CR_PIPE_ERR_EID 9
#define SAMPLE_APP_SUB_HK_ERR_EID 10
#define SAMPLE_APP_SUB_CMD_ERR_EID 11
#define SAMPLE_APP_TABLE_REG_ERR_EID 12

#endif /* SAMPLE_APP_EVENTS_H */
25 changes: 14 additions & 11 deletions fsw/src/sample_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SAMPLE_APP_Data_t SAMPLE_APP_Data;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
void SAMPLE_APP_Main(void)
{
int32 status;
CFE_Status_t status;
CFE_SB_Buffer_t *SBBufPtr;

/*
Expand Down Expand Up @@ -107,10 +107,10 @@ void SAMPLE_APP_Main(void)
/* Initialization */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
int32 SAMPLE_APP_Init(void)
CFE_Status_t SAMPLE_APP_Init(void)
{
int32 status;
char VersionString[SAMPLE_APP_CFG_MAX_VERSION_STR_LEN];
CFE_Status_t status;
char VersionString[SAMPLE_APP_CFG_MAX_VERSION_STR_LEN];

/* Zero out the global data structure */
memset(&SAMPLE_APP_Data, 0, sizeof(SAMPLE_APP_Data));
Expand Down Expand Up @@ -147,7 +147,8 @@ int32 SAMPLE_APP_Init(void)
status = CFE_SB_CreatePipe(&SAMPLE_APP_Data.CommandPipe, SAMPLE_APP_Data.PipeDepth, SAMPLE_APP_Data.PipeName);
if (status != CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("Sample App: Error creating pipe, RC = 0x%08lX\n", (unsigned long)status);
CFE_EVS_SendEvent(SAMPLE_APP_CR_PIPE_ERR_EID, CFE_EVS_EventType_ERROR,
"Sample App: Error creating SB Command Pipe, RC = 0x%08lX", (unsigned long)status);
}
}

Expand All @@ -159,7 +160,8 @@ int32 SAMPLE_APP_Init(void)
status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(SAMPLE_APP_SEND_HK_MID), SAMPLE_APP_Data.CommandPipe);
if (status != CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("Sample App: Error Subscribing to HK request, RC = 0x%08lX\n", (unsigned long)status);
CFE_EVS_SendEvent(SAMPLE_APP_SUB_HK_ERR_EID, CFE_EVS_EventType_ERROR,
"Sample App: Error Subscribing to HK request, RC = 0x%08lX", (unsigned long)status);
}
}

Expand All @@ -171,9 +173,9 @@ int32 SAMPLE_APP_Init(void)
status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(SAMPLE_APP_CMD_MID), SAMPLE_APP_Data.CommandPipe);
if (status != CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("Sample App: Error Subscribing to Command, RC = 0x%08lX\n", (unsigned long)status);
CFE_EVS_SendEvent(SAMPLE_APP_SUB_CMD_ERR_EID, CFE_EVS_EventType_ERROR,
"Sample App: Error Subscribing to Commands, RC = 0x%08lX", (unsigned long)status);
}

}

if (status == CFE_SUCCESS)
Expand All @@ -185,15 +187,16 @@ int32 SAMPLE_APP_Init(void)
CFE_TBL_OPT_DEFAULT, SAMPLE_APP_TblValidationFunc);
if (status != CFE_SUCCESS)
{
CFE_ES_WriteToSysLog("Sample App: Error Registering Example Table, RC = 0x%08lX\n", (unsigned long)status);
CFE_EVS_SendEvent(SAMPLE_APP_TABLE_REG_ERR_EID, CFE_EVS_EventType_ERROR,
"Sample App: Error Registering Example Table, RC = 0x%08lX", (unsigned long)status);
}
else
{
status = CFE_TBL_Load(SAMPLE_APP_Data.TblHandles[0], CFE_TBL_SRC_FILE, SAMPLE_APP_TABLE_FILE);
}

CFE_Config_GetVersionString(VersionString, SAMPLE_APP_CFG_MAX_VERSION_STR_LEN, "Sample App",
SAMPLE_APP_VERSION, SAMPLE_APP_BUILD_CODENAME, SAMPLE_APP_LAST_OFFICIAL);
CFE_Config_GetVersionString(VersionString, SAMPLE_APP_CFG_MAX_VERSION_STR_LEN, "Sample App", SAMPLE_APP_VERSION,
SAMPLE_APP_BUILD_CODENAME, SAMPLE_APP_LAST_OFFICIAL);

CFE_EVS_SendEvent(SAMPLE_APP_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "Sample App Initialized.%s",
VersionString);
Expand Down
4 changes: 2 additions & 2 deletions fsw/src/sample_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ extern SAMPLE_APP_Data_t SAMPLE_APP_Data;
** Note: Except for the entry point (SAMPLE_APP_Main), these
** functions are not called from any other source module.
*/
void SAMPLE_APP_Main(void);
int32 SAMPLE_APP_Init(void);
void SAMPLE_APP_Main(void);
CFE_Status_t SAMPLE_APP_Init(void);

#endif /* SAMPLE_APP_H */
2 changes: 1 addition & 1 deletion fsw/src/sample_app_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ CFE_Status_t SAMPLE_APP_ResetCountersCmd(const SAMPLE_APP_ResetCountersCmd_t *Ms
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
CFE_Status_t SAMPLE_APP_ProcessCmd(const SAMPLE_APP_ProcessCmd_t *Msg)
{
int32 status;
CFE_Status_t status;
void * TblAddr;
SAMPLE_APP_ExampleTable_t *TblPtr;
const char * TableName = "SAMPLE_APP.ExampleTable";
Expand Down
6 changes: 3 additions & 3 deletions fsw/src/sample_app_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
/* Verify contents of First Example Table buffer contents */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32 SAMPLE_APP_TblValidationFunc(void *TblData)
CFE_Status_t SAMPLE_APP_TblValidationFunc(void *TblData)
{
int32 ReturnCode = CFE_SUCCESS;
CFE_Status_t ReturnCode = CFE_SUCCESS;
SAMPLE_APP_ExampleTable_t *TblDataPtr = (SAMPLE_APP_ExampleTable_t *)TblData;

/*
Expand All @@ -58,7 +58,7 @@ int32 SAMPLE_APP_TblValidationFunc(void *TblData)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void SAMPLE_APP_GetCrc(const char *TableName)
{
int32 status;
CFE_Status_t status;
uint32 Crc;
CFE_TBL_Info_t TblInfoPtr;

Expand Down
4 changes: 2 additions & 2 deletions fsw/src/sample_app_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
#include "sample_app.h"

int32 SAMPLE_APP_TblValidationFunc(void *TblData);
void SAMPLE_APP_GetCrc(const char *TableName);
CFE_Status_t SAMPLE_APP_TblValidationFunc(void *TblData);
void SAMPLE_APP_GetCrc(const char *TableName);

#endif /* SAMPLE_APP_UTILS_H */
2 changes: 1 addition & 1 deletion fsw/src/sample_app_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

/* Development Build Macro Definitions */

#define SAMPLE_APP_BUILD_NUMBER 40 /*!< Development Build: Number of commits since baseline */
#define SAMPLE_APP_BUILD_NUMBER 46 /*!< Development Build: Number of commits since baseline */
#define SAMPLE_APP_BUILD_BASELINE "equuleus-rc1" /*!< Development Build: git tag that is the base for the current development */
#define SAMPLE_APP_BUILD_DEV_CYCLE "equuleus-rc2" /**< @brief Development: Release name for current development cycle */
#define SAMPLE_APP_BUILD_CODENAME "Equuleus" /**< @brief: Development: Code name for the current build */
Expand Down
19 changes: 10 additions & 9 deletions unit-test/coveragetest/coveragetest_sample_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,35 +143,36 @@ void Test_SAMPLE_APP_Init(void)
{
/*
* Test Case For:
* int32 SAMPLE_APP_Init( void )
* CFE_Status_t SAMPLE_APP_Init( void )
*/

/* nominal case should return CFE_SUCCESS */
UtAssert_INT32_EQ(SAMPLE_APP_Init(), CFE_SUCCESS);

/* trigger a failure for each of the sub-calls,
* and confirm a write to syslog for each.
* Note that this count accumulates, because the status
* is _not_ reset between these test cases. */
/*
* Trigger a failure for each of the sub-calls, and confirm a write to syslog for
* failure to register with EVS, and that an event is generated for subsequent error paths.
* Note that the stub counts accumulate, because the status is _not_ reset between test cases.
*/
UT_SetDeferredRetcode(UT_KEY(CFE_EVS_Register), 1, CFE_EVS_INVALID_PARAMETER);
UtAssert_INT32_EQ(SAMPLE_APP_Init(), CFE_EVS_INVALID_PARAMETER);
UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 1);

UT_SetDeferredRetcode(UT_KEY(CFE_SB_CreatePipe), 1, CFE_SB_BAD_ARGUMENT);
UtAssert_INT32_EQ(SAMPLE_APP_Init(), CFE_SB_BAD_ARGUMENT);
UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 2);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 2); /* 1 from previous nominal case, 1 from this error path */

UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 1, CFE_SB_BAD_ARGUMENT);
UtAssert_INT32_EQ(SAMPLE_APP_Init(), CFE_SB_BAD_ARGUMENT);
UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 3);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 3); /* 1 additional event sent from this error path */

UT_SetDeferredRetcode(UT_KEY(CFE_SB_Subscribe), 2, CFE_SB_BAD_ARGUMENT);
UtAssert_INT32_EQ(SAMPLE_APP_Init(), CFE_SB_BAD_ARGUMENT);
UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 4);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 4); /* 1 additional event sent from this error path */

UT_SetDeferredRetcode(UT_KEY(CFE_TBL_Register), 1, CFE_TBL_ERR_INVALID_OPTIONS);
UtAssert_INT32_EQ(SAMPLE_APP_Init(), CFE_TBL_ERR_INVALID_OPTIONS);
UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 5);
UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 6); /* 1 from table registration error, 1 from successful init event */
}

/*
Expand Down
2 changes: 1 addition & 1 deletion unit-test/coveragetest/coveragetest_sample_app_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void Test_SAMPLE_APP_TblValidationFunc(void)
{
/*
* Test Case For:
* int32 SAMPLE_APP_TblValidationFunc( void *TblData )
* CFE_Status_t SAMPLE_APP_TblValidationFunc( void *TblData )
*/
SAMPLE_APP_ExampleTable_t TestTblData;

Expand Down
6 changes: 3 additions & 3 deletions unit-test/stubs/sample_app_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
* Generated stub function for SAMPLE_APP_Init()
* ----------------------------------------------------
*/
int32 SAMPLE_APP_Init(void)
CFE_Status_t SAMPLE_APP_Init(void)
{
UT_GenStub_SetupReturnBuffer(SAMPLE_APP_Init, int32);
UT_GenStub_SetupReturnBuffer(SAMPLE_APP_Init, CFE_Status_t);

UT_GenStub_Execute(SAMPLE_APP_Init, Basic, NULL);

return UT_GenStub_GetReturnValue(SAMPLE_APP_Init, int32);
return UT_GenStub_GetReturnValue(SAMPLE_APP_Init, CFE_Status_t);
}

/*
Expand Down
6 changes: 3 additions & 3 deletions unit-test/stubs/sample_app_utils_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ void SAMPLE_APP_GetCrc(const char *TableName)
* Generated stub function for SAMPLE_APP_TblValidationFunc()
* ----------------------------------------------------
*/
int32 SAMPLE_APP_TblValidationFunc(void *TblData)
CFE_Status_t SAMPLE_APP_TblValidationFunc(void *TblData)
{
UT_GenStub_SetupReturnBuffer(SAMPLE_APP_TblValidationFunc, int32);
UT_GenStub_SetupReturnBuffer(SAMPLE_APP_TblValidationFunc, CFE_Status_t);

UT_GenStub_AddParam(SAMPLE_APP_TblValidationFunc, void *, TblData);

UT_GenStub_Execute(SAMPLE_APP_TblValidationFunc, Basic, NULL);

return UT_GenStub_GetReturnValue(SAMPLE_APP_TblValidationFunc, int32);
return UT_GenStub_GetReturnValue(SAMPLE_APP_TblValidationFunc, CFE_Status_t);
}

0 comments on commit ceaf7ab

Please sign in to comment.