From nobody Sun Feb 8 23:37:15 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1618600513; cv=none; d=zohomail.com; s=zohoarc; b=eUif/ZAURNapYF1Y9Ily3CmQXBzPeGNuhadb5mZQVpYwH3ETKHKDes731dA0cHW8qXnJ36lBnxn7rmRbw+Oh1vr2MhN8XA8IQKbADZkLSnBRvonxUEbuFtQg+O4lEIcyyLIKkkWnLvcUgNktWJ/dwCqhUnsbg02MqZqhTx4x4HE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618600513; 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=fBpwqYsKGF9Ojt8HsQiK1Tv269dPokUT1WXpImitSb4=; b=EviPtgk+fzWB3NIxVXmUpNwjk0n2CncSHOvfIT+j/FHpVzF7z5TCP5X0OxMg3UWX5g/YgMkA5NcjOuEU9Dd5GOOmhn6o06nJRkK4R4ff2vl1Iq8aZQoj84EBShr3rYCQOQfFrWBvtyple7DICsVmqY3ML18Pq1xruH8+ezPaxWE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1618600513438946.0940602867659; Fri, 16 Apr 2021 12:15:13 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-140-3HBhaquXOlq0PAIIQ_XfuQ-1; Fri, 16 Apr 2021 15:13:30 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5A234A40D5; Fri, 16 Apr 2021 19:13:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 353CF5D9E3; Fri, 16 Apr 2021 19:13:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id ECA511806D1F; Fri, 16 Apr 2021 19:13:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13GJCwVp028244 for ; Fri, 16 Apr 2021 15:12:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 80D8D5D749; Fri, 16 Apr 2021 19:12:58 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.195.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01E005D6D3 for ; Fri, 16 Apr 2021 19:12:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618600512; 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=fBpwqYsKGF9Ojt8HsQiK1Tv269dPokUT1WXpImitSb4=; b=fMMDrw9MbJzauUO8dWLrEw/8CJvDISoxX0IR32cHG5vlPZ/yFOf17/P19uJQfB+QRPonVb nVTAM5CHe8eoBB0FbZ7M+lva302tcuOenDXsdNwAbW6sqeBG9TpGA2RU+1nU9A67sWXMWV hL426NauxUhRIDGKuu6+14neUUMXy2w= X-MC-Unique: 3HBhaquXOlq0PAIIQ_XfuQ-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 07/17] tests: introduce virfirewallmock Date: Fri, 16 Apr 2021 21:12:36 +0200 Message-Id: <49714603cefae90cc31397583ee186b0ee3ffab7.1618600267.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This will allow us to run tests using firewall on hosts where the mocked binaries are not available/installed instead of skipping these tests. Signed-off-by: Pavel Hrdina --- src/util/virfile.h | 3 ++- tests/meson.build | 1 + tests/virfirewallmock.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 tests/virfirewallmock.c diff --git a/src/util/virfile.h b/src/util/virfile.h index a02779f0ec..b9f7b1766f 100644 --- a/src/util/virfile.h +++ b/src/util/virfile.h @@ -184,7 +184,8 @@ int virFileResolveAllLinks(const char *linkpath, int virFileIsLink(const char *linkpath) ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT; =20 -char *virFindFileInPath(const char *file); +char *virFindFileInPath(const char *file) + G_GNUC_NO_INLINE; =20 char *virFileFindResource(const char *filename, const char *builddir, diff --git a/tests/meson.build b/tests/meson.build index 3f66861332..05c3e90195 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -60,6 +60,7 @@ mock_libs =3D [ { 'name': 'shunload', 'sources': [ 'shunloadhelper.c' ] }, { 'name': 'vircgroupmock' }, { 'name': 'virfilecachemock' }, + { 'name': 'virfirewallmock' }, { 'name': 'virgdbusmock' }, { 'name': 'virhostcpumock' }, { 'name': 'virhostdevmock' }, diff --git a/tests/virfirewallmock.c b/tests/virfirewallmock.c new file mode 100644 index 0000000000..6b096701c9 --- /dev/null +++ b/tests/virfirewallmock.c @@ -0,0 +1,34 @@ +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + */ + +#include + +#include "internal.h" +#include "virfile.h" + +char * +virFindFileInPath(const char *file) +{ + 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; +} --=20 2.30.2