Skip to content

Commit

Permalink
validation: timer: test that odp_timer_alloc() returns TIMER_INVALID …
Browse files Browse the repository at this point in the history
…when pool is empty

Test that odp_timer_alloc() returns TIMER_INVALID when pool is empty,
with both one-shot and periodic timer pools.

Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
  • Loading branch information
JereLeppanen committed Oct 13, 2023
1 parent 35c01fe commit 222c08f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/validation/api/timer/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,9 @@ static void timer_pool_create_max(void)
ODPH_ERR("Timer alloc failed: %u / %u\n", i, num);

CU_ASSERT_FATAL(timer[i] != ODP_TIMER_INVALID);

/* Pool should have only one timer */
CU_ASSERT_FATAL(odp_timer_alloc(tp[i], queue, USER_PTR) == ODP_TIMER_INVALID);
}

for (i = 0; i < num; i++)
Expand Down Expand Up @@ -2907,6 +2910,9 @@ static void timer_test_periodic(odp_queue_type_t queue_type, int use_first, int
timer = odp_timer_alloc(timer_pool, queue, user_ctx);
CU_ASSERT_FATAL(timer != ODP_TIMER_INVALID);

/* Pool should have only one timer */
CU_ASSERT_FATAL(odp_timer_alloc(timer_pool, queue, user_ctx) == ODP_TIMER_INVALID);

memset(&start_param, 0, sizeof(odp_timer_periodic_start_t));
offset_ns = period_ns / 2;

Expand Down

0 comments on commit 222c08f

Please sign in to comment.