[PATCH 10/40] tests/functional: use query-version QMP command instead of HMP

Marc-André Lureau posted 40 patches 2 months, 3 weeks ago
There is a newer version of this series
[PATCH 10/40] tests/functional: use query-version QMP command instead of HMP
Posted by Marc-André Lureau 2 months, 3 weeks ago
Replace the human-monitor-command based version test with the native
QMP query-version command, which returns structured version data.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/functional/generic/test_version.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/functional/generic/test_version.py b/tests/functional/generic/test_version.py
index 3ab3b67f7e3..7764424826e 100755
--- a/tests/functional/generic/test_version.py
+++ b/tests/functional/generic/test_version.py
@@ -16,13 +16,15 @@
 
 class Version(QemuSystemTest):
 
-    def test_qmp_human_info_version(self):
+    def test_qmp_query_version(self):
         self.set_machine('none')
         self.vm.add_args('-nodefaults')
         self.vm.launch()
-        res = self.vm.cmd('human-monitor-command',
-                          command_line='info version')
-        self.assertRegex(res, r'^(\d+\.\d+\.\d)')
+        res = self.vm.cmd('query-version')
+        version = res['qemu']
+        self.assertIsInstance(version['major'], int)
+        self.assertIsInstance(version['minor'], int)
+        self.assertIsInstance(version['micro'], int)
 
 if __name__ == '__main__':
     QemuSystemTest.main()

-- 
2.54.0


Re: [PATCH 10/40] tests/functional: use query-version QMP command instead of HMP
Posted by Philippe Mathieu-Daudé 2 months, 3 weeks ago
On 20/5/26 23:49, Marc-André Lureau wrote:
> Replace the human-monitor-command based version test with the native
> QMP query-version command, which returns structured version data.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   tests/functional/generic/test_version.py | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>