From nobody Tue Jun 9 21:14:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1778154693; cv=none; d=zohomail.com; s=zohoarc; b=QPwRMLp/CjilYC5Ipc7nI+PevKJMvZy5t+hMWMd91RiY06cNrd4fKNChrJNE503kozaZEc016Lvxzd3nfnWx0X2dijameIYJ+NAmH/th8g2CG/CgVpSOx5Lj6VnTA4+jey8BOVoRnDjfas6mXE+JTxzXwiwbC/WBk/inp8027Hc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778154693; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=Iqvztr+QvU/AkE/cNVtCHSFQpKfracKq4/T8c32GBJg=; b=BrSYk5T34LsiVB/JLKVuLAif6949tr3b0hjPuQh8pNlQPzC6nL/xfiZX8qMEL8vsbwhYikcDIlaA/HaCz40v4RaduBFmLt7l091AXD0R6TOZyOouHCv0bjpqE9CWYl2255NXZN5rNlVEzxlSIqP2IzB3CyPEhZBUxvaZejy0OMA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1778154693154701.019135758431; Thu, 7 May 2026 04:51:33 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id EFACA41957; Thu, 7 May 2026 07:51:31 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 4BA2941872; Thu, 7 May 2026 07:49:11 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 3B1A23F2F2; Thu, 7 May 2026 07:48:55 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 415F63F2F2 for ; Thu, 7 May 2026 07:48:54 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-1-8W0zWeZ6PFeOpTkImDXH4g-1; Thu, 07 May 2026 07:48:52 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 541EE1800620 for ; Thu, 7 May 2026 11:48:51 +0000 (UTC) Received: from moe (unknown [10.43.3.236]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B2A2C1953947 for ; Thu, 7 May 2026 11:48:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778154533; h=from:from: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; bh=Iqvztr+QvU/AkE/cNVtCHSFQpKfracKq4/T8c32GBJg=; b=iP9hbtGuG7vpB6EMRfDuYbH4gHxaM88yASl/MfStxjqryzL9HvONKPmo/VbVu+9m23Uv3P D7kxNnMu8gc3a+34MAA+9clzf2G3qSmo6GcEBcR/IkeP+K2u4XyAtNds9WXm/AfgKCoolT t9nE877vvpaZRF7yprKN9e2tewVpNmc= X-MC-Unique: 8W0zWeZ6PFeOpTkImDXH4g-1 X-Mimecast-MFC-AGG-ID: 8W0zWeZ6PFeOpTkImDXH4g_1778154531 To: devel@lists.libvirt.org Subject: [PATCH 1/6] testutils: Introduce unused file detection Date: Thu, 7 May 2026 13:48:42 +0200 Message-ID: <68ce88f84cdb7db56de1473487a8e2c0daaaaaf0.1778154292.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: RXBLjnBlbCeSKYMKvbE79LFRDLXeLCI6jD4yw12r204_1778154531 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: Z4UDE6XPOWZHCIFLEFPOCK5EIDHKF6CM X-Message-ID-Hash: Z4UDE6XPOWZHCIFLEFPOCK5EIDHKF6CM X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1778154694833158500 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik This is basically a generalized version of what we have in qemuxmlconftest (functions testConfXMLEnumerate(), testQemuConfMarkUsed() and testConfXMLCheck()). The idea is to reuse the code in other tests. There's one slight difference to the original - while qemuxmlconftest always allocated the hash table, in this generalized version NULL table is okay. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tests/testutils.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++ tests/testutils.h | 14 ++++++++++++ 2 files changed, 72 insertions(+) diff --git a/tests/testutils.c b/tests/testutils.c index 35571fb2ad..484852ecc2 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -1245,3 +1245,61 @@ virCreateAnonymousFile(const uint8_t *data, size_t l= en) return -1; } #endif + +int +virTestEnumerateTestCases(const char *path, + virTestEnumerateTestCasesCB cb, + GHashTable **existingTestCases) +{ + g_autoptr(GHashTable) etc =3D virHashNew(NULL); + struct dirent *ent; + g_autoptr(DIR) dir =3D NULL; + int rc; + + /* If VIR_TEST_RANGE is in use don't bother filling in the data. */ + if (virTestHasRangeBitmap()) + return 0; + + if (virDirOpen(&dir, path) < 0) + return -1; + + while ((rc =3D virDirRead(dir, &ent, path)) > 0) { + if (cb(ent)) { + g_hash_table_insert(etc, + g_strdup_printf("%s/%s", path, ent->d_name= ), + NULL); + } + } + + if (rc =3D=3D 0) + *existingTestCases =3D g_steal_pointer(&etc); + + return rc; +} + +void +virTestCaseMarkUsed(GHashTable *existingTestCases, + const char *file) +{ + if (existingTestCases && file) + g_hash_table_remove(existingTestCases, file); +} + +int +virTestCheckUnusedTestCases(GHashTable *existingTestCases) +{ + g_autofree virHashKeyValuePair *items =3D virHashGetItems(existingTest= Cases, NULL, true); + size_t i; + int ret =3D 0; + + for (i =3D 0; items && items[i].key; i++) { + if (ret =3D=3D 0) { + fprintf(stderr, "\n"); + ret =3D -1; + } + + fprintf(stderr, "unused file: %s\n", (const char *) items[i].key); + } + + return ret; +} diff --git a/tests/testutils.h b/tests/testutils.h index e60876bd9e..ce348f1287 100644 --- a/tests/testutils.h +++ b/tests/testutils.h @@ -192,3 +192,17 @@ virTestStablePath(const char *path); #ifdef __linux__ int virCreateAnonymousFile(const uint8_t *data, size_t len); #endif + +typedef bool (*virTestEnumerateTestCasesCB)(struct dirent *); + +int +virTestEnumerateTestCases(const char *path, + virTestEnumerateTestCasesCB cb, + GHashTable **existingTestCases); + +void +virTestCaseMarkUsed(GHashTable *existingTestCases, + const char *file); + +int +virTestCheckUnusedTestCases(GHashTable *existingTestCases); --=20 2.53.0 From nobody Tue Jun 9 21:14:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1778154795; cv=none; d=zohomail.com; s=zohoarc; b=dlUDcGzXgbqoQ81lJfhjxeUAAuSt2QfLXWQf00gSAuikwnFKhTokQhG1OHklAVO3TvT0eu4RRUAAF/+5u++IDQfqKf/5QIYQ/R1lat31WMCYNByUWjifEQWdfpm4mmQMUupZ2gs/y9BUd0wBwhBFmuNxZGmDG5QE8yPlM39OhWg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778154795; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=55V7ncq5W4yO43wGVxx/bruPFHKeCgXOYDuKJu4rELs=; b=IHepSY+lHY8PsV5Hk98Y68asq59lDJGmQZq9szZ03E2SdhiQx2fHdri6D7i+dPMYo6pNUBqh2yGTl8/2sEWEVvBljVAVhpYnI3vqpdQlCf5QZbSoVKAFM+p94BY5XyZrfcej+soCIJ1k9XM2jR7BQwHaNtdaE/vyF9Le4bf1+3o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 177815479525330.626450561518254; Thu, 7 May 2026 04:53:15 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 8CB653F364; Thu, 7 May 2026 07:53:13 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id A5198418E6; Thu, 7 May 2026 07:49:17 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id DEB634181A; Thu, 7 May 2026 07:48:55 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id ECBC1417F9 for ; Thu, 7 May 2026 07:48:54 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-694-3eUuWblVOUKZi7lYu71yxw-1; Thu, 07 May 2026 07:48:53 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6CBC81954121 for ; Thu, 7 May 2026 11:48:52 +0000 (UTC) Received: from moe (unknown [10.43.3.236]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BC3941944B20 for ; Thu, 7 May 2026 11:48:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778154534; h=from:from: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; bh=55V7ncq5W4yO43wGVxx/bruPFHKeCgXOYDuKJu4rELs=; b=HuVxmVv4QXedvZtPYwsB54gSkcMFbMmeSZM1GPpb1/pk8LqJGPoquKkylSnqneomc+yZyL 4l1hJcsXKGUrhglEZYXSm7KgqNqscuMQOXAvMhTBMcaFuu8VgmKsZo1FfL0XQrP34sHVMA FjqqdVgJKfxUnkenABcQpfU7GxaICdA= X-MC-Unique: 3eUuWblVOUKZi7lYu71yxw-1 X-Mimecast-MFC-AGG-ID: 3eUuWblVOUKZi7lYu71yxw_1778154532 To: devel@lists.libvirt.org Subject: [PATCH 2/6] qemuxmlconftest: Switch to virTestEnumerateTestCases() Date: Thu, 7 May 2026 13:48:43 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 1i7F_cnOl6zJkrESLt2CkwoqM56iUHJl6Uh6hs12zc0_1778154532 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: IYGVYDR2EC44DO6EZHSVOXNUOBX3HV7I X-Message-ID-Hash: IYGVYDR2EC44DO6EZHSVOXNUOBX3HV7I X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1778154797679154100 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik The qemuxmlconftest detects unused files in qemuxmlconfdata/ directory. But it uses its own implementation for that. But now that there's a generic implementation available, switch to that. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tests/qemuxmlconftest.c | 82 ++++++++++------------------------------- 1 file changed, 19 insertions(+), 63 deletions(-) diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c index 6cfbca21a6..b64bbd6ccb 100644 --- a/tests/qemuxmlconftest.c +++ b/tests/qemuxmlconftest.c @@ -372,15 +372,6 @@ testInfoCheckDuplicate(testQemuInfo *info) } =20 =20 -static void -testQemuConfMarkUsed(testQemuInfo *info, - const char *file) -{ - if (file) - ignore_value(g_hash_table_remove(info->conf->existingTestCases, fi= le)); -} - - /** * testQemuConfXMLCommon: Prepare common test data (e.g. parse input XML) * for a test case. @@ -413,10 +404,10 @@ testQemuConfXMLCommon(testQemuInfo *info, if (info->prepared) goto cleanup; =20 - testQemuConfMarkUsed(info, info->infile); - testQemuConfMarkUsed(info, info->outfile); - testQemuConfMarkUsed(info, info->errfile); - testQemuConfMarkUsed(info, info->out_xml_inactive); + virTestCaseMarkUsed(info->conf->existingTestCases, info->infile); + virTestCaseMarkUsed(info->conf->existingTestCases, info->outfile); + virTestCaseMarkUsed(info->conf->existingTestCases, info->errfile); + virTestCaseMarkUsed(info->conf->existingTestCases, info->out_xml_inact= ive); =20 if (testQemuInfoInitArgs((testQemuInfo *) info) < 0) goto cleanup; @@ -591,7 +582,7 @@ testExtDeviceArgv(testQemuInfo *info, outfile =3D g_strdup_printf("%s/qemuxmlconfdata/%s%s%s.%s%zu.args", abs_srcdir, info->name, info->suffix, info->args.capsvariant, helper, idx); - testQemuConfMarkUsed(info, outfile); + virTestCaseMarkUsed(info->conf->existingTestCases, outfile); =20 if (!cmd) { err =3D virGetLastError(); @@ -787,51 +778,12 @@ testCompareXMLToArgv(const void *data) } =20 =20 -static int -testConfXMLCheck(GHashTable *existingTestCases) +static bool +testConfXMLEnumerate(struct dirent *ent) { - g_autofree virHashKeyValuePair *items =3D virHashGetItems(existingTest= Cases, NULL, true); - size_t i; - int ret =3D 0; - - for (i =3D 0; items[i].key; i++) { - if (ret =3D=3D 0) - fprintf(stderr, "\n"); - - fprintf(stderr, "unused file: %s\n", (const char *) items[i].key); - ret =3D -1; - } - - return ret; -} - - -static int -testConfXMLEnumerate(GHashTable *existingTestCases) -{ - struct dirent *ent; - g_autoptr(DIR) dir =3D NULL; - int rc; - - /* If VIR_TEST_RANGE is in use don't bother filling in the data, which - * also makes testConfXMLCheck succeed. */ - if (virTestHasRangeBitmap()) - return 0; - - if (virDirOpen(&dir, abs_srcdir "/qemuxmlconfdata") < 0) - return -1; - - while ((rc =3D virDirRead(dir, &ent, abs_srcdir "/qemuxmlconfdata")) >= 0) { - if (virStringHasSuffix(ent->d_name, ".xml") || - virStringHasSuffix(ent->d_name, ".args") || - virStringHasSuffix(ent->d_name, ".err")) { - g_hash_table_insert(existingTestCases, - g_strdup_printf(abs_srcdir "/qemuxmlconfda= ta/%s", ent->d_name), - NULL); - } - } - - return rc; + return virStringHasSuffix(ent->d_name, ".xml") || + virStringHasSuffix(ent->d_name, ".args") || + virStringHasSuffix(ent->d_name, ".err"); } =20 =20 @@ -902,23 +854,27 @@ mymain(void) int ret =3D 0; g_autoptr(virConnect) conn =3D NULL; g_autoptr(GHashTable) duplicateTests =3D virHashNew(NULL); - g_autoptr(GHashTable) existingTestCases =3D virHashNew(NULL); + g_autoptr(GHashTable) existingTestCases =3D NULL; g_autoptr(GHashTable) capslatest =3D testQemuGetLatestCaps(); g_autoptr(GHashTable) qapiSchemaCache =3D virHashNew((GDestroyNotify) = g_hash_table_unref); g_autoptr(GHashTable) capscache =3D virHashNew(virObjectUnref); struct testQemuConf testConf =3D { .capslatest =3D capslatest, .capscache =3D capscache, .qapiSchemaCache =3D qapiSchemaCache, - .duplicateTests =3D duplicateTests, - .existingTestCases =3D existingTestCa= ses }; + .duplicateTests =3D duplicateTests }; =20 if (!capslatest) return EXIT_FAILURE; =20 /* enumerate and store all available test cases to verify at the end t= hat * all of them were invoked */ - if (testConfXMLEnumerate(existingTestCases) < 0) + if (virTestEnumerateTestCases(abs_srcdir "/qemuxmlconfdata", + testConfXMLEnumerate, + &existingTestCases) < 0) { return EXIT_FAILURE; + } + + testConf.existingTestCases =3D existingTestCases; =20 /* Set the timezone because we are mocking the time() function. * If we don't do that, then localtime() may return unpredictable @@ -3078,7 +3034,7 @@ mymain(void) DO_TEST_CAPS_ARCH_LATEST("aarch64-virt-virtualization", "aarch64"); =20 /* check that all input files were actually used here */ - if (testConfXMLCheck(existingTestCases) < 0) + if (virTestCheckUnusedTestCases(existingTestCases) < 0) ret =3D -1; =20 qemuTestDriverFree(&driver); --=20 2.53.0 From nobody Tue Jun 9 21:14:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1778154853; cv=none; d=zohomail.com; s=zohoarc; b=R4I4Mi4a/SxaqouD86d55NlsWQm1WDbHfKpGc9DVwjpVLawt5fjW/fhOHEzOQjiPkkdPUuCVcPwkL+IlhVrPBDXIzO30yfuvQd7JqG0Tov62XP/ISKED43lcFZ8HqMYC51kAnvtpYJRKTHxFRZNERQtiyJu2mePqe2WW5ZGMF14= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778154853; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=vxfm9XYIb7cGnWWnT6xKA8uSMLy3g9y3MnmzI3qiBcQ=; b=kszdh77JLkQ1Kdt8SmH2cNc8hXud8l5JZfGEdCk0zjlDyLLZthMv6mofHpzxVPwfw94Jov5auKz2FuncNAmaP2VWdGmy8/r19btTUNklOnJuQyhesjiAYPRNco/UEPdRR+67GpMMA4gRAx2KSYXjZtWOe8CZ0d1dhoz19PBUmHo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 177815485368825.413001927479286; Thu, 7 May 2026 04:54:13 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 899483F2F4; Thu, 7 May 2026 07:54:12 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 1D61F41B0B; Thu, 7 May 2026 07:49:22 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id C7E8941820; Thu, 7 May 2026 07:48:56 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 0090A417E8 for ; Thu, 7 May 2026 07:48:55 -0400 (EDT) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-423-b868FbxnOrWxeBqBW0xMSw-1; Thu, 07 May 2026 07:48:54 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6C9A2195608D for ; Thu, 7 May 2026 11:48:53 +0000 (UTC) Received: from moe (unknown [10.43.3.236]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C0B4E1953947 for ; Thu, 7 May 2026 11:48:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778154535; h=from:from: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; bh=vxfm9XYIb7cGnWWnT6xKA8uSMLy3g9y3MnmzI3qiBcQ=; b=MKlkZrDRlOcNbhJKT8y0Wv7EPH1hkV2ikpnqKdxvnwX6Mzig0UaopQWM6pC86Q+SzJz6nB WCjxXR2GayeET6+y5LK+TylJe0+TIOr4Nt8vWsrjkoT/V5jV4FPoOzMGcSN8TVEQ51fSOl vNGhUOdlnYMUl1mukc+abwakYBnCPy4= X-MC-Unique: b868FbxnOrWxeBqBW0xMSw-1 X-Mimecast-MFC-AGG-ID: b868FbxnOrWxeBqBW0xMSw_1778154533 To: devel@lists.libvirt.org Subject: [PATCH 3/6] networkxmlconfdata: Remove passthrough-pf.conf Date: Thu, 7 May 2026 13:48:44 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: -607xfBFKQD9OA5cjV1cHD57ucuixygtzZ2YGOcgJYs_1778154533 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ZC5LKD5IEM47KBBNFADPBFTJWDQNBSNW X-Message-ID-Hash: ZC5LKD5IEM47KBBNFADPBFTJWDQNBSNW X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1778154855396158500 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik The passthrough-pf.conf file is not used really, because the test case is defined as: DO_TEST_VALIDATE_ERROR("passthrough-pf"); meaning the test is expected to fail in XML validation phase. Hence, no .conf file is ever generated for it. Remove the file. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tests/networkxmlconfdata/passthrough-pf.conf | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 tests/networkxmlconfdata/passthrough-pf.conf diff --git a/tests/networkxmlconfdata/passthrough-pf.conf b/tests/networkxm= lconfdata/passthrough-pf.conf deleted file mode 100644 index 1957dc8011..0000000000 --- a/tests/networkxmlconfdata/passthrough-pf.conf +++ /dev/null @@ -1,11 +0,0 @@ -##WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE -##OVERWRITTEN AND LOST. Changes to this configuration should be made usin= g: -## virsh net-edit local -## or other application using the libvirt API. -## -## dnsmasq conf file created by libvirt -strict-order -except-interface=3Dlo -bind-dynamic -interface=3D(null) -addn-hosts=3D/var/lib/libvirt/dnsmasq/local.addnhosts --=20 2.53.0 From nobody Tue Jun 9 21:14:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1778154923; cv=none; d=zohomail.com; s=zohoarc; b=lRrhXBt7y2ZEIwv8gfm740jafup0sw73NKerxwCtPZHS3anYWhYCDbsDn1okNSVjUGqTGvE3otvYxr2PynMVKrK2y6aH2it1cdKnd3i+NKtT7uqGuop6Xl3AFeL35fqLGfTwuQUaZvCRL/iJKP9JWdktZqCx68pgRrTuNByz1fU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778154923; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=7jF7gOYxmKBRvPDQENo4o99XvD8oRw9DnBjTYh3V3E8=; b=EhOFX4yW5XbIJ5aPZJcEyaQOyJGrSsrgykRbSwxNQc0lcrlanevrobp03rr1cwaoDDQk0BR3GMYwNvsV20xN4iUXcdocrkkAv3+0y66E5sM+OMxP4HZWscBdXdcnJrh8WmJ4B2gxbzqXNGyGGHYu0mYfpDgCGJJZIm7tUbLNeEo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1778154923679371.7607880313924; Thu, 7 May 2026 04:55:23 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 7EE8E41915; Thu, 7 May 2026 07:55:22 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 1A32641B63; Thu, 7 May 2026 07:49:27 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id A260441850; Thu, 7 May 2026 07:48:58 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id B03E5417F9 for ; Thu, 7 May 2026 07:48:56 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-447-ZiACaB-wPUiUU9WQxuz79g-1; Thu, 07 May 2026 07:48:55 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6A9D21956050 for ; Thu, 7 May 2026 11:48:54 +0000 (UTC) Received: from moe (unknown [10.43.3.236]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C7FBB1953947 for ; Thu, 7 May 2026 11:48:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778154536; h=from:from: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; bh=7jF7gOYxmKBRvPDQENo4o99XvD8oRw9DnBjTYh3V3E8=; b=W79OIFjz2CXNik9HDG2ft0S4eG6/UZQ5GiqwTDgMLT4GZS8EGvp/qsZNT2kcLgSRc9kJBE rKUVo0SAiEbu6EDJm2WQ9n1/xKfW788cbrgv9mPFTSYsJ8Otxhz5lZNLFKN18ylgfPHfw2 vGk+26VCEvfwCljl4E/ftf1D218deIo= X-MC-Unique: ZiACaB-wPUiUU9WQxuz79g-1 X-Mimecast-MFC-AGG-ID: ZiACaB-wPUiUU9WQxuz79g_1778154534 To: devel@lists.libvirt.org Subject: [PATCH 4/6] networkxmlconftest: Detect unused files Date: Thu, 7 May 2026 13:48:45 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: pV8_HpCjscN-5gULpDsCo8wf8b0hnn-x_rYxyJbI688_1778154534 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: PBIYU7OAI2TKAL7GAB4OUHBP76RXZR2P X-Message-ID-Hash: PBIYU7OAI2TKAL7GAB4OUHBP76RXZR2P X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1778154925761158500 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik Use newly introduced testutils APIs to detect unused files. This is pretty much straightforward except for one test case: hostdev. This test case queries sysfs under the hood and thus is expected to succeed on Linux and fail everywhere else. Though, hostdev.expect.xml is thus used on Linux only. Therefore, do not collect it on non-Linux platforms. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tests/networkxmlconftest.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/tests/networkxmlconftest.c b/tests/networkxmlconftest.c index 7f98004c75..40eb3ffdb4 100644 --- a/tests/networkxmlconftest.c +++ b/tests/networkxmlconftest.c @@ -35,6 +35,7 @@ struct _testInfo { char *outxml; char *outconf; char *outhostsfile; + GHashTable *existingTestCases; }; =20 typedef struct _testInfo testInfo; @@ -63,6 +64,7 @@ testCompareXMLToXMLFiles(const void *data) testCompareNetXML2XMLResult result =3D TEST_COMPARE_NET_XML2XML_RESULT= _SUCCESS; g_autoptr(virNetworkDef) def =3D NULL; =20 + virTestCaseMarkUsed(info->existingTestCases, info->inxml); if (!(def =3D virNetworkDefParse(NULL, info->inxml, info->xmlopt, fals= e))) { result =3D TEST_COMPARE_NET_XML2XML_RESULT_FAIL_PARSE; goto cleanup; @@ -84,6 +86,7 @@ testCompareXMLToXMLFiles(const void *data) if (info->expectResult =3D=3D TEST_COMPARE_NET_XML2XML_RESULT_FAIL_FOR= MAT) goto cleanup; =20 + virTestCaseMarkUsed(info->existingTestCases, info->outxml); if (virTestCompareToFile(actual, info->outxml) < 0) { result =3D TEST_COMPARE_NET_XML2XML_RESULT_FAIL_COMPARE; goto cleanup; @@ -129,6 +132,7 @@ testCompareXMLToConfFiles(const void *data) =20 if (!(def =3D g_steal_pointer(&info->def))) { /* Previous test wasn't executed. */ + virTestCaseMarkUsed(info->existingTestCases, info->inxml); if (!(def =3D virNetworkDefParse(NULL, info->inxml, info->xmlopt, = false))) goto cleanup; =20 @@ -168,10 +172,12 @@ testCompareXMLToConfFiles(const void *data) } #endif =20 + virTestCaseMarkUsed(info->existingTestCases, info->outconf); if (virTestCompareToFile(confactual, info->outconf) < 0) compareFailed =3D true; =20 if (hostsfileactual) { + virTestCaseMarkUsed(info->existingTestCases, info->outhostsfile); if (virTestCompareToFile(hostsfileactual, info->outhostsfile) < 0)= { compareFailed =3D true; } @@ -232,6 +238,7 @@ testRun(const char *name, virNetworkXMLOption *xmlopt, dnsmasqCaps *caps, testCompareNetXML2XMLResult expectResult, + GHashTable *existingTestCases, unsigned int flags) { g_autofree char *name_xml2xml =3D g_strdup_printf("Network XML-2-XML %= s", name); @@ -247,6 +254,7 @@ testRun(const char *name, info->outxml =3D g_strdup_printf("%s/networkxmlconfdata/%s.expect.xml"= , abs_srcdir, name); info->outconf =3D g_strdup_printf("%s/networkxmlconfdata/%s.conf", abs= _srcdir, name); info->outhostsfile =3D g_strdup_printf("%s/networkxmlconfdata/%s.hosts= file", abs_srcdir, name); + info->existingTestCases =3D existingTestCases; =20 virTestRunLog(ret, name_xml2xml, testCompareXMLToXMLFiles, info); =20 @@ -254,13 +262,35 @@ testRun(const char *name, virTestRunLog(ret, name_xml2conf, testCompareXMLToConfFiles, info); } =20 + +static bool +testCaseEnumerate(struct dirent *ent) +{ +#ifndef __linux__ + /* This test case is ran only on Linux. See comment in mymain(). */ + if (STREQ(ent->d_name, "hostdev.expect.xml")) + return false; +#endif + return virStringHasSuffix(ent->d_name, ".xml") || + virStringHasSuffix(ent->d_name, ".conf") || + virStringHasSuffix(ent->d_name, ".hostsfile"); +} + + static int mymain(void) { g_autoptr(virNetworkXMLOption) xmlopt =3D NULL; g_autoptr(dnsmasqCaps) caps =3D NULL; + g_autoptr(GHashTable) existingTestCases =3D NULL; int ret =3D 0; =20 + if (virTestEnumerateTestCases(abs_srcdir "/networkxmlconfdata", + testCaseEnumerate, + &existingTestCases) < 0) { + return -1; + } + if (!(xmlopt =3D networkDnsmasqCreateXMLConf())) return -1; =20 @@ -268,7 +298,7 @@ mymain(void) return -1; =20 #define DO_TEST_FULL(name, flags, expectResult) \ - testRun(name, &ret, xmlopt, caps, expectResult, flags) + testRun(name, &ret, xmlopt, caps, expectResult, existingTestCases, fla= gs) #define DO_TEST(name) \ DO_TEST_FULL(name, 0, TEST_COMPARE_NET_XML2XML_RESULT_SUCCESS) #define DO_TEST_FLAGS(name, flags) \ @@ -340,6 +370,9 @@ mymain(void) DO_TEST("leasetime-infinite"); DO_TEST("isolated-ports"); =20 + if (virTestCheckUnusedTestCases(existingTestCases) < 0) + ret =3D -1; + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 --=20 2.53.0 From nobody Tue Jun 9 21:14:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1778154977; cv=none; d=zohomail.com; s=zohoarc; b=NanQsuG/UjrwjGU+4ohfH2El46xdjFX8n47/4JyqIDAFrLnK7xB4ikljuMiCCPdaT4eqpMP2feeILu6PyYkL1a9GlFodh45q0CCt7fZEGguFEqtC7/dd82O9PEzuGau/sccf06xOee5Knh2jG7wSr+SqOKDRZanFN+BxcKJjpLw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778154977; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=gs4dxPN4qgoGUVwBiJSDxk6GijyJCqjmo7pKXvp6JO4=; b=AtgJslZr56CKB2dko7iYj/BT46ID+IpnHG6bA2+Ess01iB5jI4mOyIdylkUXMFWeRtoJkJLM5VsFAo6HDFKgQxSXt0mJnycOUL1DHba9KTijuOgL+eZAstD731411hU3qC9YKtizta3z9SdxkBtaMCSJ5geZxdwB1YsI158QE+g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1778154977022946.71197497299; Thu, 7 May 2026 04:56:17 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id DDEE63F364; Thu, 7 May 2026 07:56:15 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id D3B474198C; Thu, 7 May 2026 07:49:32 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id CB1B94185F; Thu, 7 May 2026 07:49:06 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E47504182E for ; Thu, 7 May 2026 07:48:57 -0400 (EDT) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-351-mr9Q0h0NNKG0uWPk4m3DaQ-1; Thu, 07 May 2026 07:48:56 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 67CE618002C8 for ; Thu, 7 May 2026 11:48:55 +0000 (UTC) Received: from moe (unknown [10.43.3.236]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C5ADA1953947 for ; Thu, 7 May 2026 11:48:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778154537; h=from:from: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; bh=gs4dxPN4qgoGUVwBiJSDxk6GijyJCqjmo7pKXvp6JO4=; b=it7mFhXxDIm+1qSfWPIz7/66ptMht0SVMwwVmBv171eKi3QK7xbRwZuiIamQ/wp2o2IKED 2FfQSTl8iB02ONLA5KHWqTPsfgzxalkwsTmqh/zcywZnAqewA7qBN+O5OWPThrZNYfFjl2 MdJuNyAxDPR2zHlJjZaqVBIVPRvS8/I= X-MC-Unique: mr9Q0h0NNKG0uWPk4m3DaQ-1 X-Mimecast-MFC-AGG-ID: mr9Q0h0NNKG0uWPk4m3DaQ_1778154535 To: devel@lists.libvirt.org Subject: [PATCH 5/6] cputestdata: Drop unused files Date: Thu, 7 May 2026 13:48:46 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: C4sBVTg3xA2kgoTrnHosOSOl-f95JfLRw3n0EKmq3D0_1778154535 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: BWFWI6EAVQFDSB7QEKH3SEGVZJ6TIZ67 X-Message-ID-Hash: BWFWI6EAVQFDSB7QEKH3SEGVZJ6TIZ67 X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1778154977921158500 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik There are couple of files under tests/cputestdata/ that are not used by any test case: 1) ppc64-guest-host-model.xml - unused since its introduction in v1.2.19-rc1~31 2) ppc64-host+guest-host-model.xml - Same 3) x86_64-bogus-vendor.xml - Introduced in v0.8.7~195 under slightly different name, then renamed to the current name (in v3.1.0-rc1~3) but never used actually. Just drop these three files. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tests/cputestdata/ppc64-guest-host-model.xml | 3 --- tests/cputestdata/ppc64-host+guest-host-model.xml | 3 --- tests/cputestdata/x86_64-bogus-vendor.xml | 4 ---- 3 files changed, 10 deletions(-) delete mode 100644 tests/cputestdata/ppc64-guest-host-model.xml delete mode 100644 tests/cputestdata/ppc64-host+guest-host-model.xml delete mode 100644 tests/cputestdata/x86_64-bogus-vendor.xml diff --git a/tests/cputestdata/ppc64-guest-host-model.xml b/tests/cputestda= ta/ppc64-guest-host-model.xml deleted file mode 100644 index 188ebebb72..0000000000 --- a/tests/cputestdata/ppc64-guest-host-model.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/tests/cputestdata/ppc64-host+guest-host-model.xml b/tests/cput= estdata/ppc64-host+guest-host-model.xml deleted file mode 100644 index 188ebebb72..0000000000 --- a/tests/cputestdata/ppc64-host+guest-host-model.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/tests/cputestdata/x86_64-bogus-vendor.xml b/tests/cputestdata/= x86_64-bogus-vendor.xml deleted file mode 100644 index 2ffdefe413..0000000000 --- a/tests/cputestdata/x86_64-bogus-vendor.xml +++ /dev/null @@ -1,4 +0,0 @@ - - Penryn - Bogus - --=20 2.53.0 From nobody Tue Jun 9 21:14:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1778155102; cv=none; d=zohomail.com; s=zohoarc; b=VT15xGJk0FzO0/fdMjTLNqm5qFTOXxFnXte45XMxJq/m3gtZsTWlTwxaft8lyeYBOO8gRxmCThOihX6VP7Z75plIH4XqfEoDX6iJbBvYOcQnfa6SSo/Zt/Qt1wH+mrCcgQ1ymWPApD3/9tSqXUlbb3fhuEi0P2l5MEUx2IIJ6x0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778155102; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=gI4j2oN5LFyEdi5ZCZqkyC+kaKhEDM4vJgRH1xXP+Lo=; b=ZPY0wVe3f7HhghP8SuiTGGOeZZvQSwT7/bWxnPU5w1HxW21uPBDAkdGz0poRDTGSOkitN4flUZd1aV876SJDgZCCMTUKu3WOSTf2zPmTjpVfY6zooKOlvTvuIFnu5aRYnup9x0BrJeAjQzMvgnRXCv3/Z3SPSnQI4B29EGKz/JI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 177815510261548.70314436408387; Thu, 7 May 2026 04:58:22 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id DE2494181C; Thu, 7 May 2026 07:58:21 -0400 (EDT) Received: from [172.19.199.9] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 8363441C27; Thu, 7 May 2026 07:49:41 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 6C39A3F2F2; Thu, 7 May 2026 07:49:18 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id D1BD741821 for ; Thu, 7 May 2026 07:48:58 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-574-qu8tKn0DPWSW1xEyA-oObw-1; Thu, 07 May 2026 07:48:57 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 64FB719560BB for ; Thu, 7 May 2026 11:48:56 +0000 (UTC) Received: from moe (unknown [10.43.3.236]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C3853195394A for ; Thu, 7 May 2026 11:48:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778154538; h=from:from: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; bh=gI4j2oN5LFyEdi5ZCZqkyC+kaKhEDM4vJgRH1xXP+Lo=; b=D/Wae1SibhcaUl/hBXuE78XEFXt+iAaEUt+d4WVkgd3RK6sXViY6DCB4SAYVSHQEltcWzF a8QD1mGUpB+BamebK5EoMUMuIKLop3z1wE5852OXv2u2EvEWH0qN4hPlzHu0pLEspqOdUK +4JHjpn8FdPuaOcy3vStZ3O6K4wiyps= X-MC-Unique: qu8tKn0DPWSW1xEyA-oObw-1 X-Mimecast-MFC-AGG-ID: qu8tKn0DPWSW1xEyA-oObw_1778154536 To: devel@lists.libvirt.org Subject: [PATCH 6/6] cputest: Detect unused files Date: Thu, 7 May 2026 13:48:47 +0200 Message-ID: <2675c0274e8e5c0910f35384c9dd46650ed75a47.1778154292.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 69GzE86Dl3MIQ74VHQhQhSCNyTX5q8qmyFOX_cP-Rro_1778154536 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 5B4OU2NVCDBN6NMW6ZTDOP5IZ4U6GFFZ X-Message-ID-Hash: 5B4OU2NVCDBN6NMW6ZTDOP5IZ4U6GFFZ X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1778155104372154100 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik Use newly introduced testutils APIs to detect unused files. This is pretty much straightforward, except for one small thing: some test cases depend on QEMU (and are NOP if built without it). Hence the condition in testCaseEnumerate(). Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tests/cputest.c | 103 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 82 insertions(+), 21 deletions(-) diff --git a/tests/cputest.c b/tests/cputest.c index a7d6ea8736..e29c81cb8e 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -60,6 +60,7 @@ struct data { int ncpus; unsigned int flags; int result; + GHashTable *existingTestCases; }; =20 #if WITH_QEMU @@ -68,7 +69,9 @@ static virQEMUDriver driver; =20 =20 static virCPUDef * -cpuTestLoadXML(virArch arch, const char *name) +cpuTestLoadXML(virArch arch, + const char *name, + GHashTable *existingTestCases) { g_autofree char *xml =3D NULL; g_autoptr(xmlDoc) doc =3D NULL; @@ -78,6 +81,8 @@ cpuTestLoadXML(virArch arch, const char *name) xml =3D g_strdup_printf("%s/cputestdata/%s-%s.xml", abs_srcdir, virArchToString(arch), name); =20 + virTestCaseMarkUsed(existingTestCases, xml); + if (!(doc =3D virXMLParseFileCtxt(xml, &ctxt))) return NULL; =20 @@ -90,6 +95,7 @@ cpuTestLoadXML(virArch arch, const char *name) static virCPUDef ** cpuTestLoadMultiXML(virArch arch, const char *name, + GHashTable *existingTestCases, unsigned int *count) { g_autofree char *xml =3D NULL; @@ -103,6 +109,8 @@ cpuTestLoadMultiXML(virArch arch, xml =3D g_strdup_printf("%s/cputestdata/%s-%s.xml", abs_srcdir, virArchToString(arch), name); =20 + virTestCaseMarkUsed(existingTestCases, xml); + if (!(doc =3D virXMLParseFileCtxt(xml, &ctxt))) return NULL; =20 @@ -136,7 +144,8 @@ cpuTestLoadMultiXML(virArch arch, static int cpuTestCompareXML(virArch arch, virCPUDef *cpu, - const char *name) + const char *name, + GHashTable *existingTestCases) { g_autofree char *xml =3D NULL; g_autofree char *actual =3D NULL; @@ -144,6 +153,8 @@ cpuTestCompareXML(virArch arch, xml =3D g_strdup_printf("%s/cputestdata/%s-%s.xml", abs_srcdir, virArchToString(arch), name); =20 + virTestCaseMarkUsed(existingTestCases, xml); + if (!(actual =3D virCPUDefFormat(cpu, NULL))) return -1; =20 @@ -190,9 +201,12 @@ cpuTestCompare(const void *arg) g_autoptr(virCPUDef) cpu =3D NULL; virCPUCompareResult result; =20 - if (!(host =3D cpuTestLoadXML(data->arch, data->host)) || - !(cpu =3D cpuTestLoadXML(data->arch, data->name))) + if (!(host =3D cpuTestLoadXML(data->arch, data->host, + data->existingTestCases)) || + !(cpu =3D cpuTestLoadXML(data->arch, data->name, + data->existingTestCases))) { return -1; + } =20 result =3D virCPUCompare(host->arch, host, cpu, false); if (data->result =3D=3D VIR_CPU_COMPARE_ERROR) @@ -222,9 +236,12 @@ cpuTestGuestCPU(const void *arg) g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; g_autofree char *result =3D NULL; =20 - if (!(host =3D cpuTestLoadXML(data->arch, data->host)) || - !(cpu =3D cpuTestLoadXML(data->arch, data->name))) + if (!(host =3D cpuTestLoadXML(data->arch, data->host, + data->existingTestCases)) || + !(cpu =3D cpuTestLoadXML(data->arch, data->name, + data->existingTestCases))) { goto cleanup; + } =20 if (virCPUConvertLegacy(host->arch, cpu) < 0) goto cleanup; @@ -249,7 +266,7 @@ cpuTestGuestCPU(const void *arg) =20 result =3D virBufferContentAndReset(&buf); =20 - if (cpuTestCompareXML(data->arch, cpu, result) < 0) + if (cpuTestCompareXML(data->arch, cpu, result, data->existingTestCases= ) < 0) goto cleanup; =20 ret =3D 0; @@ -284,8 +301,10 @@ cpuTestBaseline(const void *arg) const char *suffix; size_t i; =20 - if (!(cpus =3D cpuTestLoadMultiXML(data->arch, data->name, &ncpus))) + if (!(cpus =3D cpuTestLoadMultiXML(data->arch, data->name, + data->existingTestCases, &ncpus))) { goto cleanup; + } =20 baseline =3D virCPUBaseline(data->arch, cpus, ncpus, NULL, NULL, !!(data->flags & VIR_CONNECT_BASELINE_CPU_MI= GRATABLE)); @@ -317,8 +336,10 @@ cpuTestBaseline(const void *arg) suffix =3D "result"; result =3D g_strdup_printf("%s-%s", data->name, suffix); =20 - if (cpuTestCompareXML(data->arch, baseline, result) < 0) + if (cpuTestCompareXML(data->arch, baseline, result, + data->existingTestCases) < 0) { goto cleanup; + } =20 for (i =3D 0; i < ncpus; i++) { virCPUCompareResult cmp; @@ -356,9 +377,12 @@ cpuTestUpdate(const void *arg) g_autoptr(virCPUDef) cpu =3D NULL; g_autofree char *result =3D NULL; =20 - if (!(host =3D cpuTestLoadXML(data->arch, data->host)) || - !(cpu =3D cpuTestLoadXML(data->arch, data->name))) + if (!(host =3D cpuTestLoadXML(data->arch, data->host, + data->existingTestCases)) || + !(cpu =3D cpuTestLoadXML(data->arch, data->name, + data->existingTestCases))) { return -1; + } =20 if (!(migHost =3D virCPUCopyMigratable(data->arch, host))) return -1; @@ -368,7 +392,7 @@ cpuTestUpdate(const void *arg) =20 result =3D g_strdup_printf("%s+%s", data->host, data->name); =20 - return cpuTestCompareXML(data->arch, cpu, result); + return cpuTestCompareXML(data->arch, cpu, result, data->existingTestCa= ses); } =20 =20 @@ -380,7 +404,7 @@ cpuTestHasFeature(const void *arg) g_autoptr(virCPUData) hostData =3D NULL; int result; =20 - if (!(host =3D cpuTestLoadXML(data->arch, data->host))) + if (!(host =3D cpuTestLoadXML(data->arch, data->host, data->existingTe= stCases))) return -1; =20 if (cpuEncode(host->arch, host, NULL, &hostData, @@ -415,7 +439,7 @@ cpuTestValidateFeatures(const void *arg) g_autoptr(virCPUDef) cpu =3D NULL; int result; =20 - if (!(cpu =3D cpuTestLoadXML(data->arch, data->name))) + if (!(cpu =3D cpuTestLoadXML(data->arch, data->name, data->existingTes= tCases))) return -1; =20 result =3D virCPUValidateFeatures(data->arch, cpu); @@ -469,6 +493,8 @@ cpuTestMakeQEMUCaps(const struct data *data) json =3D g_strdup_printf("%s/cputestdata/%s-cpuid-%s.json", abs_srcdir, virArchToString(data->arch), data->host); =20 + virTestCaseMarkUsed(data->existingTestCases, json); + if (!(testMon =3D qemuMonitorTestNewFromFile(json, driver.xmlopt, true= ))) return NULL; =20 @@ -556,6 +582,8 @@ cpuTestCPUID(bool guest, const void *arg) hostFile =3D g_strdup_printf("%s/cputestdata/%s-cpuid-%s.xml", abs_src= dir, virArchToString(data->arch), data->host); =20 + virTestCaseMarkUsed(data->existingTestCases, hostFile); + if (virTestLoadFile(hostFile, &host) < 0 || !(hostData =3D virCPUDataParse(host))) return -1; @@ -583,7 +611,7 @@ cpuTestCPUID(bool guest, const void *arg) =20 result =3D g_strdup_printf("cpuid-%s-%s", data->host, guest ? "guest" = : "host"); =20 - return cpuTestCompareXML(data->arch, cpu, result); + return cpuTestCompareXML(data->arch, cpu, result, data->existingTestCa= ses); } =20 =20 @@ -602,8 +630,10 @@ cpuTestCPUIDBaseline(const void *arg) g_autofree char *name =3D NULL; =20 name =3D g_strdup_printf("cpuid-%s-json", data->cpus[i]); - if (!(cpus[i] =3D cpuTestLoadXML(data->arch, name))) + if (!(cpus[i] =3D cpuTestLoadXML(data->arch, name, + data->existingTestCases))) { goto cleanup; + } } =20 baseline =3D virCPUBaseline(data->arch, cpus, data->ncpus, NULL, NULL,= false); @@ -612,8 +642,10 @@ cpuTestCPUIDBaseline(const void *arg) =20 result =3D g_strdup_printf("cpuid-baseline-%s", data->name); =20 - if (cpuTestCompareXML(data->arch, baseline, result) < 0) + if (cpuTestCompareXML(data->arch, baseline, result, + data->existingTestCases) < 0) { goto cleanup; + } =20 for (i =3D 0; i < data->ncpus; i++) { virCPUCompareResult cmp; @@ -675,6 +707,7 @@ cpuTestCompareSignature(const struct data *data, "model: %3$3u (0x%3$02x)\n" "stepping: %4$= 3u (0x%4$02x)\n", signature, family, model, stepping); =20 + virTestCaseMarkUsed(data->existingTestCases, result); return virTestCompareToFile(sigStr, result); } =20 @@ -690,6 +723,8 @@ cpuTestCPUIDSignature(const void *arg) hostFile =3D g_strdup_printf("%s/cputestdata/%s-cpuid-%s.xml", abs_src= dir, virArchToString(data->arch), data->host); =20 + virTestCaseMarkUsed(data->existingTestCases, hostFile); + if (virTestLoadFile(hostFile, &host) < 0 || !(hostData =3D virCPUDataParse(host))) return -1; @@ -805,24 +840,28 @@ cpuTestUpdateLive(const void *arg) g_autoptr(virDomainCapsCPUModels) models =3D NULL; =20 cpuFile =3D g_strdup_printf("cpuid-%s-guest", data->host); - if (!(cpu =3D cpuTestLoadXML(data->arch, cpuFile))) + if (!(cpu =3D cpuTestLoadXML(data->arch, cpuFile, data->existingTestCa= ses))) return -1; =20 enabledFile =3D g_strdup_printf("%s/cputestdata/%s-cpuid-%s-enabled.xm= l", abs_srcdir, virArchToString(data->arch),= data->host); + virTestCaseMarkUsed(data->existingTestCases, enabledFile); if (virTestLoadFile(enabledFile, &enabled) < 0 || !(enabledData =3D virCPUDataParse(enabled))) return -1; =20 disabledFile =3D g_strdup_printf("%s/cputestdata/%s-cpuid-%s-disabled.= xml", abs_srcdir, virArchToString(data->arch)= , data->host); + virTestCaseMarkUsed(data->existingTestCases, disabledFile); if (virTestLoadFile(disabledFile, &disabled) < 0 || !(disabledData =3D virCPUDataParse(disabled))) return -1; =20 expectedFile =3D g_strdup_printf("cpuid-%s-json", data->host); - if (!(expected =3D cpuTestLoadXML(data->arch, expectedFile))) + if (!(expected =3D cpuTestLoadXML(data->arch, expectedFile, + data->existingTestCases))) { return -1; + } =20 /* In case the host CPU signature does not exactly match any CPU model= in * src/cpu_map, the CPU model we detect from CPUID may differ from the= one @@ -889,7 +928,7 @@ cpuTestJSONCPUID(const void *arg) if (virQEMUCapsInitCPUModel(qemuCaps, VIR_DOMAIN_VIRT_KVM, cpu, false)= !=3D 0) return -1; =20 - return cpuTestCompareXML(data->arch, cpu, result); + return cpuTestCompareXML(data->arch, cpu, result, data->existingTestCa= ses); } =20 =20 @@ -938,9 +977,21 @@ cpuTestInitModels(const char **list) } =20 =20 +static bool +testCaseEnumerate(struct dirent *ent) +{ + return virStringHasSuffix(ent->d_name, ".xml") || +#if WITH_QEMU + virStringHasSuffix(ent->d_name, ".json") || +#endif + 0; +} + + static int mymain(void) { + g_autoptr(GHashTable) existingTestCases =3D NULL; virDomainCapsCPUModels *model486 =3D NULL; virDomainCapsCPUModels *nomodel =3D NULL; virDomainCapsCPUModels *models =3D NULL; @@ -948,6 +999,12 @@ mymain(void) virDomainCapsCPUModels *ppc_models =3D NULL; int ret =3D 0; =20 + if (virTestEnumerateTestCases(abs_srcdir "/cputestdata", + testCaseEnumerate, + &existingTestCases) < 0) { + return EXIT_FAILURE; + } + #if WITH_QEMU if (qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; @@ -970,7 +1027,8 @@ mymain(void) struct data data =3D { \ arch, host, cpu, models, \ models =3D=3D NULL ? NULL : #models, \ - cpus, ncpus, flags, result \ + cpus, ncpus, flags, result, \ + existingTestCases \ }; \ g_autofree char *testLabel =3D NULL; \ \ @@ -1296,6 +1354,9 @@ mymain(void) virObjectUnref(haswell); virObjectUnref(ppc_models); =20 + if (virTestCheckUnusedTestCases(existingTestCases) < 0) + ret =3D -1; + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 --=20 2.53.0