analyze_outcomes: rename some variables for better readability
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
866b3a1886
commit
dfd7ca6344
1 changed files with 16 additions and 19 deletions
|
@ -179,7 +179,7 @@ def do_analyze_driver_vs_reference(outcome_file, args):
|
||||||
args['ignored_tests'])
|
args['ignored_tests'])
|
||||||
|
|
||||||
# List of tasks with a function that can handle this task and additional arguments if required
|
# List of tasks with a function that can handle this task and additional arguments if required
|
||||||
TASKS = {
|
KNOWN_TASKS = {
|
||||||
'analyze_coverage': {
|
'analyze_coverage': {
|
||||||
'test_function': do_analyze_coverage,
|
'test_function': do_analyze_coverage,
|
||||||
'args': {
|
'args': {
|
||||||
|
@ -645,7 +645,7 @@ def main():
|
||||||
parser = argparse.ArgumentParser(description=__doc__)
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
parser.add_argument('outcomes', metavar='OUTCOMES.CSV',
|
parser.add_argument('outcomes', metavar='OUTCOMES.CSV',
|
||||||
help='Outcome file to analyze')
|
help='Outcome file to analyze')
|
||||||
parser.add_argument('task', default='all', nargs='?',
|
parser.add_argument('specified_tasks', default='all', nargs='?',
|
||||||
help='Analysis to be done. By default, run all tasks. '
|
help='Analysis to be done. By default, run all tasks. '
|
||||||
'With one or more TASK, run only those. '
|
'With one or more TASK, run only those. '
|
||||||
'TASK can be the name of a single task or '
|
'TASK can be the name of a single task or '
|
||||||
|
@ -660,31 +660,28 @@ def main():
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
|
|
||||||
if options.list:
|
if options.list:
|
||||||
for task in TASKS:
|
for task in KNOWN_TASKS:
|
||||||
Results.log(task)
|
Results.log(task)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
result = True
|
if options.specified_tasks == 'all':
|
||||||
|
tasks_list = KNOWN_TASKS.keys()
|
||||||
if options.task == 'all':
|
|
||||||
tasks = TASKS.keys()
|
|
||||||
else:
|
else:
|
||||||
tasks = re.split(r'[, ]+', options.task)
|
tasks_list = re.split(r'[, ]+', options.specified_tasks)
|
||||||
|
|
||||||
for task in tasks:
|
for task in tasks_list:
|
||||||
if task not in TASKS:
|
if task not in KNOWN_TASKS:
|
||||||
Results.log('Error: invalid task: {}'.format(task))
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
TASKS['analyze_coverage']['args']['full_coverage'] = \
|
KNOWN_TASKS['analyze_coverage']['args']['full_coverage'] = options.full_coverage
|
||||||
options.full_coverage
|
|
||||||
|
|
||||||
for task in TASKS:
|
all_succeeded = True
|
||||||
if task in tasks:
|
|
||||||
if not TASKS[task]['test_function'](options.outcomes, TASKS[task]['args']):
|
|
||||||
result = False
|
|
||||||
|
|
||||||
if result is False:
|
for task in KNOWN_TASKS:
|
||||||
|
if task in tasks_list:
|
||||||
|
if not KNOWN_TASKS[task]['test_function'](options.outcomes, KNOWN_TASKS[task]['args']):
|
||||||
|
all_succeeded = False
|
||||||
|
|
||||||
|
if all_succeeded is False:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
Results.log("SUCCESS :-)")
|
Results.log("SUCCESS :-)")
|
||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue