Skip to content

Commit

Permalink
validation: timer: periodic timer capa per clock source
Browse files Browse the repository at this point in the history
Extend periodic timer capability test to use all supported
clock sources.

Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
  • Loading branch information
psavol authored and MatiasElo committed Oct 20, 2023
1 parent a27d53d commit 4faf583
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions test/validation/api/timer/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,10 @@ check_plain_queue_support(void)

static int check_periodic_support(void)
{
if (global_mem->periodic_support[0])
return ODP_TEST_ACTIVE;
if (global_mem->no_periodic)
return ODP_TEST_INACTIVE;

return ODP_TEST_INACTIVE;
return ODP_TEST_ACTIVE;
}

static int check_periodic_sched_support(void)
Expand Down Expand Up @@ -2645,7 +2645,7 @@ static void timer_test_sched_all(void)
timer_test_all(ODP_QUEUE_TYPE_SCHED);
}

static void timer_test_periodic_capa(void)
static void timer_test_periodic_capa_run(odp_timer_clk_src_t clk_src)
{
odp_timer_capability_t timer_capa;
odp_timer_periodic_capability_t capa;
Expand All @@ -2657,7 +2657,7 @@ static void timer_test_periodic_capa(void)
uint32_t num = 100;

memset(&timer_capa, 0, sizeof(odp_timer_capability_t));
CU_ASSERT_FATAL(odp_timer_capability(ODP_CLOCK_DEFAULT, &timer_capa) == 0);
CU_ASSERT_FATAL(odp_timer_capability(clk_src, &timer_capa) == 0);
CU_ASSERT(timer_capa.periodic.max_pools);
CU_ASSERT(timer_capa.periodic.max_timers);

Expand Down Expand Up @@ -2688,7 +2688,7 @@ static void timer_test_periodic_capa(void)
capa.max_multiplier = 1;
capa.res_ns = 0;

CU_ASSERT(odp_timer_periodic_capability(ODP_CLOCK_DEFAULT, &capa) == 1);
CU_ASSERT(odp_timer_periodic_capability(clk_src, &capa) == 1);
CU_ASSERT(capa.base_freq_hz.integer == min_fract.integer);
CU_ASSERT(capa.base_freq_hz.numer == min_fract.numer);
CU_ASSERT(capa.base_freq_hz.denom == min_fract.denom);
Expand All @@ -2700,7 +2700,7 @@ static void timer_test_periodic_capa(void)
capa.max_multiplier = 1;
capa.res_ns = 0;

CU_ASSERT(odp_timer_periodic_capability(ODP_CLOCK_DEFAULT, &capa) == 1);
CU_ASSERT(odp_timer_periodic_capability(clk_src, &capa) == 1);
CU_ASSERT(capa.base_freq_hz.integer == max_fract.integer);
CU_ASSERT(capa.base_freq_hz.numer == max_fract.numer);
CU_ASSERT(capa.base_freq_hz.denom == max_fract.denom);
Expand Down Expand Up @@ -2750,7 +2750,7 @@ static void timer_test_periodic_capa(void)
ODPH_DBG("freq %" PRIu64 ", multip %" PRIu64 ", res %" PRIu64 ",\n",
base_freq.integer, max_multiplier, res_ns);

ret = odp_timer_periodic_capability(ODP_CLOCK_DEFAULT, &capa);
ret = odp_timer_periodic_capability(clk_src, &capa);

if (ret == 1) {
CU_ASSERT(capa.base_freq_hz.integer == base_freq.integer);
Expand Down Expand Up @@ -2785,6 +2785,20 @@ static void timer_test_periodic_capa(void)
}
}

static void timer_test_periodic_capa(void)
{
odp_timer_clk_src_t clk_src;
int i;

for (i = 0; i < ODP_CLOCK_NUM_SRC; i++) {
clk_src = ODP_CLOCK_SRC_0 + i;
if (global_mem->periodic_support[i]) {
ODPH_DBG("\nTesting clock source: %i\n", clk_src);
timer_test_periodic_capa_run(clk_src);
}
}
}

static void timer_test_periodic(odp_queue_type_t queue_type, int use_first, int rounds,
int reuse_event)
{
Expand Down

0 comments on commit 4faf583

Please sign in to comment.