test/params_test.c: Add higher level parameter testing#8396
test/params_test.c: Add higher level parameter testing#8396levitte wants to merge 4 commits intoopenssl:masterfrom
Conversation
|
@paulidale, @richsalz, ask and you shall receive 😉 |
|
I think this is worth having, but seeing it as sample code is a bad idea in my view. |
|
My thought is that it can be extended with OSSL_PARAM arrays and functions that use other methods (such as your API, or @paulidale's). What I've written is designed to work with what currently exists in master. |
|
Yes, I understand that. As a functional or unit test, great. As a "way to use" the PARAM stuff, I disagree. |
|
So, errrr, how did you intend to use them? |
|
Via the higher-level API's in the two PR's. |
|
I will repeat: I have made this program in such a way that setup, setting and getting with those APIs can easily be added. |
|
Yes, I know. I understand. I guess it's worthwhile to look at the two API's and see if they're doing things this way. I know #8377 isn't. Again, that isn't to say there is anything else bad with this. More tests, the better. |
test/params_test.c is a program that tries to mimic how a provider and an application would or could handle OSSL_PARAM arrays. For the moment, this program tests a very raw way of handling OSSL_PARAM arrays. It is, however, written in a way that will hopefully make it possible to extend with other methods as APIs arise, and to set up test cases where a "provider" handles the array one way while the "application" handles it another way.
|
Now that a params API has been selected and merged, this test is updated with constructions and checks using that API. |
test/params_test.c is a program that tries to mimic how a provider and an application would or could handle OSSL_PARAM arrays. For the moment, this program tests a very raw way of handling OSSL_PARAM arrays. It is, however, written in a way that will hopefully make it possible to extend with other methods as APIs arise, and to set up test cases where a "provider" handles the array one way while the "application" handles it another way. Reviewed-by: Paul Dale <[email protected]> (Merged from #8396)
Reviewed-by: Paul Dale <[email protected]> (Merged from #8396)
Reviewed-by: Paul Dale <[email protected]> (Merged from #8396)
|
Uhm, I'm seeing compilation errors with ccache clang-3.9 -I. -Iinclude -Iapps/include -pthread -m64 -Wa,--noexecstack -Qunused-arguments -rdynamic -Wall -O0 -g -g -DDEBUG_UNUSED -DPEDANTIC -pedantic -Wno-long-long -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wswitch -Wsign-compare -Wshadow -Wformat -Wtype-limits -Wundef -Werror -Wmissing-prototypes -Wstrict-prototypes -Wswitch-default -Wno-parentheses-equality -Wno-language-extension-token -Wno-extended-offsetof -Wconditional-uninitialized -Wincompatible-pointer-types-discards-qualifiers -Wno-unknown-warning-option -Wmissing-variable-declarations -Qunused-arguments -MMD -MF
test/params_test-bin-params_test.d.tmp -MT test/params_test-bin-params_test.o -c -o test/params_test-bin-params_test.o test/params_test.c
test/params_test.c:390:13: error: no previous prototype for function 'construct_api_params' [-Werror,-Wmissing-prototypes]
OSSL_PARAM *construct_api_params(void)
^
test/params_test.c:417:23: error: no previous extern declaration for non-static variable 'raw_params' [-Werror,-Wmissing-variable-declarations]
struct param_owner_st raw_params = {
^
test/params_test.c:421:23: error: no previous extern declaration for non-static variable 'api_params' [-Werror,-Wmissing-variable-declarations]
struct param_owner_st api_params = {
^
test/params_test.c:472:35: error: implicit conversion from 'double' to 'unsigned long' changes value from 47.11 to 47 [-Werror,-Wliteral-conversion]
|| !TEST_ulong_eq(app_p2, app_p2_init) /* Should remain untouched */
~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
test/params_test.c:319:21: note: expanded from macro 'app_p2_init'
#define app_p2_init 47.11 /* Another random number */
^~~~~
test/testutil.h:397:76: note: expanded from macro 'TEST_ulong_eq'
# define TEST_ulong_eq(a, b) test_ulong_eq(__FILE__, __LINE__, #a, #b, a, b)
~~~~~~~~~~~~~ ^
test/params_test.c:494:46: error: implicit conversion from 'double' to 'unsigned long' changes value from 6.283 to 6 [-Werror,-Wliteral-conversion]
|| !TEST_ulong_eq(sneakpeek->p2, p2_init) /* Should remain untouched */
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
test/params_test.c:75:17: note: expanded from macro 'p2_init'
#define p2_init 6.283 /* Magic number */
^~~~~
test/testutil.h:397:76: note: expanded from macro 'TEST_ulong_eq'
# define TEST_ulong_eq(a, b) test_ulong_eq(__FILE__, __LINE__, #a, #b, a, b)
~~~~~~~~~~~~~ ^
test/params_test.c:515:35: error: implicit conversion from 'double' to 'unsigned long' changes value from 47.11 to 47 [-Werror,-Wliteral-conversion]
|| !TEST_ulong_eq(app_p2, app_p2_init) /* Should remain untouched */
~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
test/params_test.c:319:21: note: expanded from macro 'app_p2_init'
#define app_p2_init 47.11 /* Another random number */
^~~~~
test/testutil.h:397:76: note: expanded from macro 'TEST_ulong_eq'
# define TEST_ulong_eq(a, b) test_ulong_eq(__FILE__, __LINE__, #a, #b, a, b)
~~~~~~~~~~~~~ ^
6 errors generated.
Makefile:15536: recipe for target 'test/params_test-bin-params_test.o' failed
make[1]: *** [test/params_test-bin-params_test.o] Error 1 |
|
Yeah, see #8469 |
test/params_test.c is a program that tries to mimic how a provider and
an application would or could handle OSSL_PARAM arrays.
For the moment, this program tests a very raw way of handling
OSSL_PARAM arrays. It is, however, written in a way that will
hopefully make it possible to extend with other methods as APIs arise,
and to set up test cases where a "provider" handles the array one way
while the "application" handles it another way.