Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cFE Integration candidate: Equuleus-rc1+dev12 #2563

Merged
merged 5 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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+dev137
- msg api test buffer overrun
- send CMake message to stdout instead of stderr
- See <https://github.com/nasa/cFE/pull/2537> and <https://github.com/nasa/cFE/pull/2525>

## Development Build: equuleus-rc1+dev131
- add handle list operation routines
- See <https://github.com/nasa/cFE/pull/2548>
Expand Down
2 changes: 1 addition & 1 deletion cmake/arch_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ function(process_arch SYSVAR)
if (FILESRC)
# In case the file is a symlink, follow it to get to the actual file
get_filename_component(FILESRC "${FILESRC}" REALPATH)
message("NOTE: Selected ${FILESRC} as source for ${INSTFILE} on ${TGTNAME}")
message(STATUS "NOTE: Selected ${FILESRC} as source for ${INSTFILE} on ${TGTNAME}")
install(FILES ${FILESRC} DESTINATION ${TGTNAME}/${INSTALL_SUBDIR} RENAME ${INSTFILE})
else(FILESRC)
message("WARNING: Install file ${INSTFILE} for ${TGTNAME} not found")
Expand Down
124 changes: 77 additions & 47 deletions modules/cfe_testcase/src/msg_api_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,88 +176,118 @@
"CFE_MSG_GetFcnCode, CFE_MSG_GetMsgTime, CFE_MSG_SetMsgTime ");

/* declare local vars */
CFE_MSG_CommandHeader_t cmd;
CFE_MSG_CommandHeader_t cmdTlm;
CFE_MSG_CommandHeader_t cmd2;
CFE_MSG_FcnCode_t fcnCode;
CFE_TIME_SysTime_t msgTime;
bool isValid = true;
CFE_TIME_SysTime_t currentTime = {1000, 0xFFFF0000};
CFE_Status_t status;
CFE_MSG_CommandHeader_t cmd;
CFE_MSG_TelemetryHeader_t tlm;
CFE_MSG_FcnCode_t fcnCode;
CFE_TIME_SysTime_t msgTime;
bool isValid = true;
CFE_TIME_SysTime_t currentTime = {1000, 0xFFFF0000};

memset(&cmd, 0, sizeof(cmd));
memset(&cmdTlm, 0xFF, sizeof(cmdTlm));
memset(&cmd2, 0xFF, sizeof(cmd2));
memset(&tlm, 0, sizeof(tlm));

/* msg-init */
UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(cmd), CFE_SB_ValueToMsgId(1), sizeof(cmd)), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_MSG_SetHasSecondaryHeader(CFE_MSG_PTR(cmd), true), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_MSG_SetType(CFE_MSG_PTR(cmd), CFE_MSG_Type_Cmd), CFE_SUCCESS);

UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(cmdTlm), CFE_SB_ValueToMsgId(2), sizeof(cmdTlm)), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_MSG_SetHasSecondaryHeader(CFE_MSG_PTR(cmdTlm), true), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_MSG_SetType(CFE_MSG_PTR(cmdTlm), CFE_MSG_Type_Tlm), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(tlm), CFE_SB_ValueToMsgId(2), sizeof(tlm)), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_MSG_SetHasSecondaryHeader(CFE_MSG_PTR(tlm), true), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_MSG_SetType(CFE_MSG_PTR(tlm), CFE_MSG_Type_Tlm), CFE_SUCCESS);

UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(cmd2), CFE_SB_ValueToMsgId(3), sizeof(cmd2)), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_MSG_SetHasSecondaryHeader(CFE_MSG_PTR(cmd2), true), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_MSG_SetType(CFE_MSG_PTR(cmd2), CFE_MSG_Type_Cmd), CFE_SUCCESS);
/* test generate-checksum on commands */
CFE_Assert_STATUS_STORE(CFE_MSG_ValidateChecksum(CFE_MSG_PTR(cmd), &isValid));
if (CFE_Assert_STATUS_MAY_BE(CFE_SUCCESS))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning test

This Boolean expression is not side-effect free.
{
UtAssert_BOOL_FALSE(isValid); /* assuming a zero'ed out struct will have an invalid checksum */

/* test generate-checksum */
status = CFE_MSG_GenerateChecksum(NULL);
if (status == CFE_MSG_NOT_IMPLEMENTED)
UtAssert_INT32_EQ(CFE_MSG_GenerateChecksum(CFE_MSG_PTR(cmd)), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(CFE_MSG_PTR(cmd), &isValid), CFE_SUCCESS);
UtAssert_BOOL_TRUE(isValid);
}
else if (CFE_Assert_STATUS_MAY_BE(CFE_MSG_WRONG_MSG_TYPE))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning test

