dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0014-test_server-Fix-waiting-for-background-process.patch

905b4d
From 74774cb436fc62d258d9642254f3029397062864 Mon Sep 17 00:00:00 2001
905b4d
From: Lukas Slebodnik <lslebodn@redhat.com>
905b4d
Date: Tue, 21 Oct 2014 20:29:15 +0200
905b4d
Subject: [PATCH 14/22] test_server: Fix waiting for background process
905b4d
905b4d
A waiting loop for background process was very fast (just 5 milliseconds)
905b4d
It caused problem when test was executed with valgrind.
905b4d
The maximum time was increased to 10 seconds.
905b4d
905b4d
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
905b4d
---
905b4d
 src/tests/cwrap/test_server.c | 9 ++++++---
905b4d
 1 file changed, 6 insertions(+), 3 deletions(-)
905b4d
905b4d
diff --git a/src/tests/cwrap/test_server.c b/src/tests/cwrap/test_server.c
905b4d
index 26ecfee1e189b6a474ae52fdbfff6b8922b3f0d7..d0aeac47d0b067fdbc3399037c0a74f150337a23 100644
905b4d
--- a/src/tests/cwrap/test_server.c
905b4d
+++ b/src/tests/cwrap/test_server.c
905b4d
@@ -55,12 +55,13 @@ static void wait_for_bg_server(const char *pidfile)
905b4d
         struct stat sb;
905b4d
 
905b4d
         count++;
905b4d
-        if (count > 100) {
905b4d
+        if (count > 200) {
905b4d
+            fail();
905b4d
             break;
905b4d
         }
905b4d
 
905b4d
         ret = stat(pidfile, &sb);
905b4d
-        usleep(50);
905b4d
+        usleep(50000);
905b4d
     } while (ret != 0);
905b4d
 
905b4d
     /* read the pidfile */
905b4d
@@ -198,7 +199,9 @@ int main(int argc, const char *argv[])
905b4d
     test_dom_suite_setup(TEST_DB_PATH);
905b4d
 
905b4d
     rv = run_tests(tests);
905b4d
-    test_dom_suite_cleanup(TEST_DB_PATH, CONFDB_FILE, NULL);
905b4d
+    if (rv != 0) {
905b4d
+        test_dom_suite_cleanup(TEST_DB_PATH, CONFDB_FILE, NULL);
905b4d
+    }
905b4d
 
905b4d
     return rv;
905b4d
 }
905b4d
-- 
905b4d
1.9.3
905b4d