On 2015-05-07 18:09, Mike Holmes wrote:
> On 5 May 2015 at 12:31, Christophe Milard <[email protected]>
> wrote:
> 
> > This is the one I'd like to be reviewed... (v2) sorry for the confusion.
> >
> > On 27 April 2015 at 17:54, Christophe Milard <[email protected]
> > > wrote:
> >
> >>     The 3 init tests (init, abort,log) now links with
> >> common/odp_cunit_common,
> >>     as other tests. In main, ODP init is now performed via weak functions
> >>     which are overloaded (to do nothing) by the 3 init tests.
> >>
> >> Signed-off-by: Christophe Milard <[email protected]>
> >>
> >
> Reviewed-by: Mike Holmes <[email protected]>
> 

the review was not sent to the lng-odp list.
Can this be applied now?

Cheers,
Christophe

> 
> 
> > ---
> >>  test/validation/Makefile.am               |  6 ++---
> >>  test/validation/common/odp_cunit_common.c | 45
> >> +++++++++++++++----------------
> >>  test/validation/init/odp_init.c           | 34 +++++++++--------------
> >>  test/validation/init/odp_init_abort.c     | 35 ++++++++++--------------
> >>  test/validation/init/odp_init_log.c       | 35 ++++++++++--------------
> >>  test/validation/odp_crypto.c              | 20 ++++++++++++++
> >>  test/validation/odp_synchronizers.c       |  9 +++++++
> >>  7 files changed, 95 insertions(+), 89 deletions(-)
> >>
> >> diff --git a/test/validation/Makefile.am b/test/validation/Makefile.am
> >> index 7ea86c4..ba622c3 100644
> >> --- a/test/validation/Makefile.am
> >> +++ b/test/validation/Makefile.am
> >> @@ -48,9 +48,9 @@ dist_odp_classification_SOURCES =
> >> classification/odp_classification_tests.c \
> >>  odp_crypto_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/crypto
> >>  dist_odp_crypto_SOURCES = crypto/odp_crypto_test_inp.c \
> >>                           odp_crypto.c $(ODP_CU_COMMON)
> >> -dist_odp_init_SOURCES  = init/odp_init.c
> >> -dist_odp_init_abort_SOURCES = init/odp_init_abort.c
> >> -dist_odp_init_log_SOURCES = init/odp_init_log.c
> >> +dist_odp_init_SOURCES  = init/odp_init.c $(ODP_CU_COMMON)
> >> +dist_odp_init_abort_SOURCES = init/odp_init_abort.c $(ODP_CU_COMMON)
> >> +dist_odp_init_log_SOURCES = init/odp_init_log.c $(ODP_CU_COMMON)
> >>  dist_odp_queue_SOURCES = odp_queue.c $(ODP_CU_COMMON)
> >>  dist_odp_random_SOURCES = odp_random.c $(ODP_CU_COMMON)
> >>  dist_odp_schedule_SOURCES = odp_schedule.c $(ODP_CU_COMMON)
> >> diff --git a/test/validation/common/odp_cunit_common.c
> >> b/test/validation/common/odp_cunit_common.c
> >> index 2af4410..eac2d81 100644
> >> --- a/test/validation/common/odp_cunit_common.c
> >> +++ b/test/validation/common/odp_cunit_common.c
> >> @@ -39,13 +39,32 @@ int odp_cunit_thread_exit(pthrd_arg *arg)
> >>         return 0;
> >>  }
> >>
> >> -__attribute__((__weak__)) int tests_global_init(void)
> >> +ODP_WEAK_SYMBOL int tests_global_init(void)
> >>  {
> >> +       if (0 != odp_init_global(NULL, NULL)) {
> >> +               fprintf(stderr, "error: odp_init_global() failed.\n");
> >> +               return -1;
> >> +       }
> >> +       if (0 != odp_init_local()) {
> >> +               fprintf(stderr, "error: odp_init_local() failed.\n");
> >> +               return -1;
> >> +       }
> >> +
> >>         return 0;
> >>  }
> >>
> >> -__attribute__((__weak__)) int tests_global_term(void)
> >> +ODP_WEAK_SYMBOL int tests_global_term(void)
> >>  {
> >> +       if (0 != odp_term_local()) {
> >> +               fprintf(stderr, "error: odp_term_local() failed.\n");
> >> +               return -1;
> >> +       }
> >> +
> >> +       if (0 != odp_term_global()) {
> >> +               fprintf(stderr, "error: odp_term_global() failed.\n");
> >> +               return -1;
> >> +       }
> >> +
> >>         return 0;
> >>  }
> >>
> >> @@ -56,18 +75,8 @@ int main(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)) {
> >> -               fprintf(stderr, "error: odp_init_global() failed.\n");
> >> +       if (0 != tests_global_init())
> >>                 return -1;
> >> -       }
> >> -       if (0 != odp_init_local()) {
> >> -               fprintf(stderr, "error: odp_init_local() failed.\n");
> >> -               return -1;
> >> -       }
> >> -
> >> -       ret = tests_global_init();
> >> -       if (ret)
> >> -               return ret;
> >>
> >>         CU_set_error_action(CUEA_ABORT);
> >>
> >> @@ -83,15 +92,5 @@ int main(void)
> >>         if (0 != tests_global_term())
> >>                 return -1;
> >>
> >> -       if (0 != odp_term_local()) {
> >> -               fprintf(stderr, "error: odp_term_local() failed.\n");
> >> -               return -1;
> >> -       }
> >> -
> >> -       if (0 != odp_term_global()) {
> >> -               fprintf(stderr, "error: odp_term_global() failed.\n");
> >> -               return -1;
> >> -       }
> >> -
> >>         return (ret) ? -1 : 0;
> >>  }
> >> diff --git a/test/validation/init/odp_init.c
> >> b/test/validation/init/odp_init.c
> >> index 82f8849..3bbec11 100644
> >> --- a/test/validation/init/odp_init.c
> >> +++ b/test/validation/init/odp_init.c
> >> @@ -7,10 +7,23 @@
> >>  #include <stdarg.h>
> >>  #include <odp.h>
> >>  #include <CUnit/Basic.h>
> >> +#include "odp_cunit_common.h"
> >>
> >>  #define DEFAULT_MSG_POOL_SIZE  (4*1024*1024)
> >>  #define DEFAULT_MSG_SIZE       (8)
> >>
> >> +/* overwrite common default so as not to perform odp init in main */
> >> +int tests_global_init(void)
> >> +{
> >> +       return 0;
> >> +}
> >> +
> >> +/* overwrite common default so as not to perform odp term in main */
> >> +int tests_global_term(void)
> >> +{
> >> +       return 0;
> >> +}
> >> +
> >>  static void test_odp_init_global(void)
> >>  {
> >>         int status;
> >> @@ -30,24 +43,3 @@ CU_SuiteInfo odp_testsuites[] = {
> >>         {"Init", NULL, NULL, NULL, NULL, test_odp_init},
> >>         CU_SUITE_INFO_NULL,
> >>  };
> >> -
> >> -int main(void)
> >> -{
> >> -       int ret;
> >> -
> >> -       printf("\tODP API version: %s\n", odp_version_api_str());
> >> -       printf("\tODP implementation version: %s\n",
> >> odp_version_impl_str());
> >> -
> >> -       CU_set_error_action(CUEA_ABORT);
> >> -
> >> -       CU_initialize_registry();
> >> -       CU_register_suites(odp_testsuites);
> >> -       CU_basic_set_mode(CU_BRM_VERBOSE);
> >> -       CU_basic_run_tests();
> >> -
> >> -       ret = CU_get_number_of_failure_records();
> >> -
> >> -       CU_cleanup_registry();
> >> -
> >> -       return ret;
> >> -}
> >> diff --git a/test/validation/init/odp_init_abort.c
> >> b/test/validation/init/odp_init_abort.c
> >> index ceb82b5..c83c8d3 100644
> >> --- a/test/validation/init/odp_init_abort.c
> >> +++ b/test/validation/init/odp_init_abort.c
> >> @@ -8,6 +8,20 @@
> >>  #include <stdlib.h>
> >>  #include <odp.h>
> >>  #include <CUnit/Basic.h>
> >> +#include "odp_cunit_common.h"
> >> +
> >> +/* overwrite common default so as not to perform odp init in main */
> >> +int tests_global_init(void)
> >> +{
> >> +       return 0;
> >> +}
> >> +
> >> +/* overwrite common default so as not to perform odp term in main */
> >> +int tests_global_term(void)
> >> +{
> >> +       return 0;
> >> +}
> >> +
> >>
> >>  static void odp_init_abort(void) ODP_NORETURN;
> >>
> >> @@ -36,27 +50,6 @@ CU_SuiteInfo odp_testsuites[] = {
> >>         CU_SUITE_INFO_NULL,
> >>  };
> >>
> >> -int main(void)
> >> -{
> >> -       int ret;
> >> -
> >> -       printf("\tODP API version: %s\n", odp_version_api_str());
> >> -       printf("\tODP implementation version: %s\n",
> >> odp_version_impl_str());
> >> -
> >> -       CU_set_error_action(CUEA_ABORT);
> >> -
> >> -       CU_initialize_registry();
> >> -       CU_register_suites(odp_testsuites);
> >> -       CU_basic_set_mode(CU_BRM_VERBOSE);
> >> -       CU_basic_run_tests();
> >> -
> >> -       ret = CU_get_number_of_failure_records();
> >> -
> >> -       CU_cleanup_registry();
> >> -
> >> -       return ret;
> >> -}
> >> -
> >>  void odp_init_abort(void)
> >>  {
> >>         abort();
> >> diff --git a/test/validation/init/odp_init_log.c
> >> b/test/validation/init/odp_init_log.c
> >> index 275d343..f37ed91 100644
> >> --- a/test/validation/init/odp_init_log.c
> >> +++ b/test/validation/init/odp_init_log.c
> >> @@ -7,9 +7,23 @@
> >>  #include <stdarg.h>
> >>  #include <odp.h>
> >>  #include <CUnit/Basic.h>
> >> +#include "odp_cunit_common.h"
> >>
> >>  int replacement_logging_used;
> >>
> >> +/* overwrite common default so as not to perform odp init in main */
> >> +int tests_global_init(void)
> >> +{
> >> +       return 0;
> >> +}
> >> +
> >> +/* overwrite common default so as not to perform odp term in main */
> >> +int tests_global_term(void)
> >> +{
> >> +       return 0;
> >> +}
> >> +
> >> +
> >>  ODP_PRINTF_FORMAT(2, 3)
> >>  static int odp_init_log(odp_log_level_e level , const char *fmt, ...);
> >>
> >> @@ -42,27 +56,6 @@ CU_SuiteInfo odp_testsuites[] = {
> >>         CU_SUITE_INFO_NULL,
> >>  };
> >>
> >> -int main(void)
> >> -{
> >> -       int ret;
> >> -
> >> -       printf("\tODP API version: %s\n", odp_version_api_str());
> >> -       printf("\tODP implementation version: %s\n",
> >> odp_version_impl_str());
> >> -
> >> -       CU_set_error_action(CUEA_ABORT);
> >> -
> >> -       CU_initialize_registry();
> >> -       CU_register_suites(odp_testsuites);
> >> -       CU_basic_set_mode(CU_BRM_VERBOSE);
> >> -       CU_basic_run_tests();
> >> -
> >> -       ret = CU_get_number_of_failure_records();
> >> -
> >> -       CU_cleanup_registry();
> >> -
> >> -       return ret;
> >> -}
> >> -
> >>  int odp_init_log(odp_log_level_e level __attribute__((unused)),
> >>                  const char *fmt, ...)
> >>  {
> >> diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c
> >> index f364b1a..022c9bd 100644
> >> --- a/test/validation/odp_crypto.c
> >> +++ b/test/validation/odp_crypto.c
> >> @@ -28,6 +28,15 @@ int tests_global_init(void)
> >>         odp_pool_t pool;
> >>         odp_queue_t out_queue;
> >>
> >> +       if (0 != odp_init_global(NULL, NULL)) {
> >> +               fprintf(stderr, "error: odp_init_global() failed.\n");
> >> +               return -1;
> >> +       }
> >> +       if (0 != odp_init_local()) {
> >> +               fprintf(stderr, "error: odp_init_local() failed.\n");
> >> +               return -1;
> >> +       }
> >> +
> >>         memset(&params, 0, sizeof(params));
> >>         params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
> >>         params.pkt.len     = SHM_PKT_POOL_BUF_SIZE;
> >> @@ -71,5 +80,16 @@ int tests_global_term(void)
> >>                 fprintf(stderr, "Packet pool not found.\n");
> >>         }
> >>
> >> +       if (0 != odp_term_local()) {
> >> +               fprintf(stderr, "error: odp_term_local() failed.\n");
> >> +               return -1;
> >> +       }
> >> +
> >> +       if (0 != odp_term_global()) {
> >> +               fprintf(stderr, "error: odp_term_global() failed.\n");
> >> +               return -1;
> >> +       }
> >> +
> >> +
> >>         return 0;
> >>  }
> >> diff --git a/test/validation/odp_synchronizers.c
> >> b/test/validation/odp_synchronizers.c
> >> index edb6bf1..c334015 100644
> >> --- a/test/validation/odp_synchronizers.c
> >> +++ b/test/validation/odp_synchronizers.c
> >> @@ -1051,6 +1051,15 @@ int tests_global_init(void)
> >>         uint32_t core_count, max_threads;
> >>         int ret = 0;
> >>
> >> +       if (0 != odp_init_global(NULL, NULL)) {
> >> +               fprintf(stderr, "error: odp_init_global() failed.\n");
> >> +               return -1;
> >> +       }
> >> +       if (0 != odp_init_local()) {
> >> +               fprintf(stderr, "error: odp_init_local() failed.\n");
> >> +               return -1;
> >> +       }
> >> +
> >>         global_shm = odp_shm_reserve(GLOBAL_SHM_NAME,
> >>                                      sizeof(global_shared_mem_t), 64,
> >>                                      ODP_SHM_SW_ONLY);
> >> --
> >> 1.9.1
> >>
> >>
> >
> 
> 
> -- 
> Mike Holmes
> Technical Manager - Linaro Networking Group
> Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to