File tree Expand file tree Collapse file tree 3 files changed +18
-13
lines changed
Expand file tree Collapse file tree 3 files changed +18
-13
lines changed Original file line number Diff line number Diff line change 1717 run : |
1818 sudo apt-get update
1919 sudo apt-get install -y cmake build-essential libgtest-dev lcov
20+ cd /usr/src/googletest
21+ sudo cmake .
22+ sudo make
23+ sudo make install
2024
2125 - name : Configure & build (with coverage)
2226 run : cmake -S . -B build \
3438 run : ctest --test-dir build --output-on-failure
3539
3640 - name : Capture coverage
37- run : |
38- cd build
39- # TODO: remove
40- find . -name '*.gcda'
41- lcov -d . -c -o coverage.info
42- # move the report back up so the next steps can find it
43- mv coverage.info ..
41+ run : lcov -d build -c -o coverage.info
4442
4543 - name : Filter coverage
4644 run : lcov -r coverage.info '/usr/*' '*/test/*' -o coverage.filtered.info
Original file line number Diff line number Diff line change @@ -3,12 +3,10 @@ project(capancdt_proximity_sensor_lib LANGUAGES CXX)
33
44option (ENABLE_COVERAGE "Enable coverage reporting" OFF )
55if (ENABLE_COVERAGE)
6- message (STATUS "Building with coverage support" )
7- # GCC/Clang coverage instrumentation
8- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -O0 -g" )
9- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage -O0 -g" )
10- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage" )
11- set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage" )
6+ message (STATUS "Building with coverage instrumentation" )
7+ # apply to *all* subsequent targets
8+ add_compile_options (--coverage -O0 -g)
9+ add_link_options (--coverage)
1210endif ()
1311
1412set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /lib)
Original file line number Diff line number Diff line change @@ -188,6 +188,15 @@ Install GTest and lcov for testing. On ubuntu you can do this with:
188188sudo apt-get install libgtest-dev lcov
189189```
190190
191+ You may need to build GTest:
192+
193+ ``` bash
194+ cd /usr/src/googletest
195+ sudo cmake .
196+ sudo make
197+ sudo cp * .a /usr/lib
198+ ```
199+
191200Build the project:
192201
193202``` bash
You can’t perform that action at this time.
0 commit comments