mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-02 17:54:18 +00:00
Minor improvements to test code script
Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
parent
b85838f2f4
commit
360f8e4429
@ -126,33 +126,39 @@ code that is generated or read from helpers and platform files.
|
|||||||
This script replaces following fields in the template and generates
|
This script replaces following fields in the template and generates
|
||||||
the test source file:
|
the test source file:
|
||||||
|
|
||||||
__MBEDTLS_TEST_TEMPLATE__TEST_COMMON_HELPERS <-- All common code from helpers.function
|
__MBEDTLS_TEST_TEMPLATE__TEST_COMMON_HELPERS
|
||||||
is substituted here.
|
All common code from helpers.function
|
||||||
__MBEDTLS_TEST_TEMPLATE__FUNCTIONS_CODE <-- Test functions are substituted here
|
is substituted here.
|
||||||
from the input test_suit_xyz.function
|
__MBEDTLS_TEST_TEMPLATE__FUNCTIONS_CODE
|
||||||
file. C preprocessor checks are generated
|
Test functions are substituted here
|
||||||
for the build dependencies specified
|
from the input test_suit_xyz.function
|
||||||
in the input file. This script also
|
file. C preprocessor checks are generated
|
||||||
generates wrappers for the test
|
for the build dependencies specified
|
||||||
functions with code to expand the
|
in the input file. This script also
|
||||||
string parameters read from the data
|
generates wrappers for the test
|
||||||
file.
|
functions with code to expand the
|
||||||
__MBEDTLS_TEST_TEMPLATE__EXPRESSION_CODE <-- This script enumerates the
|
string parameters read from the data
|
||||||
expressions in the .data file and
|
file.
|
||||||
generates code to handle enumerated
|
__MBEDTLS_TEST_TEMPLATE__EXPRESSION_CODE
|
||||||
expression Ids and return the values.
|
This script enumerates the
|
||||||
__MBEDTLS_TEST_TEMPLATE__DEP_CHECK_CODE <-- This script enumerates all
|
expressions in the .data file and
|
||||||
build dependencies and generate
|
generates code to handle enumerated
|
||||||
code to handle enumerated build
|
expression Ids and return the values.
|
||||||
dependency Id and return status: if
|
__MBEDTLS_TEST_TEMPLATE__DEP_CHECK_CODE
|
||||||
the dependency is defined or not.
|
This script enumerates all
|
||||||
__MBEDTLS_TEST_TEMPLATE__DISPATCH_CODE <-- This script enumerates the functions
|
build dependencies and generate
|
||||||
specified in the input test data file
|
code to handle enumerated build
|
||||||
and generates the initializer for the
|
dependency Id and return status: if
|
||||||
function table in the template
|
the dependency is defined or not.
|
||||||
file.
|
__MBEDTLS_TEST_TEMPLATE__DISPATCH_CODE
|
||||||
__MBEDTLS_TEST_TEMPLATE__PLATFORM_CODE <-- Platform specific setup and test
|
This script enumerates the functions
|
||||||
dispatch code.
|
specified in the input test data file
|
||||||
|
and generates the initializer for the
|
||||||
|
function table in the template
|
||||||
|
file.
|
||||||
|
__MBEDTLS_TEST_TEMPLATE__PLATFORM_CODE
|
||||||
|
Platform specific setup and test
|
||||||
|
dispatch code.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -985,10 +991,7 @@ def write_test_source_file(template_file, c_file, snippets):
|
|||||||
braced = "(?P<braced>(?!))"
|
braced = "(?P<braced>(?!))"
|
||||||
# If not already matched, a "__MBEDTLS_TEST_TEMPLATE__" prefix is invalid.
|
# If not already matched, a "__MBEDTLS_TEST_TEMPLATE__" prefix is invalid.
|
||||||
invalid = "(?P<invalid>__MBEDTLS_TEST_TEMPLATE__)"
|
invalid = "(?P<invalid>__MBEDTLS_TEST_TEMPLATE__)"
|
||||||
placeholder_pattern = re.compile(escaped \
|
placeholder_pattern = re.compile("|".join([escaped, named, braced, invalid]))
|
||||||
+ "|" + named \
|
|
||||||
+ "|" + braced \
|
|
||||||
+ "|" + invalid)
|
|
||||||
|
|
||||||
with open(template_file, 'r') as template_f, open(c_file, 'w') as c_f:
|
with open(template_file, 'r') as template_f, open(c_file, 'w') as c_f:
|
||||||
for line_no, line in enumerate(template_f.readlines(), 1):
|
for line_no, line in enumerate(template_f.readlines(), 1):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user