]> code.ossystems Code Review - openembedded-core.git/commit
oe-selftest: Enable code coverage on unit tests
authorLeonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Wed, 18 Nov 2015 15:04:17 +0000 (15:04 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 1 Dec 2015 21:30:56 +0000 (21:30 +0000)
commitb3feee2cefbbd98b66dc395b651f47c5028c80a0
treec2c263bd06546a2806ff25d9cb837602362af4fd
parent924ccf202a6d89de32fc34a140bf9e35e8e43b4e
oe-selftest: Enable code coverage on unit tests

Enable code coverage through the library 'python coverage'. In case the environment
variable COVERAGE_PROCESS_START is present (one of the requisites for measuring
sub-processes; the second one is including some coverage statements into the
python sitecustomize.py file) it will be taken into account, otherwise it is
exported with value '.coveragerc'. The latter value is a configuration file
(also automatically created) with some default settings. Once tests are
executed, a coverage report is shown on the log and the coverage output data is stored
with name '.coverage.<args>' where '<args>' is the name of the  unit tests executed
or 'all_tests' when running with --run-all-tests. This output data can be latter used
for better reporting using the same tool (coverage).

As briefly indicate before, measuring sub-process implies setting the env variable
COVERAGE_PROCESS_START (done automatically by the oe-selftest code with this patch if
not already set) and creating a sitecustomize.py as explained on [1].
If either one of these is missing, complete coverage will be incomplete.

Current measurements for 'oe-selftest --run-all-tests' indicate that current coverage
is around 42 % taking into account BBLAYERS, bitbake and scripts folders. More details
on [2], indicating the coverage per file/module.

This tasks has been done together with Humberto Ibarra <humberto.ibarra.lopez@linux.intel.com>

[YOCTO #8679]

[1] http://coverage.readthedocs.org/en/latest/subprocess.html
[2] https://bugzilla.yoctoproject.org/attachment.cgi?id=2854

Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/oe-selftest