Re: [libvirt PATCH] tests: Mock virGetUserRuntimeDirectory() for qemuhotplug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2020-05-04 at 18:21 +0200, Andrea Bolognani wrote:
> On Mon, 2020-05-04 at 13:44 +0200, Michal Privoznik wrote:
> > On 5/1/20 2:30 PM, Andrea Bolognani wrote:
> > > +char *
> > > +virGetUserRuntimeDirectory(void)
> > > +{
> > > +    return g_build_filename(g_getenv("LIBVIRT_FAKE_ROOT_DIR"),
> > > +                            "user-runtime-directory", NULL);
> > > +}
> > 
> > While the qemuhotplugtest is (currently) the only one that actually uses 
> > the runtimedir, this function is called basically from every qemu* test 
> > because (almost?) every qemu* test calls virQEMUDriverConfigNew(). 
> > Therefore I think we need to fix qemuTestDriverInit() too so that after 
> > it call ConfigNew() the path is replaced with some known value.
> 
> Good point! I'll look into making this more generic.

Unfortunately it's not possible to fix this the way you suggested,
because virHostdevManager attempts to create its state directory
during object allocation and so we can't just change it after the
fact.

I have, however, made the mock more generic and applied it to other
tests that use virHostdevManager[1]. That, along with Dan's patch
that poisons $HOME and $XDG_RUNTIME_DIR in the test suite, should be
enough to ensure more issues like this one don't sneak back in.


[1] https://www.redhat.com/archives/libvir-list/2020-May/msg00212.html
[2] https://www.redhat.com/archives/libvir-list/2020-May/msg00058.html
-- 
Andrea Bolognani / Red Hat / Virtualization




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux