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 #285, Refactor OSAL to avoid inclusion of C files #443

Merged

Conversation

jphickey
Copy link
Contributor

@jphickey jphickey commented May 4, 2020

Describe the contribution
Use separate source files and CMake-based source selection
based on feature configuration, rather than using the C
preprocessor for including/excluding different OSAL function
groups.

Refactor all implementation units to provide a separate header
file for each functional group/subsystem. Remove "static"
declaration on internal helper functions so they can be invoked
from unit test.

Fixes #285
Also Fix #214 and fix #195 (trivial fixes rolled in as part of refactoring)

Testing performed
Build and execute CFE for VxWorks, POSIX and RTEMS. Sanity check of CFE functions. Confirm all unit tests passing and coverage test of VxWorks is working. Also confirm build with each inclusion/exclusion of each option (loader, network, shell) and with/without OMIT_DEPRECATED.

Expected behavior changes
No impact to runtime code. Changes build system considerably, however.

  • No more user-maintained osconfig.h file - now replaced by a cmake configuration file
  • Break up low level implementation into small, separate subsystem units, with a separate header file for each one.

System(s) tested on
Ubuntu 20.04 LTS 64 bit (build host, native test)
i686-rtems4.11 cross build using QEMU
ppc-vxworks6.9 cross build using MCP750

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

@jphickey jphickey requested review from skliper and astrogeco May 4, 2020 13:43
@jphickey
Copy link
Contributor Author

jphickey commented May 4, 2020

This is a rebase of original PR #427 which was CCB reviewed in a special session on 2020-04-22

@jphickey jphickey added the CCB:Approved Indicates code review and approval by community CCB label May 4, 2020
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.

Is osal/src/unit-test-coverage/posix/adaptors/Makefile still used for anything?

@jphickey
Copy link
Contributor Author

jphickey commented May 4, 2020

Is osal/src/unit-test-coverage/posix/adaptors/Makefile still used for anything?

Actually the entire POSIX subdirectory in coverage is more or less a placeholder for future use. We could remove the entire thing with no loss of function, it was only a starting point for someone to actually implement.

Should I do that?

@skliper
Copy link
Contributor

skliper commented May 4, 2020

Is osal/src/unit-test-coverage/posix/adaptors/Makefile still used for anything?

Actually the entire POSIX subdirectory in coverage is more or less a placeholder for future use. We could remove the entire thing with no loss of function, it was only a starting point for someone to actually implement.

Should I do that?

I thought we were using CMake, even for the coverage build? Just not following why any of the adaptor/Makefile files still exist? If they are useful or a placeholder, no need to remove.

@jphickey
Copy link
Contributor Author

jphickey commented May 4, 2020

I thought we were using CMake, even for the coverage build? Just not following why any of the adaptor/Makefile files still exist? If they are useful or a placeholder, no need to remove.

Correct. Makefile is not used and not useful in any circumstance.

But on second look, the code in this subdir is also no longer even useful as a template for a future developer because it references files which no longer exist and the README is outdated etc etc.

That's why I'm thinking just remove the entire subdir. New developer should use VxWorks as the reference point if there is a desire to implement coverage on POSIX. Existing template for POSIX is probably of negative usefulness as it will point in wrong direction, and no time budget to update it right now.

@skliper
Copy link
Contributor

skliper commented May 4, 2020

I'd suggest removing whatever Makefile/README's are no longer applicable. If all of POSIX is out of date feel free to remove.

@astrogeco
Copy link
Contributor

@skliper @jphickey can we remove but open an issue to update the template and docs? I figure new developers will probably start on POSIX as opposed to VxWorks?

@astrogeco
Copy link
Contributor

@jphickey can we split this up into smaller commits?

Use separate source files and CMake-based source selection
to configure OSAL features, rather than using the C preprocessor.

All implementation units now provide a separate header
file for each functional group/subsystem.

This commit covers the OSAL main FSW code and particularly the
"portable" implementation blocks to follow this model.  Includes
minor updates to UT stubs due to header file changes.
Use separate source files and CMake-based source selection
to configure OSAL features, rather than using the C preprocessor.

This commit covers the OSAL coverage test.  This had been using
inclusion of a C file to allow access to static functions/variables.
This updates all UT code to correspond with the FSW code changes.
All "static" helper functions become non-static so unit test can
invoke directly.  Prototype is in a private header, so
the functions are still not exposed in the API.
@skliper
Copy link
Contributor

skliper commented May 4, 2020

@skliper @jphickey can we remove but open an issue to update the template and docs? I figure new developers will probably start on POSIX as opposed to VxWorks?

See #412 as an existing issue to add the POSIX coverage tests.

Permissive mode is required for testing on POSIX when
running as a normal (non-root) user.
@jphickey
Copy link
Contributor Author

jphickey commented May 4, 2020

Force Pushed to split into several commits. This splits between FSW and coverage test changes. The bulk of the file-level changes are actually on the unit-test-coverage stuff.

In particular @skliper please have a look at the last commit a9c0205, which is the suggested method to enable permissive mode for CI now.

@astrogeco astrogeco changed the base branch from master to integration-candidate May 4, 2020 19:36
@astrogeco astrogeco merged commit a12baba into nasa:integration-candidate May 4, 2020
jphickey added a commit that referenced this pull request May 4, 2020
The "include()" cmake function only read the first file when passed a list.
Adding a foreach loop supports allowing a list of files which is useful
for adding and override/addendum file to a base config.
jphickey added a commit that referenced this pull request May 4, 2020
The "include()" cmake function only read the first file when passed a list.
Adding a foreach loop supports allowing a list of files which is useful
for adding and override/addendum file to a base config.
@skliper
Copy link
Contributor

skliper commented May 4, 2020

I'm good with a9c0205

jphickey added a commit that referenced this pull request May 5, 2020
Definitions within osconfig.h are referenced by doxygen
in other source code files, so this should also include
doxygen-formatted descriptions of each macro defined by
this template file.
@jphickey jphickey deleted the fix-285-code-selection branch May 5, 2020 18:13
@skliper skliper added this to the 5.1.0 milestone Jun 1, 2020
jphickey pushed 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 CCB:FastTrack
Projects
None yet
3 participants