mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
meson: Disable all tests when tests are disabled
Currently, passing -Dtests=disabled 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 <abologna@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
8ce0decc37
commit
87f14badd0
@ -1,6 +1,6 @@
|
|||||||
# Skip syntax-check if not building from git because we get the list of files
|
# Skip syntax-check if not building from git because we get the list of files
|
||||||
# to check using git commands and it fails if we are not in git repository.
|
# 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 = ''
|
flake8_path = ''
|
||||||
if flake8_prog.found()
|
if flake8_prog.found()
|
||||||
flake8_path = flake8_prog.full_path()
|
flake8_path = flake8_prog.full_path()
|
||||||
|
@ -119,12 +119,14 @@ html_xslt_gen = []
|
|||||||
|
|
||||||
# --- end of XSLT processing ---
|
# --- end of XSLT processing ---
|
||||||
|
|
||||||
test(
|
if build_tests[0]
|
||||||
'check-html',
|
test(
|
||||||
xmllint_prog,
|
'check-html',
|
||||||
args: [
|
xmllint_prog,
|
||||||
'--nonet', '--noout', docs_html_paths,
|
args: [
|
||||||
],
|
'--nonet', '--noout', docs_html_paths,
|
||||||
depends: docs_html_dep,
|
],
|
||||||
suite: 'script'
|
depends: docs_html_dep,
|
||||||
)
|
suite: 'script'
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
@ -351,14 +351,16 @@ run_target(
|
|||||||
depends: install_web_deps,
|
depends: install_web_deps,
|
||||||
)
|
)
|
||||||
|
|
||||||
test(
|
if build_tests[0]
|
||||||
'check-html-references',
|
test(
|
||||||
python3_prog,
|
'check-html-references',
|
||||||
args: [
|
python3_prog,
|
||||||
check_html_references_prog.full_path(),
|
args: [
|
||||||
'--webroot',
|
check_html_references_prog.full_path(),
|
||||||
meson.project_build_root() / 'docs'
|
'--webroot',
|
||||||
],
|
meson.project_build_root() / 'docs'
|
||||||
env: runutf8,
|
],
|
||||||
suite: 'script'
|
env: runutf8,
|
||||||
)
|
suite: 'script'
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
@ -2085,6 +2085,13 @@ subdir('tools')
|
|||||||
|
|
||||||
if build_tests[0]
|
if build_tests[0]
|
||||||
subdir('tests')
|
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
|
endif
|
||||||
|
|
||||||
subdir('examples')
|
subdir('examples')
|
||||||
|
@ -105,10 +105,12 @@ access_dep = declare_dependency(
|
|||||||
|
|
||||||
generated_sym_files += access_gen_sym
|
generated_sym_files += access_gen_sym
|
||||||
|
|
||||||
test(
|
if build_tests[0]
|
||||||
'check-aclperms',
|
test(
|
||||||
python3_prog,
|
'check-aclperms',
|
||||||
args: [ check_aclperms_prog.full_path(), access_perm_h, files('viraccessperm.c') ],
|
python3_prog,
|
||||||
env: runutf8,
|
args: [ check_aclperms_prog.full_path(), access_perm_h, files('viraccessperm.c') ],
|
||||||
suite: 'script'
|
env: runutf8,
|
||||||
)
|
suite: 'script'
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
216
src/meson.build
216
src/meson.build
@ -946,121 +946,123 @@ meson.add_install_script(
|
|||||||
|
|
||||||
# Check driver files
|
# Check driver files
|
||||||
|
|
||||||
if host_machine.system() == 'linux'
|
if build_tests[0]
|
||||||
|
if host_machine.system() == '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')
|
||||||
|
test(
|
||||||
|
'check-admin-symfile',
|
||||||
|
python3_prog,
|
||||||
|
args: [ check_symfile_prog.full_path(), libvirt_admin_syms, libvirt_admin_lib ],
|
||||||
|
env: runutf8,
|
||||||
|
suite: 'script'
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'check-symfile',
|
'check-symsorting',
|
||||||
python3_prog,
|
python3_prog,
|
||||||
args: [ check_symfile_prog.full_path(), libvirt_syms, libvirt_lib ],
|
args: [
|
||||||
|
check_symsorting_prog.full_path(),
|
||||||
|
meson.current_source_dir(),
|
||||||
|
files(sym_files, used_sym_files),
|
||||||
|
],
|
||||||
env: runutf8,
|
env: runutf8,
|
||||||
suite: 'script'
|
suite: 'script'
|
||||||
)
|
)
|
||||||
|
|
||||||
if conf.has('WITH_REMOTE')
|
test(
|
||||||
test(
|
'check-admin-symsorting',
|
||||||
'check-admin-symfile',
|
python3_prog,
|
||||||
python3_prog,
|
args: [
|
||||||
args: [ check_symfile_prog.full_path(), libvirt_admin_syms, libvirt_admin_lib ],
|
check_symsorting_prog.full_path(),
|
||||||
env: runutf8,
|
meson.current_source_dir(),
|
||||||
suite: 'script'
|
libvirt_admin_private_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'
|
||||||
|
)
|
||||||
|
|
||||||
|
test(
|
||||||
|
'check-admin-drivername',
|
||||||
|
python3_prog,
|
||||||
|
args: [
|
||||||
|
check_drivername_prog.full_path(), libvirt_admin_public_syms,
|
||||||
|
],
|
||||||
|
env: runutf8,
|
||||||
|
suite: 'script'
|
||||||
|
)
|
||||||
|
|
||||||
|
test(
|
||||||
|
'check-driverimpls',
|
||||||
|
python3_prog,
|
||||||
|
args: [ check_driverimpls_prog.full_path(), 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'
|
||||||
|
)
|
||||||
|
|
||||||
|
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
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
test(
|
if pdwtags_prog.found() and cc.get_id() != 'clang'
|
||||||
'check-symsorting',
|
foreach proto : check_protocols
|
||||||
python3_prog,
|
lib = proto['lib']
|
||||||
args: [
|
test(
|
||||||
check_symsorting_prog.full_path(),
|
'check-@0@'.format(proto['name']),
|
||||||
meson.current_source_dir(),
|
python3_prog,
|
||||||
files(sym_files, used_sym_files),
|
args: [
|
||||||
],
|
check_remote_protocol_prog.full_path(),
|
||||||
env: runutf8,
|
proto['name'],
|
||||||
suite: 'script'
|
lib.name(),
|
||||||
)
|
lib.full_path(),
|
||||||
|
pdwtags_prog.full_path(),
|
||||||
test(
|
files('@0@-structs'.format(proto['name'])),
|
||||||
'check-admin-symsorting',
|
],
|
||||||
python3_prog,
|
env: runutf8,
|
||||||
args: [
|
depends: [ lib ],
|
||||||
check_symsorting_prog.full_path(),
|
suite: 'script'
|
||||||
meson.current_source_dir(),
|
)
|
||||||
libvirt_admin_private_syms,
|
endforeach
|
||||||
],
|
endif
|
||||||
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'
|
|
||||||
)
|
|
||||||
|
|
||||||
test(
|
|
||||||
'check-admin-drivername',
|
|
||||||
python3_prog,
|
|
||||||
args: [
|
|
||||||
check_drivername_prog.full_path(), libvirt_admin_public_syms,
|
|
||||||
],
|
|
||||||
env: runutf8,
|
|
||||||
suite: 'script'
|
|
||||||
)
|
|
||||||
|
|
||||||
test(
|
|
||||||
'check-driverimpls',
|
|
||||||
python3_prog,
|
|
||||||
args: [ check_driverimpls_prog.full_path(), 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'
|
|
||||||
)
|
|
||||||
|
|
||||||
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 pdwtags_prog.found() and cc.get_id() != 'clang'
|
|
||||||
foreach proto : check_protocols
|
|
||||||
lib = 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
|
||||||
|
|
||||||
# configure pkg-config files for run script
|
# configure pkg-config files for run script
|
||||||
|
Loading…
Reference in New Issue
Block a user