Skip to content

test/params_test.c: Add higher level parameter testing#8396

Closed
levitte wants to merge 4 commits intoopenssl:masterfrom
levitte:test-params
Closed

test/params_test.c: Add higher level parameter testing#8396
levitte wants to merge 4 commits intoopenssl:masterfrom
levitte:test-params

Conversation

@levitte
Copy link
Member

@levitte levitte commented Mar 4, 2019

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.

@levitte levitte added the branch: master Applies to master branch label Mar 4, 2019
@levitte
Copy link
Member Author

levitte commented Mar 4, 2019

@paulidale, @richsalz, ask and you shall receive 😉

@richsalz
Copy link
Contributor

richsalz commented Mar 4, 2019

I think this is worth having, but seeing it as sample code is a bad idea in my view.
I will look more closely tomorrow.

@levitte
Copy link
Member Author

levitte commented Mar 4, 2019

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.

@richsalz
Copy link
Contributor

richsalz commented Mar 4, 2019

Yes, I understand that. As a functional or unit test, great. As a "way to use" the PARAM stuff, I disagree.

@levitte
Copy link
Member Author

levitte commented Mar 4, 2019

So, errrr, how did you intend to use them?

@richsalz
Copy link
Contributor

richsalz commented Mar 4, 2019

Via the higher-level API's in the two PR's.

@levitte
Copy link
Member Author

levitte commented Mar 4, 2019

I will repeat: I have made this program in such a way that setup, setting and getting with those APIs can easily be added.

@richsalz
Copy link
Contributor

richsalz commented Mar 4, 2019

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.

levitte added 3 commits March 12, 2019 20:12
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.
@levitte
Copy link
Member Author

levitte commented Mar 12, 2019

Now that a params API has been selected and merged, this test is updated with constructions and checks using that API.

@levitte
Copy link
Member Author

levitte commented Mar 13, 2019

Merged.

fff6841 test/params_test.c: Add run-time constructed OSSL_PARAM variant
bc1e0be test/params_test.c: Add API test case, and mixed methods
9ad41d2 test/params_test.c: Add "real world" parameter testing

@levitte levitte closed this Mar 13, 2019
levitte added a commit that referenced this pull request Mar 13, 2019
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)
levitte added a commit that referenced this pull request Mar 13, 2019
levitte added a commit that referenced this pull request Mar 13, 2019
@romen
Copy link
Member

romen commented Mar 13, 2019

Uhm, I'm seeing compilation errors with --strict-warnings after this has been merged!

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

@levitte
Copy link
Member Author

levitte commented Mar 13, 2019

Yeah, see #8469

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

branch: master Applies to master branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants