mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-05 19:35:48 +03:00
Make TASK parameter positional and allow more than one task
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
@@ -144,7 +144,7 @@ TASKS = {
|
|||||||
'component_ref': 'test_psa_crypto_config_reference_hash_use_psa',
|
'component_ref': 'test_psa_crypto_config_reference_hash_use_psa',
|
||||||
'component_driver': 'test_psa_crypto_config_accel_hash_use_psa',
|
'component_driver': 'test_psa_crypto_config_accel_hash_use_psa',
|
||||||
'ignored_suites': ['shax','mdx', # the software implementations that are being excluded
|
'ignored_suites': ['shax','mdx', # the software implementations that are being excluded
|
||||||
'md' # the legacy abstraction layer that's being excluded
|
'md', # the legacy abstraction layer that's being excluded
|
||||||
'entropy','hmac_drbg','random', # temporary limitation (see RNG EPIC)
|
'entropy','hmac_drbg','random', # temporary limitation (see RNG EPIC)
|
||||||
'psa_crypto_init', # doesn't work with external RNG
|
'psa_crypto_init', # doesn't work with external RNG
|
||||||
'hkdf', # legacy still depends on MD, but there's a PSA interface that doesn't
|
'hkdf', # legacy still depends on MD, but there's a PSA interface that doesn't
|
||||||
@@ -157,24 +157,38 @@ 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',
|
parser.add_argument('task', default='all',
|
||||||
help='Analysis to be done: all or analyze_coverage or '
|
help='Analysis to be done. By default, run all tasks. '
|
||||||
'analyze_driver_vs_reference_hash')
|
'With one or more TASK, run only those. '
|
||||||
|
'TASK can be the name of a single task or '
|
||||||
|
'coma-separated list of tasks. ')
|
||||||
|
parser.add_argument('--list', action='store_true',
|
||||||
|
help='List all available tasks and exit.')
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
|
|
||||||
|
if options.list:
|
||||||
|
for task in TASKS:
|
||||||
|
print(task)
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
result = True
|
result = True
|
||||||
|
|
||||||
|
tasks = []
|
||||||
if options.task == 'all':
|
if options.task == 'all':
|
||||||
for task in TASKS:
|
for task in TASKS:
|
||||||
|
tasks.append(task)
|
||||||
|
else:
|
||||||
|
tasks = options.task.split(',')
|
||||||
|
|
||||||
|
for task in tasks:
|
||||||
|
if task not in TASKS:
|
||||||
|
print('Error: invalid task: {}'.format(task))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
for task in TASKS:
|
||||||
|
if task in tasks:
|
||||||
if not TASKS[task]['test_function'](options.outcomes, TASKS[task]['args']):
|
if not TASKS[task]['test_function'](options.outcomes, TASKS[task]['args']):
|
||||||
result = False
|
result = False
|
||||||
elif options.task in TASKS:
|
|
||||||
if not TASKS[options.task]['test_function'](options.outcomes,
|
|
||||||
TASKS[options.task]['args']):
|
|
||||||
result = False
|
|
||||||
else:
|
|
||||||
print('Error: Unknown task: {}'.format(options.task))
|
|
||||||
result = False
|
|
||||||
|
|
||||||
if result is False:
|
if result is False:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
Reference in New Issue
Block a user