From 58b61f6d3442e984a88c093dbdfd20f1d0a82587 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=2E=C3=87a=C4=9Flar=20Onur?= Date: Sat, 19 Oct 2013 00:51:21 -0400 Subject: [PATCH] use snapshot_destroy in tests/snapshot.c and clean up containers after the test run MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: S.Çağlar Onur Signed-off-by: Serge Hallyn --- src/tests/snapshot.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/tests/snapshot.c b/src/tests/snapshot.c index 8f165486d..1f6d115d8 100644 --- a/src/tests/snapshot.c +++ b/src/tests/snapshot.c @@ -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); } -- 2.47.2