[libvirt PATCH] tests: Use qemu:///embed to simplify fakerootdir management

Michal Privoznik mprivozn at redhat.com
Thu May 7 16:27:22 UTC 2020


On 5/6/20 3:02 PM, Andrea Bolognani wrote:
> Now that the QEMU driver natively supports storing all its runtime
> data inside an arbitrary directory, we can avoid having multiple
> copies of this same logic in the test suite.
> 
> Signed-off-by: Andrea Bolognani <abologna at redhat.com>
> ---
>   tests/qemuhotplugtest.c  | 15 --------------
>   tests/qemumemlocktest.c  | 17 ----------------
>   tests/qemuxml2argvtest.c | 16 ---------------
>   tests/qemuxml2xmltest.c  | 16 ---------------
>   tests/testutilsqemu.c    | 43 ++++++++++++++--------------------------
>   5 files changed, 15 insertions(+), 92 deletions(-)
> 


> diff --git a/tests/qemumemlocktest.c b/tests/qemumemlocktest.c
> index 3f18fed1c3..0e254bb3ce 100644
> --- a/tests/qemumemlocktest.c
> +++ b/tests/qemumemlocktest.c
> @@ -51,26 +51,13 @@ testCompareMemLock(const void *data)
>       return ret;
>   }
>   
> -# define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX"
> -
>   static int
>   mymain(void)
>   {
>       int ret = 0;
> -    char *fakerootdir;
>       virQEMUCapsPtr qemuCaps = NULL;
>   
> -    fakerootdir = g_strdup(FAKEROOTDIRTEMPLATE);
> -
> -    if (!g_mkdtemp(fakerootdir)) {
> -        fprintf(stderr, "Cannot create fakerootdir");
> -        abort();
> -    }
> -
> -    g_setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, TRUE);
> -
>       if (qemuTestDriverInit(&driver) < 0) {
> -        VIR_FREE(fakerootdir);
>           return EXIT_FAILURE;
>       }

Remove the curly braces to make syntax-check happy.

Reviewed-by: Michal Privoznik <mprivozn at redhat.com>

Michal




More information about the libvir-list mailing list