[ostree] pull: Properly clean up after test
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] pull: Properly clean up after test
- Date: Tue, 1 Nov 2011 16:36:21 +0000 (UTC)
commit 3ceec68a548a2625ad0a1cace70a521e10d52a4f
Author: Colin Walters <walters verbum org>
Date: Tue Nov 1 12:35:50 2011 -0400
pull: Properly clean up after test
tests/libtest.sh | 13 ++++++++++++-
tests/run-apache.c | 1 +
tests/tmpdir-lifecycle.c | 5 ++---
3 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/tests/libtest.sh b/tests/libtest.sh
index 5c0dff8..526c88a 100644
--- a/tests/libtest.sh
+++ b/tests/libtest.sh
@@ -139,7 +139,18 @@ StartServers 1
Alias /ostree/ ${test_tmpdir}/ostree-srv/
# ScriptAlias /ostree/ ${test_tmpdir}/httpd/ostree-http-backend/
EOF
- ${SRCDIR}/tmpdir-lifecycle ${SRCDIR}/run-apache `pwd`/httpd.conf ${test_tmpdir}/httpd-address
+ ${SRCDIR}/tmpdir-lifecycle ${SRCDIR}/run-apache `pwd`/httpd.conf ${test_tmpdir}/httpd-address &
+ for i in $(seq 5); do
+ if ! test -f ${test_tmpdir}/httpd-address; then
+ sleep 1
+ else
+ break
+ fi
+ done
+ if ! test -f ${test_tmpdir}/httpd-address; then
+ echo "Error: timed out waiting for httpd-address file"
+ exit 1
+ fi
cd ${oldpwd}
}
diff --git a/tests/run-apache.c b/tests/run-apache.c
index b5f7e5c..b074e6e 100644
--- a/tests/run-apache.c
+++ b/tests/run-apache.c
@@ -134,6 +134,7 @@ main (int argc,
httpd_argv = g_ptr_array_new ();
g_ptr_array_add (httpd_argv, "httpd");
+ g_ptr_array_add (httpd_argv, "-X");
g_ptr_array_add (httpd_argv, "-f");
g_ptr_array_add (httpd_argv, argv[1]);
g_ptr_array_add (httpd_argv, "-C");
diff --git a/tests/tmpdir-lifecycle.c b/tests/tmpdir-lifecycle.c
index 95aae63..fac0c48 100644
--- a/tests/tmpdir-lifecycle.c
+++ b/tests/tmpdir-lifecycle.c
@@ -65,7 +65,6 @@ main (int argc,
GError *error = NULL;
GPtrArray *new_argv;
int i;
- GPid pid;
struct TmpdirLifecyleData data;
g_type_init ();
@@ -87,12 +86,12 @@ main (int argc,
g_ptr_array_add (new_argv, NULL);
if (!g_spawn_async (NULL, (char**)new_argv->pdata, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
- NULL, NULL, &pid, &error))
+ NULL, NULL, &data.pid, &error))
{
g_printerr ("%s\n", error->message);
return 1;
}
- g_child_watch_add (pid, on_child_exited, &data);
+ g_child_watch_add (data.pid, on_child_exited, &data);
g_main_loop_run (data.loop);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]