From nobody Tue May 14 20:58:11 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1704730131775237.9649215551451; Mon, 8 Jan 2024 08:08:51 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 805471AB3; Mon, 8 Jan 2024 11:08:50 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id E764F19C4; Mon, 8 Jan 2024 11:06:06 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 0BAB119B4; Mon, 8 Jan 2024 11:06:00 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 686B119AC for ; Mon, 8 Jan 2024 11:05:59 -0500 (EST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-380-_UdqSRhWNQ-54pm3SETrEw-1; Mon, 08 Jan 2024 11:05:57 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4C2DC8489A0 for ; Mon, 8 Jan 2024 16:05:57 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7141C15E6A for ; Mon, 8 Jan 2024 16:05:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: _UdqSRhWNQ-54pm3SETrEw-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 01/23] virschematest: Add possibility to have exceptions from the '-invalid' suffix Date: Mon, 8 Jan 2024 17:05:31 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: ZHM5XNWB5ECR2PSS5WIHOJWP7VZCRKON X-Message-ID-Hash: ZHM5XNWB5ECR2PSS5WIHOJWP7VZCRKON X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1704730133071100001 The exception is needed in qemuxml2xmltest which is in one instance testing update from an invalid config to a valid one. Currently the compliance with the test is achieved via a hack. As further patches will be simpler without the hack present we need a way to invert the expected output in specific cases. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- ...network-invalid-inactive.x86_64-latest.xml | 1 - ...m-empty-network-invalid.x86_64-latest.xml} | 0 tests/virschematest.c | 40 ++++++++++++++----- 3 files changed, 31 insertions(+), 10 deletions(-) delete mode 120000 tests/qemuxml2xmloutdata/disk-cdrom-empty-network-inval= id-inactive.x86_64-latest.xml rename tests/qemuxml2xmloutdata/{disk-cdrom-empty-network-invalid-active.x= 86_64-latest.xml =3D> disk-cdrom-empty-network-invalid.x86_64-latest.xml} (= 100%) diff --git a/tests/qemuxml2xmloutdata/disk-cdrom-empty-network-invalid-inac= tive.x86_64-latest.xml b/tests/qemuxml2xmloutdata/disk-cdrom-empty-network-= invalid-inactive.x86_64-latest.xml deleted file mode 120000 index 9733ff06a7..0000000000 --- a/tests/qemuxml2xmloutdata/disk-cdrom-empty-network-invalid-inactive.x8= 6_64-latest.xml +++ /dev/null @@ -1 +0,0 @@ -disk-cdrom-empty-network-invalid-active.x86_64-latest.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/disk-cdrom-empty-network-invalid-acti= ve.x86_64-latest.xml b/tests/qemuxml2xmloutdata/disk-cdrom-empty-network-in= valid.x86_64-latest.xml similarity index 100% rename from tests/qemuxml2xmloutdata/disk-cdrom-empty-network-invalid-activ= e.x86_64-latest.xml rename to tests/qemuxml2xmloutdata/disk-cdrom-empty-network-invalid.x86_64-= latest.xml diff --git a/tests/virschematest.c b/tests/virschematest.c index c7bfd372c9..24ddb042c1 100644 --- a/tests/virschematest.c +++ b/tests/virschematest.c @@ -33,6 +33,9 @@ struct testSchemaEntry { /* if dirRegex is non-NULL the provided regular expression is used to = match * the file names in a directory (without path prefixed) and only matc= hing * files are validated */ + const char **exceptions; /* optional NULL terminated list of filenames= inside + directory where the expected validation re= sult is + inverted */ const char *dirRegex; const char *file; }; @@ -40,6 +43,7 @@ struct testSchemaEntry { struct testSchemaData { virXMLValidator *validator; + bool exception; const char *xml_path; }; @@ -53,6 +57,9 @@ testSchemaValidateXML(const void *args) bool shouldFail =3D !!strstr(data->xml_path, "-invalid."); g_autoptr(xmlDoc) xml =3D NULL; + if (data->exception) + shouldFail =3D !shouldFail; + if (!(xml =3D virXMLParseFileCtxt(data->xml_path, NULL))) return -1; @@ -66,12 +73,14 @@ testSchemaValidateXML(const void *args) static int testSchemaFile(const char *schema, virXMLValidator *validator, - const char *path) + const char *path, + bool exception) { g_autofree char *test_name =3D NULL; struct testSchemaData data =3D { .validator =3D validator, .xml_path =3D path, + .exception =3D exception, }; test_name =3D g_strdup_printf("Checking %s against %s", path, schema); @@ -84,7 +93,7 @@ static int testSchemaDir(const char *schema, virXMLValidator *validator, const char *dir_path, - const char *filterstr) + const struct testSchemaEntry *entry) { g_autoptr(DIR) dir =3D NULL; struct dirent *ent; @@ -97,17 +106,18 @@ testSchemaDir(const char *schema, return -1; } - if (filterstr) { + if (entry->dirRegex) { g_autoptr(GError) err =3D NULL; - if (!(filter =3D g_regex_new(filterstr, 0, 0, &err))) { - VIR_TEST_VERBOSE("\nfailed to compile regex '%s': %s", filters= tr, err->message); + if (!(filter =3D g_regex_new(entry->dirRegex, 0, 0, &err))) { + VIR_TEST_VERBOSE("\nfailed to compile regex '%s': %s", entry->= dirRegex, err->message); return -1; } } while ((rc =3D virDirRead(dir, &ent, dir_path)) > 0) { g_autofree char *xml_path =3D NULL; + bool exception =3D false; if (!virStringHasSuffix(ent->d_name, ".xml")) continue; @@ -117,9 +127,12 @@ testSchemaDir(const char *schema, !g_regex_match(filter, ent->d_name, 0, NULL)) continue; + if (entry->exceptions) + exception =3D g_strv_contains(entry->exceptions, ent->d_name); + xml_path =3D g_strdup_printf("%s/%s", dir_path, ent->d_name); - if (testSchemaFile(schema, validator, xml_path) < 0) + if (testSchemaFile(schema, validator, xml_path, exception) < 0) ret =3D -1; } @@ -190,14 +203,14 @@ testSchemaEntries(const char *schema, if (entry->dir) { g_autofree char *path =3D g_strdup_printf("%s/%s", abs_top_src= dir, entry->dir); - if (testSchemaDir(schema, validator, path, entry->dirRegex) < = 0) + if (testSchemaDir(schema, validator, path, entry) < 0) ret =3D -1; } if (entry->file) { g_autofree char *path =3D g_strdup_printf("%s/%s", abs_top_src= dir, entry->file); - if (testSchemaFile(schema, validator, path) < 0) + if (testSchemaFile(schema, validator, path, false) < 0) ret =3D -1; } } @@ -212,11 +225,20 @@ static const struct testSchemaEntry schemaCapability[= ] =3D { { .dir =3D "tests/qemucaps2xmloutdata" }, }; + +/* give exceptions for output files of invalid input XMLs */ +static const char *exceptions_qemuxml2xmloutdata[] =3D { + "disk-cdrom-empty-network-invalid.x86_64-latest.xml", + NULL +}; + static const struct testSchemaEntry schemaDomain[] =3D { { .dir =3D "tests/domainschemadata" }, { .dir =3D "tests/qemuxml2argvdata" }, { .dir =3D "tests/xmconfigdata" }, - { .dir =3D "tests/qemuxml2xmloutdata" }, + { .dir =3D "tests/qemuxml2xmloutdata", + .exceptions =3D exceptions_qemuxml2xmloutdata, + }, { .dir =3D "tests/lxcxml2xmldata" }, { .dir =3D "tests/lxcxml2xmloutdata" }, { .dir =3D "tests/bhyvexml2argvdata" }, --=20 2.43.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Tue May 14 20:58:11 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1704730263831320.313485328408; Mon, 8 Jan 2024 08:11:03 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id BBB441A6D; Mon, 8 Jan 2024 11:11:02 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 61F591A27; Mon, 8 Jan 2024 11:06:13 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id C4A7019AC; Mon, 8 Jan 2024 11:06:00 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 471771878 for ; Mon, 8 Jan 2024 11:06:00 -0500 (EST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-232-0k1BCOtxMQmcdDxIYBYr3w-1; Mon, 08 Jan 2024 11:05:58 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 338B187DC04 for ; Mon, 8 Jan 2024 16:05:58 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9FE30C15A0C for ; Mon, 8 Jan 2024 16:05:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: 0k1BCOtxMQmcdDxIYBYr3w-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 02/23] qemuxml2xmltest: Add invocation for 'numatune-auto-nodeset-invalid' case Date: Mon, 8 Jan 2024 17:05:32 +0100 Message-ID: <4d49db8140a1c87e2553bc1259d4b546e775b9ef.1704729291.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 7CYBQKRIW3PXZJD4B5RNFMVNHUM34TQM X-Message-ID-Hash: 7CYBQKRIW3PXZJD4B5RNFMVNHUM34TQM X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1704730265551100001 The test case requires an exception in virschematest as the output file is no longer invalid. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- ...une-auto-nodeset-invalid.x86_64-latest.xml | 44 +++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + tests/virschematest.c | 1 + 3 files changed, 46 insertions(+) create mode 100644 tests/qemuxml2xmloutdata/numatune-auto-nodeset-invalid.= x86_64-latest.xml diff --git a/tests/qemuxml2xmloutdata/numatune-auto-nodeset-invalid.x86_64-= latest.xml b/tests/qemuxml2xmloutdata/numatune-auto-nodeset-invalid.x86_64-= latest.xml new file mode 100644 index 0000000000..896572ac54 --- /dev/null +++ b/tests/qemuxml2xmloutdata/numatune-auto-nodeset-invalid.x86_64-latest.= xml @@ -0,0 +1,44 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 2 + + + + + hvm + + + + qemu64 + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
+ + +
+ + +
+ + + + +