Re: [PATCH 14/23] cputest: Separate QEMUCaps creation from cpuTestCPUIDJson

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

 



On Thu, Oct 12, 2017 at 17:20:06 -0400, John Ferlan wrote:
> 
> 
> On 10/04/2017 10:58 AM, Jiri Denemark wrote:
> > To make the code reusable by other tests.
> > 
> > Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
> > ---
> >  tests/cputest.c | 97 +++++++++++++++++++++++++++++++++++----------------------
> >  1 file changed, 60 insertions(+), 37 deletions(-)
> > 
> > diff --git a/tests/cputest.c b/tests/cputest.c
> > index 0a07a2da14..b72c17a168 100644
> > --- a/tests/cputest.c
> > +++ b/tests/cputest.c
> > @@ -460,6 +460,64 @@ cpuTestHasFeature(const void *arg)
> >  }
> >  
> >  
> > +typedef enum {
> > +    JSON_NONE,
> > +    JSON_HOST,
> > +    JSON_MODELS,
> > +} cpuTestCPUIDJson;
> > +
> > +#if WITH_QEMU && WITH_YAJL
> > +static virQEMUCapsPtr
> > +cpuTestMakeQEMUCaps(const struct data *data)
> > +{
> > +    virQEMUCapsPtr qemuCaps = NULL;
> > +    qemuMonitorTestPtr testMon = NULL;
> > +    qemuMonitorCPUModelInfoPtr model = NULL;
> > +    char *json = NULL;
> > +
> > +    if (virAsprintf(&json, "%s/cputestdata/%s-cpuid-%s.json",
> > +                    abs_srcdir, virArchToString(data->arch), data->host) < 0)
> > +        goto error;
> 
> could be cleanup;

Yeah, but since we have the "error" label and we are jumping in case of
error I think it's slightly better to keep it as is. And it's less
fragile when someone comes and shuffles the code around. I don't really
mind either way, though.

Jirka

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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