Skip to content
Snippets Groups Projects
Commit 847c1216 authored by Zack Galbreath's avatar Zack Galbreath Committed by Todd Gamblin
Browse files

Generate CDash reports for build/install step

parent ae0ba373
Branches
Tags
No related merge requests found
......@@ -23,6 +23,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
"""Tools to produce reports of spec installations"""
import codecs
import collections
import functools
import itertools
......@@ -33,6 +34,7 @@
import time
import traceback
import xml.sax.saxutils
from six import text_type
import llnl.util.lang
import spack.build_environment
......@@ -294,7 +296,9 @@ def cdash_build_report(self, report_data):
'autoreconf': 'configure',
'cmake': 'configure',
'configure': 'configure',
'edit': 'configure'
'edit': 'configure',
'build': 'build',
'install': 'build'
}
# Initialize data structures common to each phase's report.
......@@ -344,11 +348,38 @@ def cdash_build_report(self, report_data):
if phase == 'configure' and nerrors > 0:
report_data[phase]['status'] = 1
if phase == 'build':
# Convert log output from ASCII to Unicode and escape for XML.
def clean_log_event(event):
event = vars(event)
event['text'] = xml.sax.saxutils.escape(event['text'])
event['pre_context'] = xml.sax.saxutils.escape(
'\n'.join(event['pre_context']))
event['post_context'] = xml.sax.saxutils.escape(
'\n'.join(event['post_context']))
# source_file and source_line_no are either strings or
# the tuple (None,). Distinguish between these two cases.
if event['source_file'][0] is None:
event['source_file'] = ''
event['source_line_no'] = ''
else:
event['source_file'] = xml.sax.saxutils.escape(
event['source_file'])
return event
report_data[phase]['errors'] = []
report_data[phase]['warnings'] = []
for error in errors:
report_data[phase]['errors'].append(clean_log_event(error))
for warning in warnings:
report_data[phase]['warnings'].append(
clean_log_event(warning))
# Write the report.
report_name = phase.capitalize() + ".xml"
phase_report = os.path.join(self.filename, report_name)
with open(phase_report, 'w') as f:
with codecs.open(phase_report, 'w', 'utf-8') as f:
env = spack.tengine.make_environment()
site_template = os.path.join(templates[self.format_name],
'Site.xml')
......
<Build>
<StartBuildTime>{{ build.starttime }}</StartBuildTime>
<BuildCommand>{{ install_command }}</BuildCommand>
{% for warning in build.warnings %}
<Warning>
<BuildLogLine>{{ warning.line_no }}</BuildLogLine>
<Text>{{ warning.text }}</Text>
<SourceFile>{{ warning.source_file }}</SourceFile>
<SourceLineNumber>{{ warning.source_line_no }}</SourceLineNumber>
<PreContext>{{ warning.pre_context }}</PreContext>
<PostContext>{{ warning.post_context }}</PostContext>
</Warning>
{% endfor %}
{% for error in build.errors %}
<Error>
<BuildLogLine>{{ error.line_no }}</BuildLogLine>
<Text>{{ error.text }}</Text>
<SourceFile>{{ error.source_file }}</SourceFile>
<SourceLineNumber>{{ error.source_line_no }}</SourceLineNumber>
<PreContext>{{ error.pre_context }}</PreContext>
<PostContext>{{ error.post_context }}</PostContext>
</Error>
{% endfor %}
<EndBuildTime>{{ build.endtime }}</EndBuildTime>
<ElapsedMinutes>0</ElapsedMinutes>
</Build>
</Site>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment