On 2015-01-29 12:01, Ola Liljedahl wrote:
> Don't report late timeouts using CU_FAIL as this interferes with the cunit
> test framework. Just count and report (using LOG_DBG) the number of late
> timeouts. (Discussed with Mike Holmes)

Drop "(Discussed with Mike Holmes)" and add:

Suggested-by: Mike Holmes...

Cheers,
Anders

> 
> Signed-off-by: Ola Liljedahl <[email protected]>
> ---
> (This document/code contribution attached is provided under the terms of
> agreement LES-LTM-21309)
> 
>  test/validation/odp_timer.c | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
> index c0b6f67..0238cf4 100644
> --- a/test/validation/odp_timer.c
> +++ b/test/validation/odp_timer.c
> @@ -12,6 +12,7 @@
>  #include <unistd.h>
>  #include <odp.h>
>  #include "odp_cunit_common.h"
> +#include "test_debug.h"
>  
>  /** @private Timeout range in milliseconds (ms) */
>  #define RANGE_MS 2000
> @@ -28,6 +29,9 @@ static odp_pool_t tbp;
>  /** @private Timer pool handle used by all threads */
>  static odp_timer_pool_t tp;
>  
> +/** @private Count of timeouts delivered too late */
> +static odp_atomic_u32_t ndelivtoolate;
> +
>  /** @private min() function */
>  static int min(int a, int b)
>  {
> @@ -88,9 +92,10 @@ static void handle_tmo(odp_event_t ev, bool stale, 
> uint64_t prev_tick)
>               if (tick > odp_timer_current_tick(tp))
>                       CU_FAIL("Timeout delivered early");
>               if (tick < prev_tick) {
> -                     printf("Too late tick: %"PRIu64" prev_tick %"PRIu64"\n",
> -                            tick, prev_tick);
> -                     CU_FAIL("Timeout delivered late");
> +                     LOG_DBG("Too late tick: %"PRIu64" prev_tick 
> %"PRIu64"\n",
> +                             tick, prev_tick);
> +                     /* We don't report late timeouts using CU_FAIL */
> +                     odp_atomic_inc_u32(&ndelivtoolate);
>               }
>       }
>  
> @@ -317,6 +322,9 @@ static void test_odp_timer_all(void)
>       /* Initialize barrier used by worker threads for synchronization */
>       odp_barrier_init(&test_barrier, num_workers);
>  
> +     /* Initialize the shared timeout counter */
> +     odp_atomic_init_u32(&ndelivtoolate, 0);
> +
>       /* Create and start worker threads */
>       pthrd_arg thrdarg;
>       thrdarg.testcase = 0;
> @@ -325,6 +333,8 @@ static void test_odp_timer_all(void)
>  
>       /* Wait for worker threads to exit */
>       odp_cunit_thread_exit(&thrdarg);
> +     LOG_DBG("Number of timeouts delivered/received too late: %u\n",
> +             odp_atomic_load_u32(&ndelivtoolate));
>  
>       /* Check some statistics after the test */
>       if (odp_timer_pool_info(tp, &tpinfo) != 0)
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> lng-odp mailing list
> [email protected]
> http://lists.linaro.org/mailman/listinfo/lng-odp

_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to