blob: d906ef3d3cf34ee935d1429390fdef61dc90b82e [file] [log] [blame]
Eduardo Habkost5b863f32019-04-18 00:45:01 -03001# Check for crash when using empty -cpu option
2#
3# Copyright (c) 2019 Red Hat, Inc.
4#
5# Author:
6# Eduardo Habkost <ehabkost@redhat.com>
7#
8# This work is licensed under the terms of the GNU GPL, version 2 or
9# later. See the COPYING file in the top-level directory.
Philippe Mathieu-Daudé2283b622021-09-27 18:14:33 +020010from avocado_qemu import QemuSystemTest
Eduardo Habkost5b863f32019-04-18 00:45:01 -030011
Philippe Mathieu-Daudé2283b622021-09-27 18:14:33 +020012class EmptyCPUModel(QemuSystemTest):
Eduardo Habkost5b863f32019-04-18 00:45:01 -030013 def test(self):
Wainer dos Santos Moschettac80c6be2019-12-11 13:55:36 -050014 self.vm.add_args('-S', '-display', 'none', '-machine', 'none', '-cpu', '')
15 self.vm.set_qmp_monitor(enabled=False)
16 self.vm.launch()
17 self.vm.wait()
Thomas Huth861f7242023-11-14 14:43:26 +010018 self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
Wainer dos Santos Moschettac80c6be2019-12-11 13:55:36 -050019 self.assertRegex(self.vm.get_log(), r'-cpu option cannot be empty')