aboutsummaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/045
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>2023-10-06 18:41:25 +0300
committerJohn Snow <jsnow@redhat.com>2023-10-12 14:21:44 -0400
commitb6aed193e5ecca32bb07e062f58f0daca06e7009 (patch)
tree869a1bf90b35f8bff095472c3c9f9ccd5631fe26 /tests/qemu-iotests/045
parent25ad2cf6500db3b7f2d88de448791183d7614097 (diff)
python: use vm.cmd() instead of vm.qmp() where appropriate
In many cases we just want an effect of qmp command and want to raise on failure. Use vm.cmd() method which does exactly this. The commit is generated by command git grep -l '\.qmp(' | xargs ./scripts/python_qmp_updater.py And then, fix self.assertRaises to expect ExecuteError exception in tests/qemu-iotests/124 Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 20231006154125.1068348-16-vsementsov@yandex-team.ru Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/045')
-rwxr-xr-xtests/qemu-iotests/04515
1 files changed, 5 insertions, 10 deletions
diff --git a/tests/qemu-iotests/045 b/tests/qemu-iotests/045
index 45eb239baa..a341f21cd7 100755
--- a/tests/qemu-iotests/045
+++ b/tests/qemu-iotests/045
@@ -77,8 +77,7 @@ class TestFdSets(iotests.QMPTestCase):
self.vm.shutdown()
def test_remove_fdset(self):
- result = self.vm.qmp('remove-fd', fdset_id=2)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('remove-fd', fdset_id=2)
result = self.vm.qmp('query-fdsets')
self.assert_qmp(result, 'return[0]/fdset-id', 1)
self.assert_qmp(result, 'return[1]/fdset-id', 0)
@@ -90,8 +89,7 @@ class TestFdSets(iotests.QMPTestCase):
def test_remove_fd(self):
result = self.vm.qmp('query-fdsets')
fd_image3 = result['return'][0]['fds'][0]['fd']
- result = self.vm.qmp('remove-fd', fdset_id=2, fd=fd_image3)
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('remove-fd', fdset_id=2, fd=fd_image3)
result = self.vm.qmp('query-fdsets')
self.assert_qmp(result, 'return[0]/fdset-id', 2)
self.assert_qmp(result, 'return[1]/fdset-id', 1)
@@ -151,8 +149,7 @@ class TestSCMFd(iotests.QMPTestCase):
def test_getfd(self):
self._send_fd_by_SCM()
- result = self.vm.qmp('getfd', fdname='image0:r')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('getfd', fdname='image0:r')
def test_getfd_invalid_fdname(self):
self._send_fd_by_SCM()
@@ -163,10 +160,8 @@ class TestSCMFd(iotests.QMPTestCase):
def test_closefd(self):
self._send_fd_by_SCM()
- result = self.vm.qmp('getfd', fdname='image0:r')
- self.assert_qmp(result, 'return', {})
- result = self.vm.qmp('closefd', fdname='image0:r')
- self.assert_qmp(result, 'return', {})
+ self.vm.cmd('getfd', fdname='image0:r')
+ self.vm.cmd('closefd', fdname='image0:r')
def test_closefd_fd_not_found(self):
fdname = 'image0:r'