summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZack Galbreath <zack.galbreath@kitware.com>2018-04-19 15:21:23 -0400
committerTodd Gamblin <tgamblin@llnl.gov>2018-05-15 05:43:07 -0700
commit847c1216d0bf2534d5871ca4e47eb40df211d90f (patch)
treed3e41c3af7a1f992c5cac6d5e2afa9c93b9f71f0 /lib
parentae0ba373b8dea2350a8845a15a47f837b9152d2c (diff)
downloadspack-847c1216d0bf2534d5871ca4e47eb40df211d90f.tar.gz
spack-847c1216d0bf2534d5871ca4e47eb40df211d90f.tar.bz2
spack-847c1216d0bf2534d5871ca4e47eb40df211d90f.tar.xz
spack-847c1216d0bf2534d5871ca4e47eb40df211d90f.zip
Generate CDash reports for build/install step
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/report.py35
1 files changed, 33 insertions, 2 deletions
diff --git a/lib/spack/spack/report.py b/lib/spack/spack/report.py
index 01d4e25611..049728a2a8 100644
--- a/lib/spack/spack/report.py
+++ b/lib/spack/spack/report.py
@@ -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 socket
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 @@ class collect_info(object):
'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 @@ class collect_info(object):
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')