From nobody Wed Jan 15 09:30:52 2025 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 1704731948593550.5190949770226; Mon, 8 Jan 2024 08:39:08 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 81AB71B4B; Mon, 8 Jan 2024 11:39:07 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 4B3E11AC8; Mon, 8 Jan 2024 11:07:43 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 6B83B1A05; Mon, 8 Jan 2024 11:07:01 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 BCD811A06 for ; Mon, 8 Jan 2024 11:06:10 -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-437-BlzMWW5TOSeNhX7mkHeEZg-1; Mon, 08 Jan 2024 11:06:09 -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 BC64788D12C for ; Mon, 8 Jan 2024 16:06:08 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 334F6C15A0C for ; Mon, 8 Jan 2024 16:06:08 +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_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: BlzMWW5TOSeNhX7mkHeEZg-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 13/23] qemuxml2xmltest: Remove pointless inactive->active testing Date: Mon, 8 Jan 2024 17:05:43 +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: TIWJDNQB4OYPR3NISGY645T3CSST5THD X-Message-ID-Hash: TIWJDNQB4OYPR3NISGY645T3CSST5THD 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: 1704731950387100001 'virDomainDefFormatInternalSetRootName' which is the top level XML formatter function has the following condition as the very first thing: if (def->id =3D=3D -1) flags |=3D VIR_DOMAIN_DEF_FORMAT_INACTIVE; This makes it pointless to separately do inactive->active and inactive->inactive XML -> XML testing as both will be in the end treated as inactive->inactive. This patch adds a warning to virDomainDefFormatInternalSetRootName and removes the second pointless invocation of the test from qemuxml2xmtest. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 2 ++ tests/qemuxml2xmltest.c | 42 +++++++++-------------------------------- 2 files changed, 11 insertions(+), 33 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index be57a1981e..4442a1df4b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -27721,6 +27721,8 @@ virDomainDefFormatInternalSetRootName(virDomainDef = *def, return -1; } + /* When changing this condition, beware that tests such as qemuxml*test + * were optimized based on this predicate and may need to be fixed. */ if (def->id =3D=3D -1) flags |=3D VIR_DOMAIN_DEF_FORMAT_INACTIVE; diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 896091f2f9..d1012636b5 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -20,8 +20,10 @@ static virQEMUDriver driver; static int -testXML2XMLCommon(const testQemuInfo *info) +testXML2XMLInactive(const void *opaque) { + const testQemuInfo *info =3D opaque; + if (testQemuInfoInitArgs((testQemuInfo *) info) < 0) return -1; @@ -30,17 +32,10 @@ testXML2XMLCommon(const testQemuInfo *info) if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0) return -1; - return 0; -} - - -static int -testXML2XMLActive(const void *opaque) -{ - const testQemuInfo *info =3D opaque; - - if (testXML2XMLCommon(info) < 0 || - testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, + /* we deliberately format the XML as live to catch potential test regr= essions + * as virDomainDefFormatInternalSetRootName implies _INACTIVE if 'def-= >id' + * is -1, thus VM is inactive. */ + if (testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->infile, info->outfile, true, info->parseFlags | VIR_DOMAIN_DEF_PARSE= _INACTIVE, TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS= ) < 0) { @@ -51,23 +46,6 @@ testXML2XMLActive(const void *opaque) } -static int -testXML2XMLInactive(const void *opaque) -{ - const testQemuInfo *info =3D opaque; - - if (testXML2XMLCommon(info) < 0 || - testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, - info->infile, info->outfile, false, - info->parseFlags | VIR_DOMAIN_DEF_PARSE= _INACTIVE, - TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS= ) < 0) { - return -1; - } - - return 0; -} - - static void testRun(const char *name, const char *suffix, @@ -75,8 +53,7 @@ testRun(const char *name, int *ret, ...) { - g_autofree char *name_active =3D g_strdup_printf("QEMU XML-2-XML-activ= e %s", name); - g_autofree char *name_inactive =3D g_strdup_printf("QEMU XML-2-XML-ina= ctive %s", name); + g_autofree char *testname =3D g_strdup_printf("QEMU inactive-XML -> in= active-XML %s", name); g_autoptr(testQemuInfo) info =3D g_new0(testQemuInfo, 1); va_list ap; @@ -92,8 +69,7 @@ testRun(const char *name, info->outfile =3D g_strdup_printf("%s/qemuxml2xmloutdata/%s%s.xml", abs_srcdir, info->name, suffix); - virTestRunLog(ret, name_inactive, testXML2XMLInactive, info); - virTestRunLog(ret, name_active, testXML2XMLActive, info); + virTestRunLog(ret, testname, testXML2XMLInactive, info); } --=20 2.43.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org