Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
496f4550
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,发现更多精彩内容 >>
提交
496f4550
编写于
1月 28, 2015
作者:
L
Lucas Meneghel Rodrigues
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #369 from lmr/fix-wrapper-patterns
Fix Wrapper Patterns
上级
25f01c8a
f6bf2c02
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
12 deletion
+21
-12
avocado/utils/process.py
avocado/utils/process.py
+3
-5
selftests/all/functional/avocado/wrapper_tests.py
selftests/all/functional/avocado/wrapper_tests.py
+18
-7
未找到文件。
avocado/utils/process.py
浏览文件 @
496f4550
...
...
@@ -25,6 +25,7 @@ import stat
import
shlex
import
shutil
import
threading
import
fnmatch
try
:
import
subprocess32
as
subprocess
...
...
@@ -868,11 +869,8 @@ def should_run_inside_wrapper(cmd):
args
=
shlex
.
split
(
cmd
)
cmd_binary_name
=
args
[
0
]
for
script
,
cmd
in
runtime
.
WRAP_PROCESS_NAMES_EXPR
:
if
os
.
path
.
isabs
(
cmd_binary_name
)
and
os
.
path
.
isabs
(
cmd
)
is
False
:
cmd_binary_name
=
os
.
path
.
basename
(
cmd_binary_name
)
cmd
=
os
.
path
.
basename
(
cmd
)
if
cmd_binary_name
==
cmd
:
for
script
,
cmd_expr
in
runtime
.
WRAP_PROCESS_NAMES_EXPR
:
if
fnmatch
.
fnmatch
(
cmd_binary_name
,
cmd_expr
):
runtime
.
CURRENT_WRAPPER
=
script
if
runtime
.
WRAP_PROCESS
is
not
None
and
runtime
.
CURRENT_WRAPPER
is
None
:
...
...
selftests/all/functional/avocado/wrapper_tests.py
浏览文件 @
496f4550
...
...
@@ -6,7 +6,8 @@ import unittest
import
tempfile
# simple magic for using scripts within a source tree
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
,
'..'
,
'..'
)
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
,
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
if
os
.
path
.
isdir
(
os
.
path
.
join
(
basedir
,
'avocado'
)):
sys
.
path
.
append
(
basedir
)
...
...
@@ -41,36 +42,46 @@ class WrapperTest(unittest.TestCase):
def
test_global_wrapper
(
self
):
os
.
chdir
(
basedir
)
cmd_line
=
'./scripts/avocado run --wrapper %s examples/tests/datadir.py'
%
self
.
script
.
path
cmd_line
=
(
'./scripts/avocado run --wrapper %s '
'examples/tests/datadir.py'
%
self
.
script
.
path
)
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
expected_rc
=
0
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Avocado did not return rc %d:
\n
%s"
%
(
expected_rc
,
result
))
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
tmpfile
),
"Wrapper did not create file %s"
%
self
.
tmpfile
)
"Wrapper did not touch the tmp file %s
\n
Stdout: "
"%s
\n
Cmdline: %s"
%
(
self
.
tmpfile
,
result
.
stdout
,
cmd_line
))
def
test_process_wrapper
(
self
):
os
.
chdir
(
basedir
)
cmd_line
=
'./scripts/avocado run --wrapper %s:datadir examples/tests/datadir.py'
%
self
.
script
.
path
cmd_line
=
(
'./scripts/avocado run --wrapper %s:*/datadir '
'examples/tests/datadir.py'
%
self
.
script
.
path
)
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
expected_rc
=
0
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Avocado did not return rc %d:
\n
%s"
%
(
expected_rc
,
result
))
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
tmpfile
),
"Wrapper did not create file %s"
%
self
.
tmpfile
)
"Wrapper did not touch the tmp file %s
\n
Stdout: "
"%s
\n
Stdout: %s"
%
(
self
.
tmpfile
,
cmd_line
,
result
.
stdout
))
def
test_both_wrappers
(
self
):
os
.
chdir
(
basedir
)
cmd_line
=
'./scripts/avocado run --wrapper %s --wrapper %s:datadir examples/tests/datadir.py'
%
(
self
.
dummy
.
path
,
self
.
script
.
path
)
cmd_line
=
(
'./scripts/avocado run --wrapper %s --wrapper %s:*/datadir '
'examples/tests/datadir.py'
%
(
self
.
dummy
.
path
,
self
.
script
.
path
))
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
expected_rc
=
0
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Avocado did not return rc %d:
\n
%s"
%
(
expected_rc
,
result
))
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
tmpfile
),
"Wrapper did not create file %s"
%
self
.
tmpfile
)
"Wrapper did not touch the tmp file %s
\n
Stdout: "
"%s
\n
Stdout: %s"
%
(
self
.
tmpfile
,
cmd_line
,
result
.
stdout
))
def
tearDown
(
self
):
self
.
script
.
remove
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录