Skip to content

Commit af96893

Browse files
committed
Fix #346, Add test and coverage report to CI
1 parent f59b16b commit af96893

File tree

1 file changed

+51
-19
lines changed

1 file changed

+51
-19
lines changed

.travis.yml

+51-19
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,54 @@ addons:
88
sources:
99
- ubuntu-toolchain-r-test
1010
packages:
11-
- cmake
12-
13-
before_install:
14-
- sudo apt-get install cppcheck
15-
16-
script:
17-
# Check versions
18-
- cppcheck --version
19-
20-
#cppcheck flight software osal/src/bsp, osal/src/os
21-
- 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
22-
- |
23-
if [[ -s cppcheck_flight_osal.txt ]]; then
24-
echo "You must fix cppcheck errors before submitting a pull request"
25-
echo ""
26-
cat cppcheck_flight_osal.txt
27-
exit -1
28-
fi
29-
11+
- cmake cppcheck lcov
12+
13+
_functional_test: &functional_test
14+
script:
15+
# Check versions
16+
- cppcheck --version
17+
18+
#cppcheck flight software osal/src/bsp, osal/src/os
19+
- cppcheck --force --inline-suppr --std=c99 --language=c --error-exitcode=1
20+
--enable=warning,performance,portability,style --suppress=variableScope
21+
--inconclusive --quiet src/bsp src/os 2>cppcheck_flight_osal.txt
22+
- |
23+
if [[ -s cppcheck_flight_osal.txt ]]; then
24+
echo "You must fix cppcheck errors before submitting a pull request"
25+
echo ""
26+
cat cppcheck_flight_osal.txt
27+
exit -1
28+
fi
29+
30+
# Setup
31+
- mkdir build
32+
- cd build
33+
34+
# Prep and build
35+
- cmake -DENABLE_UNIT_TESTS=true -DOSAL_SYSTEM_OSTYPE=posix -DOSAL_SYSTEM_BSPTYPE=pc-linux
36+
-DOSAL_INCLUDEDIR=src/bsp/pc-linux/config/ ..
37+
- make
38+
39+
# lcov capture pre-execution
40+
- lcov --rc lcov_branch_coverage=1 --capture --initial --directory ./ --output-file coverage_base.info
41+
42+
# Test
43+
- make test
44+
45+
# lcov post run analysis
46+
- lcov --rc lcov_branch_coverage=1 --capture --directory ./ --output-file coverage_test.info
47+
- lcov --rc lcov_branch_coverage=1 --add-tracefile coverage_base.info --add-tracefile
48+
coverage_test.info --output-file coverage_total.info
49+
- lcov --remove coverage_total.info '*unit-test-coverage*' --output-file coverage_filtered.info
50+
- genhtml coverage_filtered.info --output-directory lcov
51+
52+
jobs:
53+
include:
54+
- env: BUILDTYPE=release OSAL_OMIT_DEPRECATED=true
55+
<<: *functional_test
56+
- env: BUILDTYPE=release OSAL_OMIT_DEPRECATED=false
57+
<<: *functional_test
58+
- env: BUILDTYPE=debug OSAL_OMIT_DEPRECATED=true
59+
<<: *functional_test
60+
- env: BUILDTYPE=debug OSAL_OMIT_DEPRECATED=false
61+
<<: *functional_test

0 commit comments

Comments
 (0)