Hi, I have attached this patch as a response to a recent failure observed on PowerPC architecture by commit 311b4a67. This patch introduces a check for dynamically obtaining system page size for test hugepages-pages6 under 'qemuxml2argv' suite. ( See patch for more verbose problem description) This patch is not the most perfect implementation -- it fails syntax check; and has a Makefile-driven cleanup pending. I will be happy to deck it up and send it if the community concurs with this approach. We could also implement this via a shell script ( just like 'virt-test-aa-helper') but I couldnt find an easy way to determine host page size. Awaiting community responses, Prerna >From 8a64d4d22e2e65158d3caa45b615ca9a263f841f Mon Sep 17 00:00:00 2001 From: Prerna Saxena <prerna@xxxxxxxxxxxxxxxxxx> Date: Mon, 2 Feb 2015 10:48:48 +0530 Subject: [PATCH] Commit 311b4a67 introduces a test for normal-page backed guest XML. However, it hardcodes the page size to 4 KB which is only valid for Intel Make check consequently fails on PowerPC where page size is 64KB This makes the hugepages-pages6 test more modular, and enables the page size to be picked up at runtime. --- .../qemuxml2argv-hugepages-pages6.template | 32 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 24 +++++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages6.template diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages6.template b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages6.template new file mode 100644 index 0000000..8b9b995 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages6.template @@ -0,0 +1,32 @@ +<domain type='qemu'> + <name>SomeDummyHugepagesGuest</name> + <uuid>ef1bdff4-27f3-4e85-a807-5fb4d58463cc</uuid> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</currentMemory> + <memoryBacking> + <hugepages> + <page size='%llu' unit='KiB'/> + </hugepages> + </memoryBacking> + <vcpu placement='static'>2</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='usb' index='0'/> + <controller type='ide' index='0'/> + <controller type='pci' index='0' model='pci-root'/> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 89afa81..a16d937 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -479,6 +479,11 @@ mymain(void) { int ret = 0; bool skipLegacyCPUs = false; + const long system_page_size = sysconf(_SC_PAGESIZE) / 1024; + int fd_in; + FILE *f_out; + char *template, *xml = NULL; + char buf[1000]; abs_top_srcdir = getenv("abs_top_srcdir"); if (!abs_top_srcdir) @@ -702,7 +707,24 @@ mymain(void) DO_TEST_FAILURE("hugepages-pages4", QEMU_CAPS_MEM_PATH, QEMU_CAPS_OBJECT_MEMORY_RAM, QEMU_CAPS_OBJECT_MEMORY_FILE); DO_TEST("hugepages-pages5", QEMU_CAPS_MEM_PATH); - DO_TEST("hugepages-pages6", NONE); + + if (virAsprintf(&template, "%s/qemuxml2argvdata/qemuxml2argv-%s.template", + abs_srcdir, "hugepages-pages6") < 0 || + virAsprintf(&xml, "%s/qemuxml2argvdata/qemuxml2argv-%s.xml", + abs_srcdir, "hugepages-pages6") < 0) + return EXIT_FAILURE; + fd_in = open(template, O_RDONLY); + f_out = fopen(xml, "w"); + + if ( fd_in != -1 && f_out != NULL ) { + if(read(fd_in, &buf, sizeof(buf))) { + fprintf(f_out, buf,system_page_size); + fclose(f_out); + close(fd_in); + DO_TEST("hugepages-pages6", NONE); + } + } + DO_TEST("nosharepages", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MEM_MERGE); DO_TEST("disk-cdrom", NONE); DO_TEST("disk-cdrom-network-http", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE, -- 1.9.3 -- Prerna Saxena Linux Technology Centre, IBM Systems and Technology Lab, Bangalore, India -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list