From nobody Mon Feb 9 17:23:28 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=1698253655; cv=none; d=zohomail.com; s=zohoarc; b=oAgTZejSCjjcdpRxETqGvGO+EVJvFJLKkJEu+Y6yauzP65of5mBicbbs/07qek7TZy6VWvfpnVcRm3a7016kB0QPIjk75ThD73fYv0/eakIZgSw/ppurqnCe47Pv7RDsVJbKXTjOGNMASeOmkKAld2n2UR1yGNyB02jwrIZS9RY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698253655; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=jAEbT+xtgumOkoVbhmiNxHsjXus7N8TIPzwf+x333T0=; b=VOyM+gfx71aduZXJpGBMsEVHJSU1Rh3V6LCm6Goc3BWpzRMf07ELot+wfwZm5m2Uu3ndtA0613BoJrnICT1f2OOcBV1SuMH6UJOiKy6yIQCyAOlyvZdbI8/Uifd3/4WGywJ2ZTrGAY0yAhHyyi7gnyXtVHgxzF4dIiwVfKXPwHo= 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 1698253655060527.9249416697029; Wed, 25 Oct 2023 10:07:35 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-319-JTgIHwpmNZGRCowptuUZJQ-1; Wed, 25 Oct 2023 13:07:25 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 58F9584B102; Wed, 25 Oct 2023 17:07:19 +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 43865492BE7; Wed, 25 Oct 2023 17:07:19 +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 32FF7194658D; Wed, 25 Oct 2023 17:07:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B2D0B194658C for ; Wed, 25 Oct 2023 17:07:18 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A9150492BE7; Wed, 25 Oct 2023 17:07:18 +0000 (UTC) Received: from harajuku.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.45.224.90]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A9B28492BE9 for ; Wed, 25 Oct 2023 17:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698253653; 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=jAEbT+xtgumOkoVbhmiNxHsjXus7N8TIPzwf+x333T0=; b=UKlYKkb6H3cI2PoVu/04UvWIYN0CKnnXlx7ZNPcJKi9kEV6yXa0mD6wnPQCmk7GYWjDw+q fBoR0PxKRTCpwocjrk4LrFdZ41TAwFdlMNzgUB+PzWTUnyF3bUET+dncjKsnekPM6ClCNG lM5ZzVhmMlLRbtNH/Lc6IzquAIO6TR4= X-MC-Unique: JTgIHwpmNZGRCowptuUZJQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v2 7/8] meson: Disable all tests when tests are disabled Date: Wed, 25 Oct 2023 19:07:00 +0200 Message-ID: <20231025170701.239137-8-abologna@redhat.com> In-Reply-To: <20231025170701.239137-1-abologna@redhat.com> References: <20231025170701.239137-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 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 3.4.1 on 10.11.54.9 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: 1698253655479100014 Content-Type: text/plain; charset="utf-8"; x-default="true" Currently, passing -Dtests=3Ddisabled only disables a subset of tests: those that are written in C and thus require compilation. Other tests, such as the syntax-check ones and those that are implemented as scripts, are always enabled. There's a potentially dangerous consequence of this behavior: when tests are disabled, 'meson test' will succeed as if they had been enabled. No indication of this will be shown, so the user will likely make the reasonable assumption that everything is fine when in fact the significantly reduced coverage might be hiding failures. To solve this issues, disable *all* tests when asked to do so, and inject an intentionally failing test to ensure that 'meson test' doesn't succeed. Best viewed with 'git show -w'. Signed-off-by: Andrea Bolognani --- build-aux/meson.build | 2 +- docs/html/meson.build | 20 ++-- docs/meson.build | 24 ++--- meson.build | 7 ++ src/access/meson.build | 16 ++-- src/meson.build | 204 +++++++++++++++++++++-------------------- 6 files changed, 144 insertions(+), 129 deletions(-) diff --git a/build-aux/meson.build b/build-aux/meson.build index b5d88a4c44..84405c5ec8 100644 --- a/build-aux/meson.build +++ b/build-aux/meson.build @@ -1,6 +1,6 @@ # Skip syntax-check if not building from git because we get the list of fi= les # to check using git commands and it fails if we are not in git repository. -if git +if git and build_tests[0] flake8_path =3D '' if flake8_prog.found() flake8_path =3D flake8_prog.full_path() diff --git a/docs/html/meson.build b/docs/html/meson.build index c0a666f4e1..b4e81f8501 100644 --- a/docs/html/meson.build +++ b/docs/html/meson.build @@ -119,12 +119,14 @@ html_xslt_gen =3D [] =20 # --- end of XSLT processing --- =20 -test( - 'check-html', - xmllint_prog, - args: [ - '--nonet', '--noout', docs_html_paths, - ], - depends: docs_html_dep, - suite: 'script' -) +if build_tests[0] + test( + 'check-html', + xmllint_prog, + args: [ + '--nonet', '--noout', docs_html_paths, + ], + depends: docs_html_dep, + suite: 'script' + ) +endif diff --git a/docs/meson.build b/docs/meson.build index b20ef1c926..52763a8597 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -351,14 +351,16 @@ run_target( depends: install_web_deps, ) =20 -test( - 'check-html-references', - python3_prog, - args: [ - check_html_references_prog.full_path(), - '--webroot', - meson.project_build_root() / 'docs' - ], - env: runutf8, - suite: 'script' -) +if build_tests[0] + test( + 'check-html-references', + python3_prog, + args: [ + check_html_references_prog.full_path(), + '--webroot', + meson.project_build_root() / 'docs' + ], + env: runutf8, + suite: 'script' + ) +endif diff --git a/meson.build b/meson.build index 33027404f6..b30150d605 100644 --- a/meson.build +++ b/meson.build @@ -2085,6 +2085,13 @@ subdir('tools') =20 if build_tests[0] subdir('tests') +else + # Ensure that 'meson test' fails when tests are disabled, as opposed to + # misleadingly succeeding at doing absolutely nothing + test( + 'tests-are-disabled', + python3_prog, args: [ '-c', 'raise Exception("tests are disabled")' ], + ) endif =20 subdir('examples') diff --git a/src/access/meson.build b/src/access/meson.build index e65f17c0a2..6ca953c932 100644 --- a/src/access/meson.build +++ b/src/access/meson.build @@ -105,10 +105,12 @@ access_dep =3D declare_dependency( =20 generated_sym_files +=3D access_gen_sym =20 -test( - 'check-aclperms', - python3_prog, - args: [ check_aclperms_prog.full_path(), access_perm_h, files('viraccess= perm.c') ], - env: runutf8, - suite: 'script' -) +if build_tests[0] + test( + 'check-aclperms', + python3_prog, + args: [ check_aclperms_prog.full_path(), access_perm_h, files('viracce= ssperm.c') ], + env: runutf8, + suite: 'script' + ) +endif diff --git a/src/meson.build b/src/meson.build index 43146fe3c3..e25b3e5980 100644 --- a/src/meson.build +++ b/src/meson.build @@ -946,121 +946,123 @@ meson.add_install_script( =20 # Check driver files =20 -if host_machine.system() =3D=3D 'linux' - test( - 'check-symfile', - python3_prog, - args: [ check_symfile_prog.full_path(), libvirt_syms, libvirt_lib ], - env: runutf8, - suite: 'script' - ) - - if conf.has('WITH_REMOTE') +if build_tests[0] + if host_machine.system() =3D=3D 'linux' test( - 'check-admin-symfile', + 'check-symfile', python3_prog, - args: [ check_symfile_prog.full_path(), libvirt_admin_syms, libvirt_= admin_lib ], + args: [ check_symfile_prog.full_path(), libvirt_syms, libvirt_lib ], env: runutf8, suite: 'script' ) + + if conf.has('WITH_REMOTE') + test( + 'check-admin-symfile', + python3_prog, + args: [ check_symfile_prog.full_path(), libvirt_admin_syms, libvir= t_admin_lib ], + env: runutf8, + suite: 'script' + ) + endif endif -endif =20 -test( - 'check-symsorting', - python3_prog, - args: [ - check_symsorting_prog.full_path(), - meson.current_source_dir(), - files(sym_files, used_sym_files), - ], - env: runutf8, - suite: 'script' -) + test( + 'check-symsorting', + python3_prog, + args: [ + check_symsorting_prog.full_path(), + meson.current_source_dir(), + files(sym_files, used_sym_files), + ], + env: runutf8, + suite: 'script' + ) =20 -test( - 'check-admin-symsorting', - python3_prog, - args: [ - check_symsorting_prog.full_path(), - meson.current_source_dir(), - libvirt_admin_private_syms, - ], - env: runutf8, - suite: 'script' -) + test( + 'check-admin-symsorting', + python3_prog, + args: [ + check_symsorting_prog.full_path(), + meson.current_source_dir(), + libvirt_admin_private_syms, + ], + env: runutf8, + suite: 'script' + ) =20 -test( - 'check-drivername', - python3_prog, - args: [ - check_drivername_prog.full_path(), files(driver_headers), - files('libvirt_public.syms'), libvirt_qemu_syms, libvirt_lxc_syms, - ], - env: runutf8, - suite: 'script' -) + test( + 'check-drivername', + python3_prog, + args: [ + check_drivername_prog.full_path(), files(driver_headers), + files('libvirt_public.syms'), libvirt_qemu_syms, libvirt_lxc_syms, + ], + env: runutf8, + suite: 'script' + ) =20 -test( - 'check-admin-drivername', - python3_prog, - args: [ - check_drivername_prog.full_path(), libvirt_admin_public_syms, - ], - env: runutf8, - suite: 'script' -) + test( + 'check-admin-drivername', + python3_prog, + args: [ + check_drivername_prog.full_path(), libvirt_admin_public_syms, + ], + env: runutf8, + suite: 'script' + ) =20 -test( - 'check-driverimpls', - python3_prog, - args: [ check_driverimpls_prog.full_path(), driver_source_files ], - env: runutf8, - suite: 'script' -) + test( + 'check-driverimpls', + python3_prog, + args: [ check_driverimpls_prog.full_path(), driver_source_files ], + env: runutf8, + suite: 'script' + ) =20 -test( - 'check-aclrules', - python3_prog, - args: [ check_aclrules_prog.full_path(), files('remote/remote_protocol.x= '), stateful_driver_source_files ], - env: runutf8, - suite: 'script' -) + test( + 'check-aclrules', + python3_prog, + args: [ check_aclrules_prog.full_path(), files('remote/remote_protocol= .x'), stateful_driver_source_files ], + env: runutf8, + suite: 'script' + ) =20 -if augparse_prog.found() - foreach data : augeas_test_data - test( - 'check-augeas-@0@'.format(data['name']), - augparse_prog, - args: [ - '-I', data['srcdir'], - '-I', data['builddir'], - data['file'].full_path(), - ], - suite: 'script' - ) - endforeach -endif + if augparse_prog.found() + foreach data : augeas_test_data + test( + 'check-augeas-@0@'.format(data['name']), + augparse_prog, + args: [ + '-I', data['srcdir'], + '-I', data['builddir'], + data['file'].full_path(), + ], + suite: 'script' + ) + endforeach + endif =20 -if pdwtags_prog.found() and cc.get_id() !=3D 'clang' - foreach proto : check_protocols - lib =3D proto['lib'] - test( - 'check-@0@'.format(proto['name']), - python3_prog, - args: [ - check_remote_protocol_prog.full_path(), - proto['name'], - lib.name(), - lib.full_path(), - pdwtags_prog.full_path(), - files('@0@-structs'.format(proto['name'])), - ], - env: runutf8, - depends: [ lib ], - suite: 'script' - ) - endforeach + if pdwtags_prog.found() and cc.get_id() !=3D 'clang' + foreach proto : check_protocols + lib =3D proto['lib'] + test( + 'check-@0@'.format(proto['name']), + python3_prog, + args: [ + check_remote_protocol_prog.full_path(), + proto['name'], + lib.name(), + lib.full_path(), + pdwtags_prog.full_path(), + files('@0@-structs'.format(proto['name'])), + ], + env: runutf8, + depends: [ lib ], + suite: 'script' + ) + endforeach + endif endif =20 # configure pkg-config files for run script --=20 2.41.0