qemu-iotests: Log QMP traffic in debug mode
PATCH 1/1 qemu-iotests: Log QMP traffic in debug mode
Python tests are already annoying enough to debug. With QMP traffic available it's a little bit easier at least.
--- tests/qemu-iotests/iotests.py | 5 +++++ 1 file changed, 5 insertions(+)
tests/qemu-iotests/iotests.py +5 -0
@@ -50,6 +50,7 @@ cachemode = os.environ.get('CACHEMODE') qemu_default_machine = os.environ.get('QEMU_DEFAULT_MACHINE') socket_scm_helper = os.environ.get('SOCKET_SCM_HELPER', 'socket_scm_helper') +debug = False def qemu_img(*args): '''Run qemu-img and return the exit code'''
@@ -134,6 +135,8 @@ class VM(qtest.QEMUQtestMachine): def __init__(self): super(VM, self).__init__(qemu_prog, qemu_opts, test_dir=test_dir, socket_scm_helper=socket_scm_helper) + if debug: + self._debug = True self._num_drives = 0 def add_device(self, opts):
@@ -323,6 +326,8 @@ def verify_quorum(): def main(supported_fmts=[], supported_oses=['linux']): '''Run tests''' + global debug + # We are using TEST_DIR and QEMU_DEFAULT_MACHINE as proxies to # indicate that we're not being run via "check". There may be # other things set up by "check" that individual test cases rely
Signature · 1 line
1.8.3.1
Quoted 21 lines · Kevin Wolf
Python tests are already annoying enough to debug. With QMP traffic available it's a little bit easier at least.
Signed-off-by Kevin Wolf <[email protected]>--- tests/qemu-iotests/iotests.py | 5 +++++ 1 file changed, 5 insertions(+)tests/qemu-iotests/iotests.py +1
-0@@ -50,6 +50,7 @@ cachemode = os.environ.get('CACHEMODE') qemu_default_machine = os.environ.get('QEMU_DEFAULT_MACHINE') socket_scm_helper = os.environ.get('SOCKET_SCM_HELPER', 'socket_scm_helper') +debug = False def qemu_img(*args): '''Run qemu-img and return the exit code'''
tests/qemu-iotests/iotests.py class VM(qtest.QEMUQtestMachine): · line 141
Quoted 7 lines
tests/qemu-iotests/iotests.py +2
-0@@ -134,6 +135,8 @@ class VM(qtest.QEMUQtestMachine): def __init__(self): super(VM, self).__init__(qemu_prog, qemu_opts, test_dir=test_dir, socket_scm_helper=socket_scm_helper) + if debug: + self._debug = True self._num_drives = 0
So we already had plumbing for debug...
tests/qemu-iotests/iotests.py def verify_quorum(): · line 329
Quoted 6 lines
tests/qemu-iotests/iotests.py +1
-0def add_device(self, opts):@@ -323,6 +326,8 @@ def verify_quorum(): def main(supported_fmts=[], supported_oses=['linux']): '''Run tests''' + global debug
...but just needed to turn it on?
At any rate, I agree that it is useful for figuring out when tests go wrong, so:
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Am 23.08.2016 um 20:59 hat Eric Blake geschrieben:
Quoted 32 lines · Kevin Wolf
Quoted 21 lines
Python tests are already annoying enough to debug. With QMP traffic available it's a little bit easier at least.
Signed-off-by Kevin Wolf <[email protected]>--- tests/qemu-iotests/iotests.py | 5 +++++ 1 file changed, 5 insertions(+)tests/qemu-iotests/iotests.py +1
-0@@ -50,6 +50,7 @@ cachemode = os.environ.get('CACHEMODE') qemu_default_machine = os.environ.get('QEMU_DEFAULT_MACHINE') socket_scm_helper = os.environ.get('SOCKET_SCM_HELPER', 'socket_scm_helper') +debug = False def qemu_img(*args): '''Run qemu-img and return the exit code'''tests/qemu-iotests/iotests.py class VM(qtest.QEMUQtestMachine): · line 141
Quoted 7 lines
tests/qemu-iotests/iotests.py +2
-0@@ -134,6 +135,8 @@ class VM(qtest.QEMUQtestMachine): def __init__(self): super(VM, self).__init__(qemu_prog, qemu_opts, test_dir=test_dir, socket_scm_helper=socket_scm_helper) + if debug: + self._debug = True self._num_drives = 0So we already had plumbing for debug...
Quoted 8 lines
tests/qemu-iotests/iotests.py def verify_quorum(): · line 329
Quoted 6 lines
tests/qemu-iotests/iotests.py +1
-0def add_device(self, opts):@@ -323,6 +326,8 @@ def verify_quorum(): def main(supported_fmts=[], supported_oses=['linux']): '''Run tests''' + global debug...but just needed to turn it on?
Yes, the parent class already implements the logging. I guess this was done in the context of some other scripts (maybe QMP shell?), so we just have to reuse what's already there.
Kevin