[libvirt] [PATCH 3/8] tests: Move data directories into testQemuData

Andrea Bolognani abologna at redhat.com
Wed Mar 13 09:18:52 UTC 2019


On Wed, 2019-03-13 at 09:41 +0100, Peter Krempa wrote:
> On Thu, Mar 07, 2019 at 16:44:32 +0100, Andrea Bolognani wrote:
> > This removes a little duplication right away, and more
> > importantly will allow us to perform some interesting
> > refactoring later on.
[...]
> > @@ -47,6 +48,8 @@ testQemuDataInit(testQemuDataPtr data)
> >      if (qemuTestDriverInit(&data->driver) < 0)
> >          return -1;
> >  
> > +    data->dataDir = abs_srcdir "/qemucapabilitiesdata";
> > +
> 
> I'm not entirely persuaded that you need to pass this constant in via
> the data structure. Even after the last patch the value is never
> modified. Could you please elaborate on the refactorings that this will
> allow?

I'll admit I kinda copy-pasted commit messages around, so that's
probably why the one for this patch sounds a bit hyperbolic :)

Anyway, by the end of the series we'll have to pass dataDir to
testQemuCapsIterate() in addition to using it to build the path for
both the input and output file, so it makes sense to store it into
a variable instead of building it from abs_srcdir plus the directory
name two or more times.

As for why it's stored in the structure, I could easily have used a
global variable instead, but this approach seemed cleaner, especially
considering that we're already using the structure to store data that
is similar in scope (the driver).

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list