Skip to content

Commit 8fa1348

Browse files
Enumerate metadata test functions explicitly
When gathering test cases from test_suite_psa_crypto_metadata, look up the test function explicitly. This way test_psa_constant_names will error out if we add a new test function that needs coverage here. This change highlights an omission in the previous version: asymmetric_signature_wildcard was silently ignored as a source of algorithm expressions to test. Fix that.
1 parent d2cea9f commit 8fa1348

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

tests/scripts/test_psa_constant_names.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,22 @@ def __init__(self):
9797
}
9898
# Test functions
9999
self.table_by_test_function = {
100-
'key_type': self.key_types,
101-
'ecc_key_types': self.ecc_curves,
102-
'dh_key_types': self.dh_groups,
103-
'hash_algorithm': self.hash_algorithms,
104-
'mac_algorithm': self.mac_algorithms,
105-
'hmac_algorithm': self.mac_algorithms,
106-
'aead_algorithm': self.aead_algorithms,
107-
'key_derivation_algorithm': self.kdf_algorithms,
108-
'key_agreement_algorithm': self.ka_algorithms,
100+
# Any function ending in _algorithm also gets added to
101+
# self.algorithms.
102+
'key_type': [self.key_types],
103+
'ecc_key_types': [self.ecc_curves],
104+
'dh_key_types': [self.dh_groups],
105+
'hash_algorithm': [self.hash_algorithms],
106+
'mac_algorithm': [self.mac_algorithms],
107+
'cipher_algorithm': [],
108+
'hmac_algorithm': [self.mac_algorithms],
109+
'aead_algorithm': [self.aead_algorithms],
110+
'key_derivation_algorithm': [self.kdf_algorithms],
111+
'key_agreement_algorithm': [self.ka_algorithms],
112+
'asymmetric_signature_algorithm': [],
113+
'asymmetric_signature_wildcard': [self.algorithms],
114+
'asymmetric_encryption_algorithm': [],
115+
'other_algorithm': [],
109116
}
110117
# macro name -> list of argument names
111118
self.argspecs = {}
@@ -253,8 +260,7 @@ def add_test_case_line(self, function, argument):
253260
# exclude ones that are already chained with a KDF.
254261
# Keep the expression as one to test as an algorithm.
255262
function = 'other_algorithm'
256-
if function in self.table_by_test_function:
257-
sets.append(self.table_by_test_function[function])
263+
sets += self.table_by_test_function[function]
258264
if self.accept_test_case_line(function, argument):
259265
for s in sets:
260266
s.add(argument)

0 commit comments

Comments
 (0)