This Boolean expression is not side-effect free.
{
UtAssert_NA("CFE_MSG_GenerateChecksum not implemented");
UtAssert_NA("CFE_MSG_GenerateChecksum does not operate on commands");
}
else
{
UtAssert_INT32_EQ(CFE_MSG_GenerateChecksum(NULL), CFE_MSG_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_MSG_GenerateChecksum(CFE_MSG_PTR(cmdTlm)), CFE_MSG_WRONG_MSG_TYPE);
UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(CFE_MSG_PTR(cmdTlm), &isValid), CFE_MSG_WRONG_MSG_TYPE);
UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(NULL, &isValid), CFE_MSG_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(CFE_MSG_PTR(cmdTlm), NULL), CFE_MSG_BAD_ARGUMENT);
UtAssert_NA("CFE_MSG_GenerateChecksum on commands not implemented");
CFE_Assert_STATUS_MUST_BE(CFE_MSG_NOT_IMPLEMENTED);
}

UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(CFE_MSG_PTR(cmd), &isValid), CFE_SUCCESS);
UtAssert_True(!isValid, "Checksum isValid (%d) = false", isValid);
UtAssert_INT32_EQ(CFE_MSG_GenerateChecksum(CFE_MSG_PTR(cmd)), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(CFE_MSG_PTR(cmd), &isValid), CFE_SUCCESS);
UtAssert_True(isValid, "Checksum isValid (%d) = true", isValid);
/* test generate-checksum on telemetry */
CFE_Assert_STATUS_STORE(CFE_MSG_ValidateChecksum(CFE_MSG_PTR(tlm), &isValid));
if (CFE_Assert_STATUS_MAY_BE(CFE_SUCCESS))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning test

This Boolean expression is not side-effect free.
{
UtAssert_BOOL_FALSE(isValid); /* assuming a zero'ed out struct will have an invalid checksum */

UtAssert_INT32_EQ(CFE_MSG_GenerateChecksum(CFE_MSG_PTR(tlm)), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_MSG_ValidateChecksum(CFE_MSG_PTR(tlm), &isValid), CFE_SUCCESS);
UtAssert_BOOL_TRUE(isValid);
}
else if (CFE_Assert_STATUS_MAY_BE(CFE_MSG_WRONG_MSG_TYPE))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning test

This Boolean expression is not side-effect free.
{
UtAssert_NA("CFE_MSG_GenerateChecksum does not operate on telemetry");
}
else
{
UtAssert_NA("CFE_MSG_GenerateChecksum on telemetry not implemented");
CFE_Assert_STATUS_MUST_BE(CFE_MSG_NOT_IMPLEMENTED);
}

/* test get/set-fcn-code */
UtAssert_INT32_EQ(CFE_MSG_SetFcnCode(NULL, 4), CFE_MSG_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_MSG_SetFcnCode(CFE_MSG_PTR(cmdTlm), 4), CFE_MSG_WRONG_MSG_TYPE);
UtAssert_INT32_EQ(CFE_MSG_SetFcnCode(CFE_MSG_PTR(tlm), 4), CFE_MSG_WRONG_MSG_TYPE);

UtAssert_INT32_EQ(CFE_MSG_GetFcnCode(CFE_MSG_PTR(cmd), NULL), CFE_MSG_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_MSG_GetFcnCode(NULL, &fcnCode), CFE_MSG_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_MSG_GetFcnCode(CFE_MSG_PTR(cmdTlm), &fcnCode), CFE_MSG_WRONG_MSG_TYPE);
UtAssert_INT32_EQ(CFE_MSG_GetFcnCode(CFE_MSG_PTR(tlm), &fcnCode), CFE_MSG_WRONG_MSG_TYPE);

UtAssert_INT32_EQ(CFE_MSG_SetFcnCode(CFE_MSG_PTR(cmd), 4), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_MSG_GetFcnCode(CFE_MSG_PTR(cmd), &fcnCode), CFE_SUCCESS);
UtAssert_INT32_EQ(fcnCode, 4);

/* test get/set-msg-time */
UtAssert_INT32_EQ(CFE_MSG_SetType(CFE_MSG_PTR(cmd), CFE_MSG_Type_Tlm), CFE_SUCCESS);

UtAssert_INT32_EQ(CFE_MSG_GetMsgTime(NULL, &msgTime), CFE_MSG_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_MSG_GetMsgTime(CFE_MSG_PTR(cmd), NULL), CFE_MSG_BAD_ARGUMENT);
UtAssert_INT32_EQ(CFE_MSG_GetMsgTime(CFE_MSG_PTR(tlm), NULL), CFE_MSG_BAD_ARGUMENT);

