From b0446ad55d8949ffdb34f487ee0028bb1b5622e0 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 28 Dec 2010 15:10:34 +0100 Subject: [PATCH] tests: Migrated torture_rand to cmockery. --- tests/unittests/CMakeLists.txt | 2 +- tests/unittests/torture_rand.c | 78 ++++++++++++++++++---------------- 2 files changed, 43 insertions(+), 37 deletions(-) diff --git a/tests/unittests/CMakeLists.txt b/tests/unittests/CMakeLists.txt index f3375c90..1049805b 100644 --- a/tests/unittests/CMakeLists.txt +++ b/tests/unittests/CMakeLists.txt @@ -7,4 +7,4 @@ add_cmockery_test(torture_keyfiles torture_keyfiles.c ${TORTURE_LIBRARY}) add_cmockery_test(torture_list torture_list.c ${TORTURE_LIBRARY}) add_cmockery_test(torture_misc torture_misc.c ${TORTURE_LIBRARY}) add_cmockery_test(torture_options torture_options.c ${TORTURE_LIBRARY}) -#add_check_test(torture_rand torture_rand.c ${TORTURE_LIBRARY}) +add_cmockery_test(torture_rand torture_rand.c ${TORTURE_LIBRARY}) diff --git a/tests/unittests/torture_rand.c b/tests/unittests/torture_rand.c index 847fe407..71e8bf18 100644 --- a/tests/unittests/torture_rand.c +++ b/tests/unittests/torture_rand.c @@ -13,49 +13,55 @@ #endif #define NUM_THREADS 100 -static void setup(){ - ssh_threads_set_callbacks(ssh_threads_get_pthread()); - ssh_init(); +static void setup(void **state) { + (void) state; + + ssh_threads_set_callbacks(ssh_threads_get_pthread()); + ssh_init(); } -static void teardown(){ - ssh_finalize(); +static void teardown(void **state) { + (void) state; + + ssh_finalize(); } -static void *torture_rand_thread(void *threadid){ - char buffer[12]; - int i; - int r; - (void)threadid; - buffer[0]=buffer[1]=buffer[10]=buffer[11]='X'; - for(i=0;i