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 #1135, add bitmask assert macros #1136

Merged

Conversation

jphickey
Copy link
Contributor

Describe the contribution
Add a pair of macros that can confirm a value has bits set or does not have bits set. By using bitmask-aware macros, the logged
information can include both the raw/actual value as well as the specific bits being tested.

Fixes #1135

Testing performed
Build and run all tests

Expected behavior changes
None here, just adds new macros

System(s) tested on
Ubuntu

Additional context
Tested by updating the new time clock state checks to use this macro. Looks a little something like this in the log:

[BEGIN] 94 Test Clock
[ INFO] time_current_test.c:126:Testing: CFE_TIME_GetClockState, CFE_TIME_GetClockInfo
[ PASS] 94.001 time_current_test.c:145 - CFE_TIME_GetClockInfo() (0x33e0) &~ CFE_TIME_FLAG_CLKSET (0x8000)
[ PASS] 94.002 time_current_test.c:148 - CFE_TIME_GetClockInfo() (0x33e0) & CFE_TIME_FLAG_SRCINT (0x2000)
[ PASS] 94.003 time_current_test.c:149 - CFE_TIME_GetClockInfo() (0x33e0) & CFE_TIME_FLAG_SIGPRI (0x1000)
[ PASS] 94.004 time_current_test.c:150 - CFE_TIME_GetClockInfo() (0x33e0) &~ CFE_TIME_FLAG_REFERR (0x10)
[ PASS] 94.005 time_current_test.c:151 - CFE_TIME_GetClockInfo() (0x33e0) &~ CFE_TIME_FLAG_UNUSED (0xf)
[  END] 94 Test Clock           TOTAL::5     PASS::5     FAIL::0     MIR::0     TSF::0     TTF::0     WARN::0

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

Add a pair of macros that can confirm a value has bits set or
does not have bits set.  By using bitmask-aware macros, the logged
information can include both the raw/actual value as well as the
specific bits being tested.
@jphickey
Copy link
Contributor Author

Also note, although this could have been done only in the macro, such an implementation would still use == in the log (not really correct) and it would have evaluated the "mask" argument twice (not good, cannot be a function call or value with side effects). So this proposes adding a new comparison type enum instead, and thus the macro only evaluates arguments once, and we can use a more correct operator in the log (&/&~) so its clear we are not checking for equality here.

@jphickey jphickey added the CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) label Aug 25, 2021
@astrogeco astrogeco changed the base branch from main to integration-candidate August 27, 2021 15:21
@astrogeco astrogeco merged commit 0a25c63 into nasa:integration-candidate Aug 27, 2021
astrogeco added a commit to nasa/cFS that referenced this pull request Aug 27, 2021
@astrogeco astrogeco removed the CCB:Ready Pull request is ready for discussion at the Configuration Control Board (CCB) label Sep 1, 2021
@astrogeco
Copy link
Contributor

CCB:2021-09-01 APPROVED

@astrogeco astrogeco added the CCB:Approved Indicates code review and approval by community CCB label Sep 1, 2021
astrogeco added a commit to nasa/cFS that referenced this pull request Sep 1, 2021
**Combines**

nasa/cFE#1885,              v6.8.0-rc1+dev980
nasa/osal#1138,             v5.1.0-rc1+dev598
nasa/cFS-GroundSystem#195,  v2.2.0-rc1+dev63

**Includes**

*cFE*

nasa/cFE#1870, Add SB API test cases
nasa/cFE#1869, Add ES API test cases
nasa/cFE#1872, Add TBL API test cases
nasa/cFE#1871, Add FS API test cases
nasa/cFE#1860, Add Time Clock Test
nasa/cFE#1862, EVS coverage test
nasa/cFE#1876, SB test improvements
nasa/cFE#1865, CFE_TBL_Modified: Test CRC, updated flag
nasa/cFE#1881, Improve EVS code coverage
nasa/cFE#1877, add call to CFE_ES_ExitChildTask
nasa/cFE#1902, Incorrect OSAL Format in Users Guide Reference
nasa/cFE#1884, Improve FS coverage
nasa/cFE, Improve MSG branch coverage
nasa/cFE#1891, Improve resource ID branch coverage
nasa/cFE#1894, Improve SBR branch coverage
nasa/cFE#1896, Fix #1895, Improve TIME branch coverage
nasa/cFE#1904, Improve TBL code coverage
nasa/cFE#1864, Support custom PSP directory
nasa/cFE#1913, Update time tests to use bitmask check macros
nasa/cFE#1923, remove extra word in comment

*osal*

nasa/osal#1136, add bitmask assert macros

*cFS-GroundSystem*

nasa/cFS-GroundSystem#190, Fix #189, Virtualenv and Pipenv .gitignore support
nasa/cFS-GroundSystem#194, Fix doc, comment, and message typos

Co-authored-by: Jacob Hageman           <skliper@users.noreply.github.com>
Co-authored-by: Joseph Hickey           <jphickey@users.noreply.github.com>
Co-authored-by: Alex Campbell           <zanzaben@users.noreply.github.com>
Co-authored-by: Ariel Adams             <ArielSAdamsNASA@users.noreply.github.com>
Co-authored-by: Jose F Martinez Pedraza <pepepr08@users.noreply.github.com>
Co-authored-by: Avi                     <thnkslprpt@users.noreply.github.com>
Co-authored-by: Paul                    <pavll@users.noreply.github.com>
@skliper skliper added this to the 6.0.0 milestone Sep 24, 2021
@jphickey jphickey deleted the fix-1135-bitmask-asserts branch February 23, 2022 18:25
jphickey added a commit to jphickey/osal that referenced this pull request Aug 10, 2022
jphickey added a commit to jphickey/osal that referenced this pull request Aug 10, 2022
Corrects warnings/errors in doxygen userguide
jphickey added a commit to jphickey/osal that referenced this pull request Aug 10, 2022
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.

Add UtAssert bit field check macros
4 participants