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

Fix #85, Change EVS_Register failure from SendEvent to WriteToSysLog #86

Conversation

thnkslprpt
Copy link
Contributor

@thnkslprpt thnkslprpt commented Mar 4, 2023

Checklist

Describe the contribution
Fixes #85
CFE_EVS_SendEvent replaced by CFE_ES_WriteToSysLog on failure of CFE_EVS_Register.

Testing performed
GitHub CI actions (incl. Build + Run, Unit Tests etc.) all passing successfully.
Coverage maintained at 100%:

  lines......: 100.0% (1311 of 1311 lines)
  functions..: 100.0% (66 of 66 functions)
  branches...: 100.0% (485 of 485 branches)

Expected behavior changes
Failure can be successfully recorded somewhere even without the EVS now.

Contributor Info
Avi Weiss @thnkslprpt

@chillfig chillfig requested a review from jphickey March 9, 2023 19:45
Copy link
Contributor

@skliper skliper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't send enough props, really appreciate this fix (and checking the other apps)! I've shifted to project work vs core so much less spare time to work core issues. Hopefully get back to contributing once I catch up though!

Comment on lines 187 to 191
call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
UtAssert_True(call_count_CFE_EVS_SendEvent == 0, "CFE_EVS_SendEvent was called %u time(s), expected 0",
call_count_CFE_EVS_SendEvent);

strCmpResult = strncmp(ExpectedSysLogString, context_CFE_ES_WriteToSysLog.Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
UtAssert_True(strCmpResult == 0, "Sys Log string matched expected result, '%s'", context_CFE_ES_WriteToSysLog.Spec);
Copy link
Contributor

@skliper skliper Mar 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I'd be fine w/ just checking UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 1), no need to confirm 0 events sent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@thnkslprpt thnkslprpt force-pushed the fix-85-change-EVS_Register-failure-to-WriteToSysLog branch from 8f26900 to b2d5374 Compare March 10, 2023 03:24
@thnkslprpt
Copy link
Contributor Author

Can't send enough props, really appreciate this fix (and checking the other apps)! I've shifted to project work vs core so much less spare time to work core issues. Hopefully get back to contributing once I catch up though!

No worries at all Jake. My pleasure.

@thnkslprpt thnkslprpt force-pushed the fix-85-change-EVS_Register-failure-to-WriteToSysLog branch from b2d5374 to 0584142 Compare March 14, 2023 11:40
Copy link
Contributor

@jphickey jphickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requested some simplification here.

UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventID, DS_INIT_ERR_EID);
UtAssert_INT32_EQ(context_CFE_EVS_SendEvent[0].EventType, CFE_EVS_EventType_ERROR);
call_count_CFE_EVS_SendEvent = UT_GetStubCount(UT_KEY(CFE_EVS_SendEvent));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to get the stub count of CFE_EVS_SendEvent here that I can see. Can this be taken out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jphickey. It must have been left over from a different idea I had for this test case.
Removed now.

UtAssert_STUB_COUNT(CFE_ES_WriteToSysLog, 1);

strCmpResult = strncmp(ExpectedSysLogString, context_CFE_ES_WriteToSysLog.Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
UtAssert_True(strCmpResult == 0, "Sys Log string matched expected result, '%s'", context_CFE_ES_WriteToSysLog.Spec);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also recommend removing the format string text. We've been removing these rather than updating them. It does not really add value to the test case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool no worries - If I understood you correctly - I've just left the STUB_COUNT check.

@thnkslprpt thnkslprpt force-pushed the fix-85-change-EVS_Register-failure-to-WriteToSysLog branch 3 times, most recently from fa691a9 to 4d72114 Compare March 16, 2023 23:45
Copy link
Contributor

@jphickey jphickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just need to check/confirm if that variable needs to be added at all, I think it does not.

char ExpectedSysLogString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
snprintf(ExpectedSysLogString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH,
"DS App: Error registering for Event Services, RC = 0x%%08X\n");

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this "ExpectedSysLogString" used anywhere? Looks like its not now (which is good, but shouldn't be here at all if that's the case).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're correct - no longer needed since the UtAssert_True(strCmpResult... was removed.
Have removed the variable now.

@thnkslprpt thnkslprpt force-pushed the fix-85-change-EVS_Register-failure-to-WriteToSysLog branch from 4d72114 to 7d91157 Compare March 21, 2023 22:35
@dzbaker dzbaker merged commit 0add473 into nasa:main Apr 6, 2023
@thnkslprpt thnkslprpt deleted the fix-85-change-EVS_Register-failure-to-WriteToSysLog branch April 6, 2023 21:45
@dmknutsen dmknutsen added this to the Equuleus milestone May 26, 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 this pull request may close these issues.

Sends an event message on failure of registering with EVS
6 participants