Document how to get code coverage. (#339)
* Document how to get code coverage. Change-Id: If7eae6008ad0394490885f88b6edb8436d9f54f3 * Remove (hopefully insignificant) whitespace. Change-Id: Ie4079dd2998c616ae5b6e5b031e29cea5f11d9f8bscan_tunnel v2018.12.0
parent
42be17aed6
commit
c3c76bfafa
26
HACKING
26
HACKING
|
@ -77,6 +77,32 @@ patch:
|
||||||
src/openocd -s ../tcl -f /path/to/openocd.cfg
|
src/openocd -s ../tcl -f /path/to/openocd.cfg
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
- Runtime coverage testing
|
||||||
|
|
||||||
|
Apply the following patch to prevent OpenOCD from killing itself:
|
||||||
|
@code
|
||||||
|
--- a/src/openocd.c
|
||||||
|
+++ b/src/openocd.c
|
||||||
|
@@ -372,8 +372,6 @@ int openocd_main(int argc, char *argv[])
|
||||||
|
|
||||||
|
if (ERROR_FAIL == ret)
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
- else if (ERROR_OK != ret)
|
||||||
|
- exit_on_signal(ret);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Configure your OpenOCD binary with coverage support as follows:
|
||||||
|
@code
|
||||||
|
LDFLAGS="-fprofile-arcs -ftest-coverage"
|
||||||
|
CFLAGS="-fprofile-arcs -ftest-coverage" ./configure
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
Now every time OpenOCD is run, coverage info in your build directory is
|
||||||
|
updated. Running `gcov src/path/file.c` will generate a report.
|
||||||
|
|
||||||
Please consider performing these additonal checks where appropriate
|
Please consider performing these additonal checks where appropriate
|
||||||
(especially Clang Static Analyzer for big portions of new code) and
|
(especially Clang Static Analyzer for big portions of new code) and
|
||||||
mention the results (e.g. "Valgrind-clean, no new Clang analyzer
|
mention the results (e.g. "Valgrind-clean, no new Clang analyzer
|
||||||
|
|
Loading…
Reference in New Issue