Tests: Fix sleep interruption in health stall test
authorChristian Babeux <christian.babeux@efficios.com>
Mon, 10 Dec 2012 19:46:15 +0000 (14:46 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Thu, 13 Dec 2012 22:57:24 +0000 (17:57 -0500)
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 <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
tests/tools/health/health_stall.c

index f91bd49a8e9209d34d7835841bba68b020469de7..38fe5f88d95a1f6b50eb29050803e32cf89c11d3 100644 (file)
@@ -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);
+               }
        }
 }
This page took 0.025466 seconds and 4 git commands to generate.