[libvirt] [PATCH] Make tests independant of system page size

Michal Privoznik mprivozn at redhat.com
Mon Feb 2 12:32:19 UTC 2015


On 02.02.2015 12:10, Daniel P. Berrange wrote:
> Some code paths have special logic depending on the page size
> reported by sysconf, which in turn affects the test results.
> We must mock this so tests always have a consistent page size.
> ---
>  src/libvirt_private.syms |  2 ++
>  src/openvz/openvz_util.c |  5 +----
>  src/qemu/qemu_command.c  |  4 ++--
>  src/qemu/qemu_driver.c   |  6 +-----
>  src/util/virfile.c       |  2 +-
>  src/util/virnuma.c       |  6 +++---
>  src/util/virutil.c       | 13 +++++++++++++
>  src/util/virutil.h       |  3 +++
>  src/xen/xen_hypervisor.c |  4 ++--
>  tests/qemuxml2argvmock.c | 13 +++++++++++++
>  tests/qemuxml2argvtest.c |  1 +
>  11 files changed, 42 insertions(+), 17 deletions(-)

ACK with this squashed in:

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 791afe5..3b6eddc 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4540,7 +4540,7 @@ qemuBuildMemoryBackendStr(unsigned long long size,
     virDomainHugePagePtr master_hugepage = NULL;
     virDomainHugePagePtr hugepage = NULL;
     virDomainNumatuneMemMode mode;
-    const long system_page_size = sysconf(_SC_PAGESIZE) / 1024;
+    const long system_page_size = virGetSystemPageSizeKB();
     virMemAccess memAccess = def->cpu->cells[guestNode].memAccess;
     size_t i;
     char *mem_path = NULL;

Should we also introduce a syntax-check rule to prefer
virGetSystemPageSize*()?

Michal




More information about the libvir-list mailing list