Re: [libvirt] [PATCH v2 1/3] tests: qemuxml2argv: make CAPS_LATEST arch generic

2018-07-24 Thread Boris Fiuczynski

On 07/24/2018 01:59 PM, Peter Krempa wrote:

On Tue, Jul 24, 2018 at 13:31:04 +0200, Boris Fiuczynski wrote:

From: Bjoern Walk 

Testing with the latest capabilities has been x86_64 centric. Let's
remove the hardcoded architecture and give the user the ability to
specify the desired architecture in the macro.

Signed-off-by: Bjoern Walk 
Reviewed-by: Boris Fiuczynski 
---
  tests/qemuxml2argvtest.c | 96 ++--
  1 file changed, 54 insertions(+), 42 deletions(-)


[...]


@@ -746,9 +758,9 @@ mymain(void)
  # define DO_TEST_CAPS_VER(name, ver) \
  DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver)
  
-# define DO_TEST_CAPS_LATEST(name) \

-DO_TEST_CAPS_INTERNAL(name, "x86_64-latest", NULL, 0, 0, "x86_64", \
-  capslatest_x86_64, true)
+# define DO_TEST_CAPS_LATEST(name, arch) \
+DO_TEST_CAPS_INTERNAL(name, arch "-latest", NULL, 0, 0, arch, \
+  virHashLookup(capslatest, arch), true)


Please add a DO_TEST_CAPS_LATEST_ARCH version rather than modifying all
of the calls. We have a vast majority of x86_64 tests so we should not
need to change them.


I think that too many code changes (they are already available in this 
patch anyway) should not be the reason to hide the architecture x86_64 
in DO_TEST_CAPS_LATEST and to introduce a new macro 
DO_TEST_CAPS_LATEST_ARCH for all other architectures (including x86_64). 
Would you prefer architecture specific macros instead? e.g. rename 
DO_TEST_CAPS_LATEST to DO_TEST_CAPS_LATEST_X86_64 and create a new 
DO_TEST_CAPS_LATEST_S390.






--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list




--
Mit freundlichen Grüßen/Kind regards
   Boris Fiuczynski

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martina Köderitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH v2 1/3] tests: qemuxml2argv: make CAPS_LATEST arch generic

2018-07-24 Thread Peter Krempa
On Tue, Jul 24, 2018 at 13:31:04 +0200, Boris Fiuczynski wrote:
> From: Bjoern Walk 
> 
> Testing with the latest capabilities has been x86_64 centric. Let's
> remove the hardcoded architecture and give the user the ability to
> specify the desired architecture in the macro.
> 
> Signed-off-by: Bjoern Walk 
> Reviewed-by: Boris Fiuczynski 
> ---
>  tests/qemuxml2argvtest.c | 96 ++--
>  1 file changed, 54 insertions(+), 42 deletions(-)

[...]

> @@ -746,9 +758,9 @@ mymain(void)
>  # define DO_TEST_CAPS_VER(name, ver) \
>  DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver)
>  
> -# define DO_TEST_CAPS_LATEST(name) \
> -DO_TEST_CAPS_INTERNAL(name, "x86_64-latest", NULL, 0, 0, "x86_64", \
> -  capslatest_x86_64, true)
> +# define DO_TEST_CAPS_LATEST(name, arch) \
> +DO_TEST_CAPS_INTERNAL(name, arch "-latest", NULL, 0, 0, arch, \
> +  virHashLookup(capslatest, arch), true)

Please add a DO_TEST_CAPS_LATEST_ARCH version rather than modifying all
of the calls. We have a vast majority of x86_64 tests so we should not
need to change them.



signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH v2 1/3] tests: qemuxml2argv: make CAPS_LATEST arch generic

2018-07-24 Thread Boris Fiuczynski
From: Bjoern Walk 

Testing with the latest capabilities has been x86_64 centric. Let's
remove the hardcoded architecture and give the user the ability to
specify the desired architecture in the macro.

