Generate CDash reports for build/install step
This commit is contained in:

committed by
Todd Gamblin

parent
ae0ba373b8
commit
847c1216d0
@@ -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')
|
||||
|
Reference in New Issue
Block a user