tests/functional: Convert the hotplug_cpu avocado test
PATCH 1/1 tests/functional: Convert the hotplug_cpu avocado test
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.
---
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 => 100755MAINTAINERS +1 -0
@@ -476,6 +476,7 @@ F: docs/system/i386/sgx.rst F: target/i386/kvm/ F: target/i386/sev* F: scripts/kvm/vmxcap +F: tests/functional/test_x86_64_hotplug_cpu.py Xen emulation on X86 KVM CPUs M: David Woodhouse <[email protected]>
tests/functional/meson.build +1 -0
@@ -229,6 +229,7 @@ tests_x86_64_system_thorough = [ 'multiprocess', 'netdev_ethtool', 'virtio_gpu', + 'x86_64_hotplug_cpu', ] tests_xtensa_system_thorough = [
tests/functional/test_x86_64_hotplug_cpu.py renamed from tests/avocado/hotplug_cpu.py +45 -13
78 lines not on this page · raw message
Signature · 1 line
2.47.1
Quoted 36 lines · Thomas Huth
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 <[email protected]>--- 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 => 100755tests/functional/test_x86_64_hotplug_cpu.py renamed from tests/avocado/hotplug_cpu.py +8
-4- 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')
tests/functional/test_x86_64_hotplug_cpu.py line 66
Quoted 10 lines
tests/functional/test_x86_64_hotplug_cpu.py renamed from tests/avocado/hotplug_cpu.py +10
-0+ + 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')
Good idea to expand a bit the test testing removal.