Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
d1c9d89e
T
tp-qemu
项目概览
openeuler
/
tp-qemu
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
tp-qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d1c9d89e
编写于
6月 26, 2013
作者:
L
Lukáš Doktor
提交者:
Lucas Meneghel Rodrigues
6月 26, 2013
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qemu.tests.ksm_base: Pylint fixes
Signed-off-by:
N
Lukáš Doktor
<
ldoktor@redhat.com
>
上级
60c514f8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
20 deletion
+19
-20
qemu/tests/ksm_base.py
qemu/tests/ksm_base.py
+19
-20
未找到文件。
qemu/tests/ksm_base.py
浏览文件 @
d1c9d89e
...
...
@@ -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
,
e
xc
:
e_str
=
(
"Failed to execute command '%s' on
guest script
, "
"vm '%s': %s"
%
(
command
,
vm
.
name
,
str
(
e
xc
)))
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录