From: Christian Babeux Date: Mon, 10 Dec 2012 19:46:15 +0000 (-0500) Subject: Tests: Fix sleep interruption in health stall test X-Git-Tag: v2.1.0~51 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=050eba6da292de6ca75cac47eb6daf9a3fde9f31;p=lttng-tools.git Tests: Fix sleep interruption in health stall test The sleep(3) call can return the number of seconds left to sleep if interrupted. Handle the intteruption in the health stall test. Signed-off-by: Christian Babeux Signed-off-by: David Goulet --- diff --git a/tests/tools/health/health_stall.c b/tests/tools/health/health_stall.c index f91bd49a8..38fe5f88d 100644 --- a/tests/tools/health/health_stall.c +++ b/tests/tools/health/health_stall.c @@ -43,7 +43,10 @@ void __testpoint_thread_manage_clients_before_loop(void) const char *var = "LTTNG_THREAD_MANAGE_CLIENTS_STALL"; if (check_env_var(var)) { - sleep(STALL_TIME); + unsigned int sleep_time = STALL_TIME; + while (sleep_time > 0) { + sleep_time = sleep(sleep_time); + } } } @@ -52,7 +55,10 @@ void __testpoint_thread_manage_kernel_before_loop(void) const char *var = "LTTNG_THREAD_MANAGE_KERNEL_STALL"; if (check_env_var(var)) { - sleep(STALL_TIME); + unsigned int sleep_time = STALL_TIME; + while (sleep_time > 0) { + sleep_time = sleep(sleep_time); + } } } @@ -61,6 +67,9 @@ void __testpoint_thread_manage_apps_before_loop(void) const char *var = "LTTNG_THREAD_MANAGE_APPS_STALL"; if (check_env_var(var)) { - sleep(STALL_TIME); + unsigned int sleep_time = STALL_TIME; + while (sleep_time > 0) { + sleep_time = sleep(sleep_time); + } } }