]> git.proxmox.com Git - mirror_lxc.git/commitdiff
tests: cleanup shutdowntest.c
author2xsec <dh48.jeong@samsung.com>
Tue, 3 Jul 2018 09:25:02 +0000 (18:25 +0900)
committer2xsec <dh48.jeong@samsung.com>
Tue, 3 Jul 2018 09:25:02 +0000 (18:25 +0900)
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
src/tests/shutdowntest.c

index 00b18a45f71a03e96cb24f8ef9bbb0aea3db5a3d..cec6efc7bf307fe9e339d5f452d865703498e273 100644 (file)
@@ -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;
@@ -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;
@@ -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;
        }
 
@@ -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);