1
1
# Taken from amazon-freertos repository
2
2
cmake_minimum_required (VERSION 3.13 )
3
3
set (BINARY_DIR ${CMAKE_BINARY_DIR} )
4
+
4
5
# reset coverage counters
5
6
execute_process (
6
- COMMAND lcov --directory ${CMAKE_BINARY_DIR} --base-directory
7
- ${CMAKE_BINARY_DIR} --zerocounters
7
+ COMMAND lcov --directory ${CMAKE_BINARY_DIR}
8
+ --base-directory ${CMAKE_BINARY_DIR}
9
+ --zerocounters
8
10
COMMAND mkdir -p ${CMAKE_BINARY_DIR} /coverage )
9
- # make the initial/baseline capture a zeroed out files
11
+
12
+ # make the initial/baseline capture a zeroed out files
10
13
execute_process (
11
- COMMAND
12
- lcov --directory ${CMAKE_BINARY_DIR} --base-directory ${CMAKE_BINARY_DIR}
13
- --initial --capture --rc lcov_branch_coverage=1 --rc
14
- genhtml_branch_coverage=1
15
- --output-file=${CMAKE_BINARY_DIR}/base_coverage.info )
16
- file (GLOB files "${CMAKE_BINARY_DIR} /bin/tests/*" )
14
+ COMMAND lcov --directory ${CMAKE_BINARY_DIR}
15
+ --base-directory ${CMAKE_BINARY_DIR}
16
+ --initial
17
+ --capture
18
+ --rc lcov_branch_coverage=1
19
+ --rc genhtml_branch_coverage=1
20
+ --output-file=${CMAKE_BINARY_DIR}/base_coverage.info
21
+ --include "*source*" )
17
22
23
+ file (GLOB files "${CMAKE_BINARY_DIR} /bin/tests/*" )
18
24
set (REPORT_FILE ${CMAKE_BINARY_DIR} /utest_report.txt )
19
25
file (WRITE ${REPORT_FILE} "" )
26
+
20
27
# execute all files in bin directory, gathering the output to show it in CI
21
28
foreach (testname ${files} )
22
29
get_filename_component (test ${testname} NAME_WLE )
@@ -34,18 +41,24 @@ execute_process(COMMAND ruby ${CMOCK_DIR}/vendor/unity/auto/parse_output.rb -xml
34
41
35
42
# capture data after running the tests
36
43
execute_process (
37
- COMMAND
38
- lcov --capture --rc lcov_branch_coverage=1 --rc genhtml_branch_coverage=1
39
- --base-directory ${CMAKE_BINARY_DIR} --directory ${CMAKE_BINARY_DIR}
40
- --output-file ${CMAKE_BINARY_DIR} /second_coverage.info )
44
+ COMMAND lcov --capture
45
+ --rc lcov_branch_coverage=1
46
+ --rc genhtml_branch_coverage=1
47
+ --base-directory ${CMAKE_BINARY_DIR}
48
+ --directory ${CMAKE_BINARY_DIR}
49
+ --output-file ${CMAKE_BINARY_DIR} /second_coverage.info
50
+ --include "*source*" )
41
51
42
52
# combile baseline results (zeros) with the one after running the tests
43
53
execute_process (
44
- COMMAND
45
- lcov --base-directory ${CMAKE_BINARY_DIR} --directory ${CMAKE_BINARY_DIR}
46
- --add-tracefile ${CMAKE_BINARY_DIR} /base_coverage.info --add-tracefile
47
- ${CMAKE_BINARY_DIR} /second_coverage.info --output-file
48
- ${CMAKE_BINARY_DIR} /coverage.info --no-external --rc lcov_branch_coverage=1 )
54
+ COMMAND lcov --base-directory ${CMAKE_BINARY_DIR}
55
+ --directory ${CMAKE_BINARY_DIR}
56
+ --add-tracefile ${CMAKE_BINARY_DIR} /base_coverage.info
57
+ --add-tracefile ${CMAKE_BINARY_DIR} /second_coverage.info
58
+ --output-file ${CMAKE_BINARY_DIR} /coverage.info
59
+ --no-external
60
+ --rc lcov_branch_coverage=1 )
61
+
49
62
execute_process (
50
63
COMMAND
51
64
genhtml --rc lcov_branch_coverage=1 --branch-coverage --output-directory
0 commit comments