diff options
author | Matt Caswell <matt@openssl.org> | 2016-02-08 16:43:03 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-02-09 15:11:38 +0000 |
commit | 7b9f8f7f03eda2faa1cdd42ed29a0b70e60eaf59 (patch) | |
tree | 30f805756265bd1d016aead84dcf1c909cca8b4b /test/asynctest.c | |
parent | b184e3ef73200cb3b7914a603b43a5b8a074c85f (diff) |
Auto init/deinit libcrypto
This builds on the previous commit to auto initialise/deinitialise
libcrypto.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'test/asynctest.c')
-rw-r--r-- | test/asynctest.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/test/asynctest.c b/test/asynctest.c index 1068e8c3b2..ddff70cde6 100644 --- a/test/asynctest.c +++ b/test/asynctest.c @@ -123,12 +123,12 @@ static int blockpause(void *args) return 1; } -static int test_ASYNC_init() +static int test_ASYNC_init_thread() { ASYNC_JOB *job1 = NULL, *job2 = NULL, *job3 = NULL; int funcret1, funcret2, funcret3; - if ( !ASYNC_init(1, 2, 0) + if ( !ASYNC_init_thread(2, 0) || ASYNC_start_job(&job1, &funcret1, only_pause, NULL, 0) != ASYNC_PAUSE || ASYNC_start_job(&job2, &funcret2, only_pause, NULL, 0) @@ -146,12 +146,12 @@ static int test_ASYNC_init() || funcret1 != 1 || funcret2 != 1 || funcret3 != 1) { - fprintf(stderr, "test_ASYNC_init() failed\n"); - ASYNC_cleanup(1); + fprintf(stderr, "test_ASYNC_init_thread() failed\n"); + ASYNC_cleanup_thread(); return 0; } - ASYNC_cleanup(1); + ASYNC_cleanup_thread(); return 1; } @@ -162,18 +162,18 @@ static int test_ASYNC_start_job() ctr = 0; - if ( !ASYNC_init(1, 1, 0) + if ( !ASYNC_init_thread(1, 0) || ASYNC_start_job(&job, &funcret, add_two, NULL, 0) != ASYNC_PAUSE || ctr != 1 || ASYNC_start_job(&job, &funcret, add_two, NULL, 0) != ASYNC_FINISH || ctr != 2 || funcret != 2) { fprintf(stderr, "test_ASYNC_start_job() failed\n"); - ASYNC_cleanup(1); + ASYNC_cleanup_thread(); return 0; } - ASYNC_cleanup(1); + ASYNC_cleanup_thread(); return 1; } @@ -184,7 +184,7 @@ static int test_ASYNC_get_current_job() currjob = NULL; - if ( !ASYNC_init(1, 1, 0) + if ( !ASYNC_init_thread(1, 0) || ASYNC_start_job(&job, &funcret, save_current, NULL, 0) != ASYNC_PAUSE || currjob != job @@ -192,11 +192,11 @@ static int test_ASYNC_get_current_job() != ASYNC_FINISH || funcret != 1) { fprintf(stderr, "test_ASYNC_get_current_job() failed\n"); - ASYNC_cleanup(1); + ASYNC_cleanup_thread(); return 0; } - ASYNC_cleanup(1); + ASYNC_cleanup_thread(); return 1; } @@ -229,7 +229,7 @@ static int test_ASYNC_get_wait_fd() int funcret; OSSL_ASYNC_FD fd; - if ( !ASYNC_init(1, 1, 0) + if ( !ASYNC_init_thread(1, 0) || ASYNC_start_job(&job, &funcret, wake, NULL, 0) != ASYNC_PAUSE || (fd = ASYNC_get_wait_fd(job)) < 0 @@ -245,11 +245,11 @@ static int test_ASYNC_get_wait_fd() != ASYNC_FINISH || funcret != 1) { fprintf(stderr, "test_ASYNC_get_wait_fd() failed\n"); - ASYNC_cleanup(1); + ASYNC_cleanup_thread(); return 0; } - ASYNC_cleanup(1); + ASYNC_cleanup_thread(); return 1; } @@ -258,18 +258,18 @@ static int test_ASYNC_block_pause() ASYNC_JOB *job = NULL; int funcret; - if ( !ASYNC_init(1, 1, 0) + if ( !ASYNC_init_thread(1, 0) || ASYNC_start_job(&job, &funcret, blockpause, NULL, 0) != ASYNC_PAUSE || ASYNC_start_job(&job, &funcret, blockpause, NULL, 0) != ASYNC_FINISH || funcret != 1) { fprintf(stderr, "test_ASYNC_block_pause() failed\n"); - ASYNC_cleanup(1); + ASYNC_cleanup_thread(); return 0; } - ASYNC_cleanup(1); + ASYNC_cleanup_thread(); return 1; } @@ -284,7 +284,7 @@ int main(int argc, char **argv) CRYPTO_set_mem_debug(1); CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); - if ( !test_ASYNC_init() + if ( !test_ASYNC_init_thread() || !test_ASYNC_start_job() || !test_ASYNC_get_current_job() || !test_ASYNC_get_wait_fd() |