diff mbox

[4/5] validation: crypto: reuse common main() function

Message ID 1417453530-18743-5-git-send-email-taras.kondratiuk@linaro.org
State New
Headers show

Commit Message

Taras Kondratiuk Dec. 1, 2014, 5:05 p.m. UTC
Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
---
 test/validation/Makefile.am  |    2 +-
 test/validation/odp_crypto.c |   43 ++++++------------------------------------
 2 files changed, 7 insertions(+), 38 deletions(-)

Comments

Mike Holmes Dec. 2, 2014, 7:13 p.m. UTC | #1
On 1 December 2014 at 12:05, Taras Kondratiuk <taras.kondratiuk@linaro.org>
wrote:

> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
>

Reviewed-by: Mike Holmes <mike.holmes@linaro.org>


> ---
>  test/validation/Makefile.am  |    2 +-
>  test/validation/odp_crypto.c |   43
> ++++++------------------------------------
>  2 files changed, 7 insertions(+), 38 deletions(-)
>
> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> index 1f5eed4..d8dcb59 100644
> --- a/test/validation/Makefile.am
> +++ b/test/validation/Makefile.am
> @@ -19,5 +19,5 @@ dist_odp_init_SOURCES = odp_init.c
>  dist_odp_queue_SOURCES = odp_queue.c common/odp_cunit_common.c
>  dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
>                           crypto/odp_crypto_test_sync_inp.c \
> -                         odp_crypto.c
> +                         odp_crypto.c common/odp_cunit_common.c
>  dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
> diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c
> index 9342aca..ec3f16a 100644
> --- a/test/validation/odp_crypto.c
> +++ b/test/validation/odp_crypto.c
> @@ -5,8 +5,7 @@
>   */
>
>  #include <odp.h>
> -#include "CUnit/Basic.h"
> -#include "CUnit/TestDB.h"
> +#include "odp_cunit_common.h"
>  #include "odp_crypto_test_async_inp.h"
>  #include "odp_crypto_test_sync_inp.h"
>
> @@ -16,32 +15,19 @@
>  #define SHM_COMPL_POOL_SIZE    (128*1024)
>  #define SHM_COMPL_POOL_BUF_SIZE        128
>
> -static int init_suite(void)
> -{
> -       printf("\tODP API version: %s\n", odp_version_api_str());
> -       printf("\tODP implementation version: %s\n",
> odp_version_impl_str());
> -       return 0;
> -}
> -
> -CU_SuiteInfo suites[] = {
> -       {ODP_CRYPTO_SYNC_INP, init_suite, NULL, NULL, NULL,
> test_array_sync },
> -       {ODP_CRYPTO_ASYNC_INP, init_suite, NULL, NULL, NULL,
> test_array_async },
> +CU_SuiteInfo odp_testsuites[] = {
> +       {ODP_CRYPTO_SYNC_INP, NULL, NULL, NULL, NULL, test_array_sync },
> +       {ODP_CRYPTO_ASYNC_INP, NULL, NULL, NULL, NULL, test_array_async },
>         CU_SUITE_INFO_NULL,
>  };
>


nit as previously noted crypto needs to use the suite hooks for
the tests_global_init functionality, but that is a follow on patch



> -int main(void)
> +int tests_global_init(void)
>  {
>         odp_shm_t shm;
>         void *pool_base;
>         odp_buffer_pool_t pool;
>         odp_queue_t out_queue;
>
> -       if (odp_init_global(NULL, NULL)) {
> -               printf("ODP global init failed.\n");
> -               return -1;
> -       }
> -       odp_init_local();
> -
>         shm = odp_shm_reserve("shm_packet_pool",
>                               SHM_PKT_POOL_SIZE,
>                               ODP_CACHE_LINE_SIZE, 0);
> @@ -86,22 +72,5 @@ int main(void)
>                 return -1;
>         }
>
> -       printf("\tODP version: %s\n", odp_version_api_str());
> -
> -
> -       /* initialize the CUnit test registry */
> -       if (CUE_SUCCESS != CU_initialize_registry())
> -               return CU_get_error();
> -
> -       /* register suites */
> -       CU_register_suites(suites);
> -       /* Run all tests using the CUnit Basic interface */
> -       CU_basic_set_mode(CU_BRM_VERBOSE);
> -       CU_basic_run_tests();
> -       CU_cleanup_registry();
> -
> -       odp_term_local();
> -       odp_term_global();
> -
> -       return CU_get_error();
> +       return 0;
>  }
> --
> 1.7.9.5
>
>
diff mbox

