Message ID | 1421427959-11751-2-git-send-email-ola.liljedahl@linaro.org |
---|---|
State | New |
Headers | show |
On 16 January 2015 at 12:05, Ola Liljedahl <ola.liljedahl@linaro.org> 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) > > Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org> > Reviewed-by: Mike Holmes <mike.holmes@linaro.org> > --- > (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 4c93f71..dca01ce 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_buffer_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_buffer_t buf, 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); > } > } > > @@ -319,6 +324,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; > @@ -327,6 +335,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 > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp >
diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c index 4c93f71..dca01ce 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_buffer_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_buffer_t buf, 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); } } @@ -319,6 +324,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; @@ -327,6 +335,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)
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) Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org> --- (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(-)