Build: Produce C/JS code coverage reports from make
This is a follow up to the initial work done in PR #9463, in which the --coverage
option was added in configure in order to build instrumented C++ code.
This PR adds in a make coverage
recipe (as well as a make clean_coverage
to clean up). Using make in this way will build node, instrument the javascript code, run the tests (as per make test
) and give the coverage results. When used in conjunction with configure --coverage
both C++ and Javascript coverage results will be available - and when used on its own, just Javascript.
Aside from giving a one-line coverage results, i.e -
Javascript coverage %: 90.16
C++ coverage %: 89.1
We also produce html reports (under the coverage directory) so a developer can drill down and inspect what changes their code has made.
This is very heavily based on the work @addaleax did in her coverage project https://github.com/addaleax/node-core-coverage as well as the overnight coverage reports @mhdawson created the CI job for here https://coverage.nodejs.org
ToDo:
-
Generating the C++ coverage reports relies on pulling in the gcovr repository and then patching a file (using a patch from the testing work ground repo - and as per @addaleax original code) obviously it would more desirable not to patch anything, so next action is understand what needs to be done so this patch is no longer required.
-
It may also be useful to give the option of holding multiple sets of results within the coverage directory, so a developer can produce a 'baseline' coverage results, and then compare this with any changes they might make.
FYI @Fishrock123 @gibfahn