From 74774cb436fc62d258d9642254f3029397062864 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: Tue, 21 Oct 2014 20:29:15 +0200
Subject: [PATCH 14/22] 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.
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
---
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;
}
--
1.9.3