From 02b191e9d0f08c2d67e38f585bf082d9e2b1092b Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 26 Nov 2007 22:33:58 +0000 Subject: [PATCH] wait for apache to exit, to avoid spurious test failures svn path=/trunk/; revision=959 --- tests/apache-wrapper.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/apache-wrapper.c b/tests/apache-wrapper.c index 5c50735..bc859ae 100644 --- a/tests/apache-wrapper.c +++ b/tests/apache-wrapper.c @@ -4,6 +4,9 @@ #ifdef HAVE_APACHE +#include +#include + #include "apache-wrapper.h" static gboolean @@ -46,7 +49,21 @@ apache_init (void) void apache_cleanup (void) { + pid_t pid; + char *contents; + + if (g_file_get_contents ("httpd.pid", &contents, NULL, NULL)) { + pid = strtoul (contents, NULL, 10); + g_free (contents); + } else + pid = 0; + apache_cmd ("graceful-stop"); + + if (pid) { + while (kill (pid, 0) == 0) + g_usleep (100); + } } #endif /* HAVE_APACHE */ -- 2.7.4