-
Notifications
You must be signed in to change notification settings - Fork 30
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
Fix #85, Change EVS_Register failure from SendEvent to WriteToSysLog #86
Conversation
There was a problem hiding this 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!
unit-test/ds_app_tests.c
Outdated
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
8f26900
to
b2d5374
Compare
No worries at all Jake. My pleasure. |
b2d5374
to
0584142
Compare
There was a problem hiding this 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.
unit-test/ds_app_tests.c
Outdated
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)); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
unit-test/ds_app_tests.c
Outdated
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
fa691a9
to
4d72114
Compare
There was a problem hiding this 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.
unit-test/ds_app_tests.c
Outdated
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"); | ||
|
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
4d72114
to
7d91157
Compare
Checklist
Describe the contribution
Fixes #85
CFE_EVS_SendEvent
replaced byCFE_ES_WriteToSysLog
on failure ofCFE_EVS_Register
.Testing performed
GitHub CI actions (incl. Build + Run, Unit Tests etc.) all passing successfully.
Coverage maintained at 100%:
Expected behavior changes
Failure can be successfully recorded somewhere even without the EVS now.
Contributor Info
Avi Weiss @thnkslprpt