Skip to content

Commit 291802b

Browse files
committed
test_psa_constant_names.py: reconcile 3.6 and development branches
The script had small differences between the development branch and the mbedtls-3.6 ones. The goal of this commit is to reconcile those differences in order to make it usable from both branches. This is necessary now that the scripts lives in the framework repo. Signed-off-by: Valerio Setti <vsetti@baylibre.com>
1 parent 24f398e commit 291802b

File tree

2 files changed

+28
-11
lines changed

2 files changed

+28
-11
lines changed

scripts/test_psa_compliance.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ def main(library_build_dir: str):
8383
# can be removed.
8484
if in_tf_psa_crypto_repo:
8585
extra_includes = ';{}/drivers/builtin/include'.format(root_dir)
86-
elif os.path.isdir(os.path.join(root_dir, 'tf-psa-crypto')):
86+
elif build_tree.is_mbedtls_3_6():
87+
extra_includes = ''
88+
else:
8789
extra_includes = ';{}/tf-psa-crypto/include'.format(root_dir) + \
8890
(';{}/tf-psa-crypto/drivers/builtin/include'.format(root_dir))
8991

scripts/test_psa_constant_names.py

+25-10
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import sys
1919
from typing import Iterable, List, Optional, Tuple
2020

21+
from mbedtls_framework import build_tree
2122
from mbedtls_framework import c_build_helper
2223
from mbedtls_framework.macro_collector import InputsForTest, PSAMacroEnumerator
2324
from mbedtls_framework import typing_util
@@ -155,25 +156,39 @@ def report(self, out: typing_util.Writable) -> None:
155156
out.write(' PASS\n')
156157

157158
HEADERS = ['psa/crypto.h', 'psa/crypto_extra.h', 'psa/crypto_values.h']
158-
TEST_SUITES = ['tf-psa-crypto/tests/suites/test_suite_psa_crypto_metadata.data']
159+
160+
if build_tree.is_mbedtls_3_6():
161+
TEST_SUITES = ['tests/suites/test_suite_psa_crypto_metadata.data']
162+
else:
163+
TEST_SUITES = ['tf-psa-crypto/tests/suites/test_suite_psa_crypto_metadata.data']
159164

160165
def main():
161166
parser = argparse.ArgumentParser(description=globals()['__doc__'])
162-
parser.add_argument('--include', '-I',
163-
action='append', default=['tf-psa-crypto/include',
164-
'tf-psa-crypto/drivers/builtin/include',
165-
'tf-psa-crypto/drivers/everest/include',
166-
'include'],
167-
help='Directory for header files')
167+
if build_tree.is_mbedtls_3_6():
168+
parser.add_argument('--include', '-I',
169+
action='append', default=['include'],
170+
help='Directory for header files')
171+
else:
172+
parser.add_argument('--include', '-I',
173+
action='append', default=['tf-psa-crypto/include',
174+
'tf-psa-crypto/drivers/builtin/include',
175+
'tf-psa-crypto/drivers/everest/include',
176+
'include'],
177+
help='Directory for header files')
168178
parser.add_argument('--keep-c',
169179
action='store_true', dest='keep_c', default=False,
170180
help='Keep the intermediate C file')
171181
parser.add_argument('--no-keep-c',
172182
action='store_false', dest='keep_c',
173183
help='Don\'t keep the intermediate C file (default)')
174-
parser.add_argument('--program',
175-
default='tf-psa-crypto/programs/psa/psa_constant_names',
176-
help='Program to test')
184+
if build_tree.is_mbedtls_3_6():
185+
parser.add_argument('--program',
186+
default='programs/psa/psa_constant_names',
187+
help='Program to test')
188+
else:
189+
parser.add_argument('--program',
190+
default='tf-psa-crypto/programs/psa/psa_constant_names',
191+
help='Program to test')
177192
parser.add_argument('--show',
178193
action='store_true',
179194
help='Show tested values on stdout')

0 commit comments

Comments
 (0)