aboutsummaryrefslogtreecommitdiff
path: root/test/validation/api/scheduler
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2019-03-15 15:31:52 +0200
committerMatias Elo <matias.elo@nokia.com>2019-03-19 08:42:51 +0200
commit50d6e131ea081b60237e6c46f8515a7909770987 (patch)
tree8735f8531a520e6e7018af3629fc6db17cb85a3d /test/validation/api/scheduler
parent291afb1577f2954b94f7dfbec31e3d3768de8a81 (diff)
validation: scheduler: fix groups test invalid failure
The test would fail if odp_schedule(ODP_SCHED_NO_WAIT) wouldn't return any events on the first call. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Stanislaw Kardach <skardach@marvell.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Reported-by: Angela Czubak <aczubak@marvell.com>
Diffstat (limited to 'test/validation/api/scheduler')
-rw-r--r--test/validation/api/scheduler/scheduler.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler/scheduler.c
index b7128c1f0..652591754 100644
--- a/test/validation/api/scheduler/scheduler.c
+++ b/test/validation/api/scheduler/scheduler.c
@@ -55,6 +55,7 @@
#define CHAOS_NDX_TO_PTR(n) ((void *)(uintptr_t)n)
#define ODP_WAIT_TOLERANCE (150 * ODP_TIME_MSEC_IN_NS)
+#define WAIT_1MS_RETRIES 1000
/* Test global variables */
typedef struct {
@@ -737,7 +738,9 @@ static void scheduler_test_groups(void)
odp_queue_t queue, from;
odp_schedule_group_t mygrp[NUM_GROUPS];
odp_queue_t queue_grp[NUM_GROUPS];
+ uint64_t wait_time;
int num = NUM_GROUPS;
+ int schedule_retries;
odp_queue_param_init(&qp);
qp.type = ODP_QUEUE_TYPE_SCHED;
@@ -795,21 +798,19 @@ static void scheduler_test_groups(void)
odp_schedule_group_leave(mygrp2, &mymask);
odp_schedule_group_join(mygrp1, &mymask);
+ wait_time = odp_schedule_wait_time(ODP_TIME_MSEC_IN_NS);
+ schedule_retries = 0;
while (num) {
queue = queue_grp[j];
- ev = odp_schedule(&from, ODP_SCHED_NO_WAIT);
+ ev = odp_schedule(&from, wait_time);
if (ev == ODP_EVENT_INVALID) {
- /* change group */
- rc = odp_schedule_group_leave(mygrp[j],
- &mymask);
- CU_ASSERT_FATAL(rc == 0);
-
- j = (j + 1) % NUM_GROUPS;
- rc = odp_schedule_group_join(mygrp[j],
- &mymask);
- CU_ASSERT_FATAL(rc == 0);
+ CU_ASSERT_FATAL(schedule_retries <
+ WAIT_1MS_RETRIES);
+ schedule_retries++;
continue;
+ } else {
+ schedule_retries = 0;
}
CU_ASSERT_FATAL(from == queue);
@@ -826,6 +827,14 @@ static void scheduler_test_groups(void)
odp_buffer_free(buf);
+ /* Change group */
+ rc = odp_schedule_group_leave(mygrp[j], &mymask);
+ CU_ASSERT_FATAL(rc == 0);
+
+ j = (j + 1) % NUM_GROUPS;
+ rc = odp_schedule_group_join(mygrp[j], &mymask);
+ CU_ASSERT_FATAL(rc == 0);
+
/* Tell scheduler we're about to request an event.
* Not needed, but a convenient place to test this API.
*/