[SSSD] [PATCH] test_server: Fix waiting for background process

Lukas Slebodnik lslebodn at redhat.com
Tue Oct 21 18:38:00 UTC 2014


ehlo,

IMO, attached patch is self descriptive.

LS
-------------- next part --------------
>From 8ee8083177d9dde82b4431df042467fc2abad551 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Tue, 21 Oct 2014 20:29:15 +0200
Subject: [PATCH 2/2] test_server: Fix waiting for background process

A waiting loop for background process was very fast (just 5 milliseconds)
It caused problem when test was executed with valgrind.
The maximum time was increased to 10 seconds.
---
 src/tests/cwrap/test_server.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/tests/cwrap/test_server.c b/src/tests/cwrap/test_server.c
index 26ecfee1e189b6a474ae52fdbfff6b8922b3f0d7..d0aeac47d0b067fdbc3399037c0a74f150337a23 100644
--- a/src/tests/cwrap/test_server.c
+++ b/src/tests/cwrap/test_server.c
@@ -55,12 +55,13 @@ static void wait_for_bg_server(const char *pidfile)
         struct stat sb;
 
         count++;
-        if (count > 100) {
+        if (count > 200) {
+            fail();
             break;
         }
 
         ret = stat(pidfile, &sb);
-        usleep(50);
+        usleep(50000);
     } while (ret != 0);
 
     /* read the pidfile */
@@ -198,7 +199,9 @@ int main(int argc, const char *argv[])
     test_dom_suite_setup(TEST_DB_PATH);
 
     rv = run_tests(tests);
-    test_dom_suite_cleanup(TEST_DB_PATH, CONFDB_FILE, NULL);
+    if (rv != 0) {
+        test_dom_suite_cleanup(TEST_DB_PATH, CONFDB_FILE, NULL);
+    }
 
     return rv;
 }
-- 
2.1.0



More information about the sssd-devel mailing list