Signed-off-by: Bjoern Walk 
Reviewed-by: Boris Fiuczynski 
---
 tests/qemuxml2argvtest.c | 96 ++--
 1 file changed, 54 insertions(+), 42 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 1a936faef1..097dc6be51 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -621,10 +621,11 @@ testCompareXMLToArgv(const void *data)
 static int
 mymain(void)
 {
-int ret = 0;
+int ret = 0, i;
 char *fakerootdir;
 bool skipLegacyCPUs = false;
-char *capslatest_x86_64 = NULL;
+const char *archs[] = { "x86_64", "s390x" };
+virHashTablePtr capslatest = NULL;
 
 if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) {
 fprintf(stderr, "Out of memory\n");
@@ -693,12 +694,23 @@ mymain(void)
 if (VIR_STRDUP_QUIET(driver.config->memoryBackingDir, 
"/var/lib/libvirt/qemu/ram") < 0)
 return EXIT_FAILURE;
 
-if (!(capslatest_x86_64 = testQemuGetLatestCapsForArch(abs_srcdir 
"/qemucapabilitiesdata",
-   "x86_64", "xml")))
+capslatest = virHashCreate(4, virHashValueFree);
+if (!capslatest)
 return EXIT_FAILURE;
 
-VIR_TEST_VERBOSE("\nlatest caps x86_64: %s\n", capslatest_x86_64);
+VIR_TEST_VERBOSE("\n");
 
+for (i = 0; i < ARRAY_CARDINALITY(archs); ++i) {
+char *cap = testQemuGetLatestCapsForArch(abs_srcdir 
"/qemucapabilitiesdata",
+ archs[i], "xml");
+
+if (!cap || virHashAddEntry(capslatest, archs[i], cap) < 0)
+return EXIT_FAILURE;
+
+VIR_TEST_VERBOSE("latest caps for %s: %s\n", archs[i], cap);
+}
+
+VIR_TEST_VERBOSE("\n");
 
 /**
  * The following set of macros allows testing of XML -> argv conversion with a
@@ -746,9 +758,9 @@ mymain(void)
 # define DO_TEST_CAPS_VER(name, ver) \
 DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver)
 
-# define DO_TEST_CAPS_LATEST(name) \
-DO_TEST_CAPS_INTERNAL(name, "x86_64-latest", NULL, 0, 0, "x86_64", \
-  capslatest_x86_64, true)
+# define DO_TEST_CAPS_LATEST(name, arch) \
+DO_TEST_CAPS_INTERNAL(name, arch "-latest", NULL, 0, 0, arch, \
+  virHashLookup(capslatest, arch), true)
 
 /**
  * The following test macros should be used only in cases when the tests 
require
@@ -822,8 +834,8 @@ mymain(void)
 DO_TEST_PARSE_ERROR("minimal-no-memory", NONE);
 DO_TEST("minimal-msg-timestamp", QEMU_CAPS_MSG_TIMESTAMP);
 
-DO_TEST_CAPS_LATEST("genid");
-DO_TEST_CAPS_LATEST("genid-auto");
+DO_TEST_CAPS_LATEST("genid", "x86_64");
+DO_TEST_CAPS_LATEST("genid-auto", "x86_64");
 
 DO_TEST("machine-aliases1", NONE);
 DO_TEST("machine-aliases2", QEMU_CAPS_KVM);
@@ -989,15 +1001,15 @@ mymain(void)
 QEMU_CAPS_VIRTIO_SCSI);
 DO_TEST("nosharepages", QEMU_CAPS_MEM_MERGE);
 DO_TEST("disk-cdrom", NONE);
-DO_TEST_CAPS_LATEST("disk-cdrom");
+DO_TEST_CAPS_LATEST("disk-cdrom", "x86_64");
 DO_TEST("disk-iscsi", NONE);
 DO_TEST("disk-cdrom-network", QEMU_CAPS_KVM);
-DO_TEST_CAPS_LATEST("disk-cdrom-network");
+DO_TEST_CAPS_LATEST("disk-cdrom-network", "x86_64");
 DO_TEST("disk-cdrom-tray",
 QEMU_CAPS_VIRTIO_TX_ALG);
-DO_TEST_CAPS_LATEST("disk-cdrom-tray");
+DO_TEST_CAPS_LATEST("disk-cdrom-tray", "x86_64");
 DO_TEST("disk-floppy", NONE);
-DO_TEST_CAPS_LATEST("disk-floppy");
+DO_TEST_CAPS_LATEST("disk-floppy", "x86_64");
 DO_TEST_FAILURE("disk-floppy-pseries",
 QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
 DO_TEST("disk-floppy-tray", NONE);
@@ -1020,47 +1032,47 @@ mymain(void)
 QEMU_CAPS_DRIVE_BOOT);
 DO_TEST("floppy-drive-fat",
 QEMU_CAPS_DRIVE_BOOT);
-DO_TEST_CAPS_LATEST("floppy-drive-fat");
+DO_TEST_CAPS_LATEST("floppy-drive-fat", "x86_64");
 DO_TEST("disk-readonly-disk", NONE);
-DO_TEST_CAPS_LATEST("disk-readonly-disk");
+DO_TEST_CAPS_LATEST("disk-readonly-disk", "x86_64");
 DO_TEST("disk-fmt-qcow",
 QEMU_CAPS_DRIVE_BOOT);
 DO_TEST_PARSE_ERROR("disk-fmt-cow", QEMU_CAPS_DRIVE_BOOT);
 DO_TEST_PARSE_ERROR("disk-fmt-dir", QEMU_CAPS_DRIVE_BOOT);
 DO_TEST_PARSE_ERROR("disk-fmt-iso", QEMU_CAPS_DRIVE_BOOT);
 DO_TEST("disk-shared", NONE);
-DO_TEST_CAPS_LATEST("disk-shared");
+DO_TEST_CAPS_LATEST("disk-shared", "x86_64");
 DO_TEST_PARSE_ERROR("disk-shared-qcow", NONE);
 DO_TEST("disk-shared-locking",
 QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DISK_SHARE_RW);
 DO_TEST("disk-error-policy", NONE);
-DO_TEST_CAPS_LATEST("disk-error-policy");
+DO_TEST_CAPS_LATEST("disk-error-policy", "x86_64");
 DO_TEST("disk-cache",