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
py = import('python') py = import('python')
py = py.find_installation(required: get_option('python')) py = py.find_installation(required: get_option('python'))
swig = find_program('swig', 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( version_gen_h = vcs_tag(
command: ['git', 'describe', '--dirty=+'], command: ['git', 'describe', '--dirty=+'],
@ -59,6 +60,7 @@ version_gen_h = vcs_tag(


subdir('libfdt') subdir('libfdt')


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


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


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


foreach e: ['fdtdump', 'fdtget', 'fdtput', 'fdtoverlay'] 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 endforeach


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


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


if get_option('tests') if get_option('tests')

2
pylibfdt/meson.build

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


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

11
tests/meson.build

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


tests_exe = []
foreach t: tests 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 endforeach


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


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

Loading…
Cancel
Save