[lxc-devel] [PATCH] use snapshot_destroy in tests/snapshot.c and clean up containers after the test run

Serge Hallyn serge.hallyn at ubuntu.com
Sat Oct 19 14:49:54 UTC 2013


Quoting S.Çağlar Onur (caglar at 10ur.org):
> Signed-off-by: S.Çağlar Onur <caglar at 10ur.org>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  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 8f16548..1f6d115 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);
>  }
> -- 
> 1.8.1.2
> 
> 
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel




More information about the lxc-devel mailing list