Re: [PATCH 3/4] tests: Prepare to have different usable GIC versions

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

 



On Tue, 2016-05-10 at 18:45 -0400, Cole Robinson wrote:
> On 05/10/2016 08:46 AM, Andrea Bolognani wrote:
> > 
> > Now that we choose the GIC version based on hardware features when
> > no <gic/> element has been provided, we need a way to fake the GIC
> > capabilities of the host.
> > 
> > Update the qemuxml2argv and qemuxml2xml tests to allow this.
> > ---
> >  tests/qemuxml2argvtest.c |  77 ++++++++++++++++++-----
> >  tests/qemuxml2xmltest.c  | 159 ++++++++++++++++++++++++++++-------------------
> >  2 files changed, 159 insertions(+), 77 deletions(-)
> > 
> > diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> > index e41444d..b081634 100644
> > --- a/tests/qemuxml2argvtest.c
> > +++ b/tests/qemuxml2argvtest.c
> > @@ -34,6 +34,13 @@
> >  static const char *abs_top_srcdir;
> >  static virQEMUDriver driver;
> >  
> > +enum {
> > +    GIC_NONE = 0,
> > +    GIC_V2,
> > +    GIC_V3,
> > +    GIC_BOTH,
> > +};
> > +
> >  static unsigned char *
> >  fakeSecretGetValue(virSecretPtr obj ATTRIBUTE_UNUSED,
> >                     size_t *value_size,
> > @@ -452,6 +459,49 @@ testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy)
> >  
> >  
> >  static int
> > +testPrepareExtraFlags(struct testInfo *info,
> > +                      bool skipLegacyCPUs,
> > +                      int gic)
> > +{
> > +    virGICCapability *gicCapabilities = NULL;
> > +    size_t ngicCapabilities = 0;
> > +    int ret = -1;
> > +
> > +    if (!(info->extraFlags = virQEMUCapsNew()))
> > +        goto out;
> > +
> > +    if (testAddCPUModels(info->extraFlags, skipLegacyCPUs) < 0)
> > +        goto out;
> > +
> > +    if (VIR_ALLOC_N(gicCapabilities, 2) < 0)
> > +        goto out;
> > +
> > +# define IMPL_BOTH \
> > +         VIR_GIC_IMPLEMENTATION_KERNEL|VIR_GIC_IMPLEMENTATION_EMULATED
> > +
> > +    if (gic & GIC_V2) {
> > +        gicCapabilities[ngicCapabilities].version = VIR_GIC_VERSION_2;
> > +        gicCapabilities[ngicCapabilities].implementation = IMPL_BOTH;
> > +        ngicCapabilities++;
> > +    }
> > +    if (gic & GIC_V3) {
> > +        gicCapabilities[ngicCapabilities].version = VIR_GIC_VERSION_3;
> > +        gicCapabilities[ngicCapabilities].implementation = IMPL_BOTH;
> > +        ngicCapabilities++;
> > +    }
> > +
> > +# undef IMPL_BOTH
> > +
> > +    virQEMUCapsSetGICCapabilities(info->extraFlags,
> > +                                  gicCapabilities, ngicCapabilities);
> > +
> > +    ret = 0;
> > +
> > + out:
> > +    return ret;
> > +}
> 
> Can this logic be shared in a testutilsqemu.c function, rather than duplicated
> across both test files?

Good idea, I'll look into it.

-- 
Andrea Bolognani
Software Engineer - Virtualization Team

--
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]