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 #346, Adds library build, functional, and coverage test to CI #403

Merged
merged 1 commit into from
Apr 28, 2020
Merged
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
71 changes: 52 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,55 @@ addons:
sources:
- ubuntu-toolchain-r-test
packages:
- cmake

before_install:
- sudo apt-get install cppcheck

script:
# Check versions
- cppcheck --version

#cppcheck flight software osal/src/bsp, osal/src/os
- cppcheck --force --inline-suppr --std=c99 --language=c --error-exitcode=1 --enable=warning,performance,portability,style --suppress=variableScope --inconclusive src/bsp src/os 2>cppcheck_flight_osal.txt
- |
if [[ -s cppcheck_flight_osal.txt ]]; then
echo "You must fix cppcheck errors before submitting a pull request"
echo ""
cat cppcheck_flight_osal.txt
exit -1
fi
- cmake cppcheck lcov

_functional_test: &functional_test
script:
# Check versions
- cppcheck --version

#cppcheck flight software osal/src/bsp, osal/src/os
- cppcheck --force --inline-suppr --std=c99 --language=c --error-exitcode=1
--enable=warning,performance,portability,style --suppress=variableScope
--inconclusive --quiet src/bsp src/os 2>cppcheck_flight_osal.txt
- |
if [[ -s cppcheck_flight_osal.txt ]]; then
echo "You must fix cppcheck errors before submitting a pull request"
echo ""
cat cppcheck_flight_osal.txt
exit -1
fi
# Setup
- mkdir build
- cd build

# Prep and build
- cmake -DENABLE_UNIT_TESTS=true -DOSAL_SYSTEM_OSTYPE=posix -DOSAL_SYSTEM_BSPTYPE=pc-linux
-DOSAL_INCLUDEDIR=src/bsp/pc-linux/config/ ..
- make

# lcov capture pre-execution
- lcov --rc lcov_branch_coverage=1 --capture --initial --directory ./ --output-file coverage_base.info

# Test
- make test

# lcov post run analysis
- lcov --rc lcov_branch_coverage=1 --capture --directory ./ --output-file coverage_test.info
- lcov --rc lcov_branch_coverage=1 --add-tracefile coverage_base.info --add-tracefile
coverage_test.info --output-file coverage_total.info
- lcov --rc lcov_branch_coverage=1 --remove coverage_total.info '*unit-test-coverage*'
--output-file coverage_filtered.info
- genhtml coverage_filtered.info --output-directory lcov

jobs:
include:
- env: BUILDTYPE=release OSAL_OMIT_DEPRECATED=true
<<: *functional_test
- env: BUILDTYPE=release OSAL_OMIT_DEPRECATED=false
<<: *functional_test
- env: BUILDTYPE=debug OSAL_OMIT_DEPRECATED=true
<<: *functional_test
- env: BUILDTYPE=debug OSAL_OMIT_DEPRECATED=false
<<: *functional_test