Skip to content

Commit

Permalink
Fix #346, Add test and coverage report to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Apr 15, 2020
1 parent f59b16b commit 2373364
Showing 1 changed file with 51 additions and 19 deletions.
70 changes: 51 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,54 @@ 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 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 --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

0 comments on commit 2373364

Please sign in to comment.