Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
b9148549
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,发现更多精彩内容 >>
提交
b9148549
编写于
6月 15, 2020
作者:
N
nanliu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
virtio-serial:verify login functions of pci-serial
Signed-off-by:
N
Nana Liu
<
nanliu@redhat.com
>
上级
4a923f6c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
81 addition
and
0 deletion
+81
-0
qemu/tests/cfg/chardev_pci_serial_login.cfg
qemu/tests/cfg/chardev_pci_serial_login.cfg
+6
-0
qemu/tests/chardev_pci_serial_login.py
qemu/tests/chardev_pci_serial_login.py
+75
-0
未找到文件。
qemu/tests/cfg/chardev_pci_serial_login.cfg
0 → 100644
浏览文件 @
b9148549
- chardev_pci_serial_login:
only RHEL
only x86_64
type = chardev_pci_serial_login
serial_type = pci-serial
start_vm = no
qemu/tests/chardev_pci_serial_login.py
0 → 100644
浏览文件 @
b9148549
import
re
import
os
from
virttest
import
error_context
from
virttest
import
remote
from
virttest
import
qemu_monitor
from
virttest
import
env_process
@
error_context
.
context_aware
def
run
(
test
,
params
,
env
):
"""
Verify the login function of pci-serial (RHEL and x86 only):
1) Start guest with pci-serial with backend
2) for pty and file backend:
2.1) open and close chardev
3) for unix_socket and tcp_socket
3.1) Login guest.
3.2) move, create files inside guest
4) Hot-unplug chardev which is in use, should fail.
:param test: QEMU test object
:param params: Dictionary with the test parameters
:param env: Dictionary with test environment.
"""
def
check_guest
():
session
.
cmd
(
'touch file.txt'
)
session
.
cmd
(
'mkdir -p tmp'
)
session
.
cmd
(
'command cp file.txt ./tmp/test.txt'
)
serial_id
=
params
.
objects
(
'serials'
)[
-
1
]
prompt
=
params
.
get
(
"shell_prompt"
)
params
[
'start_vm'
]
=
'yes'
for
backend
in
[
'tcp_socket'
,
'unix_socket'
,
'pty'
,
'file'
]:
params
[
'chardev_backend_%s'
%
serial_id
]
=
backend
env_process
.
preprocess
(
test
,
params
,
env
)
vm
=
env
.
get_vm
(
params
[
"main_vm"
])
vm
.
wait_for_login
()
serial_device
=
vm
.
devices
.
get
(
serial_id
)
chardev_qid
=
serial_device
.
get_param
(
"chardev"
)
chardev_device
=
vm
.
devices
.
get_by_qid
(
chardev_qid
)[
0
]
if
backend
==
'tcp_socket'
:
session
=
remote
.
remote_login
(
client
=
'nc'
,
host
=
chardev_device
.
params
[
'host'
],
port
=
chardev_device
.
params
[
'port'
],
username
=
'root'
,
password
=
'kvmautotest'
,
prompt
=
prompt
,
timeout
=
240
)
check_guest
()
elif
backend
==
'unix_socket'
:
session
=
vm
.
wait_for_serial_login
()
check_guest
()
elif
backend
==
'pty'
:
chardev_info
=
vm
.
monitor
.
human_monitor_cmd
(
'info chardev'
)
hostfile
=
re
.
findall
(
'%s: filename=pty:(/dev/pts/
\\
d)?'
%
"serial0"
,
chardev_info
)[
0
]
if
not
hostfile
:
test
.
fail
(
"Guest boot fail with pty backend."
)
fd_pty
=
os
.
open
(
hostfile
,
os
.
O_RDWR
|
os
.
O_NONBLOCK
)
os
.
close
(
fd_pty
)
elif
backend
==
'file'
:
filename
=
chardev_device
.
params
[
'path'
]
f
=
open
(
filename
)
if
'Linux'
not
in
f
.
read
():
f
.
close
()
test
.
fail
(
"Guest boot fail with file backend."
)
f
.
close
()
try
:
vm
.
devices
.
simple_unplug
(
chardev_device
,
vm
.
monitor
)
except
qemu_monitor
.
QMPCmdError
as
e
:
if
'is busy'
not
in
e
.
data
[
'desc'
]:
test
.
fail
(
e
.
data
[
'desc'
])
else
:
test
.
fail
(
"Hot-unplug should fail."
)
vm
.
destroy
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录