Always build tests if we enabled installed-tests

If we're cross-compiling, the installed-tests are useful even if we
can't run them on the build machine: we can copy them to the host
machine (possibly via a distro package like Debian's libglib2.0-tests)
and run them there.

While I'm changing the build-tests condition anyway, deduplicate it.

Based on a patch by Helmut Grohne.

Bug-Debian: https://bugs.debian.org/941509
Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2019-10-01 19:51:48 +01:00
parent 90bdc2ffb6
commit 42d8e17795
4 changed files with 3 additions and 8 deletions

View File

@ -1009,8 +1009,6 @@ if enable_systemtap
endif
subdir('fam')
# Dont build the tests unless we can run them (either natively or in an exe wrapper)
build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())
if build_tests
subdir('tests')
endif

View File

@ -458,8 +458,6 @@ if enable_systemtap
)
endif
# Dont build the tests unless we can run them (either natively or in an exe wrapper)
build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())
if build_tests
subdir('tests')
endif

View File

@ -165,8 +165,6 @@ if enable_systemtap
)
endif
# Dont build the tests unless we can run them (either natively or in an exe wrapper)
build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())
if build_tests
subdir('tests')
endif

View File

@ -76,6 +76,9 @@ installed_tests_enabled = get_option('installed_tests')
installed_tests_template = files('template.test.in')
installed_tests_template_tap = files('template-tap.test.in')
# Dont build the tests unless we can run them (either natively, in an exe wrapper, or by installing them for later use)
build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper()) or installed_tests_enabled
add_project_arguments('-D_GNU_SOURCE', language: 'c')
# Disable strict aliasing;
@ -2097,8 +2100,6 @@ subdir('gthread')
subdir('gmodule')
subdir('gio')
subdir('fuzzing')
# Dont build the tests unless we can run them (either natively or in an exe wrapper)
build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())
if build_tests
subdir('tests')
endif