Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
26091021
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,发现更多精彩内容 >>
未验证
提交
26091021
编写于
11月 28, 2017
作者:
A
Amador Pahim
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'clebergnu-fddrainer_combined_flush'
Signed-off-by:
N
Amador Pahim
<
apahim@redhat.com
>
上级
5a9ec15f
41dfb4b9
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
18 addition
and
5 deletion
+18
-5
avocado/utils/process.py
avocado/utils/process.py
+16
-3
selftests/unit/test_utils_process.py
selftests/unit/test_utils_process.py
+2
-2
未找到文件。
avocado/utils/process.py
浏览文件 @
26091021
...
@@ -376,8 +376,19 @@ class FDDrainer(object):
...
@@ -376,8 +376,19 @@ class FDDrainer(object):
self
.
_thread
.
daemon
=
True
self
.
_thread
.
daemon
=
True
self
.
_thread
.
start
()
self
.
_thread
.
start
()
def
join
(
self
):
def
flush
(
self
):
self
.
_thread
.
join
()
self
.
_thread
.
join
()
if
self
.
_stream_logger
is
not
None
:
for
handler
in
self
.
_stream_logger
.
handlers
:
# FileHandler has a close() method, which we expect will
# flush the file on disk. SocketHandler, MemoryHandler
# and other logging handlers (custom ones?) also have
# the same interface, so let's try to use it if available
stream
=
getattr
(
handler
,
'stream'
,
None
)
if
stream
is
not
None
:
os
.
fsync
(
stream
.
fileno
())
if
hasattr
(
handler
,
'close'
):
handler
.
close
()
class
SubProcess
(
object
):
class
SubProcess
(
object
):
...
@@ -580,10 +591,12 @@ class SubProcess(object):
...
@@ -580,10 +591,12 @@ class SubProcess(object):
Close subprocess stdout and stderr, and put values into result obj.
Close subprocess stdout and stderr, and put values into result obj.
"""
"""
# Cleaning up threads
# Cleaning up threads
if
self
.
_combined_drainer
is
not
None
:
self
.
_combined_drainer
.
flush
()
if
self
.
_stdout_drainer
is
not
None
:
if
self
.
_stdout_drainer
is
not
None
:
self
.
_stdout_drainer
.
join
()
self
.
_stdout_drainer
.
flush
()
if
self
.
_stderr_drainer
is
not
None
:
if
self
.
_stderr_drainer
is
not
None
:
self
.
_stderr_drainer
.
join
()
self
.
_stderr_drainer
.
flush
()
# Clean subprocess pipes and populate stdout/err
# Clean subprocess pipes and populate stdout/err
self
.
result
.
stdout
=
self
.
get_stdout
()
self
.
result
.
stdout
=
self
.
get_stdout
()
self
.
result
.
stderr
=
self
.
get_stderr
()
self
.
result
.
stderr
=
self
.
get_stderr
()
...
...
selftests/unit/test_utils_process.py
浏览文件 @
26091021
...
@@ -242,7 +242,7 @@ class FDDrainerTests(unittest.TestCase):
...
@@ -242,7 +242,7 @@ class FDDrainerTests(unittest.TestCase):
os
.
write
(
write_fd
,
content
)
os
.
write
(
write_fd
,
content
)
os
.
write
(
write_fd
,
"finish"
)
os
.
write
(
write_fd
,
"finish"
)
os
.
close
(
write_fd
)
os
.
close
(
write_fd
)
fd_drainer
.
join
()
fd_drainer
.
flush
()
self
.
assertEqual
(
fd_drainer
.
data
.
getvalue
(),
self
.
assertEqual
(
fd_drainer
.
data
.
getvalue
(),
"foobarbazfoo
\n
bar
\n
baz
\n\n
finish"
)
"foobarbazfoo
\n
bar
\n
baz
\n\n
finish"
)
...
@@ -270,7 +270,7 @@ class FDDrainerTests(unittest.TestCase):
...
@@ -270,7 +270,7 @@ class FDDrainerTests(unittest.TestCase):
fd_drainer
.
start
()
fd_drainer
.
start
()
os
.
write
(
write_fd
,
"should go to the log
\n
"
)
os
.
write
(
write_fd
,
"should go to the log
\n
"
)
os
.
close
(
write_fd
)
os
.
close
(
write_fd
)
fd_drainer
.
join
()
fd_drainer
.
flush
()
self
.
assertEqual
(
fd_drainer
.
data
.
getvalue
(),
self
.
assertEqual
(
fd_drainer
.
data
.
getvalue
(),
"should go to the log
\n
"
)
"should go to the log
\n
"
)
self
.
assertTrue
(
handler
.
caught_record
)
self
.
assertTrue
(
handler
.
caught_record
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录