Commit 33fa0dd
committed
tests/conftest: record coordinator's coverage
Recording the coordinator's coverage is useful to determine, which parts
of the component are executed during tests.
crossbar runs labgrid's coordinator component as a guest worker. Guest
workers are spawned as subprocesses by crossbar. Therefore recording
coverage of the coordinator component does not work out of the box.
To allow recording coordinator coverage, set the coverage command line
tool as the excutable in the crossbar configuration, whose 'run'
subcommand works as a drop-in replacement for 'python'. This way the
coverage of the guest worker is recorded separately. The
'--parallel-mode' switch makes coverage add a unique suffix to the
coverage data file. Set the location of the coverage data via
'--data-file' to the root directory. pytest-cov automatically combines
the coverage data in this directory.
Since the crossbar process is forcefully terminated during the tests,
the coverage data can not be written. Since the coverage tool registers
an atexit SIGTERM handler to write its data, send crossbar SIGTERM, wait
for any remaining output and the process to exit.
Now the coverage data contains labgrid's coordinator component.
Signed-off-by: Bastian Krause <bst@pengutronix.de>1 parent 7a73dfc commit 33fa0dd
1 file changed
+34
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
101 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
102 | 127 | | |
103 | 128 | | |
104 | | - | |
| 129 | + | |
105 | 130 | | |
106 | 131 | | |
107 | 132 | | |
| |||
116 | 141 | | |
117 | 142 | | |
118 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
119 | 147 | | |
120 | | - | |
121 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
122 | 152 | | |
123 | 153 | | |
124 | 154 | | |
| |||
0 commit comments