summaryrefslogtreecommitdiffstats
path: root/tests/torture.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2014-05-30 13:59:43 +0200
committerMichael Adam <obnox@samba.org>2014-05-31 03:42:30 +0200
commit205d5c2348a5ae4858c2fe07a8b3080b19c900be (patch)
treeba40b5c2a06ad09e5d03a1f57b63a10feb3adaa1 /tests/torture.c
parent323feb7398527294d1102e24470c0761b1661d99 (diff)
downloadsocket_wrapper-205d5c2348a5ae4858c2fe07a8b3080b19c900be.tar.gz
socket_wrapper-205d5c2348a5ae4858c2fe07a8b3080b19c900be.tar.xz
socket_wrapper-205d5c2348a5ae4858c2fe07a8b3080b19c900be.zip
torture: Wait for the pidfile and then start the tests.
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'tests/torture.c')
-rw-r--r--tests/torture.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/torture.c b/tests/torture.c
index 8c9e0db..9a1d1ce 100644
--- a/tests/torture.c
+++ b/tests/torture.c
@@ -147,6 +147,7 @@ static void torture_setup_echo_srv_ip(void **state,
struct torture_state *s;
char start_echo_srv[1024] = {0};
const char *t;
+ int count = 0;
int rc;
torture_setup_socket_dir(state);
@@ -175,7 +176,18 @@ static void torture_setup_echo_srv_ip(void **state,
rc = system(start_echo_srv);
assert_int_equal(rc, 0);
- sleep(1);
+ do {
+ struct stat sb;
+
+ count++;
+ if (count > 100) {
+ break;
+ }
+
+ rc = stat(s->srv_pidfile, &sb);
+ usleep(50);
+ } while (rc != 0);
+ assert_int_equal(rc, 0);
/* set default iface for the client */
setenv("SOCKET_WRAPPER_DEFAULT_IFACE", "170", 1);