CFE_Assert_STATUS_STORE(CFE_MSG_GetMsgTime(CFE_MSG_PTR(cmd2), &msgTime));
if (!CFE_Assert_STATUS_MAY_BE(CFE_SUCCESS))
/* Check if GetMsgTime is implemented on commands */
CFE_Assert_STATUS_STORE(CFE_MSG_GetMsgTime(CFE_MSG_PTR(cmd), &msgTime));
if (CFE_Assert_STATUS_MAY_BE(CFE_SUCCESS))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning test

This Boolean expression is not side-effect free.
{
CFE_Assert_STATUS_MUST_BE(CFE_MSG_WRONG_MSG_TYPE);
memset(&msgTime, 0xff, sizeof(msgTime));
UtAssert_INT32_EQ(CFE_MSG_SetMsgTime(CFE_MSG_PTR(cmd), currentTime), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_MSG_GetMsgTime(CFE_MSG_PTR(cmd), &msgTime), CFE_SUCCESS);
UtAssert_UINT32_EQ(CFE_TIME_Compare(msgTime, currentTime), CFE_TIME_EQUAL);
}

UtAssert_INT32_EQ(CFE_MSG_SetMsgTime(NULL, currentTime), CFE_MSG_BAD_ARGUMENT);

CFE_Assert_STATUS_STORE(CFE_MSG_SetMsgTime(CFE_MSG_PTR(cmd2), currentTime));
if (!CFE_Assert_STATUS_MAY_BE(CFE_SUCCESS))
else if (CFE_Assert_STATUS_MAY_BE(CFE_MSG_WRONG_MSG_TYPE))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning test

This Boolean expression is not side-effect free.
{
UtAssert_NA("CFE_MSG_GetMsgTime does not operate on commands");
}
else
{
CFE_Assert_STATUS_MUST_BE(CFE_MSG_WRONG_MSG_TYPE);
UtAssert_NA("CFE_MSG_GetMsgTime on commands not implemented");
CFE_Assert_STATUS_MUST_BE(CFE_MSG_NOT_IMPLEMENTED);
}

UtAssert_INT32_EQ(CFE_MSG_SetMsgTime(CFE_MSG_PTR(cmd), currentTime), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_MSG_GetMsgTime(CFE_MSG_PTR(cmd), &msgTime), CFE_SUCCESS);
UtAssert_UINT32_EQ(CFE_TIME_Compare(msgTime, currentTime), CFE_TIME_EQUAL);
/* Check if GetMsgTime is implemented on telemetry */
CFE_Assert_STATUS_STORE(CFE_MSG_GetMsgTime(CFE_MSG_PTR(tlm), &msgTime));
if (CFE_Assert_STATUS_MAY_BE(CFE_SUCCESS))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning test

This Boolean expression is not side-effect free.
{
memset(&msgTime, 0xff, sizeof(msgTime));
UtAssert_INT32_EQ(CFE_MSG_SetMsgTime(CFE_MSG_PTR(tlm), currentTime), CFE_SUCCESS);
UtAssert_INT32_EQ(CFE_MSG_GetMsgTime(CFE_MSG_PTR(tlm), &msgTime), CFE_SUCCESS);
UtAssert_UINT32_EQ(CFE_TIME_Compare(msgTime, currentTime), CFE_TIME_EQUAL);
}
else if (CFE_Assert_STATUS_MAY_BE(CFE_MSG_WRONG_MSG_TYPE))

Check warning

Code scanning / CodeQL

Side effect in a Boolean expression Warning test

This Boolean expression is not side-effect free.
{
UtAssert_NA("CFE_MSG_GetMsgTime does not operate on telemetry");
}
else
{
UtAssert_NA("CFE_MSG_GetMsgTime on telemetry not implemented");
CFE_Assert_STATUS_MUST_BE(CFE_MSG_NOT_IMPLEMENTED);
}
}

void MsgApiTestSetup(void)
Expand Down
2 changes: 1 addition & 1 deletion modules/core_api/fsw/inc/cfe_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define CFE_VERSION_H

/* Development Build Macro Definitions */
#define CFE_BUILD_NUMBER 131 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */
#define CFE_BUILD_NUMBER 137 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */
#define CFE_BUILD_BASELINE "equuleus-rc1" /**< @brief Development: Reference git tag for build number */
#define CFE_BUILD_DEV_CYCLE "equuleus-rc2" /**< @brief Development: Release name for current development cycle */
#define CFE_BUILD_CODENAME "Equuleus" /**< @brief: Development: Code name for the current build */
Expand Down
Loading