aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>2016-02-16 15:47:06 +0200
committerIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>2016-02-16 15:59:32 +0200
commitdd9f4a45f4b657d67b24517f8ca9e3af0b52f9a7 (patch)
treea4ad841b135e1d6ad0a09dd932468bdf03054ff4
parent3b472f967a5205887904b9cb91e807d11c91ef98 (diff)
validation: scheduler: correct pause/resume sequence
When test for single thread is finished the following test for many threads can be started, and for some implementations can happen that future one event can arrive to main thread, as it was requested in previous test. As result one event can be lost for rest threads. So, it's better to pause scheduling for main thread when it doesn't participate in the multi-threaded test. Also move pause/resume test closer to beginning, because it's used in tests before. Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
-rw-r--r--test/validation/scheduler/scheduler.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/validation/scheduler/scheduler.c b/test/validation/scheduler/scheduler.c
index 367607c7..5d42a6cc 100644
--- a/test/validation/scheduler/scheduler.c
+++ b/test/validation/scheduler/scheduler.c
@@ -995,6 +995,8 @@ static void schedule_common(odp_schedule_sync_t sync, int num_queues,
args.enable_schd_multi = enable_schd_multi;
args.enable_excl_atomic = 0; /* Not needed with a single CPU */
+ /* resume scheduling in case it was paused */
+ odp_schedule_resume();
fill_queues(&args);
schedule_common_(&args);
@@ -1032,6 +1034,9 @@ static void parallel_execute(odp_schedule_sync_t sync, int num_queues,
args->enable_schd_multi = enable_schd_multi;
args->enable_excl_atomic = enable_excl_atomic;
+ /* disable receive events for main thread */
+ exit_schedule_loop();
+
fill_queues(args);
/* Create and launch worker threads */
@@ -1244,6 +1249,9 @@ void scheduler_test_pause_resume(void)
int i;
int local_bufs = 0;
+ /* resume scheduling in case it was paused */
+ odp_schedule_resume();
+
queue = odp_queue_lookup("sched_0_0_n");
CU_ASSERT(queue != ODP_QUEUE_INVALID);
@@ -1291,6 +1299,8 @@ void scheduler_test_pause_resume(void)
}
CU_ASSERT(exit_schedule_loop() == 0);
+
+ odp_schedule_resume();
}
static int create_queues(void)
@@ -1550,6 +1560,7 @@ odp_testinfo_t scheduler_suite[] = {
ODP_TEST_INFO(scheduler_test_num_prio),
ODP_TEST_INFO(scheduler_test_queue_destroy),
ODP_TEST_INFO(scheduler_test_groups),
+ ODP_TEST_INFO(scheduler_test_pause_resume),
ODP_TEST_INFO(scheduler_test_parallel),
ODP_TEST_INFO(scheduler_test_atomic),
ODP_TEST_INFO(scheduler_test_ordered),
@@ -1580,7 +1591,6 @@ odp_testinfo_t scheduler_suite[] = {
ODP_TEST_INFO(scheduler_test_multi_mq_mt_prio_a),
ODP_TEST_INFO(scheduler_test_multi_mq_mt_prio_o),
ODP_TEST_INFO(scheduler_test_multi_1q_mt_a_excl),
- ODP_TEST_INFO(scheduler_test_pause_resume),
ODP_TEST_INFO_NULL,
};