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

[nasa/nos3#176] Unit Tests #14

Merged
merged 4 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
[nasa/nos3#176] Baseline unit-tests from NASA/sample_app v1.3.0-rc4 t…
…o start from;
  • Loading branch information
jlucas9 committed Jul 23, 2024
commit a76fc33c08381ae3793777783f071a80d3d45296
8 changes: 8 additions & 0 deletions fsw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@ aux_source_directory(src APP_SRC_FILES)

# Create the app module
add_cfe_app(sample ${APP_SRC_FILES})

# If UT is enabled, then add the tests from the subdirectory
# Note that this is an app, and therefore does not provide
# stub functions, as other entities would not typically make
# direct function calls into this application.
if (ENABLE_UNIT_TESTS)
add_subdirectory(unit-test)
endif (ENABLE_UNIT_TESTS)
43 changes: 43 additions & 0 deletions fsw/unit-test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
##################################################################
#
# Coverage Unit Test build recipe
#
# This CMake file contains the recipe for building the sample unit tests.
# It is invoked from the parent directory when unit tests are enabled.
#
##################################################################

#
#
# NOTE on the subdirectory structures here:
#
# - "inc" provides local header files shared between the coveragetest,
# wrappers, and overrides source code units
# - "coveragetest" contains source code for the actual unit test cases
# The primary objective is to get line/path coverage on the FSW
# code units.
#

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


# Add a coverage test executable 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)

Loading