Simplify code

Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
This commit is contained in:
gabor-mezei-arm 2021-06-28 15:09:02 +02:00
parent 6c18541a5e
commit 705c452fd0
No known key found for this signature in database
GPG key ID: 106F5A41ECC305BD

View file

@ -358,7 +358,7 @@ class StorageFormat:
usage = ' | '.join(usage_flags) if usage_flags else '0'
if short is None:
short = re.sub(r'\bPSA_KEY_USAGE_', r'', usage)
extra_desc = ' ' + extra_desc if extra_desc is not None and len(extra_desc) > 0 else ''
extra_desc = ' ' + extra_desc if extra_desc else ''
description = 'usage' + extra_desc + ': ' + short
return self.key_builder.build(version=self.version,
id=1, lifetime=0x00000001,
@ -475,14 +475,12 @@ class StorageFormat:
# test cases. This allows all required information to be obtained in
# one go, which is a significant performance gain as the information
# includes numerical values obtained by compiling a C program.
generated_keys = self.generate_all_keys()
keys = self.generate_all_keys()
# Skip keys with a non-default location, because they
# require a driver and we currently have no mechanism to
# determine whether a driver is available.
keys = filter(lambda key: key.location_value() == 0, generated_keys)
return [self.make_test_case(key) for key in keys]
return [self.make_test_case(key) for key in keys if key.location_value() == 0]
class StorageFormatForward(StorageFormat):
"""Storage format stability test cases for forward compatibility."""