Support different types in the parameter store
The test framework stores size_t and int32_t values in the parameter store by converting them all to int. This is ok in practice, since we assume int covers int32_t and we don't have test data larger than 2GB. But it's confusing and error-prone. So make the parameter store a union, which allows size_t values not to be potentially truncated and makes the code a little clearer. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
5226eb5cd3
commit
b3c2eaf00f
5 changed files with 54 additions and 13 deletions
|
@ -471,7 +471,7 @@ def parse_function_arguments(line):
|
|||
continue
|
||||
if re.search(INT_CHECK_REGEX, arg.strip()):
|
||||
args.append('int')
|
||||
args_dispatch.append('*( (int *) params[%d] )' % arg_idx)
|
||||
args_dispatch.append('((mbedtls_test_argument_t*)params[%d])->s32' % arg_idx)
|
||||
elif re.search(CHAR_CHECK_REGEX, arg.strip()):
|
||||
args.append('char*')
|
||||
args_dispatch.append('(char *) params[%d]' % arg_idx)
|
||||
|
@ -479,7 +479,7 @@ def parse_function_arguments(line):
|
|||
args.append('hex')
|
||||
# create a structure
|
||||
pointer_initializer = '(uint8_t *) params[%d]' % arg_idx
|
||||
len_initializer = '*( (uint32_t *) params[%d] )' % (arg_idx+1)
|
||||
len_initializer = '((mbedtls_test_argument_t*)params[%d])->len' % (arg_idx+1)
|
||||
local_vars += """ data_t data%d = {%s, %s};
|
||||
""" % (arg_idx, pointer_initializer, len_initializer)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue