mirror of
https://github.com/Mbed-TLS/mbedtls-framework.git
synced 2026-08-15 23:57:47 +00:00
Adapt default path of psa_test_wrappers.[hc]
Adapt default path of psa_test_wrappers.[hc] in generate_psa_wrappers.py when called in the context of Mbed TLS 4.x. Signed-off-by: Ronald Cron <[email protected]>
This commit is contained in:
@@ -7,32 +7,40 @@
|
||||
|
||||
import argparse
|
||||
from mbedtls_framework.code_wrapper.psa_test_wrapper import PSATestWrapper, PSALoggingTestWrapper
|
||||
|
||||
DEFAULT_C_OUTPUT_FILE_NAME = 'tests/src/psa_test_wrappers.c'
|
||||
DEFAULT_H_OUTPUT_FILE_NAME = 'tests/include/test/psa_test_wrappers.h'
|
||||
from mbedtls_framework import build_tree
|
||||
|
||||
def main() -> None:
|
||||
default_c_output_file_name = 'tests/src/psa_test_wrappers.c'
|
||||
default_h_output_file_name = 'tests/include/test/psa_test_wrappers.h'
|
||||
|
||||
project_root = build_tree.guess_project_root()
|
||||
if build_tree.looks_like_mbedtls_root(project_root) and \
|
||||
not build_tree.is_mbedtls_3_6():
|
||||
default_c_output_file_name = 'tf-psa-crypto/' + default_c_output_file_name
|
||||
default_h_output_file_name = 'tf-psa-crypto/' + default_h_output_file_name
|
||||
|
||||
parser = argparse.ArgumentParser(description=globals()['__doc__'])
|
||||
parser.add_argument('--log',
|
||||
help='Stream to log to (default: no logging code)')
|
||||
parser.add_argument('--output-c',
|
||||
metavar='FILENAME',
|
||||
default=DEFAULT_C_OUTPUT_FILE_NAME,
|
||||
default=default_c_output_file_name,
|
||||
help=('Output .c file path (default: {}; skip .c output if empty)'
|
||||
.format(DEFAULT_C_OUTPUT_FILE_NAME)))
|
||||
.format(default_c_output_file_name)))
|
||||
parser.add_argument('--output-h',
|
||||
metavar='FILENAME',
|
||||
default=DEFAULT_H_OUTPUT_FILE_NAME,
|
||||
default=default_h_output_file_name,
|
||||
help=('Output .h file path (default: {}; skip .h output if empty)'
|
||||
.format(DEFAULT_H_OUTPUT_FILE_NAME)))
|
||||
.format(default_h_output_file_name)))
|
||||
options = parser.parse_args()
|
||||
|
||||
if options.log:
|
||||
generator = PSALoggingTestWrapper(DEFAULT_H_OUTPUT_FILE_NAME,
|
||||
DEFAULT_C_OUTPUT_FILE_NAME,
|
||||
generator = PSALoggingTestWrapper(default_h_output_file_name,
|
||||
default_c_output_file_name,
|
||||
options.log) #type: PSATestWrapper
|
||||
else:
|
||||
generator = PSATestWrapper(DEFAULT_H_OUTPUT_FILE_NAME,
|
||||
DEFAULT_C_OUTPUT_FILE_NAME)
|
||||
generator = PSATestWrapper(default_h_output_file_name,
|
||||
default_c_output_file_name)
|
||||
|
||||
if options.output_h:
|
||||
generator.write_h_file(options.output_h)
|
||||
|
||||
Reference in New Issue
Block a user