From nobody Tue Jan 21 08:31:49 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of redhat.com designates
 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1683104523; cv=none;
	d=zohomail.com; s=zohoarc;
	b=ZHTrmRWFf6yNusEKRZvmz2po3Bak8I7KJehnIR1ktOupHzDaMwqr+vZub3bNnrKiZTlpmvMMQD835Lf8PebLXd7xDq/6Jxbvl4qWexz+G0lpAR9ywUZtwyeu5T0ClXOlv6WQUTJA/DzX0GmrrciDuKa6ydwwW0MSkDTDPx3xoAA=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1683104523;
 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=1/ksN22Tm8racQ+l0sioZ7IYeNtAGBggiJajvJcf0pg=;
	b=Ei5UvX2VveircJruKKIBQGoHpMyPc6UvM1nGg9IRRlZo7yMqiqL8b6Kow+bfJks2iolsK31z3Kh2yCDyeVLUhf+204qqZKatdVLwUXKzFgKlihlEhmenW0ug9iWgLdmNsBwnUhCtB9zi0kcfmPZ1PXC/GOfx2OMjdmc7c/YY1bA=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as
 permitted sender)  smtp.mailfrom=libvir-list-bounces@redhat.com;
	dmarc=pass header.from=<mprivozn@redhat.com> (p=none dis=none)
Return-Path: <libvir-list-bounces@redhat.com>
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com
	with SMTPS id 1683104523871463.57184594450473;
 Wed, 3 May 2023 02:02:03 -0700 (PDT)
Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com
 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 us-mta-14-tUYyrUpGPeeK4fy4mquRmA-1; Wed, 03 May 2023 05:01:16 -0400
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com
 [10.11.54.2])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4C6BD3C11783;
	Wed,  3 May 2023 09:01:14 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
 (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100])
	by smtp.corp.redhat.com (Postfix) with ESMTP id 36718407D451;
	Wed,  3 May 2023 09:01:14 +0000 (UTC)
Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com
 (localhost [IPv6:::1])
	by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
 ESMTP id 9B32F1946A41;
	Wed,  3 May 2023 09:01:04 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com
 [10.11.54.2])
 by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with
 ESMTP id 506A619465BB for <libvir-list@listman.corp.redhat.com>;
 Wed,  3 May 2023 09:00:58 +0000 (UTC)
Received: by smtp.corp.redhat.com (Postfix)
 id 345B1407D451; Wed,  3 May 2023 09:00:58 +0000 (UTC)
Received: from localhost.localdomain (unknown [10.43.2.39])
 by smtp.corp.redhat.com (Postfix) with ESMTP id CEEF9407D450
 for <libvir-list@redhat.com>; Wed,  3 May 2023 09:00:57 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
	s=mimecast20190719; t=1683104522;
	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=1/ksN22Tm8racQ+l0sioZ7IYeNtAGBggiJajvJcf0pg=;
	b=Pyq8cVpfd18PfT6cHwteQiDpOLWUCVTvrQL0YVp/hIhjf3p0eeMeb0lHrgR5+8yCpKwWzo
	FXGFUwbI0J4Z0XoGNvtAHotZGpfAGABwNzFJB3vqiIuJ0lAa4aj7G0nIYBXrsXyBe+mTmZ
	HOt19Kvjqt98087LdCwRz0jLmP5L9Mg=
X-MC-Unique: tUYyrUpGPeeK4fy4mquRmA-1
X-Original-To: libvir-list@listman.corp.redhat.com
From: Michal Privoznik <mprivozn@redhat.com>
To: libvir-list@redhat.com
Subject: [PATCH 2/2] virfirewallmock: Replace virFindFileInPath() with
 virFirewallDIsRegistered()
Date: Wed,  3 May 2023 11:00:55 +0200
Message-Id: 
 <32a7244b2aff8fa3c498719704201ef2152acc68.1683104398.git.mprivozn@redhat.com>
In-Reply-To: <cover.1683104398.git.mprivozn@redhat.com>
References: <cover.1683104398.git.mprivozn@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Development discussions about the libvirt library & tools
 <libvir-list.redhat.com>
List-Unsubscribe: <https://listman.redhat.com/mailman/options/libvir-list>,
 <mailto:libvir-list-request@redhat.com?subject=unsubscribe>
List-Archive: <http://listman.redhat.com/archives/libvir-list/>
List-Post: <mailto:libvir-list@redhat.com>
List-Help: <mailto:libvir-list-request@redhat.com?subject=help>
List-Subscribe: <https://listman.redhat.com/mailman/listinfo/libvir-list>,
 <mailto:libvir-list-request@redhat.com?subject=subscribe>
Errors-To: libvir-list-bounces@redhat.com
Sender: "libvir-list" <libvir-list-bounces@redhat.com>
X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2
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: 1683104525523100001
Content-Type: text/plain; charset="utf-8"; x-default="true"

Neither of tests that use virfirewallmock.c
(networkxml2firewalltest, nwfilterebiptablestest,
nwfilterxml2firewalltest, virfirewalltest) really call
virFindFileInPath(). But at least networkxml2firewalltest calls
virFirewallDIsRegistered(), under the hood. Now, the actual
implementation connects to dbus and something, which is
definitely not what we want in our test suite.

Therefore, drop virFindFileInPath() implementation and provide
implementation for virFirewallDIsRegistered() which just returns
-2 to signal that firewalld is not registered.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
---
 tests/virfirewallmock.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/tests/virfirewallmock.c b/tests/virfirewallmock.c
index 6b096701c9..793b954d87 100644
--- a/tests/virfirewallmock.c
+++ b/tests/virfirewallmock.c
@@ -17,18 +17,10 @@
 #include <config.h>
=20
 #include "internal.h"
-#include "virfile.h"
+#include "virfirewalld.h"
=20
-char *
-virFindFileInPath(const char *file)
+int
+virFirewallDIsRegistered(void)
 {
-    if (file &&
-        (g_strrstr(file, "ebtables") ||
-         g_strrstr(file, "iptables") ||
-         g_strrstr(file, "ip6tables"))) {
-        return g_strdup(file);
-    }
-
-    /* We should not need any other binaries so return NULL. */
-    return NULL;
+    return -2;
 }
--=20
2.39.2