From nobody Tue Apr 30 09:40:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1562081086; cv=none; d=zoho.com; s=zohoarc; b=kacw+F6FO3ueNzKgPx4sSNrxGa2PRpLpluKd1XcCx0iIssZcHRtQLasRT+h17Yac0G5nkvEYOB7ZC+M4lNu4BCR+nS0KXy5tRXTrCSQu0u2hR3gYqKUGpJ5GXyI/eJ8gp3JjTltE1jEu8Eq3SFHDy2XFT2dZEChjC++/hEf/AaY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562081086; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=yDJ7Tf7G6FmWYz5A/TIQ/PQTGbbfstRuVvsUJGtuCeU=; b=QgmWgpbOb8Hln4WdFO5n3ewKgu5/ZyYMM6WTcxlSkWFCSDoJ86658cA8W/eEQTsvb4BB9NsaWAwV/HgPKojU20uymZeDip0QQDWAHUut/HnJqH3s2evSaX9dUR4K1O8gmgQfUJG3sSnhy0CHbZtev93iAdlW0MVmsQ4EYe2sNjc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1562081086664847.9921600785212; Tue, 2 Jul 2019 08:24:46 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 934E830043F8; Tue, 2 Jul 2019 15:24:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E88C1001DEA; Tue, 2 Jul 2019 15:24:08 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id F14C6206D3; Tue, 2 Jul 2019 15:23:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x62FNmKL032091 for ; Tue, 2 Jul 2019 11:23:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 665B718250; Tue, 2 Jul 2019 15:23:48 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E312B17AA7 for ; Tue, 2 Jul 2019 15:23:47 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 2 Jul 2019 17:23:42 +0200 Message-Id: <20190702152343.30295-2-abologna@redhat.com> In-Reply-To: <20190702152343.30295-1-abologna@redhat.com> References: <20190702152343.30295-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] tests: Add more DO_TEST_CAPS_*() macros X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 02 Jul 2019 15:24:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Right now we have macros such as DO_TEST_CAPS_LATEST_PARSE_ERROR() and DO_TEST_CAPS_ARCH_VER(), but there is no concise way to say "using this version of QEMU on this architecture will result in a failure". This commit adds DO_TEST_CAPS_ARCH_LATEST_FAILURE() DO_TEST_CAPS_ARCH_VER_FAILURE() DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR() DO_TEST_CAPS_ARCH_VER_PARSE_ERROR() and also slightly reworks DO_TEST_CAPS_LATEST_PARSE_ERROR() DO_TEST_CAPS_ARCH_VER() so that they use the closest more specific macro in their implementation instead of going further back towards the more generic building blocks. The ordering is also altered so that it's both more logical and fully consistent between xml2argv and xml2xml. Signed-off-by: Andrea Bolognani --- tests/qemuxml2argvtest.c | 43 ++++++++++++++++++++++++++++++---------- tests/qemuxml2xmltest.c | 32 ++++++++++++++++-------------- 2 files changed, 50 insertions(+), 25 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 91ca35d469..8d725040d3 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -712,29 +712,52 @@ mymain(void) ARG_CAPS_VER, ver, \ __VA_ARGS__) =20 -# define DO_TEST_CAPS_ARCH_VER(name, arch, ver) \ - DO_TEST_CAPS_INTERNAL(name, arch, ver, ARG_END) - -# define DO_TEST_CAPS_VER(name, ver) \ - DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver) - # define DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ...) \ DO_TEST_CAPS_INTERNAL(name, arch, "latest", __VA_ARGS__) =20 +# define DO_TEST_CAPS_ARCH_VER_FULL(name, arch, ver, ...) \ + DO_TEST_CAPS_INTERNAL(name, arch, ver, __VA_ARGS__) + # define DO_TEST_CAPS_ARCH_LATEST(name, arch) \ DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ARG_END) =20 +# define DO_TEST_CAPS_ARCH_VER(name, arch, ver) \ + DO_TEST_CAPS_ARCH_VER_FULL(name, arch, ver, ARG_END) + # define DO_TEST_CAPS_LATEST(name) \ DO_TEST_CAPS_ARCH_LATEST(name, "x86_64") =20 -# define DO_TEST_CAPS_LATEST_FAILURE(name) \ - DO_TEST_CAPS_ARCH_LATEST_FULL(name, "x86_64", \ +# define DO_TEST_CAPS_VER(name, ver) \ + DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver) + +# define DO_TEST_CAPS_ARCH_LATEST_FAILURE(name, arch) \ + DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, \ ARG_FLAGS, FLAG_EXPECT_FAILURE) =20 -# define DO_TEST_CAPS_LATEST_PARSE_ERROR(name) \ - DO_TEST_CAPS_ARCH_LATEST_FULL(name, "x86_64", \ +# define DO_TEST_CAPS_ARCH_VER_FAILURE(name, arch, ver) \ + DO_TEST_CAPS_ARCH_VER_FULL(name, arch, ver, \ + ARG_FLAGS, FLAG_EXPECT_FAILURE) + +# define DO_TEST_CAPS_LATEST_FAILURE(name) \ + DO_TEST_CAPS_ARCH_LATEST_FAILURE(name, "x86_64") + +# define DO_TEST_CAPS_VER_FAILURE(name, ver) \ + DO_TEST_CAPS_ARCH_VER_FAILURE(name, "x86_64", ver) + +# define DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR(name, arch) \ + DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, \ ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR) =20 +# define DO_TEST_CAPS_ARCH_VER_PARSE_ERROR(name, arch, ver) \ + DO_TEST_CAPS_ARCH_VER_FULL(name, arch, ver, \ + ARG_FLAGS, FLAG_EXPECT_PARSE_ERROR) + +# define DO_TEST_CAPS_LATEST_PARSE_ERROR(name) \ + DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR(name, "x86_64") + +# define DO_TEST_CAPS_VER_PARSE_ERROR(name, ver) \ + DO_TEST_CAPS_ARCH_VER_PARSE_ERROR(name, "x86_64", ver) + =20 # define DO_TEST_FULL(name, ...) \ DO_TEST_INTERNAL(name, "", \ diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index a64b17ac28..6d808e172f 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -207,36 +207,38 @@ mymain(void) testQemuInfoClear(&info); \ } while (0) =20 -# define NONE QEMU_CAPS_LAST - -# define DO_TEST_FULL(name, when, ...) \ - DO_TEST_INTERNAL(name, "", when, __VA_ARGS__) - -# define DO_TEST(name, ...) \ - DO_TEST_FULL(name, WHEN_BOTH, \ - ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST) - # define DO_TEST_CAPS_INTERNAL(name, arch, ver, ...) \ DO_TEST_INTERNAL(name, "." arch "-" ver, WHEN_BOTH, \ ARG_CAPS_ARCH, arch, \ ARG_CAPS_VER, ver, \ __VA_ARGS__) =20 -# define DO_TEST_CAPS_ARCH_VER(name, arch, ver) \ - DO_TEST_CAPS_INTERNAL(name, arch, ver, ARG_END) - -# define DO_TEST_CAPS_VER(name, ver) \ - DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver) - # define DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ...) \ DO_TEST_CAPS_INTERNAL(name, arch, "latest", __VA_ARGS__) =20 +# define DO_TEST_CAPS_ARCH_VER_FULL(name, arch, ver, ...) \ + DO_TEST_CAPS_INTERNAL(name, arch, ver, __VA_ARGS__) + # define DO_TEST_CAPS_ARCH_LATEST(name, arch) \ DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ARG_END) =20 +# define DO_TEST_CAPS_ARCH_VER(name, arch, ver) \ + DO_TEST_CAPS_ARCH_VER_FULL(name, arch, ver, ARG_END) + # define DO_TEST_CAPS_LATEST(name) \ DO_TEST_CAPS_ARCH_LATEST(name, "x86_64") =20 +# define DO_TEST_CAPS_VER(name, ver) \ + DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver) + +# define DO_TEST_FULL(name, when, ...) \ + DO_TEST_INTERNAL(name, "", when, __VA_ARGS__) + +# define DO_TEST(name, ...) \ + DO_TEST_FULL(name, WHEN_BOTH, \ + ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST) + +# define NONE QEMU_CAPS_LAST =20 /* Unset or set all envvars here that are copied in qemudBuildCommandL= ine * using ADD_ENV_COPY, otherwise these tests may fail due to unexpected --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 30 09:40:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1562081130; cv=none; d=zoho.com; s=zohoarc; b=gBGvLl2uqWcEunQqF/1DMcAS13/kc8C3SuOJVHOdXhaGlOc1UdHa9C+Luvd6cm5tt9fdHN3ElX8Ykdga68nsgggzTCao9aXoL81lUbJRd5A+ZoX39KRHf7lW3Dj4GOX3HekgPtGtYS7jTrGpuvg6CtUoE+g+n5iPPBoHlhlDRTA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562081130; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=8/20gtBQR/gV8jNycRDbvkkgMTUiavuT7PPQmf19XLc=; b=UMVfXUBEWDp9QeFKwj9W1C5nv+mgNOS3QP0QJ0fzWnmI1pOmqU4GSp2gd5lv/wBiExITLbch5xvw23T6fNdQ0wPfoGx/UuVJtP1mUQ/eUghcm9w1wF6ozHHRVBnkZkKWqJXmpHL4VsAIqu4VxeONDARMvjtToHVuXloh8wZaf9Q= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1562081130792303.0410007040226; Tue, 2 Jul 2019 08:25:30 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 50747307D864; Tue, 2 Jul 2019 15:25:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 04C501001DEA; Tue, 2 Jul 2019 15:25:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A424518433A1; Tue, 2 Jul 2019 15:25:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x62FNnAq032111 for ; Tue, 2 Jul 2019 11:23:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 34EA318C78; Tue, 2 Jul 2019 15:23:49 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B17D018250 for ; Tue, 2 Jul 2019 15:23:48 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 2 Jul 2019 17:23:43 +0200 Message-Id: <20190702152343.30295-3-abologna@redhat.com> In-Reply-To: <20190702152343.30295-1-abologna@redhat.com> References: <20190702152343.30295-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] tests: Use the new DO_TEST_CAPS_*() macros X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 02 Jul 2019 15:25:24 +0000 (UTC) Content-Type: text/plain; charset="utf-8" There are probably more situations where they could be taken advantage of, but these are very obvious scenarios because we either manage to get rid of a bunch of explicit capabilities, or we make a bunch of related test cases all use the macros by switching the only odd one out. Signed-off-by: Andrea Bolognani --- tests/qemuxml2argvtest.c | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 8d725040d3..08697e91d6 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2849,7 +2849,7 @@ mymain(void) DO_TEST_CAPS_LATEST("intel-iommu-caching-mode"); DO_TEST_CAPS_LATEST("intel-iommu-eim"); DO_TEST_CAPS_LATEST("intel-iommu-device-iotlb"); - DO_TEST_PARSE_ERROR("intel-iommu-wrong-machine", NONE); + DO_TEST_CAPS_LATEST_PARSE_ERROR("intel-iommu-wrong-machine"); DO_TEST_CAPS_ARCH_LATEST("iommu-smmuv3", "aarch64"); =20 DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS); @@ -2915,29 +2915,9 @@ mymain(void) DO_TEST_CAPS_LATEST("disk-virtio-scsi-reservations"); =20 DO_TEST_CAPS_LATEST("tseg-explicit-size"); - DO_TEST_PARSE_ERROR("tseg-i440fx", - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_MACHINE_SMM_OPT, - QEMU_CAPS_VIRTIO_SCSI, - QEMU_CAPS_MCH_EXTENDED_TSEG_MBYTES); - DO_TEST_PARSE_ERROR("tseg-explicit-size", - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_MACHINE_SMM_OPT, - QEMU_CAPS_VIRTIO_SCSI); - DO_TEST_PARSE_ERROR("tseg-invalid-size", - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_MACHINE_SMM_OPT, - QEMU_CAPS_VIRTIO_SCSI, - QEMU_CAPS_MCH_EXTENDED_TSEG_MBYTES); + DO_TEST_CAPS_LATEST_PARSE_ERROR("tseg-i440fx"); + DO_TEST_CAPS_VER_PARSE_ERROR("tseg-explicit-size", "2.10.0"); + DO_TEST_CAPS_LATEST_PARSE_ERROR("tseg-invalid-size"); =20 DO_TEST("video-virtio-gpu-ccw", QEMU_CAPS_CCW, QEMU_CAPS_DEVICE_VIRTIO_GPU, @@ -2971,10 +2951,7 @@ mymain(void) DO_TEST_CAPS_VER("virtio-non-transitional", "3.1.0"); DO_TEST_CAPS_LATEST("virtio-transitional"); DO_TEST_CAPS_LATEST("virtio-non-transitional"); - DO_TEST_PARSE_ERROR("virtio-transitional-not-supported", - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420); + DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-transitional-not-supported"); =20 /* Simple headless guests for various architectures */ DO_TEST_CAPS_ARCH_LATEST("aarch64-virt-headless", "aarch64"); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list