mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-27 06:35:22 +00:00
Move value collection into its own function
No behavior change.
This commit is contained in:
parent
ffe2d6e71b
commit
c231711dbc
@ -324,6 +324,17 @@ def normalize(expr):
|
|||||||
"""
|
"""
|
||||||
return re.sub(NORMALIZE_STRIP_RE, '', expr)
|
return re.sub(NORMALIZE_STRIP_RE, '', expr)
|
||||||
|
|
||||||
|
def collect_values(options, inputs, type_word):
|
||||||
|
"""Generate expressions using known macro names and calculate their values.
|
||||||
|
|
||||||
|
Return a list of pairs of (expr, value) where expr is an expression and
|
||||||
|
value is a string representation of its integer value.
|
||||||
|
"""
|
||||||
|
names = inputs.get_names(type_word)
|
||||||
|
expressions = sorted(inputs.generate_expressions(names))
|
||||||
|
values = run_c(options, type_word, expressions)
|
||||||
|
return expressions, values
|
||||||
|
|
||||||
def do_test(options, inputs, type_word):
|
def do_test(options, inputs, type_word):
|
||||||
"""Test psa_constant_names for the specified type.
|
"""Test psa_constant_names for the specified type.
|
||||||
|
|
||||||
@ -335,9 +346,7 @@ def do_test(options, inputs, type_word):
|
|||||||
that have been tested and ``errors`` is the list of errors that were
|
that have been tested and ``errors`` is the list of errors that were
|
||||||
encountered.
|
encountered.
|
||||||
"""
|
"""
|
||||||
names = inputs.get_names(type_word)
|
expressions, values = collect_values(options, inputs, type_word)
|
||||||
expressions = sorted(inputs.generate_expressions(names))
|
|
||||||
values = run_c(options, type_word, expressions)
|
|
||||||
output = subprocess.check_output([options.program, type_word] + values)
|
output = subprocess.check_output([options.program, type_word] + values)
|
||||||
outputs = output.decode('ascii').strip().split('\n')
|
outputs = output.decode('ascii').strip().split('\n')
|
||||||
errors = [(type_word, expr, value, output)
|
errors = [(type_word, expr, value, output)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user