From nobody Sun Feb 8 20:13:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1629294698; cv=none; d=zohomail.com; s=zohoarc; b=BogX3ORl4gr/EJqH4YqxrU0H5Vp9E+Ss5rcuGBoudjp+fPEEJNVS+7buP77I3UYYwe5a6iuXHgkQZXIrGJt36/x3hVsp9WcKbsz1k1r1Kh3GrJR2BQ2Dd0RTuTZ44l7FNuZiYd17NfF6iWq369Sanb/fBbhcKn7T37JoQMvUGVY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629294698; 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; bh=uuWc6bgIjpbz/UUXC1l4iQeaNt1AvRuq1c/hpFtTCTE=; b=TsPN0yEaoOdLd+PScR2Zy8pQi9Okth9/1J0C4stXQVw0FTdL5VFaxM9WgSW5ErCRW5whFPeulBEZtKwgXS/YpePOYd3SLBjTu91hi6DZGIy9FzhILUct0hIwnuK1nKzzn0GLKNC5EUFB7/sSo/actE0eI/Bcnuo2BvnJTpzmeEU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1629294698969131.4781082781916; Wed, 18 Aug 2021 06:51:38 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-314-Px-Qa_sBOd6mG-rRxcyDyg-1; Wed, 18 Aug 2021 09:51:36 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E3B56192D787; Wed, 18 Aug 2021 13:51:26 +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 C31795D9DE; Wed, 18 Aug 2021 13:51:26 +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 91FD05002D; Wed, 18 Aug 2021 13:51:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17IDpKqC007095 for ; Wed, 18 Aug 2021 09:51:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5232460C81; Wed, 18 Aug 2021 13:51:20 +0000 (UTC) Received: from bart.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id D0D0861096 for ; Wed, 18 Aug 2021 13:51:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629294697; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=uuWc6bgIjpbz/UUXC1l4iQeaNt1AvRuq1c/hpFtTCTE=; b=JleMgXc5/V+qOKQsSzBI8QiYMvaV+DNNmYPg5UjPBccPInduq7ssEBNEw56c7UxgLc2ybP 5lyeQ+3kYwsdhFWNAAz+Lpi+umXRuliXzC+Xh+VTOAhaVr1eSZd9BcWsJ8S1mrxog1kHYe Ev4DMedHBWX08rhJMoU42JxgkyHHo0E= X-MC-Unique: Px-Qa_sBOd6mG-rRxcyDyg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/3] vmx2xmltest: Deduplicate DO_TEST*() arguments Date: Wed, 18 Aug 2021 15:51:11 +0200 Message-Id: <89024ec6bfb07e69149028cc21fc4c88178435a3.1629294559.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1629294700571100001 Content-Type: text/plain; charset="utf-8" In majority of DO_TEST() and DO_TEST_FAIL() calls the input vmx file name is the same as the output XML file. Therefore, it's not necessary to provide the same string twice. For the rest, where the output XML file is different we can use symlinks to the expected output. Signed-off-by: Michal Privoznik --- ...x2xml-cdrom-ide-file-missing-datastore.xml | 1 + .../vmx2xml-cdrom-ide-file-missing-file.xml | 1 + .../vmx2xml-serial-pipe-client-app.xml | 1 + .../vmx2xml-serial-pipe-server-vm.xml | 1 + tests/vmx2xmltest.c | 155 +++++++++--------- 5 files changed, 81 insertions(+), 78 deletions(-) create mode 120000 tests/vmx2xmldata/vmx2xml-cdrom-ide-file-missing-datast= ore.xml create mode 120000 tests/vmx2xmldata/vmx2xml-cdrom-ide-file-missing-file.x= ml create mode 120000 tests/vmx2xmldata/vmx2xml-serial-pipe-client-app.xml create mode 120000 tests/vmx2xmldata/vmx2xml-serial-pipe-server-vm.xml diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-file-missing-datastore.xml= b/tests/vmx2xmldata/vmx2xml-cdrom-ide-file-missing-datastore.xml new file mode 120000 index 0000000000..87e5c1d22d --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-file-missing-datastore.xml @@ -0,0 +1 @@ +vmx2xml-cdrom-ide-empty.xml \ No newline at end of file diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-file-missing-file.xml b/te= sts/vmx2xmldata/vmx2xml-cdrom-ide-file-missing-file.xml new file mode 120000 index 0000000000..87e5c1d22d --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-file-missing-file.xml @@ -0,0 +1 @@ +vmx2xml-cdrom-ide-empty.xml \ No newline at end of file diff --git a/tests/vmx2xmldata/vmx2xml-serial-pipe-client-app.xml b/tests/v= mx2xmldata/vmx2xml-serial-pipe-client-app.xml new file mode 120000 index 0000000000..d0b077d644 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-serial-pipe-client-app.xml @@ -0,0 +1 @@ +vmx2xml-serial-pipe.xml \ No newline at end of file diff --git a/tests/vmx2xmldata/vmx2xml-serial-pipe-server-vm.xml b/tests/vm= x2xmldata/vmx2xml-serial-pipe-server-vm.xml new file mode 120000 index 0000000000..d0b077d644 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-serial-pipe-server-vm.xml @@ -0,0 +1 @@ +vmx2xml-serial-pipe.xml \ No newline at end of file diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c index 00a87b3576..9f7f50b42d 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -110,8 +110,7 @@ testCompareFiles(const char *vmx, const char *xml, bool= should_fail_parse) } =20 struct testInfo { - const char *input; - const char *output; + const char *file; bool should_fail; }; =20 @@ -124,9 +123,9 @@ testCompareHelper(const void *data) char *xml =3D NULL; =20 vmx =3D g_strdup_printf("%s/vmx2xmldata/vmx2xml-%s.vmx", abs_srcdir, - info->input); + info->file); xml =3D g_strdup_printf("%s/vmx2xmldata/vmx2xml-%s.xml", abs_srcdir, - info->output); + info->file); =20 ret =3D testCompareFiles(vmx, xml, info->should_fail); =20 @@ -191,18 +190,18 @@ mymain(void) { int ret =3D 0; =20 -# define DO_TEST_FULL(_in, _out, _should_fail) \ +# define DO_TEST_FULL(file, should_fail) \ do { \ - struct testInfo info =3D { _in, _out, _should_fail }; \ + struct testInfo info =3D { file, should_fail }; \ virResetLastError(); \ - if (virTestRun("VMware VMX-2-XML "_in" -> "_out, \ + if (virTestRun("VMware VMX-2-XML " file, \ testCompareHelper, &info) < 0) { \ ret =3D -1; \ } \ } while (0) =20 -# define DO_TEST(_in, _out) DO_TEST_FULL(_in, _out, false) -# define DO_TEST_FAIL(_in, _out) DO_TEST_FULL(_in, _out, true) +# define DO_TEST(file) DO_TEST_FULL(file, false) +# define DO_TEST_FAIL(file) DO_TEST_FULL(file, true) =20 testCapsInit(); =20 @@ -218,100 +217,100 @@ mymain(void) ctx.autodetectSCSIControllerModel =3D NULL; ctx.datacenterPath =3D NULL; =20 - DO_TEST("case-insensitive-1", "case-insensitive-1"); - DO_TEST("case-insensitive-2", "case-insensitive-2"); + DO_TEST("case-insensitive-1"); + DO_TEST("case-insensitive-2"); =20 - DO_TEST("minimal", "minimal"); - DO_TEST("minimal-64bit", "minimal-64bit"); + DO_TEST("minimal"); + DO_TEST("minimal-64bit"); =20 - DO_TEST("graphics-vnc", "graphics-vnc"); + DO_TEST("graphics-vnc"); =20 - DO_TEST("scsi-driver", "scsi-driver"); - DO_TEST("scsi-writethrough", "scsi-writethrough"); + DO_TEST("scsi-driver"); + DO_TEST("scsi-writethrough"); =20 - DO_TEST("harddisk-scsi-file", "harddisk-scsi-file"); - DO_TEST("harddisk-ide-file", "harddisk-ide-file"); - DO_TEST("harddisk-transient", "harddisk-transient"); + DO_TEST("harddisk-scsi-file"); + DO_TEST("harddisk-ide-file"); + DO_TEST("harddisk-transient"); =20 - DO_TEST("cdrom-scsi-file", "cdrom-scsi-file"); - DO_TEST("cdrom-scsi-empty", "cdrom-scsi-empty"); - DO_TEST("cdrom-scsi-device", "cdrom-scsi-device"); - DO_TEST("cdrom-scsi-raw-device", "cdrom-scsi-raw-device"); - DO_TEST("cdrom-scsi-raw-auto-detect", "cdrom-scsi-raw-auto-detect"); - DO_TEST("cdrom-scsi-passthru", "cdrom-scsi-passthru"); - DO_TEST("cdrom-ide-file", "cdrom-ide-file"); - DO_TEST("cdrom-ide-empty", "cdrom-ide-empty"); - DO_TEST("cdrom-ide-empty-2", "cdrom-ide-empty-2"); - DO_TEST("cdrom-ide-device", "cdrom-ide-device"); - DO_TEST("cdrom-ide-raw-device", "cdrom-ide-raw-device"); - DO_TEST("cdrom-ide-raw-auto-detect", "cdrom-ide-raw-auto-detect"); + DO_TEST("cdrom-scsi-file"); + DO_TEST("cdrom-scsi-empty"); + DO_TEST("cdrom-scsi-device"); + DO_TEST("cdrom-scsi-raw-device"); + DO_TEST("cdrom-scsi-raw-auto-detect"); + DO_TEST("cdrom-scsi-passthru"); + DO_TEST("cdrom-ide-file"); + DO_TEST("cdrom-ide-empty"); + DO_TEST("cdrom-ide-empty-2"); + DO_TEST("cdrom-ide-device"); + DO_TEST("cdrom-ide-raw-device"); + DO_TEST("cdrom-ide-raw-auto-detect"); =20 - DO_TEST("cdrom-ide-file-missing-datastore", "cdrom-ide-empty"); - DO_TEST("cdrom-ide-file-missing-file", "cdrom-ide-empty"); + DO_TEST("cdrom-ide-file-missing-datastore"); + DO_TEST("cdrom-ide-file-missing-file"); =20 - DO_TEST_FAIL("harddisk-ide-file-missing-datastore", "harddisk-ide-file= "); - DO_TEST_FAIL("harddisk-scsi-file-missing-file", "harddisk-scsi-file"); + DO_TEST_FAIL("harddisk-ide-file-missing-datastore"); + DO_TEST_FAIL("harddisk-scsi-file-missing-file"); =20 - DO_TEST("floppy-file", "floppy-file"); - DO_TEST("floppy-device", "floppy-device"); + DO_TEST("floppy-file"); + DO_TEST("floppy-device"); =20 - DO_TEST("sharedfolder", "sharedfolder"); + DO_TEST("sharedfolder"); =20 - DO_TEST("ethernet-e1000", "ethernet-e1000"); - DO_TEST("ethernet-vmxnet2", "ethernet-vmxnet2"); + DO_TEST("ethernet-e1000"); + DO_TEST("ethernet-vmxnet2"); =20 - DO_TEST("ethernet-custom", "ethernet-custom"); - DO_TEST("ethernet-bridged", "ethernet-bridged"); - DO_TEST("ethernet-nat", "ethernet-nat"); + DO_TEST("ethernet-custom"); + DO_TEST("ethernet-bridged"); + DO_TEST("ethernet-nat"); =20 - DO_TEST("ethernet-generated", "ethernet-generated"); - DO_TEST("ethernet-static", "ethernet-static"); - DO_TEST("ethernet-vpx", "ethernet-vpx"); - DO_TEST("ethernet-other", "ethernet-other"); + DO_TEST("ethernet-generated"); + DO_TEST("ethernet-static"); + DO_TEST("ethernet-vpx"); + DO_TEST("ethernet-other"); =20 - DO_TEST("serial-file", "serial-file"); - DO_TEST("serial-device", "serial-device"); - DO_TEST("serial-pipe-client-app", "serial-pipe"); - DO_TEST("serial-pipe-server-vm", "serial-pipe"); - DO_TEST("serial-network-server", "serial-network-server"); - DO_TEST("serial-network-client", "serial-network-client"); + DO_TEST("serial-file"); + DO_TEST("serial-device"); + DO_TEST("serial-pipe-client-app"); + DO_TEST("serial-pipe-server-vm"); + DO_TEST("serial-network-server"); + DO_TEST("serial-network-client"); =20 - DO_TEST("parallel-file", "parallel-file"); - DO_TEST("parallel-device", "parallel-device"); + DO_TEST("parallel-file"); + DO_TEST("parallel-device"); =20 - DO_TEST("esx-in-the-wild-1", "esx-in-the-wild-1"); - DO_TEST("esx-in-the-wild-2", "esx-in-the-wild-2"); - DO_TEST("esx-in-the-wild-3", "esx-in-the-wild-3"); - DO_TEST("esx-in-the-wild-4", "esx-in-the-wild-4"); - DO_TEST("esx-in-the-wild-5", "esx-in-the-wild-5"); - DO_TEST("esx-in-the-wild-6", "esx-in-the-wild-6"); - DO_TEST("esx-in-the-wild-7", "esx-in-the-wild-7"); - DO_TEST("esx-in-the-wild-8", "esx-in-the-wild-8"); - DO_TEST("esx-in-the-wild-9", "esx-in-the-wild-9"); - DO_TEST("esx-in-the-wild-10", "esx-in-the-wild-10"); - DO_TEST("esx-in-the-wild-11", "esx-in-the-wild-11"); + DO_TEST("esx-in-the-wild-1"); + DO_TEST("esx-in-the-wild-2"); + DO_TEST("esx-in-the-wild-3"); + DO_TEST("esx-in-the-wild-4"); + DO_TEST("esx-in-the-wild-5"); + DO_TEST("esx-in-the-wild-6"); + DO_TEST("esx-in-the-wild-7"); + DO_TEST("esx-in-the-wild-8"); + DO_TEST("esx-in-the-wild-9"); + DO_TEST("esx-in-the-wild-10"); + DO_TEST("esx-in-the-wild-11"); =20 - DO_TEST("gsx-in-the-wild-1", "gsx-in-the-wild-1"); - DO_TEST("gsx-in-the-wild-2", "gsx-in-the-wild-2"); - DO_TEST("gsx-in-the-wild-3", "gsx-in-the-wild-3"); - DO_TEST("gsx-in-the-wild-4", "gsx-in-the-wild-4"); + DO_TEST("gsx-in-the-wild-1"); + DO_TEST("gsx-in-the-wild-2"); + DO_TEST("gsx-in-the-wild-3"); + DO_TEST("gsx-in-the-wild-4"); =20 - DO_TEST("ws-in-the-wild-1", "ws-in-the-wild-1"); - DO_TEST("ws-in-the-wild-2", "ws-in-the-wild-2"); + DO_TEST("ws-in-the-wild-1"); + DO_TEST("ws-in-the-wild-2"); =20 - DO_TEST("fusion-in-the-wild-1", "fusion-in-the-wild-1"); + DO_TEST("fusion-in-the-wild-1"); =20 - DO_TEST("annotation", "annotation"); + DO_TEST("annotation"); =20 - DO_TEST("smbios", "smbios"); + DO_TEST("smbios"); =20 - DO_TEST("svga", "svga"); + DO_TEST("svga"); =20 - DO_TEST("firmware-efi", "firmware-efi"); + DO_TEST("firmware-efi"); =20 ctx.datacenterPath =3D "folder1/folder2/datacenter1"; =20 - DO_TEST("datacenterpath", "datacenterpath"); + DO_TEST("datacenterpath"); =20 virObjectUnref(caps); virObjectUnref(xmlopt); --=20 2.31.1