Patch

diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index 1f5eed4..d8dcb59 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -19,5 +19,5 @@  dist_odp_init_SOURCES = odp_init.c
 dist_odp_queue_SOURCES = odp_queue.c common/odp_cunit_common.c
 dist_odp_crypto_SOURCES = crypto/odp_crypto_test_async_inp.c \
 			  crypto/odp_crypto_test_sync_inp.c \
-			  odp_crypto.c
+			  odp_crypto.c common/odp_cunit_common.c
 dist_odp_shm_SOURCES = odp_shm.c common/odp_cunit_common.c
diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c
index 9342aca..ec3f16a 100644
--- a/test/validation/odp_crypto.c
+++ b/test/validation/odp_crypto.c
@@ -5,8 +5,7 @@ 
  */
 
 #include <odp.h>
-#include "CUnit/Basic.h"
-#include "CUnit/TestDB.h"
+#include "odp_cunit_common.h"
 #include "odp_crypto_test_async_inp.h"
 #include "odp_crypto_test_sync_inp.h"
 
@@ -16,32 +15,19 @@ 
 #define SHM_COMPL_POOL_SIZE	(128*1024)
 #define SHM_COMPL_POOL_BUF_SIZE	128
 
-static int init_suite(void)
-{
-	printf("\tODP API version: %s\n", odp_version_api_str());
-	printf("\tODP implementation version: %s\n", odp_version_impl_str());
-	return 0;
-}
-
-CU_SuiteInfo suites[] = {
-	{ODP_CRYPTO_SYNC_INP, init_suite, NULL, NULL, NULL, test_array_sync },
-	{ODP_CRYPTO_ASYNC_INP, init_suite, NULL, NULL, NULL, test_array_async },
+CU_SuiteInfo odp_testsuites[] = {
+	{ODP_CRYPTO_SYNC_INP, NULL, NULL, NULL, NULL, test_array_sync },
+	{ODP_CRYPTO_ASYNC_INP, NULL, NULL, NULL, NULL, test_array_async },
 	CU_SUITE_INFO_NULL,
 };
 
-int main(void)
+int tests_global_init(void)
 {
 	odp_shm_t shm;
 	void *pool_base;
 	odp_buffer_pool_t pool;
 	odp_queue_t out_queue;
 
-	if (odp_init_global(NULL, NULL)) {
-		printf("ODP global init failed.\n");
-		return -1;
-	}
-	odp_init_local();
-
 	shm = odp_shm_reserve("shm_packet_pool",
 			      SHM_PKT_POOL_SIZE,
 			      ODP_CACHE_LINE_SIZE, 0);
@@ -86,22 +72,5 @@  int main(void)
 		return -1;
 	}
 
-	printf("\tODP version: %s\n", odp_version_api_str());
-
-
-	/* initialize the CUnit test registry */
-	if (CUE_SUCCESS != CU_initialize_registry())
-		return CU_get_error();
-
-	/* register suites */
-	CU_register_suites(suites);
-	/* Run all tests using the CUnit Basic interface */
-	CU_basic_set_mode(CU_BRM_VERBOSE);
-	CU_basic_run_tests();
-	CU_cleanup_registry();
-
-	odp_term_local();
-	odp_term_global();
-
-	return CU_get_error();
+	return 0;
 }