提交 e4d8bdbb 编写于 作者: F Feng Yang

qemu.tests: Fix bug that 'Tail' object has no attribute 'read_until_last_line_matches'

Now VM.process is a Tail object which do not have read_until_last_line_matches attribute.

So remove read_until_last_line_matches() function call.
Signed-off-by: NFeng Yang <fyang@redhat.com>
上级 8d83a59f
......@@ -8,6 +8,18 @@ from autotest.client import utils as client_utils
from virttest import aexpect, env_process, utils_misc, qemu_storage
def process_output_check(process, exp_str):
"""
Check whether the output of process match regular expression.
:param process: Tail object in VM.
:param exp_str: regular expression string.
:return: a corresponding MatchObject instance or None
"""
output = process.get_output()
return re.search(exp_str, output)
@error.context_aware
def run(test, params, env):
"""
......@@ -309,10 +321,10 @@ def run(test, params, env):
vm_guest.migrate(mig_timeout, mig_protocol,
not_wait_for_migration=True,
migration_exec_cmd_src=migration_exec_cmd_src)
try:
vm_guest.process.read_until_last_line_matches(exp_str,
timeout=ro_timeout)
except aexpect.ExpectTimeoutError:
if not utils_misc.wait_for(lambda: process_output_check(
vm_guest.process, exp_str),
timeout=ro_timeout, first=2):
raise error.TestFail("The Read-only file system warning not"
" come in time limit.")
......@@ -358,9 +370,10 @@ def run(test, params, env):
vm_guest.migrate(mig_timeout, mig_protocol,
not_wait_for_migration=True,
migration_exec_cmd_src=migration_exec_cmd_src)
try:
vm_guest.process.read_until_last_line_matches(exp_str)
except aexpect.ExpectTimeoutError:
if not utils_misc.wait_for(lambda: process_output_check(
vm_guest.process, exp_str),
timeout=60, first=1):
raise error.TestFail("The migration to destination with low "
"storage space didn't fail as it should.")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册