Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ros_buildfarm/ci_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from ros_buildfarm.common import get_node_label
from ros_buildfarm.common \
import get_repositories_and_script_generating_key_files
from ros_buildfarm.common import get_xunit_publisher_types_and_patterns
from ros_buildfarm.common import JobValidationError
from ros_buildfarm.common import write_groovy_script_and_configs
from ros_buildfarm.config import get_ci_build_files
Expand Down Expand Up @@ -293,6 +294,9 @@ def _get_ci_job_config(

'show_images': build_file.show_images,
'show_plots': build_file.show_plots,

'xunit_publisher_types': get_xunit_publisher_types_and_patterns(
ros_version),
}
job_config = expand_template(template_name, job_data)
return job_config
13 changes: 13 additions & 0 deletions ros_buildfarm/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,3 +589,16 @@ def get_package_repo_data(repository_baseurl, targets, cache_dir):
repository_baseurl, target, cache_dir)
data[target] = index
return data


def get_xunit_publisher_types_and_patterns(ros_version):
types = []
if ros_version == 1:
types.append(('GoogleTestType', 'ws/test_results/**/*.xml'))
elif ros_version == 2:
types.append(('GoogleTestType', 'ws/test_results/**/*.gtest.xml'))
types.append(('JUnitType', 'ws/test_results/**/pytest.xml'))
types.append(('JUnitType', 'ws/test_results/**/*.xunit.xml'))
else:
assert False, 'Unsupported ROS version: ' + str(ros_version)
return types
4 changes: 4 additions & 0 deletions ros_buildfarm/devel_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from ros_buildfarm.common import get_node_label
from ros_buildfarm.common \
import get_repositories_and_script_generating_key_files
from ros_buildfarm.common import get_xunit_publisher_types_and_patterns
from ros_buildfarm.common import git_github_orgunit
from ros_buildfarm.common import JobValidationError
from ros_buildfarm.common import write_groovy_script_and_configs
Expand Down Expand Up @@ -434,6 +435,9 @@ def _get_devel_job_config(

'timeout_minutes': build_file.jenkins_job_timeout,

'xunit_publisher_types': get_xunit_publisher_types_and_patterns(
ros_version),

'git_ssh_credential_id': config.git_ssh_credential_id,

'collate_test_stats': build_file.collate_test_stats,
Expand Down
4 changes: 3 additions & 1 deletion ros_buildfarm/templates/ci/ci_job.xml.em
Original file line number Diff line number Diff line change
Expand Up @@ -436,10 +436,12 @@ parameters = [
plots=show_plots,
))@
@[end if]@
@[if xunit_publisher_types]@
@(SNIPPET(
'publisher_xunit',
pattern='ws/test_results/**/*.xml',
types=xunit_publisher_types,
))@
@[end if]@
</publishers>
<buildWrappers>
@[if timeout_minutes is not None]@
Expand Down
4 changes: 3 additions & 1 deletion ros_buildfarm/templates/devel/devel_job.xml.em
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,12 @@ if pull_request:
'publisher_warnings',
unstable_threshold=0 if notify_compiler_warnings else '',
))@
@[if xunit_publisher_types]@
@(SNIPPET(
'publisher_xunit',
pattern='ws/test_results/**/*.xml',
types=xunit_publisher_types,
))@
@[end if]@
@[if (not pull_request) and collate_test_stats]@
@(SNIPPET(
'publisher_groovy-postbuild',
Expand Down
16 changes: 14 additions & 2 deletions ros_buildfarm/templates/snippet/publisher_xunit.xml.em
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
@{
# for backward compatibility only
if 'types' not in vars() and 'pattern' in vars():
types = [('GoogleTestType', pattern)]
}@
<xunit plugin="xunit@@2.3.1">
<types>
<GoogleTestType>
@[for type_tag_and_pattern in types]@
@{
# expanding these within the for statement leads to a TypeError in empy version 3.3.4 and older
type_tag, pattern = type_tag_and_pattern
assert type_tag in ('GoogleTestType', 'JUnitType'), 'Unsupported test type tag: ' + type_tag
}@
<@(type_tag)>
<pattern>@ESCAPE(pattern)</pattern>
<skipNoTestFiles>true</skipNoTestFiles>
<failIfNotNew>true</failIfNotNew>
<deleteOutputFiles>true</deleteOutputFiles>
<stopProcessingIfError>true</stopProcessingIfError>
</GoogleTestType>
</@(type_tag)>
@[end for]@
</types>
<thresholds>
<org.jenkinsci.plugins.xunit.threshold.FailedThreshold>
Expand Down