]> git.proxmox.com Git - mirror_lxc.git/commitdiff
use snapshot_destroy in tests/snapshot.c and clean up containers after the test run
authorS.Çağlar Onur <caglar@10ur.org>
Sat, 19 Oct 2013 04:51:21 +0000 (00:51 -0400)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Sat, 19 Oct 2013 14:50:09 +0000 (09:50 -0500)
Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/tests/snapshot.c

index 8f165486d800be45d4dc5d1e4ed574a1ddb33fcd..1f6d115d81d6b8d0057362d2512914cb89737990 100644 (file)
@@ -118,13 +118,25 @@ int main(int argc, char *argv[])
                goto err;
        }
 
-       printf("All tests passed\n");
+       if (!c->snapshot_destroy(c, "snap0")) {
+               fprintf(stderr, "%s: %d: failed to destroy snapshot\n", __FILE__, __LINE__);
+               goto err;
+       }
+
+       if (!c->destroy(c)) {
+               fprintf(stderr, "%s: %d: failed to destroy container\n", __FILE__, __LINE__);
+               goto err;
+       }
+
        lxc_container_put(c);
-       exit(0);
+       try_to_remove();
 
+       printf("All tests passed\n");
+       exit(0);
 err:
        lxc_container_put(c);
-       fprintf(stderr, "Exiting on error\n");
        try_to_remove();
+
+       fprintf(stderr, "Exiting on error\n");
        exit(1);
 }