Browse Source

meson: fix dependencies of tests

If the tests are run without a full compile they will fail. For example
with the following.

> rm -rf build/
> meson setup build/
> meson test -C build/

This is because the tests rely on the devicetree tools and test
executables.

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
main
Brandon Maier 8 months ago committed by David Gibson
parent
commit
bb51223083
  1. 14
      meson.build
  2. 2
      pylibfdt/meson.build
  3. 11
      tests/meson.build

14
meson.build

@ -50,6 +50,7 @@ endif @@ -50,6 +50,7 @@ endif
py = import('python')
py = py.find_installation(required: get_option('python'))
swig = find_program('swig', required: get_option('python'))
pylibfdt_enabled = not meson.is_cross_build() and py.found() and swig.found() ? true : false

version_gen_h = vcs_tag(
command: ['git', 'describe', '--dirty=+'],
@ -59,6 +60,7 @@ version_gen_h = vcs_tag( @@ -59,6 +60,7 @@ version_gen_h = vcs_tag(

subdir('libfdt')

dtc_tools = []
if get_option('tools')
flex = find_program('flex', required: true)
bison = find_program('bison', required: true)
@ -82,7 +84,7 @@ if get_option('tools') @@ -82,7 +84,7 @@ if get_option('tools')
)

if cc.check_header('fnmatch.h')
executable(
dtc_tools += executable(
'convert-dtsv0',
[
lgen.process('convert-dtsv0-lexer.l'),
@ -94,7 +96,7 @@ if get_option('tools') @@ -94,7 +96,7 @@ if get_option('tools')
)
endif

executable(
dtc_tools += executable(
'dtc',
[
lgen.process('dtc-lexer.l'),
@ -115,7 +117,7 @@ if get_option('tools') @@ -115,7 +117,7 @@ if get_option('tools')
)

foreach e: ['fdtdump', 'fdtget', 'fdtput', 'fdtoverlay']
executable(e, files(e + '.c'), dependencies: util_dep, install: true, link_args: extra_link_args)
dtc_tools += executable(e, files(e + '.c'), dependencies: util_dep, install: true, link_args: extra_link_args)
endforeach

install_data(
@ -125,10 +127,8 @@ if get_option('tools') @@ -125,10 +127,8 @@ if get_option('tools')
)
endif

if not meson.is_cross_build()
if py.found() and swig.found()
subdir('pylibfdt')
endif
if pylibfdt_enabled
subdir('pylibfdt')
endif

if get_option('tests')

2
pylibfdt/meson.build

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
setup_py = find_program('../setup.py')
setup_py = [setup_py, '--quiet', '--top-builddir', meson.project_build_root()]

custom_target(
pylibfdt = custom_target(
'pylibfdt',
input: 'libfdt.i',
depends: libfdt,

11
tests/meson.build

@ -109,8 +109,9 @@ if not static_build @@ -109,8 +109,9 @@ if not static_build
test_deps += [dl]
endif

tests_exe = []
foreach t: tests
executable(t, files(t + '.c'), dependencies: test_deps, link_args: extra_link_args)
tests_exe += executable(t, files(t + '.c'), dependencies: test_deps, link_args: extra_link_args)
endforeach

run_tests = find_program('run_tests.sh')
@ -128,11 +129,17 @@ if not yaml.found() @@ -128,11 +129,17 @@ if not yaml.found()
env += 'NO_YAML=1'
endif

run_test_deps = [
dtc_tools, dumptrees_dtb, tests_exe
]
if pylibfdt_enabled
run_test_deps += pylibfdt
endif
test(
'run-test',
run_tests,
workdir: meson.current_build_dir(),
depends: dumptrees_dtb,
depends: run_test_deps,
env: env,
timeout: 1800, # mostly for valgrind
)

Loading…
Cancel
Save