From nobody Mon Feb 9 17:08:08 2026 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=1650883067; cv=none; d=zohomail.com; s=zohoarc; b=VlhvZq6pkaNoHvDSBIyJ80bbU+rg0QvVO2BX1ZzSRNsarXGwbBbHi+S2KNJLxbZLZR1raCMaxwqZgWbTK3wJd50b/m1Ox9RabagGBS+rVUR9hi0dOMeKbzAS9rSyfDEp+CODDZ6UEbXlNjByL+7K3o/mbT7gwyw89Pyw5z/vJZs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650883067; 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=cqGPYLj7youJLdP5Nigxfp3kH8gBCZNYuccBs9BRJZI=; b=XXTUs+p5egLHNZtNQfc4P8jsn8q+3JJ6ifoCQLkCZ/lgD72M5fLMDs4SNDU/BYcnPFrTo5UZngNG30UNLyhE0kwR6/H3ebtsqDeOhFnafZB1RAxQtlAoMfCd2rEhoVq+V3syxiAn/zvPpjQJQjns/MSlS2lNW8yDYhpf7j1kAbc= 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= (p=none dis=none) Return-Path: 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 1650883067190312.0261656231926; Mon, 25 Apr 2022 03:37:47 -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-25-nFbTLaSlN_uq17T6WeakiA-1; Mon, 25 Apr 2022 06:37:41 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E94163811F55; Mon, 25 Apr 2022 10:37:39 +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 D05F9C28122; Mon, 25 Apr 2022 10:37:39 +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 58A46194036A; Mon, 25 Apr 2022 10:37:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 66E8C194035D for ; Mon, 25 Apr 2022 10:37:37 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 480B5141DED5; Mon, 25 Apr 2022 10:37:37 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0833145BF0C for ; Mon, 25 Apr 2022 10:37:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650883066; 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=cqGPYLj7youJLdP5Nigxfp3kH8gBCZNYuccBs9BRJZI=; b=hCjukwGG1StJbPCF4Y5+BAOBW48NQJlsgif2lPR+jlwupvHzoSQPIljnNadjNZ4klVZs7h wG2bfID6HjDe0mQnXsS3JZl6h6kEcd32ndODjbaflWJNqsedP52n4rT0YPDpnQPFRKZLEv D94g8hdLwRZwiQFR58pDyFigLsefK+8= X-MC-Unique: nFbTLaSlN_uq17T6WeakiA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/2] tests: Deduplicate some WITH_* checks Date: Mon, 25 Apr 2022 12:37:34 +0200 Message-Id: <15d31988e12c59717bc92f635758773664c821ac.1650882981.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 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) X-ZM-MESSAGEID: 1650883068225100005 Content-Type: text/plain; charset="utf-8"; x-default="true" When constructing mock_libs array it is firstly initialized to a static set of mocks followed by couple of WITH_* checks to append driver specific mocks. These checks are then repeated when filling some other variables (e.g. supplementary helpers, libraries, tests, etc.). Dissolve the former in the latter since we are already doing that, partially, for qemu (qemucapsprobemock and qemuhotplugmock) Signed-off-by: Michal Privoznik --- tests/meson.build | 92 +++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 52 deletions(-) diff --git a/tests/meson.build b/tests/meson.build index 8d613d23f2..9b9fcaa622 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -84,40 +84,6 @@ if host_machine.system() =3D=3D 'linux' ] endif =20 -if conf.has('WITH_BHYVE') - mock_libs +=3D [ - { 'name': 'bhyveargv2xmlmock' }, - { 'name': 'bhyvexml2argvmock' }, - ] -endif - -if conf.has('WITH_LIBXL') - mock_libs +=3D [ - { 'name': 'xlmock', 'sources': [ 'libxlmock.c' ], 'deps': [ libxl_dep = ] }, - ] -endif - -if conf.has('WITH_NSS') - mock_libs +=3D [ - { 'name': 'nssmock' }, - ] -endif - -if conf.has('WITH_QEMU') - mock_libs +=3D [ - { 'name': 'qemucaps2xmlmock' }, - { 'name': 'qemucpumock' }, - { 'name': 'qemuxml2argvmock' }, - { 'name': 'virhostidmock' }, - ] -endif - -if conf.has('WITH_SECDRIVER_SELINUX') - mock_libs +=3D [ - { 'name': 'securityselinuxhelper' }, - ] -endif - =20 # build libraries used by tests =20 @@ -139,6 +105,10 @@ if conf.has('WITH_LIBXL') link_whole: [ libxl_driver_imp ], link_with: [ libvirt_lib ], ) + + mock_libs +=3D [ + { 'name': 'xlmock', 'sources': [ 'libxlmock.c' ], 'deps': [ libxl_dep = ] }, + ] else test_utils_xen_lib =3D [] test_xen_driver_lib =3D [] @@ -176,8 +146,12 @@ if conf.has('WITH_QEMU') ) =20 mock_libs +=3D [ + { 'name': 'qemucaps2xmlmock' }, { 'name': 'qemucapsprobemock', 'link_with': [ test_qemu_driver_lib ] }, + { 'name': 'qemucpumock' }, { 'name': 'qemuhotplugmock', 'link_with': [ test_utils_qemu_lib, test_= utils_lib ] }, + { 'name': 'qemuxml2argvmock' }, + { 'name': 'virhostidmock' }, ] else test_qemu_driver_lib =3D [] @@ -192,24 +166,6 @@ test_file_wrapper_lib =3D static_library( ) =20 tests_deps =3D [] -foreach mock : mock_libs - tests_deps +=3D shared_library( - mock['name'], - mock.get('sources', [ '@0@.c'.format(mock['name']) ]), - override_options: [ - 'b_asneeded=3Dfalse', - 'b_lundef=3Dfalse', - ], - dependencies: [ - tests_dep, - mock.get('deps', []), - ], - link_with: [ - libvirt_lib, - mock.get('link_with', []), - ], - ) -endforeach =20 # build helpers used by tests =20 @@ -367,6 +323,11 @@ if conf.has('WITH_BHYVE') { 'name': 'bhyvexml2argvtest', 'link_with': [ bhyve_driver_impl ] }, { 'name': 'bhyvexml2xmltest', 'link_with': [ bhyve_driver_impl ] }, ] + + mock_libs +=3D [ + { 'name': 'bhyveargv2xmlmock' }, + { 'name': 'bhyvexml2argvmock' }, + ] endif =20 if conf.has('WITH_ESX') @@ -428,6 +389,10 @@ if conf.has('WITH_NSS') 'link_with': [ nss_libvirt_guest_impl ], }, ] + + mock_libs +=3D [ + { 'name': 'nssmock' }, + ] endif =20 if conf.has('WITH_NWFILTER') @@ -506,6 +471,10 @@ if conf.has('WITH_SECDRIVER_SELINUX') ] endif endif + + mock_libs +=3D [ + { 'name': 'securityselinuxhelper' }, + ] endif =20 if conf.has('WITH_STORAGE') @@ -556,6 +525,25 @@ if conf.has('WITH_YAJL') ] endif =20 +foreach mock : mock_libs + tests_deps +=3D shared_library( + mock['name'], + mock.get('sources', [ '@0@.c'.format(mock['name']) ]), + override_options: [ + 'b_asneeded=3Dfalse', + 'b_lundef=3Dfalse', + ], + dependencies: [ + tests_dep, + mock.get('deps', []), + ], + link_with: [ + libvirt_lib, + mock.get('link_with', []), + ], + ) +endforeach + foreach data : tests test_sources =3D '@0@.c'.format(data['name']) test_bin =3D executable( --=20 2.35.1