提交 a057c85f 编写于 作者: H Huan Xiong

pci_devices: run "info qtree" after the guest boots up

QEMU "info qtree" output depends on information generated by guest
firmware. One example is the bus number in PCI device address. QEMU
retrieves it from the PCI configuration space of the bridge which
creates the bus that a PCI device is attached to. So if test runs
"info qtree" before firmware finishes initializing pci devices, its
output can be incorrect.

The current code works around this timing issue by sleeping 5 seconds.
That is not reliable and doesn't work on my aarch64 system. So I'd
suggest to change the test to not start until it verifies the guest
has booted up. This will make the test execution time slightly longer
but is reliable.
Signed-off-by: NHuan Xiong <huan.xiong@hxt-semitech.com>
上级 0924b645
......@@ -8,7 +8,6 @@ import logging
import random
import re
import six
import time
from virttest import env_process
from virttest import error_context
......@@ -356,11 +355,12 @@ def run(test, params, env):
vm = env.get_vm(params["main_vm"])
# PCI devices are initialized by firmware, which might require some time
# to setup. Wait 5s before getting the qtree.
time.sleep(5)
qtree = qemu_qtree.QtreeContainer()
# to setup. Wait until the guest boots up.
error_context.context("Verify VM booted properly.", logging.info)
session = vm.wait_for_login()
error_context.context("Verify qtree vs. qemu devices", logging.info)
qtree = qemu_qtree.QtreeContainer()
_info_qtree = vm.monitor.info('qtree', False)
qtree.parse_info_qtree(_info_qtree)
info_qdev = process_qdev(vm.devices)
......@@ -374,9 +374,6 @@ def run(test, params, env):
logging.error(err)
errors += "qdev vs. qtree, "
error_context.context("Verify VM booted properly.", logging.info)
session = vm.wait_for_login()
error_context.context("Verify lspci vs. qtree", logging.info)
if params.get('lspci_cmd'):
_info_lspci = session.cmd_output(params['lspci_cmd'])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册