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

TIME includes unnecessary asserts in invalid command length tests #2323

Open
2 tasks done
thnkslprpt opened this issue May 4, 2023 · 0 comments · May be fixed by #2324
Open
2 tasks done

TIME includes unnecessary asserts in invalid command length tests #2323

thnkslprpt opened this issue May 4, 2023 · 0 comments · May be fixed by #2324

Comments

@thnkslprpt
Copy link
Contributor

Checklist

  • I reviewed the Contributing Guide.
  • I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.

Describe the bug
TIME is the only module that also checks the command counters in the coverage tests for commands issued with an invalid length.

/* Noop with bad size */
UT_InitData();
memset(&CmdBuf, 0, sizeof(CmdBuf));
CFE_TIME_Global.CommandCounter = 0;
CFE_TIME_Global.CommandErrorCounter = 0;
UT_CallTaskPipe(CFE_TIME_TaskPipe, &CmdBuf.message, 0, UT_TPID_CFE_TIME_CMD_NOOP_CC);
CFE_UtAssert_EVENTSENT(CFE_TIME_LEN_ERR_EID);
UtAssert_UINT32_EQ(CFE_TIME_Global.CommandCounter, 0);
UtAssert_UINT32_EQ(CFE_TIME_Global.CommandErrorCounter, 1);

The others:

/* Test sending a no-op command with an invalid command length */
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_NOOP_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
/* Test sending a reset counters command with an invalid command length */

/* Test invalid command length event */
UT_InitData_EVS();
UT_EVS_DoDispatchCheckEvents(&cmd, 0, UT_TPID_CFE_EVS_CMD_NOOP_CC, &UT_EVS_EventBuf);
UtAssert_UINT32_EQ(UT_EVS_EventBuf.EventID, CFE_EVS_LEN_ERR_EID);
/* Test invalid command length with reset counters command */

UT_CallTaskPipe(CFE_SB_ProcessCmdPipePkt, &Noop.SBBuf.Msg, 0, UT_TPID_CFE_SB_CMD_NOOP_CC);
CFE_UtAssert_EVENTSENT(CFE_SB_LEN_ERR_EID);
}

/* Test command pipe messages handler response to an invalid
* message length
*/
UT_InitData();
UT_CallTaskPipe(CFE_TBL_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoopCmd) - 1, UT_TPID_CFE_TBL_CMD_NOOP_CC);
CFE_UtAssert_EVENTSENT(CFE_TBL_LEN_ERR_EID);
/* Test command pipe messages handler response to an invalid

Expected behavior
Can simplify the unit tests for TIME by removing these extra asserts - checking for CFE_TIME_LEN_ERR_EID being sent seems sufficient.

Reporter Info
Avi Weiss @thnkslprpt

thnkslprpt added a commit to thnkslprpt/cFE that referenced this issue May 4, 2023
thnkslprpt added a commit to thnkslprpt/cFE that referenced this issue Dec 14, 2023
thnkslprpt added a commit to thnkslprpt/cFE that referenced this issue Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants