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

Include accurate build time in CDash report

parent 8d087208
No related branches found
No related tags found
No related merge requests found
...@@ -63,10 +63,10 @@ def __init__(self, args): ...@@ -63,10 +63,10 @@ def __init__(self, args):
self.buildname = args.cdash_build or self.install_command self.buildname = args.cdash_build or self.install_command
self.site = args.cdash_site or socket.gethostname() self.site = args.cdash_site or socket.gethostname()
self.osname = platform.system() self.osname = platform.system()
self.starttime = int(time.time()) self.endtime = int(time.time())
buildstamp_format = "%Y%m%d-%H%M-{0}".format(args.cdash_track) buildstamp_format = "%Y%m%d-%H%M-{0}".format(args.cdash_track)
self.buildstamp = time.strftime(buildstamp_format, self.buildstamp = time.strftime(buildstamp_format,
time.localtime(self.starttime)) time.localtime(self.endtime))
self.buildId = None self.buildId = None
self.revision = '' self.revision = ''
git = which('git') git = which('git')
...@@ -80,16 +80,18 @@ def build_report(self, filename, report_data): ...@@ -80,16 +80,18 @@ def build_report(self, filename, report_data):
report_data[phase] = {} report_data[phase] = {}
report_data[phase]['log'] = "" report_data[phase]['log'] = ""
report_data[phase]['status'] = 0 report_data[phase]['status'] = 0
report_data[phase]['starttime'] = self.starttime report_data[phase]['endtime'] = self.endtime
report_data[phase]['endtime'] = self.starttime
# Track the phases we perform so we know what reports to create. # Track the phases we perform so we know what reports to create.
phases_encountered = [] phases_encountered = []
total_duration = 0
# Parse output phase-by-phase. # Parse output phase-by-phase.
phase_regexp = re.compile(r"Executing phase: '(.*)'") phase_regexp = re.compile(r"Executing phase: '(.*)'")
cdash_phase = '' cdash_phase = ''
for spec in report_data['specs']: for spec in report_data['specs']:
if 'time' in spec:
total_duration += int(spec['time'])
for package in spec['packages']: for package in spec['packages']:
if 'stdout' in package: if 'stdout' in package:
current_phase = '' current_phase = ''
...@@ -121,7 +123,9 @@ def build_report(self, filename, report_data): ...@@ -121,7 +123,9 @@ def build_report(self, filename, report_data):
build_pos = phases_encountered.index("build") build_pos = phases_encountered.index("build")
phases_encountered.insert(0, phases_encountered.pop(build_pos)) phases_encountered.insert(0, phases_encountered.pop(build_pos))
self.starttime = self.endtime - total_duration
for phase in phases_encountered: for phase in phases_encountered:
report_data[phase]['starttime'] = self.starttime
errors, warnings = parse_log_events( errors, warnings = parse_log_events(
report_data[phase]['log'].splitlines()) report_data[phase]['log'].splitlines())
nerrors = len(errors) nerrors = len(errors)
...@@ -182,8 +186,8 @@ def concretization_report(self, filename, msg): ...@@ -182,8 +186,8 @@ def concretization_report(self, filename, msg):
report_data = {} report_data = {}
self.initialize_report(filename, report_data) self.initialize_report(filename, report_data)
report_data['update'] = {} report_data['update'] = {}
report_data['update']['starttime'] = self.starttime report_data['update']['starttime'] = self.endtime
report_data['update']['endtime'] = self.starttime report_data['update']['endtime'] = self.endtime
report_data['update']['revision'] = self.revision report_data['update']['revision'] = self.revision
report_data['update']['log'] = msg report_data['update']['log'] = msg
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment