How to use python coverage tool
chbae 2023. 4. 21. 04:07
Test Environment: Python3 and Poky (Yocto Reference System)
$ sudo pip3 install coverage
$ git clone git://git.yoctoproject.org/poky $ cd poky $ source oe-init-build-env $ coverage3 run ../bitbake/bin/bitbake zip-native
".coverage" file is created in poky/build directory
$ coverage3 report
Result analysis in each files
"xxx.cover" files are created in each file's directory.
You can open the xxx,cover file using "vi" tool with "vim syntax"
Sometimes you need "sudo" to avoid error.
$ coverage3 annotate $ vi bitbake,cover
Create reports as HTML type
$ coverage3 html
The htmlcov directory is created and to run webserver temporarily, you can use "python -m SimpleHTTPServer 9999 or python3 -m http.server 9999" command.