Skip to content

Commit

Permalink
tests: cleanup shutdowntest.c
Browse files Browse the repository at this point in the history
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
  • Loading branch information
2xsec committed Jul 3, 2018
1 parent 0ce5c91 commit 70b12b4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/tests/shutdowntest.c
Expand Up @@ -49,8 +49,10 @@ int main(int argc, char *argv[])
fprintf(stderr, "%d: failed to set network type\n", __LINE__);
goto out;
}

c->set_config_item(c, "lxc.net.0.link", "lxcbr0");
c->set_config_item(c, "lxc.net.0.flags", "up");

if (!c->createl(c, "busybox", NULL, NULL, 0, NULL)) {
fprintf(stderr, "%d: failed to create a container\n", __LINE__);
goto out;
Expand All @@ -64,6 +66,7 @@ int main(int argc, char *argv[])
c->clear_config(c);
c->load_config(c, NULL);
c->want_daemonize(c, true);

if (!c->startl(c, 0, NULL)) {
fprintf(stderr, "%d: failed to start %s\n", __LINE__, MYNAME);
goto out;
Expand All @@ -74,9 +77,9 @@ int main(int argc, char *argv[])

if (!c->shutdown(c, 120)) {
fprintf(stderr, "%d: failed to shut down %s\n", __LINE__, MYNAME);
if (!c->stop(c)) {
if (!c->stop(c))
fprintf(stderr, "%d: failed to kill %s\n", __LINE__, MYNAME);
}

goto out;
}

Expand All @@ -92,10 +95,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)) {
if (c && c->is_defined(c))
c->destroy(c);
}

lxc_container_put(c);
exit(ret);
Expand Down

0 comments on commit 70b12b4

Please sign in to comment.