[libvirt] [PATCH 4/4] tests: Add some compatibility-related cases to the CPU tests

Jiri Denemark jdenemar at redhat.com
Fri Aug 21 22:02:49 UTC 2015


On Fri, Aug 21, 2015 at 14:59:19 -0700, Andrea Bolognani wrote:
> On Fri, 2015-08-21 at 14:37 -0700, Jiri Denemark wrote:
> 
> > > --- a/tests/cputest.c
> > > +++ b/tests/cputest.c
> > > @@ -607,6 +607,10 @@ mymain(void)
> > >      DO_TEST_COMPARE("ppc64", "host", "guest-legacy",
> > > VIR_CPU_COMPARE_IDENTICAL);
> > >      DO_TEST_COMPARE("ppc64", "host", "guest-legacy-incompatible",
> > > VIR_CPU_COMPARE_INCOMPATIBLE);
> > >      DO_TEST_COMPARE("ppc64", "host", "guest-legacy-invalid",
> > > VIR_CPU_COMPARE_ERROR);
> > > +    DO_TEST_COMPARE("ppc64", "host", "guest-compat-none",
> > > VIR_CPU_COMPARE_IDENTICAL);
> > > +    DO_TEST_COMPARE("ppc64", "host", "guest-compat-valid",
> > > VIR_CPU_COMPARE_IDENTICAL);
> > > +    DO_TEST_COMPARE("ppc64", "host", "guest-compat-invalid",
> > > VIR_CPU_COMPARE_ERROR);
> > 
> > I'm wondering how the above test could have passed when ret was
> > initialized to VIR_CPU_COMPARE_IDENTICAL in patch 2 :-)
> 
> All tests pass both on my laptop and on actual POWER hardware...
> Did you get a failure instead?

No, I just missed one line in the patch 2. Everything is correct as it
is.

> > > diff --git a/tests/cputestdata/ppc64-host+guest-compat
> > > -incompatible.xml b/tests/cputestdata/ppc64-host+guest-compat
> > > -incompatible.xml
> > > new file mode 100644
> > > index 0000000..1fab751
> > > --- /dev/null
> > > +++ b/tests/cputestdata/ppc64-host+guest-compat-incompatible.xml
> > > @@ -0,0 +1,3 @@
> > > +<cpu mode='host-model' match='exact'>
> > > +  <model fallback='allow'>power8</model>
> > > +</cpu>
> > 
> > The test is supposed to fail for this (and some other cases too) so
> > why
> > do we need to have an output XML?
> 
> Test cases that use VIR_TEST_UPDATE() run in two steps:
> 
>   1. run cpuUpdate() and compare the returned XML to the expected
>      XML - the file you're referring to
> 
>   2. the obtained XML definition is tested for compatibility with
>      the host CPU using cpuCompare()
> 
> So the expected failures refer to the second check, and you still
> need to have the expected XML for the first part - if you try and
> remove it, the test case will fail.

I see (thinking is more difficult than just asking :-P)

ACK

Jirka




More information about the libvir-list mailing list