Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
93a1b986
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,发现更多精彩内容 >>
提交
93a1b986
编写于
4月 03, 2018
作者:
X
Xu Han
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[qemu] Replace autotest modules - fg
Signed-off-by:
N
Xu Han
<
xuhan@redhat.com
>
上级
6594648d
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
162 addition
and
157 deletion
+162
-157
qemu/tests/file_copy_stress.py
qemu/tests/file_copy_stress.py
+5
-5
qemu/tests/fio_perf.py
qemu/tests/fio_perf.py
+3
-6
qemu/tests/flag_check.py
qemu/tests/flag_check.py
+27
-20
qemu/tests/floppy.py
qemu/tests/floppy.py
+56
-51
qemu/tests/flow_caches_stress_test.py
qemu/tests/flow_caches_stress_test.py
+17
-16
qemu/tests/format_disk.py
qemu/tests/format_disk.py
+31
-29
qemu/tests/fullscreen_setup.py
qemu/tests/fullscreen_setup.py
+1
-3
qemu/tests/getfd.py
qemu/tests/getfd.py
+4
-5
qemu/tests/gluster_boot_snap_boot.py
qemu/tests/gluster_boot_snap_boot.py
+5
-6
qemu/tests/gluster_create_images.py
qemu/tests/gluster_create_images.py
+3
-4
qemu/tests/guest_memory_dump_analysis.py
qemu/tests/guest_memory_dump_analysis.py
+10
-12
未找到文件。
qemu/tests/file_copy_stress.py
浏览文件 @
93a1b986
import
time
import
logging
from
autotest.client.shared
import
error
from
virttest
import
error_context
from
virttest
import
utils_misc
from
virttest
import
utils_test
@
error
.
context_aware
@
error
_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
Transfer a file back and forth between host and guest.
...
...
@@ -26,14 +25,15 @@ def run(test, params, env):
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
vm
.
verify_alive
()
error
.
context
(
"Login to guest"
,
logging
.
info
)
error
_context
.
context
(
"Login to guest"
,
logging
.
info
)
session
=
vm
.
wait_for_login
(
timeout
=
login_timeout
)
scp_sessions
=
int
(
params
.
get
(
"scp_para_sessions"
,
1
))
try
:
stress_timeout
=
float
(
params
.
get
(
"stress_timeout"
,
"3600"
))
error
.
context
(
"Do file transfer between host and guest"
,
logging
.
info
)
error_context
.
context
(
"Do file transfer between host and guest"
,
logging
.
info
)
start_time
=
time
.
time
()
stop_time
=
start_time
+
stress_timeout
# here when set a run flag, when other case call this case as a
...
...
qemu/tests/fio_perf.py
浏览文件 @
93a1b986
...
...
@@ -4,10 +4,7 @@ import time
import
threading
import
logging
from
autotest.client
import
utils
from
avocado.utils
import
process
from
avocado.core
import
exceptions
from
virttest
import
utils_misc
,
utils_test
from
virttest
import
data_dir
...
...
@@ -64,7 +61,7 @@ def get_version(session, result_file, kvm_ver_chk_cmd, guest_ver_cmd, type, driv
:param timeout: Timeout in seconds
"""
kvm_ver
=
util
s
.
system_output
(
kvm_ver_chk_cmd
)
kvm_ver
=
proces
s
.
system_output
(
kvm_ver_chk_cmd
)
host_ver
=
os
.
uname
()[
2
]
result_file
.
write
(
"### kvm-userspace-ver : %s
\n
"
%
kvm_ver
)
...
...
@@ -207,7 +204,7 @@ def run(test, params, env):
(
s
,
o
)
=
session
.
cmd_status_output
(
online_disk_run
,
timeout
=
cmd_timeout
)
if
s
:
raise
exceptions
.
TestF
ail
(
"Failed to online disk: %s"
%
o
)
test
.
f
ail
(
"Failed to online disk: %s"
%
o
)
# format disk
if
format
==
"True"
:
session
.
cmd
(
pre_cmd
,
cmd_timeout
)
...
...
@@ -239,7 +236,7 @@ def run(test, params, env):
(
s
,
o
)
=
session
.
cmd_status_output
(
drop_cache
,
timeout
=
cmd_timeout
)
if
s
:
raise
exceptions
.
TestF
ail
(
"Failed to free memory: %s"
%
o
)
test
.
f
ail
(
"Failed to free memory: %s"
%
o
)
cpu_file
=
os
.
path
.
join
(
data_dir
.
get_tmp_dir
(),
"cpus"
)
io_exits_b
=
int
(
process
.
system_output
(
"cat /sys/kernel/debug/kvm/exits"
))
fio_t
=
threading
.
Thread
(
target
=
fio_thread
)
...
...
qemu/tests/flag_check.py
浏览文件 @
93a1b986
...
...
@@ -2,14 +2,16 @@ import re
import
logging
import
os.path
from
autotest.client.shared
import
utils
,
error
from
avocado.utils
import
download
from
avocado.utils
import
process
from
virttest
import
error_context
from
virttest
import
utils_misc
from
virttest
import
data_dir
from
virttest
import
virt_vm
@
error
.
context_aware
@
error
_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
flag_check test:
...
...
@@ -83,7 +85,7 @@ def run(test, params, env):
"""
qemu_binary
=
utils_misc
.
get_qemu_binary
(
params
)
cmd
=
qemu_binary
+
params
.
get
(
"query_cmd"
,
" -cpu ?"
)
output
=
util
s
.
system_output
(
cmd
)
output
=
proces
s
.
system_output
(
cmd
)
flags_re
=
re
.
compile
(
params
.
get
(
"pattern"
,
"flags:(.*)"
))
flag_list
=
flags_re
.
search
(
output
)
flags
=
[]
...
...
@@ -131,15 +133,17 @@ def run(test, params, env):
dump_file
=
params
.
get
(
"dump_file"
)
default_dump_path
=
os
.
path
.
join
(
data_dir
.
get_deps_dir
(),
"cpuid"
)
dump_path
=
params
.
get
(
"dump_path"
,
default_dump_path
)
cpuinfo_file
=
utils
.
unmap_url
(
dump_path
,
dump_file
,
dump_path
)
dump_file_path
=
os
.
path
.
join
(
dump_path
,
dump_file
)
cpuinfo_file
=
os
.
path
.
join
(
default_dump_path
,
dump_file
)
download
.
get_file
(
dump_file_path
,
dump_file
)
host_flags
=
utils_misc
.
get_cpu_flags
()
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
guest_cpumodel
=
vm
.
cpuinfo
.
model
extra_flags
=
params
.
get
(
"cpu_model_flags"
,
" "
)
error
.
context
(
"Boot guest with -cpu %s,%s"
%
(
guest_cpumodel
,
extra_flags
),
logging
.
info
)
error
_context
.
context
(
"Boot guest with -cpu %s,%s"
%
(
guest_cpumodel
,
extra_flags
),
logging
.
info
)
if
params
.
get
(
"start_vm"
)
==
"no"
and
"unknown,check"
in
extra_flags
:
params
[
"start_vm"
]
=
"yes"
...
...
@@ -151,7 +155,7 @@ def run(test, params, env):
except
virt_vm
.
VMCreateError
as
detail
:
output
=
str
(
detail
)
if
params
[
"qemu_output"
]
not
in
output
:
raise
error
.
TestF
ail
(
"no qemu output: %s"
%
params
[
"qemu_output"
])
test
.
f
ail
(
"no qemu output: %s"
%
params
[
"qemu_output"
])
else
:
vm
.
verify_alive
()
timeout
=
float
(
params
.
get
(
"login_timeout"
,
240
))
...
...
@@ -163,10 +167,12 @@ def run(test, params, env):
qemu_model
=
host_cpumodel
[
0
]
else
:
qemu_model
=
guest_cpumodel
error
.
context
(
"Get model %s support flags"
%
qemu_model
,
logging
.
info
)
error_context
.
context
(
"Get model %s support flags"
%
qemu_model
,
logging
.
info
)
# Get flags for every reg from model's info
models_info
=
utils
.
system_output
(
"cat %s"
%
cpuinfo_file
).
split
(
"x86"
)
models_info
=
process
.
system_output
(
"cat %s"
%
cpuinfo_file
).
split
(
"x86"
)
model_info
=
qemu_model_info
(
models_info
,
qemu_model
)
reg_list
=
params
.
get
(
"reg_list"
,
"feature_edx "
).
split
()
model_support_flags
=
" "
...
...
@@ -178,10 +184,10 @@ def run(test, params, env):
model_support_flags
=
set
(
map
(
utils_misc
.
Flag
,
model_support_flags
.
split
()))
error
.
context
(
"Get guest flags"
,
logging
.
info
)
error
_context
.
context
(
"Get guest flags"
,
logging
.
info
)
guest_flags
=
get_guest_cpuflags
(
session
)
error
.
context
(
"Get expected flag list"
,
logging
.
info
)
error
_context
.
context
(
"Get expected flag list"
,
logging
.
info
)
# out_flags is definded in dump file, but not in guest
out_flags
=
params
.
get
(
"out_flags"
,
" "
).
split
()
...
...
@@ -208,7 +214,7 @@ def run(test, params, env):
lack_flags
=
set
(
expected_flags
|
check_flags
)
-
host_flags
if
"check"
in
extra_flags
and
"unknown"
not
in
extra_flags
:
error
.
context
(
"Check lack flag in host"
,
logging
.
info
)
error
_context
.
context
(
"Check lack flag in host"
,
logging
.
info
)
process_output
=
vm
.
process
.
get_output
()
miss_warn
=
[]
if
lack_flags
:
...
...
@@ -216,17 +222,18 @@ def run(test, params, env):
if
flag
not
in
process_output
:
miss_warn
.
extend
(
flag
.
split
())
if
miss_warn
:
raise
error
.
TestF
ail
(
"no warning for lack flag %s"
%
miss_warn
)
test
.
f
ail
(
"no warning for lack flag %s"
%
miss_warn
)
error
.
context
(
"Compare guest flags with expected flags"
,
logging
.
info
)
error_context
.
context
(
"Compare guest flags with expected flags"
,
logging
.
info
)
all_support_flags
=
get_all_support_flags
()
missing_flags
=
expected_flags
-
guest_flags
unexpect_flags
=
(
guest_flags
-
expected_flags
-
all_support_flags
-
option_flags
)
if
missing_flags
or
unexpect_flags
:
raise
error
.
TestF
ail
(
"missing flags:
\n
%s
\n
"
"more flags than expected:
\n
%s
\n
"
"expected flags:
\n
%s
\n
"
"guest flags:
\n
%s
\n
"
%
(
missing_flags
,
unexpect_flags
,
expected_flags
,
guest_flags
))
test
.
f
ail
(
"missing flags:
\n
%s
\n
"
"more flags than expected:
\n
%s
\n
"
"expected flags:
\n
%s
\n
"
"guest flags:
\n
%s
\n
"
%
(
missing_flags
,
unexpect_flags
,
expected_flags
,
guest_flags
))
qemu/tests/floppy.py
浏览文件 @
93a1b986
...
...
@@ -4,21 +4,17 @@ import os
import
sys
import
re
try
:
import
aexpect
except
ImportError
:
from
virttest
import
aexpect
import
aexpect
from
autotest.client
import
utils
from
autotest.client.shared
import
error
from
autotest.client.shared.syncdata
import
SyncData
from
avocado.utils
import
process
from
virttest
import
data_dir
from
virttest
import
env_process
from
virttest
import
error_context
from
virttest.utils_test.qemu
import
migration
@
error
.
context_aware
@
error
_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
Test virtual floppy of guest:
...
...
@@ -48,17 +44,17 @@ def run(test, params, env):
:return: path to new floppy file.
"""
error
.
context
(
"creating test floppy"
,
logging
.
info
)
error
_context
.
context
(
"creating test floppy"
,
logging
.
info
)
floppy
=
params
[
"floppy_name"
]
if
not
os
.
path
.
isabs
(
floppy
):
floppy
=
os
.
path
.
join
(
data_dir
.
get_data_dir
(),
floppy
)
if
prepare
:
util
s
.
run
(
"dd if=/dev/zero of=%s bs=512 count=2880"
%
floppy
)
proces
s
.
run
(
"dd if=/dev/zero of=%s bs=512 count=2880"
%
floppy
)
return
floppy
def
cleanup_floppy
(
path
):
""" Removes created floppy """
error
.
context
(
"cleaning up temp floppy images"
,
logging
.
info
)
error
_context
.
context
(
"cleaning up temp floppy images"
,
logging
.
info
)
os
.
remove
(
"%s"
%
path
)
def
lazy_copy
(
vm
,
dst_path
,
check_path
,
copy_timeout
=
None
,
dsize
=
None
):
...
...
@@ -126,27 +122,27 @@ def run(test, params, env):
else
:
time
.
sleep
(
20
)
error
.
context
(
"Formating floppy disk before using it"
)
error
_context
.
context
(
"Formating floppy disk before using it"
)
format_cmd
=
params
[
"format_floppy_cmd"
]
self
.
session
.
cmd
(
format_cmd
,
timeout
=
120
)
logging
.
info
(
"Floppy disk formatted successfully"
)
if
self
.
dest_dir
:
error
.
context
(
"Mounting floppy"
)
error
_context
.
context
(
"Mounting floppy"
)
self
.
session
.
cmd
(
"mount %s %s"
%
(
guest_floppy_path
,
self
.
dest_dir
))
error
.
context
(
"Testing floppy"
)
error
_context
.
context
(
"Testing floppy"
)
self
.
session
.
cmd
(
params
[
"test_floppy_cmd"
])
error
.
context
(
"Copying file to the floppy"
)
error
_context
.
context
(
"Copying file to the floppy"
)
md5_cmd
=
params
.
get
(
"md5_cmd"
)
if
md5_cmd
:
md5_source
=
self
.
session
.
cmd
(
"%s %s"
%
(
md5_cmd
,
source_file
))
try
:
md5_source
=
md5_source
.
split
(
" "
)[
0
]
except
IndexError
:
error
.
TestE
rror
(
"Failed to get md5 from source file,"
" output: '%s'"
%
md5_source
)
test
.
e
rror
(
"Failed to get md5 from source file,"
" output: '%s'"
%
md5_source
)
else
:
md5_source
=
None
...
...
@@ -155,16 +151,17 @@ def run(test, params, env):
logging
.
info
(
"Succeed to copy file '%s' into floppy disk"
%
source_file
)
error
.
context
(
"Checking if the file is unchanged after copy"
)
error_context
.
context
(
"Checking if the file is unchanged "
"after copy"
)
if
md5_cmd
:
md5_dest
=
self
.
session
.
cmd
(
"%s %s"
%
(
md5_cmd
,
dest_file
))
try
:
md5_dest
=
md5_dest
.
split
(
" "
)[
0
]
except
IndexError
:
error
.
TestE
rror
(
"Failed to get md5 from dest file,"
" output: '%s'"
%
md5_dest
)
test
.
e
rror
(
"Failed to get md5 from dest file,"
" output: '%s'"
%
md5_dest
)
if
md5_source
!=
md5_dest
:
raise
error
.
TestF
ail
(
"File changed after copy to floppy"
)
test
.
f
ail
(
"File changed after copy to floppy"
)
else
:
md5_dest
=
None
self
.
session
.
cmd
(
"%s %s %s"
%
(
params
[
"diff_file_cmd"
],
...
...
@@ -180,7 +177,8 @@ def run(test, params, env):
class
Multihost
(
MiniSubtest
):
def
test
(
self
):
error
.
context
(
"Preparing migration env and floppies."
,
logging
.
info
)
error_context
.
context
(
"Preparing migration env and floppies."
,
logging
.
info
)
mig_protocol
=
params
.
get
(
"mig_protocol"
,
"tcp"
)
self
.
mig_type
=
migration
.
MultihostMigration
if
mig_protocol
==
"fd"
:
...
...
@@ -219,6 +217,8 @@ def run(test, params, env):
class
test_multihost_write
(
Multihost
):
def
test
(
self
):
from
autotest.client.shared.syncdata
import
SyncData
super
(
test_multihost_write
,
self
).
test
()
copy_timeout
=
int
(
params
.
get
(
"copy_timeout"
,
480
))
...
...
@@ -243,7 +243,8 @@ def run(test, params, env):
# If mount_dir specified, treat guest as a Linux OS
# Some Linux distribution does not load floppy at boot
# and Windows needs time to load and init floppy driver
error
.
context
(
"Prepare floppy for writing."
,
logging
.
info
)
error_context
.
context
(
"Prepare floppy for writing."
,
logging
.
info
)
if
self
.
mount_dir
:
lsmod
=
session
.
cmd
(
"lsmod"
)
if
'floppy'
not
in
lsmod
:
...
...
@@ -253,13 +254,13 @@ def run(test, params, env):
session
.
cmd
(
format_floppy_cmd
)
error
.
context
(
"Mount and copy data."
,
logging
.
info
)
error
_context
.
context
(
"Mount and copy data."
,
logging
.
info
)
if
self
.
mount_dir
:
session
.
cmd
(
"mount %s %s"
%
(
guest_floppy_path
,
self
.
mount_dir
),
timeout
=
30
)
error
.
context
(
"File copying test."
,
logging
.
info
)
error
_context
.
context
(
"File copying test."
,
logging
.
info
)
pid
=
lazy_copy
(
vm
,
src_file
,
check_copy_path
,
copy_timeout
)
...
...
@@ -273,34 +274,35 @@ def run(test, params, env):
if
not
self
.
is_src
:
# Starts in destination
vm
=
env
.
get_vm
(
self
.
vms
[
0
])
session
=
vm
.
wait_for_login
(
timeout
=
login_timeout
)
error
.
context
(
"Wait for copy finishing."
,
logging
.
info
)
error
_context
.
context
(
"Wait for copy finishing."
,
logging
.
info
)
status
=
session
.
cmd_status
(
"kill %s"
%
pid
,
timeout
=
copy_timeout
)
if
status
!=
0
:
raise
error
.
TestF
ail
(
"Copy process was terminatted with"
" error code %s"
%
(
status
))
test
.
f
ail
(
"Copy process was terminatted with"
" error code %s"
%
(
status
))
session
.
cmd_status
(
"kill -s SIGINT %s"
%
(
pid
),
timeout
=
copy_timeout
)
error
.
context
(
"Check floppy file checksum."
,
logging
.
info
)
error_context
.
context
(
"Check floppy file checksum."
,
logging
.
info
)
md5_cmd
=
params
.
get
(
"md5_cmd"
,
"md5sum"
)
if
md5_cmd
:
md5_floppy
=
session
.
cmd
(
"%s %s"
%
(
md5_cmd
,
src_file
))
try
:
md5_floppy
=
md5_floppy
.
split
(
" "
)[
0
]
except
IndexError
:
error
.
TestE
rror
(
"Failed to get md5 from source file,"
" output: '%s'"
%
md5_floppy
)
test
.
e
rror
(
"Failed to get md5 from source file,"
" output: '%s'"
%
md5_floppy
)
md5_check
=
session
.
cmd
(
"%s %s"
%
(
md5_cmd
,
check_copy_path
))
try
:
md5_check
=
md5_check
.
split
(
" "
)[
0
]
except
IndexError
:
error
.
TestE
rror
(
"Failed to get md5 from dst file,"
" output: '%s'"
%
md5_floppy
)
test
.
e
rror
(
"Failed to get md5 from dst file,"
" output: '%s'"
%
md5_floppy
)
if
md5_check
!=
md5_floppy
:
raise
error
.
TestF
ail
(
"There is mistake in copying, "
"it is possible to check file on vm."
)
test
.
f
ail
(
"There is mistake in copying, "
"it is possible to check file on vm."
)
session
.
cmd
(
"rm -f %s"
%
(
src_file
))
session
.
cmd
(
"rm -f %s"
%
(
check_copy_path
))
...
...
@@ -314,6 +316,8 @@ def run(test, params, env):
class
test_multihost_eject
(
Multihost
):
def
test
(
self
):
from
autotest.client.shared.syncdata
import
SyncData
super
(
test_multihost_eject
,
self
).
test
()
self
.
mount_dir
=
params
.
get
(
"mount_dir"
,
None
)
...
...
@@ -344,7 +348,8 @@ def run(test, params, env):
# If mount_dir specified, treat guest as a Linux OS
# Some Linux distribution does not load floppy at boot
# and Windows needs time to load and init floppy driver
error
.
context
(
"Prepare floppy for writing."
,
logging
.
info
)
error_context
.
context
(
"Prepare floppy for writing."
,
logging
.
info
)
if
self
.
mount_dir
:
# If linux
lsmod
=
session
.
cmd
(
"lsmod"
)
if
'floppy'
not
in
lsmod
:
...
...
@@ -353,7 +358,7 @@ def run(test, params, env):
time
.
sleep
(
20
)
if
floppy
not
in
vm
.
monitor
.
info
(
"block"
):
raise
error
.
TestF
ail
(
"Wrong floppy image is placed in vm."
)
test
.
f
ail
(
"Wrong floppy image is placed in vm."
)
try
:
session
.
cmd
(
format_floppy_cmd
)
...
...
@@ -363,7 +368,7 @@ def run(test, params, env):
" Trying a second time as a workaround"
)
session
.
cmd
(
format_floppy_cmd
)
error
.
context
(
"Check floppy"
)
error
_context
.
context
(
"Check floppy"
)
if
self
.
mount_dir
:
# If linux
session
.
cmd
(
"mount %s %s"
%
(
guest_floppy_path
,
self
.
mount_dir
),
timeout
=
30
)
...
...
@@ -381,23 +386,23 @@ def run(test, params, env):
output
=
session
.
cmd
(
"type %s"
%
(
filepath
))
written
=
"test
\n\n
"
if
output
!=
written
:
raise
error
.
TestF
ail
(
"Data read from the floppy differs"
"from the data written to it."
" EXPECTED: %s GOT: %s"
%
(
repr
(
written
),
repr
(
output
)))
test
.
f
ail
(
"Data read from the floppy differs"
"from the data written to it."
" EXPECTED: %s GOT: %s"
%
(
repr
(
written
),
repr
(
output
)))
error
.
context
(
"Change floppy."
)
error
_context
.
context
(
"Change floppy."
)
vm
.
monitor
.
cmd
(
"eject floppy0"
)
vm
.
monitor
.
cmd
(
"change floppy %s"
%
(
second_floppy
))
session
.
cmd
(
format_floppy_cmd
)
error
.
context
(
"Mount and copy data"
)
error
_context
.
context
(
"Mount and copy data"
)
if
self
.
mount_dir
:
# If linux
session
.
cmd
(
"mount %s %s"
%
(
guest_floppy_path
,
self
.
mount_dir
),
timeout
=
30
)
if
second_floppy
not
in
vm
.
monitor
.
info
(
"block"
):
raise
error
.
TestF
ail
(
"Wrong floppy image is placed in vm."
)
test
.
f
ail
(
"Wrong floppy image is placed in vm."
)
sync
=
SyncData
(
self
.
mig
.
master_id
(),
self
.
mig
.
hostid
,
self
.
mig
.
hosts
,
sync_id
,
self
.
mig
.
sync_server
)
...
...
@@ -421,10 +426,10 @@ def run(test, params, env):
output
=
session
.
cmd
(
"type %s"
%
(
filepath
))
written
=
"test
\n\n
"
if
output
!=
written
:
raise
error
.
TestF
ail
(
"Data read from the floppy differs"
"from the data written to it."
" EXPECTED: %s GOT: %s"
%
(
repr
(
written
),
repr
(
output
)))
test
.
f
ail
(
"Data read from the floppy differs"
"from the data written to it."
" EXPECTED: %s GOT: %s"
%
(
repr
(
written
),
repr
(
output
)))
self
.
mig
.
_hosts_barrier
(
self
.
mig
.
hosts
,
self
.
mig
.
hosts
,
'finish_floppy_test'
,
login_timeout
)
...
...
@@ -437,5 +442,5 @@ def run(test, params, env):
tests_group
=
locals
()[
test_type
]
tests_group
()
else
:
raise
error
.
TestF
ail
(
"Test group '%s' is not defined in"
" migration_with_dst_problem test"
%
test_type
)
test
.
f
ail
(
"Test group '%s' is not defined in"
" migration_with_dst_problem test"
%
test_type
)
qemu/tests/flow_caches_stress_test.py
浏览文件 @
93a1b986
import
logging
from
autotest.client
import
utils
from
autotest.client.shared
import
error
from
avocado.utils
import
process
from
virttest
import
error_context
from
virttest
import
utils_netperf
from
virttest
import
utils_net
from
virttest
import
env_process
...
...
@@ -12,7 +12,7 @@ from virttest import utils_test
# This decorator makes the test function aware of context strings
@
error
.
context_aware
@
error
_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
QEMU flow caches stress test test
...
...
@@ -33,13 +33,13 @@ def run(test, params, env):
:param env: Dictionary with test environment.
"""
msg
=
"Make sure nf_conntrack is disabled in host and guest."
error
.
context
(
msg
,
logging
.
info
)
if
"nf_conntrack"
in
util
s
.
system_output
(
"lsmod"
):
error
_context
.
context
(
msg
,
logging
.
info
)
if
"nf_conntrack"
in
proces
s
.
system_output
(
"lsmod"
):
err
=
"nf_conntrack load in host, skip this case"
raise
error
.
TestNAError
(
err
)
test
.
cancel
(
err
)
params
[
"start_vm"
]
=
"yes"
error
.
context
(
"Boot up guest"
,
logging
.
info
)
error
_context
.
context
(
"Boot up guest"
,
logging
.
info
)
env_process
.
preprocess_vm
(
test
,
params
,
env
,
params
[
"main_vm"
])
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
vm
.
verify_alive
()
...
...
@@ -48,7 +48,7 @@ def run(test, params, env):
session
=
vm
.
wait_for_login
(
timeout
=
timeout
)
if
"nf_conntrack"
in
session
.
cmd_output
(
"lsmod"
):
msg
=
"Unload nf_conntrack module in guest."
error
.
context
(
msg
,
logging
.
info
)
error
_context
.
context
(
msg
,
logging
.
info
)
black_str
=
"#disable nf_conntrack
\\
nblacklist nf_conntrack
\\
n"
\
"blacklist nf_conntrack_ipv6
\\
nblacklist xt_conntrack
\\
n"
\
"blacklist nf_conntrack_ftp
\\
nblacklist xt_state
\\
n"
\
...
...
@@ -59,7 +59,7 @@ def run(test, params, env):
session
=
vm
.
reboot
(
session
,
timeout
=
timeout
)
if
"nf_conntrack"
in
session
.
cmd_output
(
"lsmod"
):
err
=
"Fail to unload nf_conntrack module in guest."
error
.
TestE
rror
(
err
)
test
.
e
rror
(
err
)
netperf_link
=
utils_misc
.
get_path
(
data_dir
.
get_deps_dir
(
"netperf"
),
params
[
"netperf_link"
])
...
...
@@ -91,14 +91,15 @@ def run(test, params, env):
compile_option_server
=
params
.
get
(
"compile_option_server"
,
""
)
if
int
(
params
.
get
(
"queues"
,
1
))
>
1
and
params
.
get
(
"os_type"
)
==
"linux"
:
error
.
context
(
"Enable multi queues support in guest."
,
logging
.
info
)
error_context
.
context
(
"Enable multi queues support in guest."
,
logging
.
info
)
guest_mac
=
vm
.
get_mac_address
()
ifname
=
utils_net
.
get_linux_ifname
(
session
,
guest_mac
)
cmd
=
"ethtool -L %s combined %s"
%
(
ifname
,
params
.
get
(
"queues"
))
status
,
out
=
session
.
cmd_status_output
(
cmd
)
msg
=
"Fail to enable multi queues support in guest."
msg
+=
"Command %s fail output: %s"
%
(
cmd
,
out
)
error
.
TestE
rror
(
msg
)
test
.
e
rror
(
msg
)
if
params
.
get
(
"os_type"
)
==
"linux"
:
session
.
cmd
(
"iptables -F"
,
ignore_all_errors
=
True
)
...
...
@@ -110,7 +111,7 @@ def run(test, params, env):
g_client_path
=
win_netperf_path
g_md5sum
=
win_netperf_md5sum
error
.
context
(
"Setup netperf in guest and host"
,
logging
.
info
)
error
_context
.
context
(
"Setup netperf in guest and host"
,
logging
.
info
)
netperf_client
=
utils_netperf
.
NetperfClient
(
netperf_client_ip
,
g_client_path
,
g_md5sum
,
g_client_link
,
...
...
@@ -132,12 +133,12 @@ def run(test, params, env):
status_test_command
=
status_test_command
,
compile_option
=
compile_option_server
)
try
:
error
.
base_context
(
"Run netperf test between host and guest."
)
error
.
context
(
"Start netserver in host."
,
logging
.
info
)
error
_context
.
base_context
(
"Run netperf test between host and guest."
)
error
_context
.
context
(
"Start netserver in host."
,
logging
.
info
)
netperf_server
.
start
()
error
.
context
(
"Start Netperf in guest for %ss."
%
netperf_timeout
,
logging
.
info
)
error
_context
.
context
(
"Start Netperf in guest for %ss."
%
netperf_timeout
,
logging
.
info
)
test_option
=
"-t TCP_CRR -l %s -- -b 10 -D"
%
netperf_timeout
netperf_client
.
bg_start
(
netperf_server_ip
,
test_option
,
client_num
)
...
...
qemu/tests/format_disk.py
浏览文件 @
93a1b986
...
...
@@ -3,12 +3,11 @@ import re
import
aexpect
from
autotest.client.shared
import
error
from
virttest
import
error_context
from
virttest
import
utils_misc
@
error
.
context_aware
@
error
_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
Format guest disk:
...
...
@@ -29,7 +28,7 @@ def run(test, params, env):
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
vm
.
verify_alive
()
error
.
context
(
"Login to the guest"
,
logging
.
info
)
error
_context
.
context
(
"Login to the guest"
,
logging
.
info
)
session
=
vm
.
wait_for_login
(
timeout
=
int
(
params
.
get
(
"login_timeout"
,
360
)))
cmd_timeout
=
int
(
params
.
get
(
"cmd_timeout"
,
360
))
...
...
@@ -45,45 +44,45 @@ def run(test, params, env):
drive_id
=
""
drive_path
=
utils_misc
.
get_linux_drive_path
(
session
,
drive_id
)
if
not
drive_path
:
raise
error
.
TestE
rror
(
"Failed to get '%s' drive path"
%
drive_name
)
test
.
e
rror
(
"Failed to get '%s' drive path"
%
drive_name
)
# Create a partition on disk
create_partition_cmd
=
params
.
get
(
"create_partition_cmd"
)
if
create_partition_cmd
:
has_dispart
=
re
.
findall
(
"diskpart"
,
create_partition_cmd
,
re
.
I
)
if
(
params
.
get
(
"os_type"
)
==
'windows'
and
has_dispart
):
error
.
context
(
"Get disk list in guest"
)
error
_context
.
context
(
"Get disk list in guest"
)
list_disk_cmd
=
params
.
get
(
"list_disk_cmd"
)
status
,
output
=
session
.
cmd_status_output
(
list_disk_cmd
,
timeout
=
cmd_timeout
)
for
i
in
re
.
findall
(
"Disk*.(\d+)\s+Offline"
,
output
):
error
.
context
(
"Set disk '%s' to online status"
%
i
,
logging
.
info
)
error
_context
.
context
(
"Set disk '%s' to online status"
%
i
,
logging
.
info
)
set_online_cmd
=
params
.
get
(
"set_online_cmd"
)
%
i
status
,
output
=
session
.
cmd_status_output
(
set_online_cmd
,
timeout
=
cmd_timeout
)
if
status
!=
0
:
raise
error
.
TestF
ail
(
"Can not set disk online %s"
%
output
)
test
.
f
ail
(
"Can not set disk online %s"
%
output
)
error
.
context
(
"Create partition on disk"
,
logging
.
info
)
error
_context
.
context
(
"Create partition on disk"
,
logging
.
info
)
status
,
output
=
session
.
cmd_status_output
(
create_partition_cmd
,
timeout
=
cmd_timeout
)
if
status
!=
0
:
raise
error
.
TestFail
(
"Failed to create partition with error: %s"
%
output
)
test
.
fail
(
"Failed to create partition with error: %s"
%
output
)
format_cmd
=
params
.
get
(
"format_cmd"
,
""
).
format
(
drive_path
)
if
format_cmd
:
error
.
context
(
"Format the disk with cmd '%s'"
%
format_cmd
,
logging
.
info
)
error
_context
.
context
(
"Format the disk with cmd '%s'"
%
format_cmd
,
logging
.
info
)
status
,
output
=
session
.
cmd_status_output
(
format_cmd
,
timeout
=
cmd_timeout
)
if
status
!=
0
:
raise
error
.
TestF
ail
(
"Failed to format with error: %s"
%
output
)
test
.
f
ail
(
"Failed to format with error: %s"
%
output
)
mount_cmd
=
params
.
get
(
"mount_cmd"
,
""
).
format
(
drive_path
)
if
mount_cmd
:
error
.
context
(
"Mount the disk with cmd '%s'"
%
mount_cmd
,
logging
.
info
)
error_context
.
context
(
"Mount the disk with cmd '%s'"
%
mount_cmd
,
logging
.
info
)
status
,
output
=
session
.
cmd_status_output
(
mount_cmd
,
timeout
=
cmd_timeout
)
if
status
!=
0
:
...
...
@@ -91,11 +90,12 @@ def run(test, params, env):
device_list
=
session
.
cmd_output_safe
(
show_dev_cmd
)
logging
.
debug
(
"The devices which will be mounted are: %s"
%
device_list
)
raise
error
.
TestF
ail
(
"Failed to mount with error: %s"
%
output
)
test
.
f
ail
(
"Failed to mount with error: %s"
%
output
)
testfile_name
=
params
.
get
(
"testfile_name"
)
if
testfile_name
:
error
.
context
(
"Write some random string to test file"
,
logging
.
info
)
error_context
.
context
(
"Write some random string to test file"
,
logging
.
info
)
ranstr
=
utils_misc
.
generate_random_string
(
100
)
writefile_cmd
=
params
[
"writefile_cmd"
]
...
...
@@ -103,30 +103,31 @@ def run(test, params, env):
status
,
output
=
session
.
cmd_status_output
(
writefile_cmd
,
timeout
=
cmd_timeout
)
if
status
!=
0
:
raise
error
.
TestF
ail
(
"Write to file error: %s"
%
output
)
test
.
f
ail
(
"Write to file error: %s"
%
output
)
error
.
context
(
"Read in the file to see whether content has changed"
,
logging
.
info
)
error
_context
.
context
(
"Read in the file to see whether "
"content has changed"
,
logging
.
info
)
md5chk_cmd
=
params
.
get
(
"md5chk_cmd"
)
if
md5chk_cmd
:
status
,
output
=
session
.
cmd_status_output
(
md5chk_cmd
,
timeout
=
cmd_timeout
)
if
status
!=
0
:
raise
error
.
TestF
ail
(
"Check file md5sum error."
)
test
.
f
ail
(
"Check file md5sum error."
)
readfile_cmd
=
params
[
"readfile_cmd"
]
readfile_cmd
=
readfile_cmd
%
testfile_name
status
,
output
=
session
.
cmd_status_output
(
readfile_cmd
,
timeout
=
cmd_timeout
)
if
status
!=
0
:
raise
error
.
TestF
ail
(
"Read file error: %s"
%
output
)
test
.
f
ail
(
"Read file error: %s"
%
output
)
if
output
.
strip
()
!=
ranstr
:
raise
error
.
TestF
ail
(
"The content written to file has changed, "
"from: %s, to: %s"
%
(
ranstr
,
output
.
strip
()))
test
.
f
ail
(
"The content written to file has changed, "
"from: %s, to: %s"
%
(
ranstr
,
output
.
strip
()))
umount_cmd
=
params
.
get
(
"umount_cmd"
,
""
).
format
(
drive_path
)
if
umount_cmd
:
error
.
context
(
"Unmounting disk(s) after file write/read operation"
)
error_context
.
context
(
"Unmounting disk(s) after file "
"write/read operation"
)
status
,
output
=
session
.
cmd_status_output
(
umount_cmd
,
timeout
=
cmd_timeout
)
if
status
!=
0
:
...
...
@@ -134,12 +135,13 @@ def run(test, params, env):
"show_mount_cmd"
,
""
).
format
(
drive_path
)
mount_list
=
session
.
cmd_output_safe
(
show_mount_cmd
)
logging
.
debug
(
"The mounted devices are: %s"
%
mount_list
)
raise
error
.
TestF
ail
(
"Failed to umount with error: %s"
%
output
)
test
.
f
ail
(
"Failed to umount with error: %s"
%
output
)
output
=
""
try
:
output
=
session
.
cmd
(
"dmesg -c"
)
error
.
context
(
"Checking if there are I/O error messages in dmesg"
)
error_context
.
context
(
"Checking if there are I/O error "
"messages in dmesg"
)
except
aexpect
.
ShellCmdError
:
pass
...
...
@@ -155,6 +157,6 @@ def run(test, params, env):
logging
.
error
(
e_msg
)
for
line
in
io_error_msg
:
logging
.
error
(
line
)
raise
error
.
TestF
ail
(
e_msg
)
test
.
f
ail
(
e_msg
)
session
.
close
()
qemu/tests/fullscreen_setup.py
浏览文件 @
93a1b986
...
...
@@ -8,8 +8,6 @@ the same setup will result in them having the same resolution.
"""
import
logging
from
autotest.client.shared
import
error
from
virttest
import
utils_spice
...
...
@@ -92,7 +90,7 @@ def run(test, params, env):
logging
.
info
(
"Current Resolution of Guest: "
+
currentGuestRes
)
if
(
newClientResolution
==
currentGuestRes
):
raise
error
.
TestF
ail
(
"Client resolution is same as guest resolution!"
)
test
.
f
ail
(
"Client resolution is same as guest resolution!"
)
# Start vdagent daemon
utils_spice
.
start_vdagent
(
guest_root_session
,
test_timeout
)
...
...
qemu/tests/getfd.py
浏览文件 @
93a1b986
import
os
from
autotest.client.shared
import
error
def
run
(
test
,
params
,
env
):
...
...
@@ -38,7 +37,7 @@ def run(test, params, env):
pid
=
vm
.
get_pid
()
if
pid
is
None
:
raise
error
.
TestE
rror
(
"Fail to get process id for VM"
)
test
.
e
rror
(
"Fail to get process id for VM"
)
# directory for storing temporary files
fdfiles_dir
=
os
.
path
.
join
(
test
.
tmpdir
,
'fdfiles'
)
...
...
@@ -55,11 +54,11 @@ def run(test, params, env):
os
.
close
(
fd
)
# getfd is supposed to generate no output
if
response
:
raise
error
.
TestE
rror
(
"getfd returned error: %s"
%
response
)
test
.
e
rror
(
"getfd returned error: %s"
%
response
)
# check if qemu process has a copy of the fd
if
not
has_fd
(
pid
,
path
):
raise
error
.
TestE
rror
(
"QEMU process does not seem to have a file "
"descriptor pointing to file %s"
%
path
)
test
.
e
rror
(
"QEMU process does not seem to have a file "
"descriptor pointing to file %s"
%
path
)
# clean up files
for
n
in
range
(
nofiles
):
...
...
qemu/tests/gluster_boot_snap_boot.py
浏览文件 @
93a1b986
import
logging
from
autotest.client.shared
import
error
from
virttest
import
env_process
from
virttest
import
error_context
from
virttest
import
qemu_storage
from
virttest
import
data_dir
@
error
.
context_aware
@
error
_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
Run an gluster test.
...
...
@@ -30,13 +29,13 @@ def run(test, params, env):
params
[
'image_format_backing_file_snapshot'
]
=
params
.
get
(
"image_format"
)
params
[
'image_name_snapshot'
]
=
params
.
get
(
"image_name"
)
+
"-snap"
error
.
context
(
"boot guest over glusterfs"
,
logging
.
info
)
error
_context
.
context
(
"boot guest over glusterfs"
,
logging
.
info
)
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
vm
.
verify_alive
()
vm
.
wait_for_login
(
timeout
=
timeout
)
error
.
context
(
"shutdown VM"
,
logging
.
info
)
error
_context
.
context
(
"shutdown VM"
,
logging
.
info
)
vm
.
destroy
()
error
.
context
(
"create snapshot of vm disk"
,
logging
.
info
)
error
_context
.
context
(
"create snapshot of vm disk"
,
logging
.
info
)
snapshot_params
=
params
.
object_params
(
"snapshot"
)
...
...
qemu/tests/gluster_create_images.py
浏览文件 @
93a1b986
from
autotest.client.shared
import
error
from
virttest
import
env_process
from
virttest
import
error_context
@
error
.
context_aware
@
error
_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
Run an gluster test.
...
...
@@ -19,7 +18,7 @@ def run(test, params, env):
:param params: Dictionary with test parameters.
:param env: Dictionary with the test environment.
"""
error
.
context
(
"Create gluster fs image"
)
error
_context
.
context
(
"Create gluster fs image"
)
gluster_params
=
params
.
object_params
(
"gluster"
)
image_name
=
gluster_params
.
get
(
"image_name"
)
...
...
qemu/tests/guest_memory_dump_analysis.py
浏览文件 @
93a1b986
...
...
@@ -16,7 +16,6 @@ import threading
from
aexpect
import
ShellCmdError
from
autotest.client.shared
import
error
REQ_GUEST_MEM
=
4096
# exact size of guest RAM required
REQ_GUEST_ARCH
=
"x86_64"
# the only supported guest arch
...
...
@@ -51,13 +50,13 @@ def run(test, params, env):
"""
mem_size
=
vm
.
get_memory_size
()
if
(
mem_size
!=
REQ_GUEST_MEM
):
raise
error
.
TestE
rror
(
"the guest must have %d MB RAM exactly "
"(current: %d MB)"
%
(
REQ_GUEST_MEM
,
mem_size
))
test
.
e
rror
(
"the guest must have %d MB RAM exactly "
"(current: %d MB)"
%
(
REQ_GUEST_MEM
,
mem_size
))
arch
=
session
.
cmd
(
"uname -m"
).
rstrip
()
if
(
arch
!=
REQ_GUEST_ARCH
):
raise
error
.
TestE
rror
(
"this test only supports %s guests "
"(current: %s)"
%
(
REQ_GUEST_ARCH
,
arch
))
test
.
e
rror
(
"this test only supports %s guests "
"(current: %s)"
%
(
REQ_GUEST_ARCH
,
arch
))
def
install_kernel_debuginfo
(
vm
,
session
,
login_timeout
):
"""
...
...
@@ -93,8 +92,7 @@ def run(test, params, env):
try
:
guest_kernel
=
session
.
cmd
(
"uname -r"
).
rstrip
()
except
ShellCmdError
,
details
:
raise
error
.
TestError
(
"guest uname command failed: %s"
%
details
)
test
.
error
(
"guest uname command failed: %s"
%
details
)
return
session
.
cmd
(
"yum -y install --enablerepo='*debuginfo' "
"kernel-debuginfo-%s"
%
guest_kernel
,
timeout
=
LONG_TIMEOUT
)
...
...
@@ -142,8 +140,8 @@ def run(test, params, env):
logging
.
debug
(
"%s"
,
output
)
df_megs
=
int
(
string
.
split
(
output
)[
10
])
if
(
df_megs
<
REQ_GUEST_DF
):
raise
error
.
TestE
rror
(
"insufficient free disk space: %d < %d"
%
(
df_megs
,
REQ_GUEST_DF
))
test
.
e
rror
(
"insufficient free disk space: %d < %d"
%
(
df_megs
,
REQ_GUEST_DF
))
def
dump_and_compress
(
qmp_monitor
,
vmcore_host
):
"""
...
...
@@ -263,7 +261,7 @@ def run(test, params, env):
logging
.
debug
(
"%s"
,
output
)
if
(
string
.
find
(
output
,
"crash:"
)
>=
0
or
string
.
find
(
output
,
"WARNING:"
)
>=
0
):
raise
error
.
TestF
ail
(
"vmcore corrupt"
)
test
.
f
ail
(
"vmcore corrupt"
)
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
vm
.
verify_alive
()
...
...
@@ -272,7 +270,7 @@ def run(test, params, env):
if
qmp_monitor
:
qmp_monitor
=
qmp_monitor
[
0
]
else
:
raise
error
.
TestE
rror
(
'Could not find a QMP monitor, aborting test'
)
test
.
e
rror
(
'Could not find a QMP monitor, aborting test'
)
login_timeout
=
int
(
params
.
get
(
"login_timeout"
,
240
))
session
=
vm
.
wait_for_login
(
timeout
=
login_timeout
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录