[PATCH 04/14] qemuxml2argvtest: Use virnuma mock

Michal Privoznik posted 14 patches 2 years, 9 months ago
There is a newer version of this series
[PATCH 04/14] qemuxml2argvtest: Use virnuma mock
Posted by Michal Privoznik 2 years, 9 months ago
While no part of cmd line building process currently depends on a
host NUMA configuration, this will change soon. Use freshly
changed virnumamock from qemuxml2argvtest and make the mock read
NUMA data from vircaps2xmldata which seems to have the most rich
NUMA configuration.

This also means, we have to start building virnumamock
unconditionally. But this is not a problem, since nothing inside
of the mock relies on Linux specificity. The whole mock is merely
just reading files and parsing them.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 tests/meson.build        | 2 +-
 tests/qemuxml2argvtest.c | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/meson.build b/tests/meson.build
index 15b049c6ac..44a04698cf 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -88,13 +88,13 @@ mock_libs = [
   { 'name': 'virportallocatormock' },
   { 'name': 'virprocessmock' },
   { 'name': 'virrandommock' },
+  { 'name': 'virnumamock' },
 ]
 
 if host_machine.system() == 'linux'
   mock_libs += [
     { 'name': 'virfilemock' },
     { 'name': 'virnetdevbandwidthmock' },
-    { 'name': 'virnumamock' },
     { 'name': 'virtestmock' },
     { 'name': 'virusbmock' },
   ]
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 740d7a5db5..8bc0b5147f 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -830,6 +830,8 @@ mymain(void)
     linuxCaps = driver.caps;
     macOSCaps = testQemuCapsInitMacOS();
 
+    virFileWrapperAddPrefix("/sys/devices/system",
+                            abs_srcdir "/vircaps2xmldata/linux-basic/system");
     virFileWrapperAddPrefix(SYSCONFDIR "/qemu/firmware",
                             abs_srcdir "/qemufirmwaredata/etc/qemu/firmware");
     virFileWrapperAddPrefix(PREFIX "/share/qemu/firmware",
@@ -2908,7 +2910,8 @@ VIR_TEST_MAIN_PRELOAD(mymain,
                       VIR_TEST_MOCK("domaincaps"),
                       VIR_TEST_MOCK("virrandom"),
                       VIR_TEST_MOCK("qemucpu"),
-                      VIR_TEST_MOCK("virpci"))
+                      VIR_TEST_MOCK("virpci"),
+                      VIR_TEST_MOCK("virnuma"))
 
 #else
 
-- 
2.39.2
Re: [PATCH 04/14] qemuxml2argvtest: Use virnuma mock
Posted by Andrea Bolognani 2 years, 9 months ago
On Wed, Mar 08, 2023 at 12:14:31PM +0100, Michal Privoznik wrote:
> While no part of cmd line building process currently depends on a
> host NUMA configuration, this will change soon. Use freshly
> changed virnumamock from qemuxml2argvtest and make the mock read
> NUMA data from vircaps2xmldata which seems to have the most rich
> NUMA configuration.
>
> This also means, we have to start building virnumamock
> unconditionally. But this is not a problem, since nothing inside
> of the mock relies on Linux specificity. The whole mock is merely
> just reading files and parsing them.
>
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  tests/meson.build        | 2 +-
>  tests/qemuxml2argvtest.c | 5 ++++-
>  2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tests/meson.build b/tests/meson.build
> index 15b049c6ac..44a04698cf 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -88,13 +88,13 @@ mock_libs = [
>    { 'name': 'virportallocatormock' },
>    { 'name': 'virprocessmock' },
>    { 'name': 'virrandommock' },
> +  { 'name': 'virnumamock' },
>  ]

Please keep this list sorted.

-- 
Andrea Bolognani / Red Hat / Virtualization