summaryrefslogtreecommitdiff
path: root/FreeRTOS/Test/CMock/Readme.md
blob: 059f65303f6c04878128f0a0270836d98d2a34e6 (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# FreeRTOS Kernel Unit Tests

## Prerequisites as tested
GCC
```
gcc: gcc (GCC) 9.2.0
```
LCOV
```
lcov: LCOV version 1.14-6-g40580cd
```
Make
```
GNU Make 3.82
```
Ruby
```
ruby 2.0.0p648 (2015-12-16) [x86_64-linux]
```
Doxygen (optional)
```
1.8.5
```
Python (optional, required for coverage filtering)
```
Python 3.8 or later
```
Cflow (optional, required for coverage filtering)
```
cflow (GNU cflow) 1.6
```
## How to run
```
$ make help
Usage: $ make <unit>

 where <unit> is one of: queue doc all run run_formatted run_col
 run_col_formatted coverage
```
Explanation
```
$ make queue
```
Would build the kernel queue unit tests and put the executable in build/bin

```
$ make doc
```
Would generate the doxygen documentation in build/doc

```
$ make run | run_formatted | run_col | run_col_formatted
```
Would build all unit tests and runs them one after the other with different
options between normal and formatted and colored for easily spotting errors

```
$ make coverage
```
Would build all unit tests, runs them one after the other, then generates html code
coverage and places them in build/coverage with initial file index.html

## Running individual tests
From each test directory, you can build, run the test, and generate gcov coverage with the default "all" target like so:
```
$ make -C list
```
For convenience, a "gcov" target is also provided.
```
$ make -C list gcov
```
Alternatively, you can generate filtered coverage with the "lcov" target:
```
$ make -C list lcov
```
You can also generate an html coverage report with the lcovhtml target:
```
$ make -C list lcovhtml
```

## Coverage Filtering ##
Coverage filtering is meant to remove "unintentional" or "incidental" test coverage that is generated by other test cases which call a specific function but are not meant to test that function.
In order to use coverage filtering and the associated lcov and lcovhtml targets, you must install the "optional" requirements listed above.


Additionally, you must also document which functions you are targeting inside each _utest.c file with a tag inside each file similar to the following:
```
@coverage vFunctionNameHere vAnotherFunctionNameHere
```