提交 d1c9d89e 编写于 作者: L Lukáš Doktor 提交者: Lucas Meneghel Rodrigues

qemu.tests.ksm_base: Pylint fixes

Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 60c514f8
......@@ -17,26 +17,25 @@ def run_ksm_base(test, params, env):
"""
def _start_allocator(vm, session, timeout):
"""
Execute allocator.py on a guest, wait until it is initialized.
Execute guest script and wait until it is initialized.
@param vm: VM object.
@param session: Remote session to a VM object.
@param timeout: Timeout that will be used to verify if allocator.py
@param timeout: Timeout that will be used to verify if guest script
started properly.
"""
logging.debug("Starting allocator.py on guest %s", vm.name)
logging.debug("Starting guest script on guest %s", vm.name)
session.sendline("python /tmp/ksm_overcommit_guest.py")
try:
(match, data) = session.read_until_last_line_matches(
["PASS:", "FAIL:"],
timeout)
except aexpect.ExpectProcessTerminatedError, e:
raise error.TestFail("Command allocator.py on vm '%s' failed: %s" %
(vm.name, str(e)))
_ = session.read_until_last_line_matches(["PASS:", "FAIL:"],
timeout)
except aexpect.ExpectProcessTerminatedError, exc:
raise error.TestFail("Command guest script on vm '%s' failed: %s" %
(vm.name, str(exc)))
def _execute_allocator(command, vm, session, timeout):
"""
Execute a given command on allocator.py main loop, indicating the vm
Execute a given command on guest script main loop, indicating the vm
the command was executed on.
@param command: Command that will be executed.
......@@ -46,16 +45,16 @@ def run_ksm_base(test, params, env):
@return: Tuple (match index, data)
"""
logging.debug("Executing '%s' on allocator.py loop, vm: %s, timeout: %s",
command, vm.name, timeout)
logging.debug("Executing '%s' on guest script loop, vm: %s, timeout: "
"%s", command, vm.name, timeout)
session.sendline(command)
try:
(match, data) = session.read_until_last_line_matches(
["PASS:","FAIL:"],
timeout)
except aexpect.ExpectProcessTerminatedError, e:
e_str = ("Failed to execute command '%s' on allocator.py, "
"vm '%s': %s" % (command, vm.name, str(e)))
["PASS:", "FAIL:"],
timeout)
except aexpect.ExpectProcessTerminatedError, exc:
e_str = ("Failed to execute command '%s' on guest script, "
"vm '%s': %s" % (command, vm.name, str(exc)))
raise error.TestFail(e_str)
return (match, data)
......@@ -86,7 +85,7 @@ def run_ksm_base(test, params, env):
query_cmd = re.sub("QEMU_PID", str(vm.process.get_pid()), query_cmd)
s, sharing_page_0 = commands.getstatusoutput(query_cmd)
_, sharing_page_0 = commands.getstatusoutput(query_cmd)
if query_regex:
sharing_page_0 = re.findall(query_regex, sharing_page_0)[0]
......@@ -99,7 +98,7 @@ def run_ksm_base(test, params, env):
_execute_allocator(cmd, vm, session, fill_timeout)
time.sleep(120)
s, sharing_page_1 = commands.getstatusoutput(query_cmd)
_, sharing_page_1 = commands.getstatusoutput(query_cmd)
if query_regex:
sharing_page_1 = re.findall(query_regex, sharing_page_1)[0]
......@@ -114,7 +113,7 @@ def run_ksm_base(test, params, env):
_execute_allocator(cmd, vm, session, fill_timeout)
time.sleep(120)
s, sharing_page_2 = commands.getstatusoutput(query_cmd)
_, sharing_page_2 = commands.getstatusoutput(query_cmd)
if query_regex:
sharing_page_2 = re.findall(query_regex, sharing_page_2)[0]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册