Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
4ea4332a
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,发现更多精彩内容 >>
未验证
提交
4ea4332a
编写于
9月 27, 2017
作者:
C
Cleber Rosa
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'ldoktor/avocado-version2'
Signed-off-by:
N
Cleber Rosa
<
crosa@redhat.com
>
上级
1b623348
5117d996
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
41 addition
and
27 deletion
+41
-27
avocado/core/job.py
avocado/core/job.py
+41
-27
未找到文件。
avocado/core/job.py
浏览文件 @
4ea4332a
...
@@ -131,6 +131,7 @@ class Job(object):
...
@@ -131,6 +131,7 @@ class Job(object):
#: has not been attempted. If set to an empty list, it means that no
#: has not been attempted. If set to an empty list, it means that no
#: test was found during resolution.
#: test was found during resolution.
self
.
test_suite
=
None
self
.
test_suite
=
None
self
.
test_runner
=
None
# The result events dispatcher is shared with the test runner.
# The result events dispatcher is shared with the test runner.
# Because of our goal to support using the phases of a job
# Because of our goal to support using the phases of a job
...
@@ -284,8 +285,8 @@ class Job(object):
...
@@ -284,8 +285,8 @@ class Job(object):
"""
"""
Prepares a test suite to be used for running tests
Prepares a test suite to be used for running tests
:param references: String with tests references to be resolved, and
then
:param references: String with tests references to be resolved, and
run, separated by whitespace. Optionally, a
then
run, separated by whitespace. Optionally, a
list of tests (each test a string).
list of tests (each test a string).
:returns: a test suite (a list of test factories)
:returns: a test suite (a list of test factories)
"""
"""
...
@@ -327,15 +328,21 @@ class Job(object):
...
@@ -327,15 +328,21 @@ class Job(object):
git
=
path
.
find_command
(
'git'
)
git
=
path
.
find_command
(
'git'
)
except
path
.
CmdNotFoundError
:
except
path
.
CmdNotFoundError
:
return
return
git_root
=
process
.
run
(
'%s rev-parse --show-toplevel'
%
git
,
# We need to get git root as `py2to3` creates this file in BUILD
ignore_status
=
True
,
verbose
=
False
)
olddir
=
os
.
getcwd
()
if
git_root
.
exit_status
==
0
and
os
.
path
.
exists
(
os
.
path
.
join
(
try
:
git_root
.
stdout
.
strip
(),
'python-avocado.spec'
)):
os
.
chdir
(
os
.
path
.
dirname
(
__file__
))
cmd
=
"%s show --summary --pretty='%%H'"
%
git
git_root
=
process
.
run
(
'%s rev-parse --show-toplevel'
%
git
,
result
=
process
.
run
(
cmd
,
ignore_status
=
True
,
verbose
=
False
)
ignore_status
=
True
,
verbose
=
False
)
if
result
.
exit_status
==
0
:
if
git_root
.
exit_status
==
0
and
os
.
path
.
exists
(
os
.
path
.
join
(
top_commit
=
result
.
stdout
.
splitlines
()[
0
][:
8
]
git_root
.
stdout
.
strip
(),
'python-avocado.spec'
)):
return
" (GIT commit %s)"
%
top_commit
cmd
=
"%s show --summary --pretty='%%H'"
%
git
res
=
process
.
run
(
cmd
,
ignore_status
=
True
,
verbose
=
False
)
if
res
.
exit_status
==
0
:
top_commit
=
res
.
stdout
.
splitlines
()[
0
][:
8
]
return
" (GIT commit %s)"
%
top_commit
finally
:
os
.
chdir
(
olddir
)
def
_log_avocado_version
(
self
):
def
_log_avocado_version
(
self
):
version_log
=
version
.
VERSION
version_log
=
version
.
VERSION
...
@@ -377,12 +384,14 @@ class Job(object):
...
@@ -377,12 +384,14 @@ class Job(object):
LOG_JOB
.
info
(
'logs '
+
self
.
logdir
)
LOG_JOB
.
info
(
'logs '
+
self
.
logdir
)
LOG_JOB
.
info
(
''
)
LOG_JOB
.
info
(
''
)
def
_log_variants
(
self
,
variants
):
@
staticmethod
def
_log_variants
(
variants
):
lines
=
variants
.
to_str
(
summary
=
1
,
variants
=
1
,
use_utf8
=
False
)
lines
=
variants
.
to_str
(
summary
=
1
,
variants
=
1
,
use_utf8
=
False
)
for
line
in
lines
.
splitlines
():
for
line
in
lines
.
splitlines
():
LOG_JOB
.
info
(
line
)
LOG_JOB
.
info
(
line
)
def
_log_tmp_dir
(
self
):
@
staticmethod
def
_log_tmp_dir
():
LOG_JOB
.
info
(
'Temporary dir: %s'
,
data_dir
.
get_tmp_dir
())
LOG_JOB
.
info
(
'Temporary dir: %s'
,
data_dir
.
get_tmp_dir
())
LOG_JOB
.
info
(
''
)
LOG_JOB
.
info
(
''
)
...
@@ -418,8 +427,8 @@ class Job(object):
...
@@ -418,8 +427,8 @@ class Job(object):
"'avocado list -V %s' for details"
%
references
)
"'avocado list -V %s' for details"
%
references
)
else
:
else
:
e_msg
=
(
"No test references provided nor any other arguments "
e_msg
=
(
"No test references provided nor any other arguments "
"resolved into tests. Please double check the
executed
"
"resolved into tests. Please double check the "
" command."
)
"
executed
command."
)
raise
exceptions
.
OptionValidationError
(
e_msg
)
raise
exceptions
.
OptionValidationError
(
e_msg
)
def
pre_tests
(
self
):
def
pre_tests
(
self
):
...
@@ -432,6 +441,9 @@ class Job(object):
...
@@ -432,6 +441,9 @@ class Job(object):
self
.
_result_events_dispatcher
.
map_method
(
'pre_tests'
,
self
)
self
.
_result_events_dispatcher
.
map_method
(
'pre_tests'
,
self
)
def
run_tests
(
self
):
def
run_tests
(
self
):
"""
The actual test execution phase
"""
variant
=
getattr
(
self
.
args
,
"avocado_variants"
,
None
)
variant
=
getattr
(
self
.
args
,
"avocado_variants"
,
None
)
if
variant
is
None
:
if
variant
is
None
:
variant
=
varianter
.
Varianter
()
variant
=
varianter
.
Varianter
()
...
@@ -547,23 +559,25 @@ class TestProgram(object):
...
@@ -547,23 +559,25 @@ class TestProgram(object):
sys
.
exit
(
exit_codes
.
AVOCADO_FAIL
)
sys
.
exit
(
exit_codes
.
AVOCADO_FAIL
)
os
.
environ
[
'AVOCADO_STANDALONE_IN_MAIN'
]
=
'True'
os
.
environ
[
'AVOCADO_STANDALONE_IN_MAIN'
]
=
'True'
self
.
prog
N
ame
=
os
.
path
.
basename
(
sys
.
argv
[
0
])
self
.
prog
_n
ame
=
os
.
path
.
basename
(
sys
.
argv
[
0
])
output
.
add_log_handler
(
""
,
output
.
ProgressStreamHandler
,
output
.
add_log_handler
(
""
,
output
.
ProgressStreamHandler
,
fmt
=
"%(message)s"
)
fmt
=
"%(message)s"
)
self
.
parse
A
rgs
(
sys
.
argv
[
1
:])
self
.
parse
_a
rgs
(
sys
.
argv
[
1
:])
self
.
args
.
reference
=
[
sys
.
argv
[
0
]]
self
.
args
.
reference
=
[
sys
.
argv
[
0
]]
self
.
runTests
()
self
.
run_tests
()
def
parseArgs
(
self
,
argv
):
def
parse_args
(
self
,
argv
):
self
.
parser
=
argparse
.
ArgumentParser
(
prog
=
self
.
progName
)
self
.
parser
=
argparse
.
ArgumentParser
(
prog
=
self
.
prog_name
)
self
.
parser
.
add_argument
(
'-r'
,
'--remove-test-results'
,
action
=
'store_true'
,
self
.
parser
.
add_argument
(
'-r'
,
'--remove-test-results'
,
help
=
'remove all test results files after test execution'
)
action
=
'store_true'
,
help
=
"remove all test "
self
.
parser
.
add_argument
(
'-d'
,
'--test-results-dir'
,
dest
=
'logdir'
,
default
=
None
,
"results files after test execution"
)
metavar
=
'TEST_RESULTS_DIR'
,
self
.
parser
.
add_argument
(
'-d'
,
'--test-results-dir'
,
dest
=
'logdir'
,
help
=
'use an alternative test results directory'
)
default
=
None
,
metavar
=
'TEST_RESULTS_DIR'
,
help
=
"use an alternative test results "
"directory"
)
self
.
args
=
self
.
parser
.
parse_args
(
argv
)
self
.
args
=
self
.
parser
.
parse_args
(
argv
)
def
run
T
ests
(
self
):
def
run
_t
ests
(
self
):
self
.
args
.
standalone
=
True
self
.
args
.
standalone
=
True
self
.
args
.
show
=
[
"test"
]
self
.
args
.
show
=
[
"test"
]
output
.
reconfigure
(
self
.
args
)
output
.
reconfigure
(
self
.
args
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录