diff mbox

[PATCHv2,3/5] validation: queue: reuse common main() function

Message ID 1417598541-31897-4-git-send-email-taras.kondratiuk@linaro.org
State New
Headers show

Commit Message

Taras Kondratiuk Dec. 3, 2014, 9:22 a.m. UTC
Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
---
 test/validation/Makefile.am |    2 +-
 test/validation/odp_queue.c |   64 +++++++------------------------------------
 2 files changed, 11 insertions(+), 55 deletions(-)

Comments

Taras Kondratiuk Dec. 3, 2014, 1:35 p.m. UTC | #1
Mike, Yan,

Could you please review this patch, to get the series merged?
This series needs rebase again, because another test change was just
merged.
Taras Kondratiuk Dec. 4, 2014, 3:59 p.m. UTC | #2
On 12/03/2014 03:35 PM, Taras Kondratiuk wrote:
> Mike, Yan,
>
> Could you please review this patch, to get the series merged?
> This series needs rebase again, because another test change was just
> merged.

ping
Mike Holmes Dec. 4, 2014, 4:12 p.m. UTC | #3
On 3 December 2014 at 04:22, 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_queue.c |   64
> +++++++------------------------------------
>  2 files changed, 11 insertions(+), 55 deletions(-)
>
> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> index 837ae95..183fb0c 100644
> --- a/test/validation/Makefile.am
> +++ b/test/validation/Makefile.am
> @@ -16,7 +16,7 @@ odp_shm_LDFLAGS = $(AM_LDFLAGS)
>  endif
>
>  dist_odp_init_SOURCES = odp_init.c
> -dist_odp_queue_SOURCES = odp_queue.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
> diff --git a/test/validation/odp_queue.c b/test/validation/odp_queue.c
> index 09dba0e..2c8fe80 100644
> --- a/test/validation/odp_queue.c
> +++ b/test/validation/odp_queue.c
> @@ -5,7 +5,7 @@
>   */
>
>  #include "odp.h"
> -#include "CUnit/Basic.h"
> +#include "odp_cunit_common.h"
>
>  #define MAX_BUFFER_QUEUE        (8)
>  #define MSG_POOL_SIZE           (4*1024*1024)
> @@ -13,7 +13,7 @@
>
>  static int queue_contest = 0xff;
>
> -static int test_odp_buffer_pool_init(void)
> +static int init_queue_suite(void)
>  {
>         odp_buffer_pool_t pool;
>         void *pool_base;
> @@ -105,56 +105,12 @@ static void test_odp_queue_sunnyday(void)
>         return;
>  }
>
> -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());
> -
> -       if (0 != odp_init_global(NULL, NULL)) {
> -               printf("odp_init_global fail.\n");
> -               return -1;
> -       }
> -       if (0 != odp_init_local()) {
> -               printf("odp_init_local fail.\n");
> -               return -1;
> -       }
> -       if (0 != test_odp_buffer_pool_init()) {
> -               printf("test_odp_buffer_pool_init fail.\n");
> -               return -1;
> -       }
> -       return 0;
> -}
> -
> -static int finalize(void)
> -{
> -       odp_term_local();
> -       odp_term_global();
> -       return 0;
> -}
> -
> -int main(void)
> -{
> -       CU_pSuite ptr_suite = NULL;
> -
> -       /* initialize the CUnit test registry */
> -       if (CUE_SUCCESS != CU_initialize_registry())
> -               return CU_get_error();
> +CU_TestInfo test_odp_queue[] = {
> +       {"queue sunnyday",  test_odp_queue_sunnyday},
> +       CU_TEST_INFO_NULL,
> +};
>
> -       /* add the tests to the queue suite */
> -       ptr_suite = CU_add_suite(__FILE__, init_suite, finalize);
> -       if (NULL == ptr_suite) {
> -               CU_cleanup_registry();
> -               return CU_get_error();
> -       }
> -
> -       if (NULL == CU_ADD_TEST(ptr_suite, test_odp_queue_sunnyday)) {
> -               CU_cleanup_registry();
> -               return CU_get_error();
> -       }
> -
> -       /* Run all tests using the CUnit Basic interface */
> -       CU_basic_set_mode(CU_BRM_VERBOSE);
> -       CU_basic_run_tests();
> -       CU_cleanup_registry();
> -       return CU_get_error();
> -}
> +CU_SuiteInfo odp_testsuites[] = {
> +       {"Queue", init_queue_suite, NULL, NULL, NULL, test_odp_queue},
> +       CU_SUITE_INFO_NULL,
> +};
> --
> 1.7.9.5
>
>
diff mbox

Patch

diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
index 837ae95..183fb0c 100644
--- a/test/validation/Makefile.am
+++ b/test/validation/Makefile.am
@@ -16,7 +16,7 @@  odp_shm_LDFLAGS = $(AM_LDFLAGS)
 endif
 
 dist_odp_init_SOURCES = odp_init.c
-dist_odp_queue_SOURCES = odp_queue.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
diff --git a/test/validation/odp_queue.c b/test/validation/odp_queue.c
index 09dba0e..2c8fe80 100644
--- a/test/validation/odp_queue.c
+++ b/test/validation/odp_queue.c
@@ -5,7 +5,7 @@ 
  */
 
 #include "odp.h"
-#include "CUnit/Basic.h"
+#include "odp_cunit_common.h"
 
 #define MAX_BUFFER_QUEUE        (8)
 #define MSG_POOL_SIZE           (4*1024*1024)
@@ -13,7 +13,7 @@ 
 
 static int queue_contest = 0xff;
 
-static int test_odp_buffer_pool_init(void)
+static int init_queue_suite(void)
 {
 	odp_buffer_pool_t pool;
 	void *pool_base;
@@ -105,56 +105,12 @@  static void test_odp_queue_sunnyday(void)
 	return;
 }
 
-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());
-
-	if (0 != odp_init_global(NULL, NULL)) {
-		printf("odp_init_global fail.\n");
-		return -1;
-	}
-	if (0 != odp_init_local()) {
-		printf("odp_init_local fail.\n");
-		return -1;
-	}
-	if (0 != test_odp_buffer_pool_init()) {
-		printf("test_odp_buffer_pool_init fail.\n");
-		return -1;
-	}
-	return 0;
-}
-
-static int finalize(void)
-{
-	odp_term_local();
-	odp_term_global();
-	return 0;
-}
-
-int main(void)
-{
-	CU_pSuite ptr_suite = NULL;
-
-	/* initialize the CUnit test registry */
-	if (CUE_SUCCESS != CU_initialize_registry())
-		return CU_get_error();
+CU_TestInfo test_odp_queue[] = {
+	{"queue sunnyday",  test_odp_queue_sunnyday},
+	CU_TEST_INFO_NULL,
+};
 
-	/* add the tests to the queue suite */
-	ptr_suite = CU_add_suite(__FILE__, init_suite, finalize);
-	if (NULL == ptr_suite) {
-		CU_cleanup_registry();
-		return CU_get_error();
-	}
-
-	if (NULL == CU_ADD_TEST(ptr_suite, test_odp_queue_sunnyday)) {
-		CU_cleanup_registry();
-		return CU_get_error();
-	}
-
-	/* Run all tests using the CUnit Basic interface */
-	CU_basic_set_mode(CU_BRM_VERBOSE);
-	CU_basic_run_tests();
-	CU_cleanup_registry();
-	return CU_get_error();
-}
+CU_SuiteInfo odp_testsuites[] = {
+	{"Queue", init_queue_suite, NULL, NULL, NULL, test_odp_queue},
+	CU_SUITE_INFO_NULL,
+};