Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
aa6ae35c
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,发现更多精彩内容 >>
提交
aa6ae35c
编写于
11月 25, 2016
作者:
S
suqinhuang
提交者:
GitHub
11月 25, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #677 from suqinhuang/driver_load_rng
Add virtio-win viorng driver load/unload test
上级
2b55044b
6f4cdc92
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
96 addition
and
50 deletion
+96
-50
qemu/tests/cfg/driver_load_stress.cfg
qemu/tests/cfg/driver_load_stress.cfg
+26
-4
qemu/tests/driver_in_use.py
qemu/tests/driver_in_use.py
+12
-6
qemu/tests/driver_load.py
qemu/tests/driver_load.py
+58
-40
未找到文件。
qemu/tests/cfg/driver_load_stress.cfg
浏览文件 @
aa6ae35c
...
...
@@ -4,17 +4,25 @@
kill_vm_on_error = yes
check_guest_bsod = yes
login_timeout = 240
suppress_exception = no
driver_load_cmd = C:\devcon.exe enable @DRIVER_ID
driver_unload_cmd = C:\devcon.exe disable @DRIVER_ID
driver_id_cmd = C:\devcon.exe find * | find "VirtIO"
image_snapshot = yes
only Windows
sub_test = driver_load
i386, i686:
driver_load_cmd = "WIN_UTILS:\devcon\wnet_x86\devcon.exe enable @DRIVER_ID"
driver_unload_cmd = "WIN_UTILS:\devcon\wnet_x86\devcon.exe disable @DRIVER_ID"
driver_id_cmd = 'WIN_UTILS:\devcon\wnet_x86\devcon.exe find * | find "VirtIO"'
driver_check_cmd = "WIN_UTILS:\devcon\wnet_x86\devcon.exe status @DRIVER_ID"
x86_64:
driver_load_cmd = "WIN_UTILS:\devcon\wnet_amd64\devcon.exe enable @DRIVER_ID"
driver_unload_cmd = "WIN_UTILS:\devcon\wnet_amd64\devcon.exe disable @DRIVER_ID"
driver_id_cmd = 'WIN_UTILS:\devcon\wnet_amd64\devcon.exe find * | find "VirtIO"'
driver_check_cmd = "WIN_UTILS:\devcon\wnet_amd64\devcon.exe status @DRIVER_ID"
variants:
- before_bg_test:
run_bg_flag = "before_bg_test"
- during_bg_test:
run_bg_flag = "during_bg_test"
suppress_exception = yes
- after_bg_test:
run_bg_flag = "after_bg_test"
variants:
...
...
@@ -111,3 +119,17 @@
# reset media player play mode
post_cmd += "reg add HKCU\Software\Microsoft\MediaPlayer\Preferences /v ModeLoop /t REG_DWORD /d 0 /f"
target_process = wmplayer.exe
- with_viorng:
no no_virtio_rng
driver_name = viorng
run_bgstress = rng_bat
target_process = random\w*.exe
session_cmd_timeout = 240
read_rng_cmd = "WIN_UTILS:\random_%PROCESSOR_ARCHITECTURE%.exe"
rng_data_rex = "0x\w"
driver_id_pattern = "(.*?):.*?VirtIO RNG Device"
during_bg_test:
run_bgstress = for /l %i in (1, 1, 2000) do WIN_UTILS:\random_%PROCESSOR_ARCHITECTURE%.exe &
test_after_load = rng_bat
bg_stress_test_is_cmd = yes
read_rng_timeout = 360
qemu/tests/driver_in_use.py
浏览文件 @
aa6ae35c
...
...
@@ -54,10 +54,16 @@ def run(test, params, env):
# Need to set bg_stress_run_flag in some cases to make sure all
# necessary steps are active
env
[
bg_stress_run_flag
]
=
False
stress_thread
=
utils
.
InterruptedThread
(
utils_test
.
run_virt_sub_test
,
(
test
,
params
,
env
),
{
"sub_type"
:
bg_stress_test
})
stress_thread
.
start
()
if
params
.
get
(
"bg_stress_test_is_cmd"
,
"no"
)
==
"yes"
:
session
=
vm
.
wait_for_login
()
bg_stress_test
=
utils_misc
.
set_winutils_letter
(
session
,
bg_stress_test
)
session
.
sendline
(
bg_stress_test
)
else
:
stress_thread
=
utils
.
InterruptedThread
(
utils_test
.
run_virt_sub_test
,
(
test
,
params
,
env
),
{
"sub_type"
:
bg_stress_test
})
stress_thread
.
start
()
if
not
utils_misc
.
wait_for
(
lambda
:
check_bg_running
(
target_process
),
120
,
0
,
1
):
raise
exceptions
.
TestFail
(
"Backgroud test %s is not "
...
...
@@ -95,8 +101,8 @@ def run(test, params, env):
wait_time
=
float
(
params
.
get
(
"wait_bg_time"
,
60
))
suppress_exception
=
params
.
get
(
"suppress_exception"
,
"no"
)
==
"yes"
error_context
.
context
(
"Run
sub test %s %s"
%
(
sub_type
,
run_bg_flag
)
,
logging
.
info
)
error_context
.
context
(
"Run
%s %s %s"
%
(
sub_type
,
run_bg_flag
,
bg_stress_test
),
logging
.
info
)
if
run_bg_flag
==
"before_bg_test"
:
run_subtest
(
sub_type
)
if
vm
.
is_dead
():
...
...
qemu/tests/driver_load.py
浏览文件 @
aa6ae35c
import
logging
import
re
import
time
from
a
utotest.client.shared
import
error
from
a
vocado.core
import
exceptions
from
virttest
import
utils_test
from
virttest
import
utils_misc
from
virttest
import
error_context
@
error
.
context_aware
@
error
_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
KVM driver load test:
...
...
@@ -21,72 +22,89 @@ def run(test, params, env):
:param env: Dictionary with test environment.
"""
def
load_driver
(
session
,
cmd
,
driver_id
):
def
load_driver
(
cmd
,
driver_id
):
"""
Load driver
:param cmd: Driver load cmd
:param driver_id: Driver id in windows guest
"""
nic_index
=
len
(
vm
.
virtnet
)
-
1
session
=
vm
.
wait_for_login
(
nic_index
=
nic_index
)
if
params
[
"os_type"
]
==
"windows"
:
cmd
=
cmd
.
replace
(
"DRIVER_ID"
,
driver_id
)
status
,
output
=
session
.
cmd_status_output
(
cmd
)
session
.
close
()
if
status
!=
0
:
raise
error
.
TestFail
(
"failed to load driver, %s"
%
output
)
if
params
[
"os_type"
]
==
"windows"
:
if
"device(s) are enabled"
not
in
output
:
raise
error
.
TestFail
(
"failed to load driver, %s"
%
output
)
def
unload_driver
(
session
,
cmd
,
driver_id
):
raise
exceptions
.
TestFail
(
"failed to load driver, %s"
%
output
)
def
unload_driver
(
cmd
,
driver_id
):
"""
Unload driver
:param cmd: Driver unload cmd
:param driver_id: Driver id in windows guest
"""
nic_index
=
len
(
vm
.
virtnet
)
-
1
session
=
vm
.
wait_for_login
(
nic_index
=
nic_index
)
if
params
[
"os_type"
]
==
"windows"
:
cmd
=
cmd
.
replace
(
"DRIVER_ID"
,
driver_id
)
status
,
output
=
session
.
cmd_status_output
(
cmd
)
session
.
close
()
if
status
!=
0
:
raise
error
.
TestFail
(
"failed to unload driver, %s"
%
output
)
if
params
[
"os_type"
]
==
"windows"
:
if
"device(s) disabled"
not
in
output
:
raise
error
.
TestFail
(
"failed to unload driver, %s"
%
output
)
def
check_driver
(
session
,
cmd
,
pattern
):
if
"reboot"
in
output
:
vm
.
reboot
()
session
.
close
()
else
:
raise
exceptions
.
TestFail
(
"failed to unload driver, %s"
%
output
)
def
get_driver_id
(
cmd
,
pattern
):
"""
Get driver id from guest
:param cmd: cmd to get driver info
:param pattern: pattern to filter driver id
"""
nic_index
=
len
(
vm
.
virtnet
)
-
1
session
=
vm
.
wait_for_login
(
nic_index
=
nic_index
)
output
=
session
.
cmd_output
(
cmd
)
driver_id
=
re
.
findall
(
pattern
,
output
)
if
not
driver_id
:
raise
e
rror
.
TestFail
(
"Didn't find driver info from guest %s"
%
output
)
raise
e
xceptions
.
TestFail
(
"Didn't find driver info from guest %s"
%
output
)
driver_id
=
driver_id
[
0
]
if
params
[
"os_type"
]
==
"windows"
:
driver_id
=
'^&'
.
join
(
driver_id
.
split
(
'&'
))
session
.
close
()
return
driver_id
error
.
context
(
"Try to log into guest."
,
logging
.
info
)
error
_context
.
context
(
"Try to log into guest."
,
logging
.
info
)
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
vm
.
verify_alive
()
timeout
=
float
(
params
.
get
(
"login_timeout"
,
240
))
# Use the last nic for send driver load/unload command
nic_index
=
len
(
vm
.
virtnet
)
-
1
session
=
vm
.
wait_for_login
(
nic_index
=
nic_index
,
timeout
=
timeout
)
session
=
vm
.
wait_for_login
(
timeout
=
timeout
)
driver_id_cmd
=
params
[
"driver_id_cmd"
]
driver_id_pattern
=
params
[
"driver_id_pattern"
]
driver_load_cmd
=
params
[
"driver_load_cmd"
]
driver_unload_cmd
=
params
[
"driver_unload_cmd"
]
devcon
=
params
.
get
(
"devcon"
)
if
devcon
:
error
.
context
(
"Copy devcon.exe from winutils.iso to C:
\\
"
)
copy_devcon_cmd
=
params
.
get
(
"devcon"
)
%
\
utils_misc
.
get_winutils_vol
(
session
)
session
.
cmd
(
copy_devcon_cmd
)
driver_id_cmd
=
utils_misc
.
set_winutils_letter
(
session
,
params
[
"driver_id_cmd"
])
driver_load_cmd
=
utils_misc
.
set_winutils_letter
(
session
,
params
[
"driver_load_cmd"
])
driver_unload_cmd
=
utils_misc
.
set_winutils_letter
(
session
,
params
[
"driver_unload_cmd"
])
session
.
close
()
for
repeat
in
range
(
0
,
int
(
params
.
get
(
"repeats"
,
1
))):
error
.
context
(
"Unload and load the driver. Round %s"
%
repeat
,
logging
.
info
)
error
.
context
(
"Get driver info from guest"
,
logging
.
info
)
driver_id
=
check_driver
(
session
,
driver_id_cmd
,
driver_id_pattern
)
error
_context
.
context
(
"Unload and load the driver. Round %s"
%
repeat
,
logging
.
info
)
logging
.
info
(
"Get driver info from guest"
)
driver_id
=
get_driver_id
(
driver_id_cmd
,
driver_id_pattern
)
error
.
context
(
"Unload the driver"
,
logging
.
info
)
unload_driver
(
session
,
driver_unload_cmd
,
driver_id
)
error
_context
.
context
(
"Unload the driver"
,
logging
.
info
)
unload_driver
(
driver_unload_cmd
,
driver_id
)
time
.
sleep
(
5
)
error
.
context
(
"Load the driver"
,
logging
.
info
)
load_driver
(
session
,
driver_load_cmd
,
driver_id
)
error_context
.
context
(
"Load the driver"
,
logging
.
info
)
load_driver
(
driver_load_cmd
,
driver_id
)
time
.
sleep
(
5
)
test_after_load
=
params
.
get
(
"test_after_load"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录