-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·29 lines (22 loc) · 856 Bytes
/
Copy pathbuild.sh
File metadata and controls
executable file
·29 lines (22 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Print every line, fail if any line fails
set -xe
# Save for later
BASE_DIR=${PWD}
# Build CMake Project
export CC=${CC:-gcc}
export CXX=${CXX:-g++}
GCOV=${GCOV:-gcov}
cd cmake_project
rm -rf build/
mkdir build && cd build
cmake .. -G Ninja
ninja
# Run unit tests
ctest
# Run fastcov with smart branch filtering, as well as system header (/usr/include) and cmake project test file filtering
# ${BASE_DIR}/fastcov.py -t ExampleTest --gcov "${GCOV}" --branch-coverage --include cmake_project/src/ --verbose --lcov -o example.info
${BASE_DIR}/fastcov.py -t ExampleTest --gcov "${GCOV}" --branch-coverage --exclude /usr/include cmake_project/test/ --verbose --lcov -o example.info
# Generate report with lcov's genhtml
genhtml --branch-coverage example.info -o coverage_report
echo "Now open ${PWD}/coverage_report/index.html in a browser"