Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
06b27a5d
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看板
提交
06b27a5d
编写于
7月 22, 2016
作者:
A
Amador Pahim
提交者:
GitHub
7月 22, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1322 from clebergnu/epipe_v2
Deal with IOError due to (EPIPE) [v2]
上级
34db920f
9e137692
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
7 deletion
+29
-7
avocado/core/app.py
avocado/core/app.py
+0
-1
avocado/core/output.py
avocado/core/output.py
+16
-6
selftests/functional/test_output.py
selftests/functional/test_output.py
+13
-0
未找到文件。
avocado/core/app.py
浏览文件 @
06b27a5d
...
...
@@ -39,7 +39,6 @@ class AvocadoApp(object):
os
.
environ
[
'LIBC_FATAL_STDERR_'
]
=
'1'
signal
.
signal
(
signal
.
SIGTSTP
,
signal
.
SIG_IGN
)
# ignore ctrl+z
signal
.
signal
(
signal
.
SIGPIPE
,
signal
.
SIG_DFL
)
self
.
parser
=
Parser
()
output
.
early_start
()
try
:
...
...
avocado/core/output.py
浏览文件 @
06b27a5d
...
...
@@ -15,6 +15,7 @@
"""
Manages output and logging in avocado applications.
"""
import
errno
import
logging
import
os
import
re
...
...
@@ -277,12 +278,21 @@ class StdOutput(object):
Prints all stored messages as they occurred into streams they were
produced for.
"""
for
stream
,
msg
in
self
.
records
:
if
stream
:
sys
.
stdout
.
write
(
msg
)
else
:
sys
.
stderr
.
write
(
msg
)
del
self
.
records
[:]
try
:
for
stream
,
msg
in
self
.
records
:
if
stream
:
sys
.
stdout
.
write
(
msg
)
else
:
sys
.
stderr
.
write
(
msg
)
del
self
.
records
[:]
# IOError due to EPIPE is ignored. That is to avoid having to
# handle all IOErrors at the main application loop
# indiscriminately. By handling them here, we can be sure
# that the failure was due to stdout or stderr not being
# connected to an open PIPE.
except
IOError
as
e
:
if
not
e
.
errno
==
errno
.
EPIPE
:
raise
def
fake_outputs
(
self
):
"""
...
...
selftests/functional/test_output.py
浏览文件 @
06b27a5d
...
...
@@ -399,6 +399,19 @@ class OutputPluginTest(unittest.TestCase):
os
.
chdir
(
basedir
)
process
.
run
(
"perl %s"
%
perl_script
)
def
test_broken_pipe
(
self
):
os
.
chdir
(
basedir
)
cmd_line
=
"(./scripts/avocado run --help | whacky-unknown-command)"
result
=
process
.
run
(
cmd_line
,
shell
=
True
,
ignore_status
=
True
)
expected_rc
=
127
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
(
"avocado run to broken pipe did not return "
"rc %d:
\n
%s"
%
(
expected_rc
,
result
)))
self
.
assertEqual
(
len
(
result
.
stderr
.
splitlines
()),
1
)
self
.
assertIn
(
"whacky-unknown-command"
,
result
.
stderr
)
self
.
assertIn
(
"not found"
,
result
.
stderr
)
self
.
assertNotIn
(
"Avocado crashed"
,
result
.
stderr
)
def
tearDown
(
self
):
shutil
.
rmtree
(
self
.
tmpdir
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录