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 #981, rework "unit-tests" to use macros #1001

Merged

Conversation

jphickey
Copy link
Contributor

@jphickey jphickey commented May 12, 2021

Describe the contribution
Update most of the conditions in the "unit tests" to use the support macros whenever possible. The macros display the
function being called as well as the return value being checked for, and therefore this makes it so the test log file can be
cross referenced back to the documentation to ensure the documented return codes are being tested.

As a nice side effect this also removes quite a bit of repetition in the test programs.

Fixes #981

Testing performed
Build and run all OSAL unit tests

Expected behavior changes
Log file produced has much more detail, and can now be cross referenced back to documentation.

System(s) tested on
Ubuntu 20.04 (native)
RTEMS 4.11 (pc686+qemu)

Additional context
See gist of complete test output log for "osal_core_UT": https://gist.github.com/jphickey/ccb739d1f1cf6b36caca73e5ee9205cf
Dependency note: PR #1000 fixes the OS_rmdir test.

Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.

Update most of the conditions in the "unit tests" to use the
support macros whenever possible.  The macros display the
function being called as well as the return value being checked
for, and therefore this makes it so the test log file can be
cross referenced back to the documentation to ensure the
documented return codes are being tested.

As a nice side effect this also removes quite a bit of
repetition in the test programs.
@jphickey jphickey force-pushed the fix-981-rework-unit-tests branch from 8d17673 to 0548239 Compare May 12, 2021 14:03
@jphickey jphickey added the CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) label May 12, 2021
@astrogeco astrogeco added CCB:Approved Indicates code review and approval by community CCB and removed CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) labels May 12, 2021
@astrogeco
Copy link
Contributor

astrogeco commented May 12, 2021

CCB:2021-05-12 APPROVED

  • Basically a rewrite of most of the unit tests
  • Most of the tests were not using the new macros like UT_Setup and UT_RetVal
  • Adds new macros like UT_Nominal_OR_NotImpl
  • Do we want to move these macros to a "higher level" so others osal tests can use these?
  • Why do we even have two sets of tests? Can we combine or move to a single directory?
    • @skliper, could this be an Intern Project?
  • The changes were tested by running the unit tests

@astrogeco astrogeco changed the base branch from main to integration-candidate May 12, 2021 18:36
@astrogeco
Copy link
Contributor

astrogeco commented May 12, 2021

@jphickey see test failures,

The following tests FAILED:
	 72 - osal_file_UT (Failed)
Makefile:125: recipe for target 'test' failed
make: *** [test] Error 8
Error: Process completed with exit code 2.

@jphickey
Copy link
Contributor Author

@jphickey see test failures,

The following tests FAILED:
	 72 - osal_file_UT (Failed)
Makefile:125: recipe for target 'test' failed
make: *** [test] Error 8
Error: Process completed with exit code 2.

Yes, as noted in the summary, this should be fixed by PR #1000 ( it is actually a FSW bug that wasn't detected by tests until now ).

@astrogeco astrogeco merged commit 09fe7b7 into nasa:integration-candidate May 12, 2021
astrogeco added a commit to nasa/cFS that referenced this pull request May 19, 2021
nasa/cFE#1482, Resolve sequence count auto-increment rollover bug

nasa/osal#985, rename hooks to handlers
nasa/osal#1000, propagate status code in OS_rmdir
nasa/osal#1001, rework "unit-tests" to use macros
nasa/osal#1003, remove extra newlines in utassert logs
nasa/osal#990, Add test for object id inline functions
nasa/osal#998, fixed invalid inputs for OS_mkdir
nasa/osal#812, Improves config guide documentation
astrogeco added a commit to nasa/cFS that referenced this pull request May 19, 2021
Combines:

nasa/cFE#1508, cFE v6.8.0-rc1+dev580
nasa/osal#1006, osal v5.1.0-rc1+dev452

Includes:

nasa/cFE#1482, Resolve sequence count auto-increment rollover bug
nasa/cFE#1491, Correctly format code block section terminator
nasa/cFE#1530, Fix typos in developer guide

nasa/osal#985, rename hooks to handlers
nasa/osal#1000, propagate status code in OS_rmdir
nasa/osal#1001, rework "unit-tests" to use macros
nasa/osal#1003, remove extra newlines in utassert logs
nasa/osal#990, Add test for object id inline functions
nasa/osal#998, fixed invalid inputs for OS_mkdir
nasa/osal#812, Improves config guide documentation
nasa/osal#987, Show CodeQL Preview
astrogeco added a commit to nasa/cFS that referenced this pull request May 19, 2021
Combines:

nasa/cFE#1508, cFE v6.8.0-rc1+dev580
nasa/osal#1006, osal v5.1.0-rc1+dev452

Includes:

nasa/cFE#1482, Resolve sequence count auto-increment rollover bug
nasa/cFE#1491, Correctly format code block section terminator
nasa/cFE#1530, Fix typos in developer guide

nasa/osal#985, rename hooks to handlers
nasa/osal#1000, propagate status code in OS_rmdir
nasa/osal#1001, rework "unit-tests" to use macros
nasa/osal#1003, remove extra newlines in utassert logs
nasa/osal#990, Add test for object id inline functions
nasa/osal#998, fixed invalid inputs for OS_mkdir
nasa/osal#812, Improves config guide documentation
nasa/osal#987, Show CodeQL Preview

Co-Authored-By: Jake Hageman <[email protected]>
Co-Authored-By: Joseph Hickey <[email protected]>
Co-Authored-By: Ariel Adams <[email protected]>
Co-Authored-By: Alex Campbell <[email protected]>
Co-Authored-By: Tobias Nießen <[email protected]>
Co-Authored-By: Jonathan Bohren <[email protected]>
Co-Authored-By: Andrei Tumbar <[email protected]>
@jphickey jphickey deleted the fix-981-rework-unit-tests branch May 26, 2021 18:48
@skliper skliper added this to the 6.0.0 milestone Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CCB:Approved Indicates code review and approval by community CCB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve consistency in the result reporting in "unit-tests"
3 participants