Merge "Add support for the Jenkins Valgrind publisher plugin."

This commit is contained in:
Jenkins 2014-08-26 17:06:08 +00:00 committed by Gerrit Code Review
commit e5c0c619ba
4 changed files with 91 additions and 0 deletions

View File

@ -3537,6 +3537,64 @@ def fitnesse(parser, xml_parent, data):
XML.SubElement(fitnesse, 'fitnessePathToXmlResultsIn').text = results
def valgrind(parser, xml_parent, data):
"""yaml: valgrind
This plugin publishes Valgrind Memcheck XML results.
Requires the Jenkins `Valgrind Plugin.
<https://wiki.jenkins-ci.org/display/JENKINS/Valgrind+Plugin>`_
:arg str pattern: Filename pattern to locate the Valgrind XML report files
(required)
:arg dict thresholds: Mark build as failed or unstable if the number of
errors exceeds a threshold. All threshold values are optional.
:thresholds:
* **unstable** (`dict`)
:unstable: * **invalid-read-write** (`int`)
* **definitely-lost** (`int`)
* **total** (`int`)
* **failed** (`dict`)
:failed: * **invalid-read-write** (`int`)
* **definitely-lost** (`int`)
* **total** (`int`)
:arg bool publish-if-aborted: Publish results for aborted builds
(default false)
:arg bool publish-if-failed: Publish results for failed builds
(default false)
Example:
.. literalinclude:: /../../tests/publishers/fixtures/valgrind001.yaml
"""
p = XML.SubElement(xml_parent,
'org.jenkinsci.plugins.valgrind.ValgrindPublisher')
p = XML.SubElement(p, 'valgrindPublisherConfig')
if 'pattern' not in data:
raise JenkinsJobsException("A filename pattern must be specified.")
XML.SubElement(p, 'pattern').text = data['pattern']
dthresholds = data.get('thresholds', {})
for threshold in ['unstable', 'failed']:
dthreshold = dthresholds.get(threshold, {})
threshold = threshold.replace('failed', 'fail')
XML.SubElement(p, '%sThresholdInvalidReadWrite' % threshold).text \
= str(dthreshold.get('invalid-read-write', ''))
XML.SubElement(p, '%sThresholdDefinitelyLost' % threshold).text \
= str(dthreshold.get('definitely-lost', ''))
XML.SubElement(p, '%sThresholdTotal' % threshold).text \
= str(dthreshold.get('total', ''))
XML.SubElement(p, 'publishResultsForAbortedBuilds').text = str(
data.get('publish-if-aborted', False)).lower()
XML.SubElement(p, 'publishResultsForFailedBuilds').text = str(
data.get('publish-if-failed', False)).lower()
class Publishers(jenkins_jobs.modules.base.Base):
sequence = 70

View File

@ -158,6 +158,7 @@ jenkins_jobs.publishers =
text-finder=jenkins_jobs.modules.publishers:text_finder
trigger-parameterized-builds=jenkins_jobs.modules.publishers:trigger_parameterized_builds
trigger=jenkins_jobs.modules.publishers:trigger
valgrind=jenkins_jobs.modules.publishers:valgrind
violations=jenkins_jobs.modules.publishers:violations
warnings=jenkins_jobs.modules.publishers:warnings
workspace-cleanup=jenkins_jobs.modules.publishers:workspace_cleanup

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<org.jenkinsci.plugins.valgrind.ValgrindPublisher>
<valgrindPublisherConfig>
<pattern>test.xml</pattern>
<unstableThresholdInvalidReadWrite>1</unstableThresholdInvalidReadWrite>
<unstableThresholdDefinitelyLost>2</unstableThresholdDefinitelyLost>
<unstableThresholdTotal>3</unstableThresholdTotal>
<failThresholdInvalidReadWrite>4</failThresholdInvalidReadWrite>
<failThresholdDefinitelyLost>5</failThresholdDefinitelyLost>
<failThresholdTotal>6</failThresholdTotal>
<publishResultsForAbortedBuilds>true</publishResultsForAbortedBuilds>
<publishResultsForFailedBuilds>true</publishResultsForFailedBuilds>
</valgrindPublisherConfig>
</org.jenkinsci.plugins.valgrind.ValgrindPublisher>
</publishers>
</project>

View File

@ -0,0 +1,14 @@
publishers:
- valgrind:
pattern: "test.xml"
thresholds:
unstable:
invalid-read-write: 1
definitely-lost: 2
total: 3
failed:
invalid-read-write: 4
definitely-lost: 5
total: 6
publish-if-aborted: true
publish-if-failed: true