From 62d8d068b7dbbc8f14b08d328b2b56f239eded48 Mon Sep 17 00:00:00 2001 From: Kent McLeod Date: Thu, 9 Dec 2021 15:14:37 +1100 Subject: [PATCH] scheduler: Increase timeout period when simulating (#63) * scheduler: Increase timeout period when simulating Waiting for two timeouts is not enough when simulating in cloud instances. Increase the timeout period under simulation to 100ms. Signed-off-by: Kent McLeod --- apps/sel4test-tests/src/tests/scheduler.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/sel4test-tests/src/tests/scheduler.c b/apps/sel4test-tests/src/tests/scheduler.c index b1c24045..b3867798 100644 --- a/apps/sel4test-tests/src/tests/scheduler.c +++ b/apps/sel4test-tests/src/tests/scheduler.c @@ -49,7 +49,12 @@ static int test_thread_suspend(env_t env) set_helper_priority(env, &t1, 100); start_helper(env, &t1, (helper_fn_t) counter_func, (seL4_Word) &counter, 0, 0, 0); - sel4test_periodic_start(env, 10 * NS_IN_MS); + /* We increase the timeout in cases where we are running on a simulator that + * simulates larger clock rates via compressing the clock stream and can + * cause large instantaneous time jumps. + */ + int timeout = config_set(CONFIG_SIMULATION) ? 100 : 10; + sel4test_periodic_start(env, timeout * NS_IN_MS); seL4_Word old_counter; @@ -59,9 +64,8 @@ static int test_thread_suspend(env_t env) old_counter = counter; /* Let it run again. */ - /* We wait for two timer interrupts to force a block in case 10ms passes instantly - * in cases where we are running on a simulator that simulates larger clock rates - * via compressing the clock stream. + /* We wait for two timer interrupts to force a block in case 100ms passes + * instantly in cases where we are running on a simulator. */ sel4test_ntfn_timer_wait(env); sel4test_ntfn_timer_wait(env);