From cf0c72d3c53376ceb1f67a19dc73fdc17a69eb09 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Graber?= Date: Tue, 1 Apr 2014 16:38:39 -0400 Subject: [PATCH] tests: Try to make shutdowntest a bit more robust MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This should help it run better on slow test environment like the LXC CI armhf builder. - Wait longer for the container to start - Wait longer for the container to shutdown - On failure to shutdown, kill the container - Always destroy the container if it's around Signed-off-by: Stéphane Graber Acked-by: Serge E. Hallyn --- src/tests/shutdowntest.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/tests/shutdowntest.c b/src/tests/shutdowntest.c index 2450221ff..0f9a8fd14 100644 --- a/src/tests/shutdowntest.c +++ b/src/tests/shutdowntest.c @@ -70,10 +70,13 @@ int main(int argc, char *argv[]) } /* Wait for init to be ready for SIGPWR */ - sleep(10); + sleep(20); - if (!c->shutdown(c, 60)) { + if (!c->shutdown(c, 120)) { fprintf(stderr, "%d: failed to shut down %s\n", __LINE__, MYNAME); + if (!c->stop(c)) { + fprintf(stderr, "%d: failed to kill %s\n", __LINE__, MYNAME); + } goto out; } @@ -90,6 +93,10 @@ int main(int argc, char *argv[]) fprintf(stderr, "all lxc_container tests passed for %s\n", c->name); ret = 0; out: + if (c && c->is_defined(c)) { + c->destroy(c); + } + lxc_container_put(c); exit(ret); } -- 2.47.2