Since we don't have ssh support in the functional test framework yet,
simply use the serial console for this test instead. It's also
sufficient to only boot into an initrd here, no need to fire up a
full-blown guest, so the test now finishes much faster.
While we're at it, also unplug the CPU now and check that it is gone
in the guest.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
MAINTAINERS | 1 +
tests/functional/meson.build | 1 +
.../test_x86_64_hotplug_cpu.py} | 58 ++++++++++++++-----
3 files changed, 47 insertions(+), 13 deletions(-)
rename tests/{avocado/hotplug_cpu.py =>
functional/test_x86_64_hotplug_cpu.py} (25%)
mode change 100644 => 100755
- self.ssh_command('test -e /sys/devices/system/cpu/cpu0')
- with self.assertRaises(AssertionError):
- self.ssh_command('test -e /sys/devices/system/cpu/cpu1')
+ exec_command_and_wait_for_pattern(self,
+ 'cd /sys/devices/system/cpu/cpu0',
+ 'cpu0#')
+ exec_command_and_wait_for_pattern(self,
+ 'cd /sys/devices/system/cpu/cpu1',
+ 'No such file or directory')
self.vm.cmd('device_add',
driver='Haswell-x86_64-cpu',
+ id='c1',
socket_id=0,
core_id=1,
thread_id=0)
- self.ssh_command('test -e /sys/devices/system/cpu/cpu1')
+ self.wait_for_console_pattern('CPU1 has been hot-added')
+
+ exec_command_and_wait_for_pattern(self,
+ 'cd /sys/devices/system/cpu/cpu1',
+ 'cpu1#')
+
+ self.vm.cmd('device_del', id='c1')
+
+ exec_command_and_wait_for_pattern(self,
+ 'cd /sys/devices/system/cpu/cpu1',
+ 'No such file or directory')