sb: Move the option check for reporting errors to the error reporter.

Updates #2536.
This commit is contained in:
Chris Johns 2017-10-12 13:40:12 +11:00
parent c4b6bf0d6d
commit 6dc551cf47
2 changed files with 34 additions and 33 deletions

View File

@ -111,9 +111,6 @@ class build:
return name
def _generate_report_(self, header, footer = None):
label, result = self.opts.with_arg('error-report')
if (label.startswith('without_') and result != 'yes') or \
(label.startswith('with_') and result != 'no'):
ereport.generate('rsb-report-%s.txt' % self.macros['name'],
self.opts, header, footer)

View File

@ -1,6 +1,6 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
# Copyright 2010-2014 Chris Johns (chrisj@rtems.org)
# Copyright 2010-2017 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-testing'.
@ -21,12 +21,17 @@
# Create an error log.
#
from __future__ import print_function
import os
import error
import log
def generate(name, opts, header = None, footer = None):
label, result = opts.with_arg('error-report')
if (label.startswith('without_') and result != 'yes') or \
(label.startswith('with_') and result != 'no'):
r = ['RTEMS Tools Project - Source Builder Error Report'] + []
if header:
r += [' %s' % (header)]
@ -47,9 +52,8 @@ def generate(name, opts, header = None, footer = None):
r += [footer]
try:
name = name.replace('/', '-')
l = open(name, 'w')
with open(name, 'w') as l:
l.write(os.linesep.join(r))
l.close()
log.notice(' See error report: %s' % (name))
except:
log.stderr('error: failure to create error report')