diff options
author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2022-10-24 22:16:29 +0200 |
---|---|---|
committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2022-11-01 01:56:09 +0100 |
commit | a1a0a9d75a6d0c65c92479885a2dbe0e7aa779b7 (patch) | |
tree | 40dc5a466c530b9aae80f3e705f0b76c1e2e3eae /gio/tests/meson.build | |
parent | e9cbcfff806762a12c99db492ca502dffde0ccf0 (diff) | |
download | glib-a1a0a9d75a6d0c65c92479885a2dbe0e7aa779b7.tar.gz |
gio/meson: Make possible for test to depend on extra programs
We have some test programs on which some tests depend on, for example
appinfo-test is a tool that is used by the desktop-app-info tests.
So test can now have an 'extra_programs' key where the extra program
names can be included.
This could have been handled manually via 'depends', but this allows
to avoid repeating code and be sure that all is defined when extra
programs targets are checked.
Diffstat (limited to 'gio/tests/meson.build')
-rw-r--r-- | gio/tests/meson.build | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/gio/tests/meson.build b/gio/tests/meson.build index 6dec5fe47..b0e280953 100644 --- a/gio/tests/meson.build +++ b/gio/tests/meson.build @@ -870,6 +870,23 @@ if meson.can_run_host_binaries() } endif +test_extra_programs_targets = {} +foreach program_name, extra_args : test_extra_programs + source = extra_args.get('source', program_name + '.c') + extra_sources = extra_args.get('extra_sources', []) + install = installed_tests_enabled and extra_args.get('install', true) + test_extra_programs_targets += { + program_name : executable(program_name, + sources: [source, extra_sources], + c_args : test_c_args, + dependencies : common_gio_tests_deps + extra_args.get('dependencies', []), + install_dir : installed_tests_execdir, + install_tag : 'tests', + install : install, + ) + } +endforeach + foreach test_name, extra_args : gio_tests source = extra_args.get('source', test_name + '.c') extra_sources = extra_args.get('extra_sources', []) @@ -911,6 +928,11 @@ foreach test_name, extra_args : gio_tests suite = ['gio'] + extra_args.get('suite', []) timeout = suite.contains('slow') ? test_timeout_slow : test_timeout local_test_env = test_env + depends = [extra_args.get('depends', [])] + + foreach program : extra_args.get('extra_programs', []) + depends += test_extra_programs_targets[program] + endforeach foreach var, value : extra_args.get('env', {}) local_test_env.append(var, value) @@ -925,34 +947,27 @@ foreach test_name, extra_args : gio_tests timeout : timeout, suite : suite, is_parallel : extra_args.get('is_parallel', true), - depends : extra_args.get('depends', []), + depends : depends, should_fail : extra_args.get('should_fail', false), ) endforeach -foreach program_name, extra_args : test_extra_programs - source = extra_args.get('source', program_name + '.c') - extra_sources = extra_args.get('extra_sources', []) - install = installed_tests_enabled and extra_args.get('install', true) - executable(program_name, [source, extra_sources], - c_args : test_c_args, - dependencies : common_gio_tests_deps + extra_args.get('dependencies', []), - install_dir : installed_tests_execdir, - install_tag : 'tests', - install : install, - ) -endforeach - foreach test_name, extra_args : python_tests + depends = [extra_args.get('depends', [])] suite = ['gio', 'no-valgrind'] if extra_args.get('can_fail', false) suite += 'failing' endif + foreach program : extra_args.get('extra_programs', []) + depends += test_extra_programs_targets[program] + endforeach + test( test_name, python, + depends: depends, args: ['-B', files(test_name)], env: test_env, suite: suite, |