Display failed configuration tests in yellow in multicheck

This commit is contained in:
Thomas Nagy 2016-08-20 13:06:23 +02:00
parent 93bda59033
commit ec6b72b0ad
No known key found for this signature in database
GPG Key ID: 49B4C67C05277AAA
2 changed files with 16 additions and 8 deletions

View File

@ -43,11 +43,11 @@ def configure(conf):
conf.multicheck(
{'header_name':'stdio.h', 'msg':'... stdio'},
{'header_name':'ueistd.h', 'msg':'... unistd', 'mandatory':False},
{'header_name':'xyztabcd.h', 'msg':'... optional xyztabcd.h', 'mandatory': False},
{'header_name':'stdlib.h', 'msg':'... stdlib', 'okmsg': 'aye', 'errmsg': 'nope'},
{'func': test_build, 'msg':'... testing an arbitrary build function', 'okmsg':'ok'},
msg = 'Checking for headers in parallel',
mandatory = False
mandatory = False # failures will not cause an error message
)
conf.check_cc(header_name='stdio.h', auto_add_header_name=True)

View File

@ -1274,7 +1274,12 @@ class cfgtask(Task.TaskBase):
errmsg=args.get('errmsg', ''),
)
else:
bld.check(**args)
args['multicheck_mandatory'] = args.get('mandatory', True)
args['mandatory'] = True
try:
bld.check(**args)
finally:
args['mandatory'] = args['multicheck_mandatory']
except Exception:
return 1
@ -1327,12 +1332,15 @@ def multicheck(self, *k, **kw):
self.end_msg('fail', color='RED')
raise Errors.WafError('There is an error in the library, read config.log for more information')
failure_count = 0
for x in tasks:
if x.hasrun != Task.SUCCESS:
self.end_msg(kw.get('errmsg', 'no'), color='YELLOW', **kw)
break
failure_count += 1
if failure_count:
self.end_msg(kw.get('errmsg', '%s test failed' % failure_count), color='YELLOW', **kw)
else:
self.end_msg('ok', **kw)
self.end_msg('all ok', **kw)
# optional output lines on msg/okmsg/errmsg
for x in tasks:
@ -1344,6 +1352,6 @@ def multicheck(self, *k, **kw):
self.end_msg(x.args.get('okmsg', 'yes'), 'GREEN')
for x in tasks:
if x.hasrun != Task.SUCCESS:
self.end_msg(kw.get('errmsg', 'no'), color='YELLOW', **kw)
self.fatal(kw.get('fatalmsg') or 'One of the tests has failed, read config.log for more information')
if x.args.get('mandatory', True):
self.fatal(kw.get('fatalmsg') or 'One of the tests has failed, read config.log for more information')