Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
2bc0aa69
A
avocado
项目概览
openeuler
/
avocado
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
avocado
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2bc0aa69
编写于
8月 24, 2014
作者:
L
Lucas Meneghel Rodrigues
提交者:
Lucas Meneghel Rodrigues
8月 24, 2014
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #162 from lmr/force-fail-ctrl-c
avocado.process: Make processes to fail when interrupted by user
上级
164a230b
b7461b85
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
8 deletion
+17
-8
avocado/core/exceptions.py
avocado/core/exceptions.py
+2
-0
avocado/plugins/vm.py
avocado/plugins/vm.py
+1
-1
avocado/utils/process.py
avocado/utils/process.py
+14
-7
未找到文件。
avocado/core/exceptions.py
浏览文件 @
2bc0aa69
...
...
@@ -146,6 +146,8 @@ class CmdError(Exception):
def
__str__
(
self
):
if
self
.
result
is
not
None
:
if
self
.
result
.
interrupted
:
return
"Command %s interrupted by user (Ctrl+C)"
%
self
.
command
if
self
.
result
.
exit_status
is
None
:
msg
=
"Command '%s' failed and is not responding to signals"
msg
%=
self
.
command
...
...
avocado/plugins/vm.py
浏览文件 @
2bc0aa69
...
...
@@ -68,7 +68,7 @@ class VMTestRunner(TestRunner):
:param urls: a string with test URLs.
:return: a dictionary with test results.
"""
avocado_cmd
=
'avocado --json run --archive "%s"'
%
urls
avocado_cmd
=
'avocado --json
-
run --archive "%s"'
%
urls
stdout
=
self
.
result
.
vm
.
remote
.
run
(
avocado_cmd
)
try
:
results
=
json
.
loads
(
stdout
)
...
...
avocado/utils/process.py
浏览文件 @
2bc0aa69
...
...
@@ -91,14 +91,18 @@ class CmdResult(object):
self
.
stdout
=
stdout
self
.
stderr
=
stderr
self
.
duration
=
duration
self
.
interrupted
=
False
def
__repr__
(
self
):
return
(
"Command: %s
\n
"
"Exit status: %s
\n
"
"Duration: %s
\n
"
"Stdout:
\n
%s
\n
"
"Stderr:
\n
%s
\n
"
%
(
self
.
command
,
self
.
exit_status
,
self
.
duration
,
self
.
stdout
,
self
.
stderr
))
cmd_rep
=
(
"Command: %s
\n
"
"Exit status: %s
\n
"
"Duration: %s
\n
"
"Stdout:
\n
%s
\n
"
"Stderr:
\n
%s
\n
"
%
(
self
.
command
,
self
.
exit_status
,
self
.
duration
,
self
.
stdout
,
self
.
stderr
))
if
self
.
interrupted
:
cmd_rep
+=
"Command interrupted by user (Ctrl+C)
\n
"
return
cmd_rep
class
SubProcess
(
object
):
...
...
@@ -142,7 +146,9 @@ class SubProcess(object):
self
.
stderr_thread
.
start
()
def
signal_handler
(
signum
,
frame
):
self
.
result
.
interrupted
=
True
self
.
wait
()
signal
.
signal
(
signal
.
SIGINT
,
signal_handler
)
def
__str__
(
self
):
...
...
@@ -329,7 +335,8 @@ def run(cmd, timeout=None, verbose=True, ignore_status=False):
"""
sp
=
SubProcess
(
cmd
=
cmd
,
verbose
=
verbose
)
cmd_result
=
sp
.
run
(
timeout
=
timeout
)
if
cmd_result
.
exit_status
!=
0
and
not
ignore_status
:
fail_condition
=
cmd_result
.
exit_status
!=
0
or
cmd_result
.
interrupted
if
fail_condition
and
not
ignore_status
:
raise
exceptions
.
CmdError
(
cmd
,
sp
.
result
)
return
cmd_result
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录