1*cce85725SThomas Huth#!/usr/bin/env python3 2*cce85725SThomas Huth# 3*cce85725SThomas Huth# Check for crash when using empty -cpu option 4*cce85725SThomas Huth# 5*cce85725SThomas Huth# Copyright (c) 2019 Red Hat, Inc. 6*cce85725SThomas Huth# 7*cce85725SThomas Huth# Author: 8*cce85725SThomas Huth# Eduardo Habkost <ehabkost@redhat.com> 9*cce85725SThomas Huth# 10*cce85725SThomas Huth# This work is licensed under the terms of the GNU GPL, version 2 or 11*cce85725SThomas Huth# later. See the COPYING file in the top-level directory. 12*cce85725SThomas Huthfrom qemu_test import QemuSystemTest 13*cce85725SThomas Huth 14*cce85725SThomas Huthclass EmptyCPUModel(QemuSystemTest): 15*cce85725SThomas Huth def test(self): 16*cce85725SThomas Huth self.vm.add_args('-S', '-display', 'none', '-machine', 'none', '-cpu', '') 17*cce85725SThomas Huth self.vm.set_qmp_monitor(enabled=False) 18*cce85725SThomas Huth self.vm.launch() 19*cce85725SThomas Huth self.vm.wait() 20*cce85725SThomas Huth self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1") 21*cce85725SThomas Huth self.assertRegex(self.vm.get_log(), r'-cpu option cannot be empty') 22*cce85725SThomas Huth 23*cce85725SThomas Huthif __name__ == '__main__': 24*cce85725SThomas Huth QemuSystemTest.main() 25