Skip to content

Commit

Permalink
Merge pull request #5860 from Yingshun/viommu_lc_reset
Browse files Browse the repository at this point in the history
viommu: Add a test scenario about 'virsh reset'
  • Loading branch information
Yingshun authored Sep 5, 2024
2 parents b89959f + d7c2902 commit 4abb80d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions libvirt/tests/cfg/sriov/vIOMMU/iommu_device_lifecycle.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@
- suspend_resume:
- reboot_many_times:
loop_time = 5
- reset:
19 changes: 14 additions & 5 deletions libvirt/tests/src/sriov/vIOMMU/iommu_device_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,26 @@ def run(test, params, env):
test.log.info("TEST_STEP: Start the VM.")
vm.start()
test.log.debug(vm_xml.VMXML.new_from_dumpxml(vm.name))
if test_scenario == "reboot_many_times":
if test_scenario in ["reboot_many_times", "reset"]:
vm.cleanup_serial_console()
vm.create_serial_console()
for _ in range(int(params.get('loop_time', '5'))):
test.log.info("TEST_STEP: Reboot the VM.")
if test_scenario == "reset":
test.log.info("TEST_STEP: Reset the VM.")
session = vm.wait_for_serial_login(
timeout=int(params.get('login_timeout')))
session.sendline(params.get("reboot_command"))
_match, _text = session.read_until_output_matches(
virsh.reset(vm.name, **VIRSH_ARGS)
_match, _text = session.read_until_last_line_matches(
[r"[Ll]ogin:\s*"], timeout=240, internal_timeout=0.5)
session.close()
else:
for _ in range(int(params.get('loop_time', '5'))):
test.log.info("TEST_STEP: Reboot the VM.")
session = vm.wait_for_serial_login(
timeout=int(params.get('login_timeout')))
session.sendline(params.get("reboot_command"))
_match, _text = session.read_until_last_line_matches(
[r"[Ll]ogin:\s*"], timeout=240, internal_timeout=0.5)
session.close()

session = vm.wait_for_serial_login(
timeout=int(params.get('login_timeout')))
Expand Down

0 comments on commit 4abb80d

Please sign in to comment.