Commit cf0c72d3 by Stéphane Graber

tests: Try to make shutdowntest a bit more robust

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: 's avatarStéphane Graber <stgraber@ubuntu.com> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
parent 982b5959
...@@ -70,10 +70,13 @@ int main(int argc, char *argv[]) ...@@ -70,10 +70,13 @@ int main(int argc, char *argv[])
} }
/* Wait for init to be ready for SIGPWR */ /* 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); 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; goto out;
} }
...@@ -90,6 +93,10 @@ int main(int argc, char *argv[]) ...@@ -90,6 +93,10 @@ int main(int argc, char *argv[])
fprintf(stderr, "all lxc_container tests passed for %s\n", c->name); fprintf(stderr, "all lxc_container tests passed for %s\n", c->name);
ret = 0; ret = 0;
out: out:
if (c && c->is_defined(c)) {
c->destroy(c);
}
lxc_container_put(c); lxc_container_put(c);
exit(ret); exit(ret);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment