On Tue, Dec 26, 2017 at 12:47:31AM +0530, Pavan Nikhilesh wrote:
> Modify test_eventdev_octeontx to be standalone selftest independent of
> test framework.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavat...@caviumnetworks.com>
> ---
>  drivers/event/octeontx/octeontx_evdev_selftest.c | 427 
> +++++++++++++----------
>  1 file changed, 234 insertions(+), 193 deletions(-)
> 
> diff --git a/drivers/event/octeontx/octeontx_evdev_selftest.c 
> b/drivers/event/octeontx/octeontx_evdev_selftest.c
> index 8fddb4fd2..3877bca4a 100644
> --- a/drivers/event/octeontx/octeontx_evdev_selftest.c
> +++ b/drivers/event/octeontx/octeontx_evdev_selftest.c
> @@ -46,12 +46,21 @@
>  #include <rte_per_lcore.h>
>  #include <rte_random.h>
>  #include <rte_bus_vdev.h>
> +#include <rte_test.h>
>  
> -#include "test.h"
> +#include "ssovf_evdev.h"
>  
>  #define NUM_PACKETS (1 << 18)
>  #define MAX_EVENTS  (16 * 1024)
>  
> +#define OCTEONTX_TEST_RUN(setup, teardown, test) \
> +     octeontx_test_run(setup, teardown, test, #test)
> +
> +static int total;
> +static int passed;
> +static int failed;
> +static int unsupported;
> +
>  static int evdev;
>  static struct rte_mempool *eventdev_test_mempool;
>  
> @@ -79,11 +88,11 @@ static inline int
>  seqn_list_update(int val)
>  {
>       if (seqn_list_index >= NUM_PACKETS)
> -             return TEST_FAILED;
> +             return -1;
>  
>       seqn_list[seqn_list_index++] = val;
>       rte_smp_wmb();
> -     return TEST_SUCCESS;
> +     return 0;
>  }
>  
>  static inline int
> @@ -93,11 +102,11 @@ seqn_list_check(int limit)
>  
>       for (i = 0; i < limit; i++) {
>               if (seqn_list[i] != i) {
> -                     printf("Seqn mismatch %d %d\n", seqn_list[i], i);
> -                     return TEST_FAILED;
> +                     ssovf_log_dbg("Seqn mismatch %d %d", seqn_list[i], i);
> +                     return -1;
>               }
>       }
> -     return TEST_SUCCESS;
> +     return 0;
>  }
>  
>  struct test_core_param {
> @@ -114,20 +123,21 @@ testsuite_setup(void)
>  
>       evdev = rte_event_dev_get_dev_id(eventdev_name);
>       if (evdev < 0) {
> -             printf("%d: Eventdev %s not found - creating.\n",
> +             ssovf_log_dbg("%d: Eventdev %s not found - creating.",
>                               __LINE__, eventdev_name);
>               if (rte_vdev_init(eventdev_name, NULL) < 0) {
> -                     printf("Error creating eventdev %s\n", eventdev_name);
> -                     return TEST_FAILED;
> +                     ssovf_log_dbg("Error creating eventdev %s",
> +                                     eventdev_name);
> +                     return -1;
>               }
>               evdev = rte_event_dev_get_dev_id(eventdev_name);
>               if (evdev < 0) {
> -                     printf("Error finding newly created eventdev\n");
> -                     return TEST_FAILED;
> +                     ssovf_log_dbg("Error finding newly created eventdev");
> +                     return -1;
>               }
>       }
>  
> -     return TEST_SUCCESS;
> +     return 0;
>  }
>  
>  static void
> @@ -177,31 +187,34 @@ _eventdev_setup(int mode)
>                                       512, /* Use very small mbufs */
>                                       rte_socket_id());
>       if (!eventdev_test_mempool) {
> -             printf("ERROR creating mempool\n");
> -             return TEST_FAILED;
> +             ssovf_log_dbg("ERROR creating mempool");
> +             return -1;
>       }
>  
>       ret = rte_event_dev_info_get(evdev, &info);
> -     TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info");
> -     TEST_ASSERT(info.max_num_events >= (int32_t)MAX_EVENTS,
> -                     "max_num_events=%d < max_events=%d",
> -                     info.max_num_events, MAX_EVENTS);
> +     RTE_TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info");
> +     if (!(info.max_num_events >= (int32_t)MAX_EVENTS)) {
> +             ssovf_log_dbg("ERROR max_num_events=%d < max_events=%d",
> +                             info.max_num_events, MAX_EVENTS);
> +             return -1;
> +     }
>  
I'm not sure how any of this is particularly adventageous.  You've replaced two
ASSERTION macros with one and an additional conditional.  The assert macros are
just a flexible as their were previously (which is to say, not overly so).  So
i'm not sure what the advantage of renaming them is.

Neil

Reply via email to