[libvirt] [PATCH] test: Skip storage test when filesystem storage backend isn't compiled in

Jiri Denemark jdenemar at redhat.com
Mon Jun 23 10:13:16 UTC 2014


On Mon, Jun 23, 2014 at 12:04:28 +0200, Peter Krempa wrote:
> 'virstoragetest' accesses backing chains of files on local storage with
> the help of the storage driver. Disable the test on builds without the
> storage driver as the test is crashing otherwise.
> ---
>  tests/virstoragetest.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
> index e15578c..043c5e6 100644
> --- a/tests/virstoragetest.c
> +++ b/tests/virstoragetest.c
> @@ -536,6 +536,12 @@ mymain(void)
>      virStorageSourcePtr chain2; /* short for chain->backingStore */
>      virStorageSourcePtr chain3; /* short for chain2->backingStore */
> 
> +#if !WITH_STORAGE_FS
> +    /* this test doesn't make sense without storage driver access
> +     * to local files */
> +    return EXIT_AM_SKIP;
> +#endif
> +
>      /* Prep some files with qemu-img; if that is not found on PATH, or
>       * if it lacks support for qcow2 and qed, skip this test.  */
>      if ((ret = testPrepImages()) != 0)

Static analysis tools will complain about dead code and unused
variables. The way we usually implement this is to make the whole
mymain() conditional.

Jirka




More information about the libvir-list mailing list