@samitouri / QOSamiQemu / commits / ea86b6c69f

tests/functional: use query-version QMP command instead of HMP

Replace the human-monitor-command based version test with the native QMP query-version command, which returns structured version data. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20260828-qemu-no-hmp-v5-9-9227de146347@redhat.com>

Marc-André Lureau committed Aug 28, 2026 at 16:04 UTC ea86b6c69fe7bd12a05f47c7d4e071862ea9b9f2
1 file changed +6 -4
tests/functional/generic/test_version.py
+6 -4
@@ -16,13 +16,15 @@ from qemu_test import QemuSystemTest
16
17 class Version(QemuSystemTest):
18
19 - def test_qmp_human_info_version(self):
19 + def test_qmp_query_version(self):
20 self.set_machine('none')
21 self.vm.add_args('-nodefaults')
22 self.vm.launch()
23 - res = self.vm.cmd('human-monitor-command',
24 - command_line='info version')
25 - self.assertRegex(res, r'^(\d+\.\d+\.\d)')
23 + res = self.vm.cmd('query-version')
24 + version = res['qemu']
25 + self.assertIsInstance(version['major'], int)
26 + self.assertIsInstance(version['minor'], int)
27 + self.assertIsInstance(version['micro'], int)
28
29 if __name__ == '__main__':
30 QemuSystemTest.main()