mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
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.
This commit is contained in:
parent
e9cbcfff80
commit
a1a0a9d75a
@ -870,6 +870,23 @@ if meson.can_run_host_binaries()
|
|||||||
}
|
}
|
||||||
endif
|
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
|
foreach test_name, extra_args : gio_tests
|
||||||
source = extra_args.get('source', test_name + '.c')
|
source = extra_args.get('source', test_name + '.c')
|
||||||
extra_sources = extra_args.get('extra_sources', [])
|
extra_sources = extra_args.get('extra_sources', [])
|
||||||
@ -911,6 +928,11 @@ foreach test_name, extra_args : gio_tests
|
|||||||
suite = ['gio'] + extra_args.get('suite', [])
|
suite = ['gio'] + extra_args.get('suite', [])
|
||||||
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
|
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout
|
||||||
local_test_env = test_env
|
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', {})
|
foreach var, value : extra_args.get('env', {})
|
||||||
local_test_env.append(var, value)
|
local_test_env.append(var, value)
|
||||||
@ -925,34 +947,27 @@ foreach test_name, extra_args : gio_tests
|
|||||||
timeout : timeout,
|
timeout : timeout,
|
||||||
suite : suite,
|
suite : suite,
|
||||||
is_parallel : extra_args.get('is_parallel', true),
|
is_parallel : extra_args.get('is_parallel', true),
|
||||||
depends : extra_args.get('depends', []),
|
depends : depends,
|
||||||
should_fail : extra_args.get('should_fail', false),
|
should_fail : extra_args.get('should_fail', false),
|
||||||
)
|
)
|
||||||
endforeach
|
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
|
foreach test_name, extra_args : python_tests
|
||||||
|
depends = [extra_args.get('depends', [])]
|
||||||
suite = ['gio', 'no-valgrind']
|
suite = ['gio', 'no-valgrind']
|
||||||
|
|
||||||
if extra_args.get('can_fail', false)
|
if extra_args.get('can_fail', false)
|
||||||
suite += 'failing'
|
suite += 'failing'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
foreach program : extra_args.get('extra_programs', [])
|
||||||
|
depends += test_extra_programs_targets[program]
|
||||||
|
endforeach
|
||||||
|
|
||||||
test(
|
test(
|
||||||
test_name,
|
test_name,
|
||||||
python,
|
python,
|
||||||
|
depends: depends,
|
||||||
args: ['-B', files(test_name)],
|
args: ['-B', files(test_name)],
|
||||||
env: test_env,
|
env: test_env,
|
||||||
suite: suite,
|
suite: suite,
|
||||||
|
Loading…
Reference in New Issue
Block a user