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 #29, Fix #14, update code coverage, #34

Merged
merged 1 commit into from
Jul 8, 2022
Merged

Conversation

chillfig
Copy link
Contributor

@chillfig chillfig commented Jul 1, 2022

Removes comments about DS_AppProcessHK_Test_SnprintfFail,
Adds DS_CmdCloseAll_Test_CloseAll,
Adds coverage of null filename with no "/" to DS_FileCloseDest
Adds coverage of !OS_ObjectDefined 2nd check in DS_FileSetupWrite()
Adds coverage of StringTerminator branch in DS_FileCreateDest_Test()
Adds coverage of MaxPathnameLength branch in DS_FileCreatName_Test()
Adds PathBaseSeqTooLarge in DS_FileCreatName_Test()
Adds PathBaseSeqExtTooLarge in DS_FileCreatName_Test()
Adds ExtensionZero in DS_FileCreatName_Test()

Checklist (Please check before submitting)

Describe the contribution
A clear and concise description of what the contribution is.

Testing performed

  1. lcov --capture --rc lcov_branch_coverage=1 --directory build --output-file coverage_test.info
  2. lcov --rc lcov_branch_coverage=1 --add-tracefile coverage_base.info --add-tracefile coverage_test.info --output-file coverage_total.info
  3. genhtml coverage_total.info --branch-coverage --output-directory lcov

Expected behavior changes
100% code coverage

System(s) tested on
Ubuntu 18.04

Additional context
100% coverage depends on the resolution of #32
Afterwards, .github/workflows/unit-test-coverage.yml will need to be updated in this pull request to account for no missing branch coverage.

Third party code
If included, identify any third party code and provide text file of license

Contributor Info - All information REQUIRED for consideration of pull request
Justin Figueroa, ASRC Federal

@chillfig chillfig requested a review from skliper July 1, 2022 04:52
@chillfig chillfig self-assigned this Jul 1, 2022
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.

Great work! Just a couple minor requested changes.

Comment on lines 3034 to 3035
int32 strCmpResult;
char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove (along with noted sections below). Checking a constant event string adds very little value. Checking the Event ID is sufficient and easier to maintain.

size_t forced_Size = sizeof(DS_CloseAllCmd_t);

UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &forced_Size, sizeof(forced_Size), false);
snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "DEST CLOSE ALL command");
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove

Comment on lines 3057 to 3058
strCmpResult = strncmp(ExpectedEventString, context_CFE_EVS_SendEvent[0].Spec, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH);
UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec);
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove

UtAssert_True(strCmpResult == 0, "Event string matched expected result, '%s'", context_CFE_EVS_SendEvent[0].Spec);

/* Verify command struct size minus header is at least explicitly padded to 32-bit boundaries */
UtAssert_True(CMD_STRUCT_DATA_IS_32_ALIGNED(DS_CloseAllCmd_t), "DS_CloseAllCmd_t is 32-bit aligned");
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid ever using UtAssert_True. UtAssert_BOOL_TRUE is the preferred macro.

Comment on lines 1434 to 1437
UtAssert_True(DS_AppData.FileStatus[FileIndex].FileAge == 0, "DS_AppData.FileStatus[FileIndex].FileAge == 0");
UtAssert_True(DS_AppData.FileStatus[FileIndex].FileSize == 0, "DS_AppData.FileStatus[FileIndex].FileSize == 0");
UtAssert_True(DS_AppData.FileStatus[FileIndex].FileName[0] == 0,
"DS_AppData.FileStatus[FileIndex].FileName[0] == 0");
Copy link
Contributor

Choose a reason for hiding this comment

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

These could be UtAssert_UINT32_EQ

Removes comments about DS_AppProcessHK_Test_SnprintfFail,
Adds DS_CmdCloseAll_Test_CloseAll,
Adds coverage of null filename with no "/" to DS_FileCloseDest
Adds coverage of !OS_ObjectDefined 2nd check in DS_FileSetupWrite()
Adds coverage of StringTerminator branch in DS_FileCreateDest_Test()
Adds coverage of MaxPathnameLength branch in DS_FileCreatName_Test()
Adds PathBaseSeqTooLarge in DS_FileCreatName_Test()
Adds PathBaseSeqExtTooLarge in DS_FileCreatName_Test()
Adds ExtensionZero in DS_FileCreatName_Test()
Adds UtAssert fixes according to PR review
@skliper skliper mentioned this pull request Jul 5, 2022
2 tasks
@chillfig chillfig changed the title Fix #14, update code coverage, Fix #29, Fix #14, update code coverage, Jul 6, 2022
dzbaker added a commit to dzbaker/DS that referenced this pull request Jul 7, 2022
@dzbaker dzbaker merged commit 43e9e7b into nasa:main Jul 8, 2022
@chillfig chillfig deleted the lcov branch July 12, 2022 16:10
@skliper skliper added this to the Draco milestone Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants