From nobody Mon Feb 2 07:31:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; 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 8.43.85.245 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=1769611508; cv=none; d=zohomail.com; s=zohoarc; b=KENx8wnquY/YnVQkYjg5DTgIJC2pEctZDCJip4GZXWb/eWrDtiYIXPcoX5sYo+7Ox8ik5rtAfUTg4HAw33/qkoCre2fw192+8PgOURnFCejB55MPo+wrN3FBWb6J+1pwi6rGGwlrBnizwbMDgHur5mVMjcZpesku8A5Bqp9Ng8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769611508; 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=eGBKESMKy6soR+WamqNqRfhOPYmlNgEKdLwfIX0uGSg=; b=T1UDPYPgCNeAiHYisoALltS5Jp8PtKaqewBKa52SH/gfDSNbrhNdn/Y9gUx/BrADIUzCQ0LrPtAa8+1k3j5ReEk0lKi6yhKyQNxCPIFhqEx0Cra07M6wGXLN10bCgFZndCKfLgsFGjuYfFyrd6N6uqC71uFo/RwZmGXKdRnGvZs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 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 [8.43.85.245]) by mx.zohomail.com with SMTPS id 17696115080231000.8886142065244; Wed, 28 Jan 2026 06:45:08 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 648BB41B95; Wed, 28 Jan 2026 09:45:07 -0500 (EST) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 4EDC844056; Wed, 28 Jan 2026 09:32:07 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 52AA441A13; Wed, 28 Jan 2026 09:32:03 -0500 (EST) 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 7DDC941B27 for ; Wed, 28 Jan 2026 09:30:59 -0500 (EST) 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-32--mbUIv2FPtGvU9V5DfWGMA-1; Wed, 28 Jan 2026 09:30:57 -0500 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 E3F961800371 for ; Wed, 28 Jan 2026 14:30: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 4CBEE19540E7 for ; Wed, 28 Jan 2026 14:30:56 +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=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_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=1769610659; 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=eGBKESMKy6soR+WamqNqRfhOPYmlNgEKdLwfIX0uGSg=; b=iwk6axvrhMln+UGEZXHWoArmc5IZuTs0yu7JFYIChY3Si3EtForNkP2O/sSCLhAleDal1S p+C+iIV4ISM7aUoTchs0TUp9B9H49tJSSJMWElAHc5i980aPJL34gb2Q6j1jPxeGpCpXrs DM7Nsab0wOEuLcuzYqkTCEmeHJyE4p8= X-MC-Unique: -mbUIv2FPtGvU9V5DfWGMA-1 X-Mimecast-MFC-AGG-ID: -mbUIv2FPtGvU9V5DfWGMA_1769610657 To: devel@lists.libvirt.org Subject: [PATCH 10/20] networkxml2conftest: Allow regenerating hosts file Date: Wed, 28 Jan 2026 15:30:31 +0100 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: XPqvSg-kuj3MD2EtjcC5dHPa0NK-us_cVSeOJTA9AVk_1769610657 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ZMCWNU4W2ALR27NNGZV72EC6OW32OQQD X-Message-ID-Hash: ZMCWNU4W2ALR27NNGZV72EC6OW32OQQD 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: 1769611510370154100 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik Inside of testCompareXMLToConfFiles() the networkDnsmasqConfContents() is called. This may also produce contents of corresponding hosts file. This is then compared to expected contents stored on disk as ${testname}.hostsfile. But due to additional checks virTestCompareToFile() might not even be called. Problem with that is when there's actual content but the file doesn't exist the compare helper is not called and thus VIR_TEST_REGENERATE_OUTPUT trick doesn't work. Let's call the helper more often as it is perfectly capable of handling this edge case. What it is not capable of handling is when the file shouldn't exist at all. So handling of that case is kept. Signed-off-by: Michal Privoznik --- tests/networkxml2conftest.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c index d089ff38b1..cb2cafa918 100644 --- a/tests/networkxml2conftest.c +++ b/tests/networkxml2conftest.c @@ -75,18 +75,16 @@ testCompareXMLToConfFiles(const char *inxml, const char= *outconf, if (virTestCompareToFile(confactual, outconf) < 0) goto fail; =20 - if (virFileExists(outhostsfile)) { - if (!hostsfileactual) { - VIR_TEST_DEBUG("%s: hostsfile exists but the configuration did= " - "not specify any host", outhostsfile); + if (hostsfileactual) { + if (virTestCompareToFile(hostsfileactual, outhostsfile) < 0) { goto fail; - } else if (virTestCompareToFile(hostsfileactual, outhostsfile) < 0= ) { + } + } else { + if (virFileExists(outhostsfile)) { + VIR_TEST_DEBUG("%s: hostsfile exists but the configuration did= not specify any host", + outhostsfile); goto fail; } - } else if (hostsfileactual) { - VIR_TEST_DEBUG("%s: file does not exist but actual data was expect= ed", - outhostsfile); - goto fail; } =20 ret =3D 0; --=20 2.52.0