]> Git Repo - qemu.git/commitdiff
python/aqmp: Add Coverage.py support
authorJohn Snow <[email protected]>
Wed, 15 Sep 2021 16:29:55 +0000 (12:29 -0400)
committerJohn Snow <[email protected]>
Mon, 27 Sep 2021 16:10:29 +0000 (12:10 -0400)
I'm not exposing this via the Makefile help, it's not likely to be
useful to passersby. Switch the avocado runner to the 'legacy' runner
for now, as the new runner seems to obscure coverage reports, again.

Usage is to enter your venv of choice and then:
`make check-coverage && xdg-open htmlcov/index.html`.

Signed-off-by: John Snow <[email protected]>
Message-id: 20210915162955[email protected]
Signed-off-by: John Snow <[email protected]>
python/.gitignore
python/Makefile
python/avocado.cfg
python/setup.cfg

index c8b0e67fe6c8b58ef19d72f1db6b06b8a21d3ac5..904f324bb11ac71b5091af55bfedb5649d227bc5 100644 (file)
@@ -15,3 +15,8 @@ qemu.egg-info/
 .venv/
 .tox/
 .dev-venv/
+
+# Coverage.py reports
+.coverage
+.coverage.*
+htmlcov/
index fe27a3e12ee3a3136d3f3d7131b8b6418bf6c821..3334311362573a8b9f39efb12fed6acf65c96b8a 100644 (file)
@@ -92,6 +92,13 @@ check:
 check-tox:
        @tox $(QEMU_TOX_EXTRA_ARGS)
 
+.PHONY: check-coverage
+check-coverage:
+       @coverage run -m avocado --config avocado.cfg run tests/*.py
+       @coverage combine
+       @coverage html
+       @coverage report
+
 .PHONY: clean
 clean:
        python3 setup.py clean --all
@@ -100,3 +107,5 @@ clean:
 .PHONY: distclean
 distclean: clean
        rm -rf qemu.egg-info/ .venv/ .tox/ $(QEMU_VENV_DIR) dist/
+       rm -f .coverage .coverage.*
+       rm -rf htmlcov/
index 10dc6fb60549fd00c77335245e0dc4d4e953f2bd..c7722e7ecd327cdaf7f7d81da3ff622ca763f07c 100644 (file)
@@ -1,3 +1,6 @@
+[run]
+test_runner = runner
+
 [simpletests]
 # Don't show stdout/stderr in the test *summary*
 status.failure_fields = ['status']
index 8481fa7c92348f806f9b2c494fc68e72ee68af1f..4fd0c68a5b70e0eada5066e86e10b39bafb14de5 100644 (file)
@@ -140,3 +140,13 @@ deps =
     .[fuse]  # Workaround to trigger tox venv rebuild
 commands =
     make check
+
+# Coverage.py [https://coverage.readthedocs.io/en/latest/] is a tool for
+# measuring code coverage of Python programs. It monitors your program,
+# noting which parts of the code have been executed, then analyzes the
+# source to identify code that could have been executed but was not.
+
+[coverage:run]
+concurrency = multiprocessing
+source = qemu/
+parallel = true
This page took 0.025328 seconds and 4 git commands to generate.