From 9838dc27020d2f0261b9e38dbad7706c4b56ee4f Mon Sep 17 00:00:00 2001 From: Ronald Cron Date: Wed, 24 Mar 2021 09:18:23 +0100 Subject: [PATCH] tests: Fine tune handling of policy negative tests Fine tune handling of policy negative tests when setting automatically PSA crypto unit tests dependencies. Signed-off-by: Ronald Cron --- tests/scripts/set_psa_test_dependencies.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/scripts/set_psa_test_dependencies.py b/tests/scripts/set_psa_test_dependencies.py index ad1bc9012..3f5a0d4ff 100755 --- a/tests/scripts/set_psa_test_dependencies.py +++ b/tests/scripts/set_psa_test_dependencies.py @@ -165,9 +165,14 @@ def systematic_dependencies(file_name, function_name, arguments): deps = set() # Run key policy negative tests even if the algorithm to attempt performing - # is not supported. + # is not supported but in the case where the test is to check an + # incompatibility between a requested algorithm for a cryptographic + # operation and a key policy. In the latter, we want to filter out the + # cases # where PSA_ERROR_NOT_SUPPORTED is returned instead of + # PSA_ERROR_NOT_PERMITTED. if function_name.endswith('_key_policy') and \ - arguments[-1].startswith('PSA_ERROR_'): + arguments[-1].startswith('PSA_ERROR_') and \ + arguments[-1] != ('PSA_ERROR_NOT_PERMITTED'): arguments[-2] = '' if function_name == 'copy_fail' and \ arguments[-1].startswith('PSA_ERROR_'):