mirror of
https://github.com/cuberite/polarssl.git
synced 2025-09-29 16:32:32 -04:00
analyze_outcomes: print all output on stderr
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
1f39a62ce6
commit
5d8d1a7f60
@ -20,18 +20,25 @@ class Results:
|
|||||||
self.error_count = 0
|
self.error_count = 0
|
||||||
self.warning_count = 0
|
self.warning_count = 0
|
||||||
|
|
||||||
|
# Private method
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def log(fmt, *args, **kwargs):
|
def __log(fmt, *args, **kwargs):
|
||||||
sys.stderr.write((fmt + '\n').format(*args, **kwargs))
|
sys.stderr.write((fmt + '\n').format(*args, **kwargs))
|
||||||
|
|
||||||
def error(self, fmt, *args, **kwargs):
|
def error(self, fmt, *args, **kwargs):
|
||||||
self.log('Error: ' + fmt, *args, **kwargs)
|
self.__log('Error: ' + fmt, *args, **kwargs)
|
||||||
self.error_count += 1
|
self.error_count += 1
|
||||||
|
|
||||||
def warning(self, fmt, *args, **kwargs):
|
def warning(self, fmt, *args, **kwargs):
|
||||||
self.log('Warning: ' + fmt, *args, **kwargs)
|
self.__log('Warning: ' + fmt, *args, **kwargs)
|
||||||
self.warning_count += 1
|
self.warning_count += 1
|
||||||
|
|
||||||
|
# This is a static method because we don't need to track any data about
|
||||||
|
# the number of times it is called
|
||||||
|
@staticmethod
|
||||||
|
def info(fmt, *args, **kwargs):
|
||||||
|
Results.__log(fmt, *args, **kwargs)
|
||||||
|
|
||||||
class TestCaseOutcomes:
|
class TestCaseOutcomes:
|
||||||
"""The outcomes of one test case across many configurations."""
|
"""The outcomes of one test case across many configurations."""
|
||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
@ -96,7 +103,7 @@ def analyze_driver_vs_reference(outcomes, component_ref, component_driver,
|
|||||||
if component_ref in entry:
|
if component_ref in entry:
|
||||||
reference_test_passed = True
|
reference_test_passed = True
|
||||||
if(reference_test_passed and not driver_test_passed):
|
if(reference_test_passed and not driver_test_passed):
|
||||||
print(key)
|
Results.info(key)
|
||||||
result = False
|
result = False
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@ -131,7 +138,7 @@ def do_analyze_coverage(outcome_file, args):
|
|||||||
"""Perform coverage analysis."""
|
"""Perform coverage analysis."""
|
||||||
del args # unused
|
del args # unused
|
||||||
outcomes = read_outcome_file(outcome_file)
|
outcomes = read_outcome_file(outcome_file)
|
||||||
print("\n*** Analyze coverage ***\n")
|
Results.info("\n*** Analyze coverage ***\n")
|
||||||
results = analyze_outcomes(outcomes)
|
results = analyze_outcomes(outcomes)
|
||||||
return results.error_count == 0
|
return results.error_count == 0
|
||||||
|
|
||||||
@ -140,7 +147,7 @@ def do_analyze_driver_vs_reference(outcome_file, args):
|
|||||||
ignored_suites = ['test_suite_' + x for x in args['ignored_suites']]
|
ignored_suites = ['test_suite_' + x for x in args['ignored_suites']]
|
||||||
|
|
||||||
outcomes = read_outcome_file(outcome_file)
|
outcomes = read_outcome_file(outcome_file)
|
||||||
print("\n*** Analyze driver {} vs reference {} ***\n".format(
|
Results.info("\n*** Analyze driver {} vs reference {} ***\n".format(
|
||||||
args['component_driver'], args['component_ref']))
|
args['component_driver'], args['component_ref']))
|
||||||
return analyze_driver_vs_reference(outcomes, args['component_ref'],
|
return analyze_driver_vs_reference(outcomes, args['component_ref'],
|
||||||
args['component_driver'], ignored_suites,
|
args['component_driver'], ignored_suites,
|
||||||
@ -201,7 +208,7 @@ def main():
|
|||||||
|
|
||||||
if options.list:
|
if options.list:
|
||||||
for task in TASKS:
|
for task in TASKS:
|
||||||
print(task)
|
Results.info(task)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
result = True
|
result = True
|
||||||
@ -213,7 +220,7 @@ def main():
|
|||||||
|
|
||||||
for task in tasks:
|
for task in tasks:
|
||||||
if task not in TASKS:
|
if task not in TASKS:
|
||||||
print('Error: invalid task: {}'.format(task))
|
Results.info('Error: invalid task: {}'.format(task))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
for task in TASKS:
|
for task in TASKS:
|
||||||
@ -223,7 +230,7 @@ def main():
|
|||||||
|
|
||||||
if result is False:
|
if result is False:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
print("SUCCESS :-)")
|
Results.info("SUCCESS :-)")
|
||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
# Print the backtrace and exit explicitly with our chosen status.
|
# Print the backtrace and exit explicitly with our chosen status.
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user