-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
env_process: Refactor QEMU coverage report resetter
Refactor the piece of code in env_process.preprocess that resetted gcov before running tests or creating VMs. Don't merge it with the postprocess step related to gcov as well, as it would break the order (relative to the process() call) in which they are run. Signed-off-by: Beñat Gartzia Arruabarrena <bgartzia@redhat.com>
- Loading branch information
Showing
2 changed files
with
30 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
|
||
from avocado.utils import process as a_process | ||
|
||
from virttest.test_setup.core import Setuper | ||
|
||
|
||
class ResetQemuGCov(Setuper): | ||
def setup(self): | ||
# Check if code coverage for qemu is enabled and | ||
# if coverage reset is enabled too, reset coverage report | ||
gcov_qemu = self.params.get("gcov_qemu", "no") == "yes" | ||
gcov_qemu_reset = self.params.get("gcov_qemu_reset", "no") == "yes" | ||
if gcov_qemu and gcov_qemu_reset: | ||
qemu_builddir = os.path.join(self.test.bindir, "build", "qemu") | ||
qemu_bin = os.path.join(self.test.bindir, "bin", "qemu") | ||
if os.path.isdir(qemu_builddir) and os.path.isfile(qemu_bin): | ||
os.chdir(qemu_builddir) | ||
# Looks like libvirt process does not have permissions to write to | ||
# coverage files, hence give write for all files in qemu source | ||
reset_cmd = "make clean-coverage;%s -version;" % qemu_bin | ||
reset_cmd += ( | ||
'find %s -name "*.gcda" -exec chmod a=rwx {} \;' % qemu_builddir | ||
) | ||
a_process.system(reset_cmd, shell=True) | ||
|
||
def cleanup(self): | ||
pass |