Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
9e4be41b
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,发现更多精彩内容 >>
提交
9e4be41b
编写于
3月 31, 2014
作者:
L
Lucas Meneghel Rodrigues
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #40 from ldoktor/virtio_console
qemu.tests.virtio_console: test_perf fixes
上级
ce341e73
a3f18baa
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
26 deletion
+37
-26
qemu/tests/virtio_console.py
qemu/tests/virtio_console.py
+37
-26
未找到文件。
qemu/tests/virtio_console.py
浏览文件 @
9e4be41b
...
@@ -627,7 +627,7 @@ def run(test, params, env):
...
@@ -627,7 +627,7 @@ def run(test, params, env):
threads
=
[]
threads
=
[]
queues
=
[]
queues
=
[]
for
i
in
range
(
0
,
len
(
recv_pts
)):
for
i
in
x
range
(
0
,
len
(
recv_pts
)):
queues
.
append
(
deque
())
queues
.
append
(
deque
())
# Start loopback
# Start loopback
...
@@ -646,7 +646,7 @@ def run(test, params, env):
...
@@ -646,7 +646,7 @@ def run(test, params, env):
thread
.
start
()
thread
.
start
()
threads
.
append
(
thread
)
threads
.
append
(
thread
)
for
i
in
range
(
len
(
recv_pts
)):
for
i
in
x
range
(
len
(
recv_pts
)):
thread
=
qemu_virtio_port
.
ThRecvCheck
(
recv_pts
[
i
],
queues
[
i
],
thread
=
qemu_virtio_port
.
ThRecvCheck
(
recv_pts
[
i
],
queues
[
i
],
EXIT_EVENT
,
EXIT_EVENT
,
buf_len
[
i
+
1
])
buf_len
[
i
+
1
])
...
@@ -1095,7 +1095,7 @@ def run(test, params, env):
...
@@ -1095,7 +1095,7 @@ def run(test, params, env):
"""
"""
if
not
stats
:
if
not
stats
:
return
None
return
None
for
i
in
range
((
len
(
stats
)
-
1
),
0
,
-
1
):
for
i
in
x
range
((
len
(
stats
)
-
1
),
0
,
-
1
):
stats
[
i
]
=
stats
[
i
]
-
stats
[
i
-
1
]
stats
[
i
]
=
stats
[
i
]
-
stats
[
i
-
1
]
stats
[
i
]
/=
scale
stats
[
i
]
/=
scale
stats
[
0
]
/=
scale
stats
[
0
]
/=
scale
...
@@ -1131,6 +1131,7 @@ def run(test, params, env):
...
@@ -1131,6 +1131,7 @@ def run(test, params, env):
if
not
param
:
if
not
param
:
continue
continue
error
.
context
(
"test_perf: params %s"
%
param
,
logging
.
info
)
error
.
context
(
"test_perf: params %s"
%
param
,
logging
.
info
)
EXIT_EVENT
.
clear
()
# Prepare
# Prepare
param
=
param
.
split
(
':'
)
param
=
param
.
split
(
':'
)
duration
=
test_time
duration
=
test_time
...
@@ -1150,7 +1151,7 @@ def run(test, params, env):
...
@@ -1150,7 +1151,7 @@ def run(test, params, env):
port
.
open
()
port
.
open
()
data
=
""
data
=
""
for
_
in
range
(
buf_len
):
for
_
in
x
range
(
buf_len
):
data
+=
"%c"
%
random
.
randrange
(
255
)
data
+=
"%c"
%
random
.
randrange
(
255
)
funcatexit
.
register
(
env
,
params
.
get
(
'type'
),
__set_exit_event
)
funcatexit
.
register
(
env
,
params
.
get
(
'type'
),
__set_exit_event
)
...
@@ -1168,7 +1169,7 @@ def run(test, params, env):
...
@@ -1168,7 +1169,7 @@ def run(test, params, env):
loads
.
start
()
loads
.
start
()
_time
=
time
.
time
()
_time
=
time
.
time
()
thread
.
start
()
thread
.
start
()
for
_
in
range
(
100
):
for
_
in
x
range
(
100
):
stats
.
append
(
thread
.
idx
)
stats
.
append
(
thread
.
idx
)
time
.
sleep
(
time_slice
)
time
.
sleep
(
time_slice
)
_time
=
time
.
time
()
-
_time
-
duration
_time
=
time
.
time
()
-
_time
-
duration
...
@@ -1178,14 +1179,21 @@ def run(test, params, env):
...
@@ -1178,14 +1179,21 @@ def run(test, params, env):
thread
.
join
()
thread
.
join
()
if
thread
.
ret_code
:
if
thread
.
ret_code
:
no_errors
+=
1
no_errors
+=
1
logging
.
error
(
"test_perf: error occurred in thread %s"
,
logging
.
error
(
"test_perf: error occurred in thread %s "
thread
)
"(H2G)"
,
thread
)
elif
thread
.
idx
==
0
:
no_errors
+=
1
logging
.
error
(
"test_perf: no data sent (H2G)"
)
# Let the guest read-out all the remaining data
# Let the guest read-out all the remaining data
while
not
guest_worker
.
_cmd
(
"virt.poll('%s', %s)"
for
_
in
xrange
(
60
):
%
(
port
.
name
,
select
.
POLLIN
),
if
guest_worker
.
_cmd
(
"virt.poll('%s', %s)"
10
)[
0
]:
%
(
port
.
name
,
select
.
POLLIN
),
10
)[
0
]:
break
time
.
sleep
(
1
)
time
.
sleep
(
1
)
else
:
raise
error
.
TestFail
(
"Unable to read-out all remaining "
"data in 60s."
)
guest_worker
.
safe_exit_loopback_threads
([
port
],
[])
guest_worker
.
safe_exit_loopback_threads
([
port
],
[])
...
@@ -1213,7 +1221,7 @@ def run(test, params, env):
...
@@ -1213,7 +1221,7 @@ def run(test, params, env):
loads
.
start
()
loads
.
start
()
guest_worker
.
cmd
(
"virt.send_loop()"
,
10
)
guest_worker
.
cmd
(
"virt.send_loop()"
,
10
)
_time
=
time
.
time
()
_time
=
time
.
time
()
for
_
in
range
(
100
):
for
_
in
x
range
(
100
):
stats
.
append
(
thread
.
idx
)
stats
.
append
(
thread
.
idx
)
time
.
sleep
(
time_slice
)
time
.
sleep
(
time_slice
)
_time
=
time
.
time
()
-
_time
-
duration
_time
=
time
.
time
()
-
_time
-
duration
...
@@ -1224,8 +1232,11 @@ def run(test, params, env):
...
@@ -1224,8 +1232,11 @@ def run(test, params, env):
thread
.
join
()
thread
.
join
()
if
thread
.
ret_code
:
if
thread
.
ret_code
:
no_errors
+=
1
no_errors
+=
1
logging
.
error
(
"test_perf: error occurred in thread %s"
,
logging
.
error
(
"test_perf: error occurred in thread %s"
thread
)
"(G2H)"
,
thread
)
elif
thread
.
idx
==
0
:
no_errors
+=
1
logging
.
error
(
"test_perf: No data received (G2H)"
)
# Deviation is higher than single time_slice
# Deviation is higher than single time_slice
if
(
_time
>
time_slice
):
if
(
_time
>
time_slice
):
logging
.
error
(
"Test ran %fs longer which is more than one "
logging
.
error
(
"Test ran %fs longer which is more than one "
...
@@ -1300,7 +1311,7 @@ def run(test, params, env):
...
@@ -1300,7 +1311,7 @@ def run(test, params, env):
threads
=
[]
threads
=
[]
queues
=
[]
queues
=
[]
verified
=
[]
verified
=
[]
for
i
in
range
(
0
,
len
(
ports
[
1
:])):
for
i
in
x
range
(
0
,
len
(
ports
[
1
:])):
queues
.
append
(
deque
())
queues
.
append
(
deque
())
verified
.
append
(
0
)
verified
.
append
(
0
)
...
@@ -1319,7 +1330,7 @@ def run(test, params, env):
...
@@ -1319,7 +1330,7 @@ def run(test, params, env):
thread
.
start
()
thread
.
start
()
threads
.
append
(
thread
)
threads
.
append
(
thread
)
for
i
in
range
(
len
(
ports
[
1
:])):
for
i
in
x
range
(
len
(
ports
[
1
:])):
_
=
threading
.
Event
()
_
=
threading
.
Event
()
thread
=
qemu_virtio_port
.
ThRecvCheck
(
ports
[
1
:][
i
],
queues
[
i
],
thread
=
qemu_virtio_port
.
ThRecvCheck
(
ports
[
1
:][
i
],
queues
[
i
],
EXIT_EVENT
,
blocklen
,
EXIT_EVENT
,
blocklen
,
...
@@ -1338,7 +1349,7 @@ def run(test, params, env):
...
@@ -1338,7 +1349,7 @@ def run(test, params, env):
i
+=
1
i
+=
1
time
.
sleep
(
2
)
time
.
sleep
(
2
)
for
j
in
range
(
no_migrations
):
for
j
in
x
range
(
no_migrations
):
error
.
context
(
"Performing migration number %s/%s"
error
.
context
(
"Performing migration number %s/%s"
%
(
j
,
no_migrations
))
%
(
j
,
no_migrations
))
vm
=
utils_test
.
qemu
.
migrate
(
vm
,
env
,
3600
,
"exec"
,
0
,
offline
)
vm
=
utils_test
.
qemu
.
migrate
(
vm
,
env
,
3600
,
"exec"
,
0
,
offline
)
...
@@ -1351,7 +1362,7 @@ def run(test, params, env):
...
@@ -1351,7 +1362,7 @@ def run(test, params, env):
ports
=
get_virtio_ports
(
vm
)[
1
]
ports
=
get_virtio_ports
(
vm
)[
1
]
else
:
else
:
ports
=
get_virtio_ports
(
vm
)[
0
]
ports
=
get_virtio_ports
(
vm
)[
0
]
for
i
in
range
(
len
(
threads
)):
for
i
in
x
range
(
len
(
threads
)):
threads
[
i
].
port
=
ports
[
i
]
threads
[
i
].
port
=
ports
[
i
]
threads
[
i
].
migrate_event
.
set
()
threads
[
i
].
migrate_event
.
set
()
...
@@ -1375,7 +1386,7 @@ def run(test, params, env):
...
@@ -1375,7 +1386,7 @@ def run(test, params, env):
EXIT_EVENT
.
set
()
EXIT_EVENT
.
set
()
raise
error
.
TestFail
(
"Send thread died unexpectedly in "
raise
error
.
TestFail
(
"Send thread died unexpectedly in "
"migration %d"
%
(
j
+
1
))
"migration %d"
%
(
j
+
1
))
for
i
in
range
(
0
,
len
(
ports
[
1
:])):
for
i
in
x
range
(
0
,
len
(
ports
[
1
:])):
if
not
threads
[
i
+
1
].
isAlive
():
if
not
threads
[
i
+
1
].
isAlive
():
EXIT_EVENT
.
set
()
EXIT_EVENT
.
set
()
raise
error
.
TestFail
(
"Recv thread %d died unexpectedly in "
raise
error
.
TestFail
(
"Recv thread %d died unexpectedly in "
...
@@ -1547,12 +1558,12 @@ def run(test, params, env):
...
@@ -1547,12 +1558,12 @@ def run(test, params, env):
consoles
[
0
][
0
].
sock
.
setblocking
(
0
)
consoles
[
0
][
0
].
sock
.
setblocking
(
0
)
consoles
[
1
][
0
].
sock
.
setblocking
(
0
)
consoles
[
1
][
0
].
sock
.
setblocking
(
0
)
logging
.
info
(
"Test correct initialization of hotplug ports"
)
logging
.
info
(
"Test correct initialization of hotplug ports"
)
for
bus_id
in
range
(
1
,
5
):
# count of pci device
for
bus_id
in
x
range
(
1
,
5
):
# count of pci device
ret
=
vm
.
monitors
[
0
].
cmd
(
"device_add virtio-serial-pci,"
ret
=
vm
.
monitors
[
0
].
cmd
(
"device_add virtio-serial-pci,"
"id=virtio_serial_pci%d"
%
(
bus_id
))
"id=virtio_serial_pci%d"
%
(
bus_id
))
if
ret
!=
""
:
if
ret
!=
""
:
logging
.
error
(
ret
)
logging
.
error
(
ret
)
for
i
in
range
(
bus_id
*
5
+
5
):
# max ports 30
for
i
in
x
range
(
bus_id
*
5
+
5
):
# max ports 30
_virtio_dev_add
(
vm
,
bus_id
,
i
,
console
)
_virtio_dev_add
(
vm
,
bus_id
,
i
,
console
)
time
.
sleep
(
pause
)
time
.
sleep
(
pause
)
# Test correct initialization of hotplug ports
# Test correct initialization of hotplug ports
...
@@ -1590,7 +1601,7 @@ def run(test, params, env):
...
@@ -1590,7 +1601,7 @@ def run(test, params, env):
logging
.
info
(
"Trying to add maximum count of ports to one pci device"
)
logging
.
info
(
"Trying to add maximum count of ports to one pci device"
)
# Try to add ports
# Try to add ports
for
i
in
range
(
30
):
# max port 30
for
i
in
x
range
(
30
):
# max port 30
_virtio_dev_add
(
vm
,
0
,
i
,
console
)
_virtio_dev_add
(
vm
,
0
,
i
,
console
)
time
.
sleep
(
pause
)
time
.
sleep
(
pause
)
guest_worker
=
qemu_virtio_port
.
GuestWorker
(
vm
)
guest_worker
=
qemu_virtio_port
.
GuestWorker
(
vm
)
...
@@ -1598,14 +1609,14 @@ def run(test, params, env):
...
@@ -1598,14 +1609,14 @@ def run(test, params, env):
logging
.
info
(
"Trying delete and add again part of ports"
)
logging
.
info
(
"Trying delete and add again part of ports"
)
# Try to delete ports
# Try to delete ports
for
i
in
range
(
25
):
# max port 30
for
i
in
x
range
(
25
):
# max port 30
_virtio_dev_del
(
vm
,
0
,
i
)
_virtio_dev_del
(
vm
,
0
,
i
)
time
.
sleep
(
pause
)
time
.
sleep
(
pause
)
guest_worker
=
qemu_virtio_port
.
GuestWorker
(
vm
)
guest_worker
=
qemu_virtio_port
.
GuestWorker
(
vm
)
guest_worker
.
cmd
(
'guest_exit()'
,
10
)
guest_worker
.
cmd
(
'guest_exit()'
,
10
)
# Try to add ports
# Try to add ports
for
i
in
range
(
5
):
# max port 30
for
i
in
x
range
(
5
):
# max port 30
_virtio_dev_add
(
vm
,
0
,
i
,
console
)
_virtio_dev_add
(
vm
,
0
,
i
,
console
)
time
.
sleep
(
pause
)
time
.
sleep
(
pause
)
guest_worker
=
qemu_virtio_port
.
GuestWorker
(
vm
)
guest_worker
=
qemu_virtio_port
.
GuestWorker
(
vm
)
...
@@ -1613,7 +1624,7 @@ def run(test, params, env):
...
@@ -1613,7 +1624,7 @@ def run(test, params, env):
logging
.
info
(
"Trying to add and delete one port 100 times"
)
logging
.
info
(
"Trying to add and delete one port 100 times"
)
# Try 100 times add and delete one port.
# Try 100 times add and delete one port.
for
i
in
range
(
100
):
for
i
in
x
range
(
100
):
_virtio_dev_del
(
vm
,
0
,
0
)
_virtio_dev_del
(
vm
,
0
,
0
)
time
.
sleep
(
pause
)
time
.
sleep
(
pause
)
_virtio_dev_add
(
vm
,
0
,
0
,
console
)
_virtio_dev_add
(
vm
,
0
,
0
,
console
)
...
@@ -1743,7 +1754,7 @@ def run(test, params, env):
...
@@ -1743,7 +1754,7 @@ def run(test, params, env):
try
:
try
:
sent1
=
0
sent1
=
0
for
_
in
range
(
1000000
):
for
_
in
x
range
(
1000000
):
sent1
+=
port
.
sock
.
send
(
"a"
)
sent1
+=
port
.
sock
.
send
(
"a"
)
except
socket
.
timeout
:
except
socket
.
timeout
:
logging
.
info
(
"Data sending to closed port timed out."
)
logging
.
info
(
"Data sending to closed port timed out."
)
...
@@ -1760,7 +1771,7 @@ def run(test, params, env):
...
@@ -1760,7 +1771,7 @@ def run(test, params, env):
loads
.
start
()
loads
.
start
()
try
:
try
:
sent2
=
0
sent2
=
0
for
_
in
range
(
40000
):
for
_
in
x
range
(
40000
):
sent2
=
port
.
sock
.
send
(
"a"
)
sent2
=
port
.
sock
.
send
(
"a"
)
except
socket
.
timeout
:
except
socket
.
timeout
:
logging
.
info
(
"Data sending to closed port timed out."
)
logging
.
info
(
"Data sending to closed port timed out."
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录