[libvirt] [PATCH] qemuxml2argvtest: uncoditionally mock NUMA routines

Ján Tomko jtomko at redhat.com
Fri May 13 12:07:42 UTC 2016

On Thu, May 12, 2016 at 10:47:04AM +0300, Roman Bogorodskiy wrote:
> Currently, qemuxml2argvmock.c only mocks virNumaNodeIsAvailable(), and
> only if libvirt was built with NUMA support. This causes some test
> failures where NUMA is involved.

This is misleading, you are probably compiling with clang, which
inlines virNumaGetMaxNode, so the mocked version of it is never called.

With no NUMA support, even libvirtd uses the implementation of
virNumaNodeIsAvailable based on virNumaGetMaxNode.
And the mocked virNumaNodesetIsAvailable is functionally identical to
the implementation in virnuma.c.

There were two attempts to get around it:
and mocking virNumaNodesetIsAvailable by its identical copy:
(mocking virNumaNodeIsAvailable should not be needed).

All they need is a decision.


> For example, memory-hotplug-dimm fails because it goes all they way down
> to qemuBuildMemoryBackendStr() that calls virNumaNodesetIsAvailable()
> for a user specified nodeset and fails, hence the test (unexpectedly)
> fails.
> To make qemuxml2argtest successfully run on non-NUMA platforms, do the
> following:
>  - mock virNumaNodeIsAvailable() unconditionally
>  - add a mock for virNumaNodesetIsAvailable()
> ---
>  tests/qemuxml2argvmock.c | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)

More information about the libvir-list mailing list