Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
d378f0db
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看板
未验证
提交
d378f0db
编写于
1月 31, 2019
作者:
C
Caio Carrara
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'ldoktor/xunit-name2'
Signed-off-by:
N
Caio Carrara
<
ccarrara@redhat.com
>
上级
870c2ffe
ab118967
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
3 deletion
+18
-3
avocado/plugins/xunit.py
avocado/plugins/xunit.py
+13
-3
man/avocado.rst
man/avocado.rst
+5
-0
未找到文件。
avocado/plugins/xunit.py
浏览文件 @
d378f0db
...
...
@@ -91,10 +91,13 @@ class XUnitResult(Result):
system_out
.
appendChild
(
system_out_cdata
)
return
element
,
system_out
def
_render
(
self
,
result
,
max_test_log_size
):
def
_render
(
self
,
result
,
max_test_log_size
,
job_name
):
document
=
Document
()
testsuite
=
document
.
createElement
(
'testsuite'
)
testsuite
.
setAttribute
(
'name'
,
os
.
path
.
basename
(
os
.
path
.
dirname
(
result
.
logfile
)))
if
job_name
:
testsuite
.
setAttribute
(
'name'
,
job_name
)
else
:
testsuite
.
setAttribute
(
'name'
,
os
.
path
.
basename
(
os
.
path
.
dirname
(
result
.
logfile
)))
testsuite
.
setAttribute
(
'tests'
,
self
.
_escape_attr
(
result
.
tests_total
))
testsuite
.
setAttribute
(
'errors'
,
self
.
_escape_attr
(
result
.
errors
+
result
.
interrupted
))
testsuite
.
setAttribute
(
'failures'
,
self
.
_escape_attr
(
result
.
failed
))
...
...
@@ -137,7 +140,8 @@ class XUnitResult(Result):
return
max_test_log_size
=
getattr
(
job
.
args
,
'xunit_max_test_log_chars'
,
None
)
content
=
self
.
_render
(
result
,
max_test_log_size
)
job_name
=
getattr
(
job
.
args
,
'xunit_job_name'
,
None
)
content
=
self
.
_render
(
result
,
max_test_log_size
,
job_name
)
if
getattr
(
job
.
args
,
'xunit_job_result'
,
'off'
)
==
'on'
:
xunit_path
=
os
.
path
.
join
(
job
.
logdir
,
'results.xml'
)
with
open
(
xunit_path
,
'wb'
)
as
xunit_file
:
...
...
@@ -180,6 +184,12 @@ class XUnitCLI(CLI):
'File will be named "results.xml". '
'Defaults to on.'
))
run_subcommand_parser
.
output
.
add_argument
(
'--xunit-job-name'
,
default
=
None
,
help
=
"Override the reported "
"job name. By default uses the Avocado job name which is always "
"unique. This is useful for reporting in Jenkins as it only "
"evaluates first-failure from jobs of the same name."
)
run_subcommand_parser
.
output
.
add_argument
(
'--xunit-max-test-log-chars'
,
metavar
=
'SIZE'
,
type
=
lambda
x
:
data_structures
.
DataSize
(
x
).
b
,
help
=
"Limit the "
...
...
man/avocado.rst
浏览文件 @
d378f0db
...
...
@@ -133,6 +133,11 @@ Options for subcommand `run` (`avocado run --help`)::
--xunit-job-result {on,off}
Enables default xUnit result in the job results
directory. File will be named "results.xml".
--xunit-job-name XUNIT_JOB_NAME
Override the reported job name. By default uses the
Avocado job name which is always unique. This is
useful for reporting in Jenkins as it only evaluates
first-failure from jobs of the same name.
--xunit-max-test-log-chars SIZE
Limit the attached job log to given number of
characters (k/m/g suffix allowed)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录