Patch-Source: https://gitlab.freedesktop.org/libfprint/fprintd/-/merge_requests/222 --- From 3c17eda191bf0227499278d93642bfed039b979d Mon Sep 17 00:00:00 2001 From: fossdd Date: Sat, 22 Feb 2025 18:40:40 +0100 Subject: [PATCH] build: Add tests meson option --- meson.build | 49 +++++++++++++++++++++++++++-------------------- meson_options.txt | 4 ++++ tests/meson.build | 2 -- 3 files changed, 32 insertions(+), 23 deletions(-) diff --git a/meson.build b/meson.build index eebea25c..5692ad30 100644 --- a/meson.build +++ b/meson.build @@ -165,29 +165,34 @@ endif polkit_policy_directory = polkit_gobject_dep.get_variable('policydir') -# Tests dependencies -pam_wrapper_dep = dependency('pam_wrapper', required: false) -if get_option('pam') and not pam_wrapper_dep.found() - warning('Dependency "pam_wrapper" required by test suite not found') -endif - xmllint = find_program('xmllint', required: false) python3 = find_program('python3') # No meson without it! -python3_test_modules = { - 'cairo': true, - 'dbus': true, - 'dbusmock': true, - 'gi': true, - 'gi.repository.FPrint': true, - 'pypamtest': get_option('pam'), -} -python3_available_modules = [] - -foreach module, required : python3_test_modules - if required and run_command(python3, '-c', 'import @0@'.format(module), check: false).returncode() != 0 - warning('Python3 module \'' + module + '\' required by test suite not found') + +# Tests dependencies +if get_option('tests') + pam_wrapper_dep = dependency('pam_wrapper', required: false) + if get_option('pam') and not pam_wrapper_dep.found() + warning('Dependency "pam_wrapper" required by test suite not found') endif -endforeach + + python3_test_modules = { + 'cairo': true, + 'dbus': true, + 'dbusmock': true, + 'gi': true, + 'gi.repository.FPrint': true, + 'pypamtest': get_option('pam'), + } + python3_available_modules = [] + + foreach module, required : python3_test_modules + if required and run_command(python3, '-c', 'import @0@'.format(module), check: false).returncode() != 0 + warning('Python3 module \'' + module + '\' required by test suite not found') + endif + endforeach +endif + +address_sanitizer = get_option('b_sanitize') == 'address' cdata = configuration_data() cdata.set_quoted('GETTEXT_PACKAGE', meson.project_name()) @@ -211,7 +216,9 @@ endif if get_option('gtk_doc') subdir('doc') endif -subdir('tests') +if get_option('tests') + subdir('tests') +endif subdir('po') output = [] diff --git a/meson_options.txt b/meson_options.txt index 286889ee..73b28f2c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -28,3 +28,7 @@ option('gtk_doc', type: 'boolean', value: false, description: 'Use gtk-doc to build documentation') +option('tests', + type: 'boolean', + value: true, + description: 'Run tests') diff --git a/tests/meson.build b/tests/meson.build index 0e5ea3c2..9c96e10b 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -16,8 +16,6 @@ python_tests = [ # } ] -address_sanitizer = get_option('b_sanitize') == 'address' - tests = [ 'fprintd', 'test_fprintd_utils', -- GitLab