pull: Properly clean up after test

This commit is contained in:
Colin Walters 2011-11-01 12:35:50 -04:00
parent 8f877c5b65
commit 3ceec68a54
3 changed files with 15 additions and 4 deletions

View File

@ -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}
}

View File

@ -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");

View File

@ -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);