Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / tests / avocado / hotplug_cpu.py
blob6374bf1b546e6fbe8e6d4b46f74b5065eb470d38
1 # Functional test that hotplugs a CPU and checks it on a Linux guest
3 # Copyright (c) 2021 Red Hat, Inc.
5 # Author:
6 # Cleber Rosa <crosa@redhat.com>
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.
11 from avocado_qemu import LinuxTest
14 class HotPlugCPU(LinuxTest):
16 def test(self):
17 """
18 :avocado: tags=arch:x86_64
19 :avocado: tags=machine:q35
20 :avocado: tags=accel:kvm
21 """
22 self.require_accelerator('kvm')
23 self.vm.add_args('-accel', 'kvm')
24 self.vm.add_args('-cpu', 'Haswell')
25 self.vm.add_args('-smp', '1,sockets=1,cores=2,threads=1,maxcpus=2')
26 self.launch_and_wait()
28 self.ssh_command('test -e /sys/devices/system/cpu/cpu0')
29 with self.assertRaises(AssertionError):
30 self.ssh_command('test -e /sys/devices/system/cpu/cpu1')
32 self.vm.command('device_add',
33 driver='Haswell-x86_64-cpu',
34 socket_id=0,
35 core_id=1,
36 thread_id=0)
37 self.ssh_command('test -e /sys/devices/system/cpu/cpu1')