aboutsummaryrefslogtreecommitdiff
path: root/test/validation/api/scheduler
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2019-04-24 10:46:48 +0300
committerMatias Elo <matias.elo@nokia.com>2019-05-14 16:01:43 +0300
commitff1c6ceb92f014785ec4d90a4bd2ec6802a18bab (patch)
treeab3f3affaa7d29e7dac41c9448ea732c2762fe30 /test/validation/api/scheduler
parentebefa333864660b8cc8e971f1b963aa31f2dfb3b (diff)
validation: scheduler: fix chaos test clean-up
Wait until all threads have finished before doing clean-up. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Stanislaw Kardach <skardach@marvell.com>
Diffstat (limited to 'test/validation/api/scheduler')
-rw-r--r--test/validation/api/scheduler/scheduler.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler/scheduler.c
index c64abbb83..848c683b3 100644
--- a/test/validation/api/scheduler/scheduler.c
+++ b/test/validation/api/scheduler/scheduler.c
@@ -928,14 +928,25 @@ static int chaos_thread(void *arg)
printf("Thread %d completed %d rounds...terminating\n",
odp_thread_id(), CHAOS_NUM_EVENTS);
- exit_schedule_loop();
-
end_time = odp_time_local();
diff = odp_time_diff(end_time, start_time);
printf("Thread %d ends, elapsed time = %" PRIu64 "us\n",
odp_thread_id(), odp_time_to_ns(diff) / 1000);
+ /* Make sure scheduling context is released */
+ odp_schedule_pause();
+ while ((ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT))
+ != ODP_EVENT_INVALID) {
+ odp_event_free(ev);
+ }
+
+ /* Don't resume scheduling until all threads have finished */
+ odp_barrier_wait(&globals->barrier);
+ odp_schedule_resume();
+
+ drain_queues();
+
return 0;
}