From 2373364cae2e038bf0097ac4a8ff39c3eae10410 Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Wed, 1 Apr 2020 17:30:11 -0400 Subject: [PATCH] Fix #346, Add test and coverage report to CI --- .travis.yml | 70 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7bf2b9177..d7cb92afe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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