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

sample_app Integration candidate: 2021-03-05 #130

Merged
merged 5 commits into from
Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
cmake_minimum_required(VERSION 2.6.4)
project(CFE_SAMPLE_APP C)

include_directories(fsw/mission_inc)
include_directories(fsw/platform_inc)

# Include the public API from sample_lib to demonstrate how
# to call library-provided functions
include_directories(${sample_lib_MISSION_DIR}/fsw/public_inc)

# Create the app module
add_cfe_app(sample_app fsw/src/sample_app.c)

# Include the public API from sample_lib to demonstrate how
# to call library-provided functions
add_cfe_app_dependency(sample_app sample_lib)

# Add table
add_cfe_tables(sampleAppTable fsw/tables/sample_app_tbl.c)

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ sample_app is an example for how to build and link an application in cFS. See al

## Version History

### Development Build: 1.2.0-rc1+dev48

- Fix #126, simplify build to use wrappers and interface libs
- Fix #128, Add Testing Tools to the Security Policy
- See <https://github.com/nasa/sample_app/pull/130>

### Development Build: 1.2.0-rc1+dev37

- Documentation: Add `Security.md` with instructions on reporting vulnerabilities
Expand Down
32 changes: 29 additions & 3 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,38 @@

To report a vulnerability for the sample_app subsystem please [submit an issue](https://github.com/nasa/sample_app/issues/new/choose).

For general cFS vulnerabilities please [open a cFS framework issue](https://github.com/nasa/cfs/issues/new/choose) and see our [top-level security policy](https://github.com/nasa/cFS/security/policy).
For general cFS vulnerabilities please [open a cFS framework issue](https://github.com/nasa/cfs/issues/new/choose) and see our [top-level security policy](https://github.com/nasa/cFS/security/policy) for additional information.

In either case please use the "Bug Report" template and provide as much information as possible. Apply appropraite labels for each report. For security related reports, tag the issue with the "security" label.

## Testing

**Disclaimer: nasa/sample_app is not responsible for any liability incurred under the [Apache License 2.0](https://github.com/nasa/sample_app/blob/main/LICENSE).**

Testing is an important aspect our team values to improve sample_app.

To view tools used for the cFS bundle, see our [top-level security policy](https://github.com/nasa/cFS/security/policy).

### CodeQL

The [sample_app CodeQL GitHub Actions workflow](https://github.com/nasa/sample_app/actions/workflows/codeql-build.yml) is available to the public. To review the results, fork the sample_app repository and run the CodeQL workflow.

CodeQL is ran for every push and pull-request on all branches of sample_app in GitHub Actions.

For the CodeQL GitHub Actions setup, visit https://github.com/github/codeql-action.

### Cppcheck

The [sample_app Cppcheck GitHub Actions workflow and results](https://github.com/nasa/sample_app/actions/workflows/static-analysis.yml) are available to the public. To view the results, select a workflow and download the artifacts.

Cppcheck is ran for every push on the main branch and every pull request on all branches of sample_app in Github Actions.

For more information about Cppcheck, visit http://cppcheck.sourceforge.net/.

## Additional Support

For additional support, email us at cfs-program@lists.nasa.gov. For help using OSAL and cFS, [subscribe to our mailing list](https://lists.nasa.gov/mailman/listinfo/cfs-community) that includes all the community members/users of the NASA core Flight Software (cFS) product line. The mailing list is used to communicate any information related to the cFS product such as current releases, bug findings and fixes, enhancement requests, community meeting notifications, sending out meeting minutes, etc.
For additional support, submit a GitHub issue. You can also email the cfs community at cfs-community@lists.nasa.gov.

You can subscribe to the mailing list [here](https://lists.nasa.gov/mailman/listinfo/cfs-community) that includes all the community members/users of the NASA core Flight Software (cFS) product line. The mailing list is used to communicate any information related to the cFS product such as current releases, bug findings and fixes, enhancement requests, community meeting notifications, sending out meeting minutes, etc.

If you wish to report a cybersecurity incident or concern please contact the NASA Security Operations Center either by phone at 1-877-627-2732 or via email address soc@nasa.gov.
If you wish to report a cybersecurity incident or concern, please contact the NASA Security Operations Center either by phone at 1-877-627-2732 or via email address soc@nasa.gov.
2 changes: 1 addition & 1 deletion fsw/src/sample_app_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

/* Development Build Macro Definitions */

#define SAMPLE_APP_BUILD_NUMBER 37 /*!< Development Build: Number of commits since baseline */
#define SAMPLE_APP_BUILD_NUMBER 48 /*!< Development Build: Number of commits since baseline */
#define SAMPLE_APP_BUILD_BASELINE \
"v1.2.0-rc1" /*!< Development Build: git tag that is the base for the current development */

Expand Down
66 changes: 17 additions & 49 deletions unit-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,60 +16,28 @@
# - "coveragetest" contains source code for the actual unit test cases
# The primary objective is to get line/path coverage on the FSW
# code units.
# - "wrappers" contains wrappers for the FSW code. The wrapper adds
# any UT-specific scaffolding to facilitate the coverage test, and
# includes the unmodified FSW source file.
#

set(UT_NAME sample_app)

# Use the UT assert public API, and allow direct
# inclusion of source files that are normally private
include_directories(${osal_MISSION_DIR}/ut_assert/inc)
include_directories(${PROJECT_SOURCE_DIR}/fsw/src)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc)

# Generate a dedicated "testrunner" executable that executes the tests for each FSW code unit
# Although sample_app has only one source file, this is done in a loop such that
# the general pattern should work for several files as well.
foreach(SRCFILE sample_app.c)
get_filename_component(UNITNAME "${SRCFILE}" NAME_WE)

set(TESTNAME "${UT_NAME}-${UNITNAME}")
set(UNIT_SOURCE_FILE "${CFE_SAMPLE_APP_SOURCE_DIR}/fsw/src/${UNITNAME}.c")
set(TESTCASE_SOURCE_FILE "coveragetest/coveragetest_${UNITNAME}.c")

# Compile the source unit under test as a OBJECT
add_library(ut_${TESTNAME}_object OBJECT
${UNIT_SOURCE_FILE}
)

# Apply the UT_COVERAGE_COMPILE_FLAGS to the units under test
# This should enable coverage analysis on platforms that support this
target_compile_options(ut_${TESTNAME}_object PRIVATE ${UT_COVERAGE_COMPILE_FLAGS})

# Compile a test runner application, which contains the
# actual coverage test code (test cases) and the unit under test
add_executable(${TESTNAME}-testrunner
${TESTCASE_SOURCE_FILE}
$<TARGET_OBJECTS:ut_${TESTNAME}_object>
)

# This also needs to be linked with UT_COVERAGE_LINK_FLAGS (for coverage)
# This is also linked with any other stub libraries needed,
# as well as the UT assert framework
target_link_libraries(${TESTNAME}-testrunner
${UT_COVERAGE_LINK_FLAGS}
ut_sample_lib_stubs
ut_cfe-core_stubs
ut_assert
)

# Add it to the set of tests to run as part of "make test"
add_test(${TESTNAME} ${TESTNAME}-testrunner)
foreach(TGT ${INSTALL_TARGET_LIST})
install(TARGETS ${TESTNAME}-testrunner DESTINATION ${TGT}/${UT_INSTALL_SUBDIR})
endforeach()

endforeach()

# Add a coverate test excutable called "sample_app-ALL" that
# covers all of the functions in sample_app.
#
# Also note in a more complex app/lib the coverage test can also
# be broken down into smaller units (in which case one should use
# a unique suffix other than "ALL" for each unit). For example,
# OSAL implements a separate coverage test per source unit.
add_cfe_coverage_test(sample_app ALL
"coveragetest/coveragetest_sample_app.c"
"${CFE_SAMPLE_APP_SOURCE_DIR}/fsw/src/sample_app.c"
)

# The sample_app uses library functions provided by sample_lib so must be linked
# with the sample_lib stub library (this is mainly just an example of how this
# can be done).
add_cfe_coverage_dependency(sample_app ALL sample_lib)