diff --git a/scripts/test_psa_compliance.py b/scripts/test_psa_compliance.py index 98ec7597e..c5e9748ca 100755 --- a/scripts/test_psa_compliance.py +++ b/scripts/test_psa_compliance.py @@ -50,6 +50,17 @@ def main(library_build_dir: str): library_subdir + '/' + 'lib' + crypto_name + '.a') + # Temporary while the PSA compliance test suite is still run as part + # of Mbed TLS testing. When it is not the case anymore, the last case + # can be removed. + if in_tf_psa_crypto_repo: + extra_includes = ';{}/drivers/builtin/include'.format(root_dir) + elif build_tree.is_mbedtls_3_6(): + extra_includes = '' + else: + extra_includes = ';{}/tf-psa-crypto/include'.format(root_dir) + \ + (';{}/tf-psa-crypto/drivers/builtin/include'.format(root_dir)) + if not os.path.exists(crypto_lib_filename): #pylint: disable=bad-continuation subprocess.check_call([ @@ -78,15 +89,6 @@ def main(library_build_dir: str): os.mkdir(build_dir) os.chdir(build_dir) - # Temporary while the PSA compliance test suite is still run as part - # of Mbed TLS testing. When it is not the case anymore, the second case - # can be removed. - if in_tf_psa_crypto_repo: - extra_includes = ';{}/drivers/builtin/include'.format(root_dir) - elif os.path.isdir(os.path.join(root_dir, 'tf-psa-crypto')): - extra_includes = ';{}/tf-psa-crypto/include'.format(root_dir) + \ - (';{}/tf-psa-crypto/drivers/builtin/include'.format(root_dir)) - #pylint: disable=bad-continuation subprocess.check_call([ 'cmake', '..', diff --git a/scripts/test_psa_constant_names.py b/scripts/test_psa_constant_names.py index 228a61fb9..ad1311041 100755 --- a/scripts/test_psa_constant_names.py +++ b/scripts/test_psa_constant_names.py @@ -18,6 +18,7 @@ import subprocess import sys from typing import Iterable, List, Optional, Tuple +from mbedtls_framework import build_tree from mbedtls_framework import c_build_helper from mbedtls_framework.macro_collector import InputsForTest, PSAMacroEnumerator from mbedtls_framework import typing_util @@ -155,25 +156,39 @@ class Tests: out.write(' PASS\n') HEADERS = ['psa/crypto.h', 'psa/crypto_extra.h', 'psa/crypto_values.h'] -TEST_SUITES = ['tf-psa-crypto/tests/suites/test_suite_psa_crypto_metadata.data'] + +if build_tree.is_mbedtls_3_6(): + TEST_SUITES = ['tests/suites/test_suite_psa_crypto_metadata.data'] +else: + TEST_SUITES = ['tf-psa-crypto/tests/suites/test_suite_psa_crypto_metadata.data'] def main(): parser = argparse.ArgumentParser(description=globals()['__doc__']) - parser.add_argument('--include', '-I', - action='append', default=['tf-psa-crypto/include', - 'tf-psa-crypto/drivers/builtin/include', - 'tf-psa-crypto/drivers/everest/include', - 'include'], - help='Directory for header files') + if build_tree.is_mbedtls_3_6(): + parser.add_argument('--include', '-I', + action='append', default=['include'], + help='Directory for header files') + else: + parser.add_argument('--include', '-I', + action='append', default=['tf-psa-crypto/include', + 'tf-psa-crypto/drivers/builtin/include', + 'tf-psa-crypto/drivers/everest/include', + 'include'], + help='Directory for header files') parser.add_argument('--keep-c', action='store_true', dest='keep_c', default=False, help='Keep the intermediate C file') parser.add_argument('--no-keep-c', action='store_false', dest='keep_c', help='Don\'t keep the intermediate C file (default)') - parser.add_argument('--program', - default='tf-psa-crypto/programs/psa/psa_constant_names', - help='Program to test') + if build_tree.is_mbedtls_3_6(): + parser.add_argument('--program', + default='programs/psa/psa_constant_names', + help='Program to test') + else: + parser.add_argument('--program', + default='tf-psa-crypto/programs/psa/psa_constant_names', + help='Program to test') parser.add_argument('--show', action='store_true', help='Show tested values on stdout')