| 1 |
girepository_tests = {} |
| 2 |
|
| 3 |
# Some GIR files are needed to test against |
| 4 |
if enable_gir |
| 5 |
girepository_tests += { |
| 6 |
'cmph-bdz': { |
| 7 |
'dependencies': [cmph_dep], |
| 8 |
}, |
| 9 |
'gthash' : { |
| 10 |
'dependencies': [girepo_gthash_dep], |
| 11 |
}, |
| 12 |
'repository' : { |
| 13 |
'depends': [glib_gir, gobject_gir], |
| 14 |
}, |
| 15 |
'repository-search-paths' : { |
| 16 |
'c_args': '-DGOBJECT_INTROSPECTION_LIBDIR="@0@"'.format(glib_libdir), |
| 17 |
'depends': [glib_gir], |
| 18 |
}, |
| 19 |
} |
| 20 |
endif |
| 21 |
|
| 22 |
test_env = environment() |
| 23 |
test_env.set('G_TEST_SRCDIR', meson.current_source_dir()) |
| 24 |
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) |
| 25 |
|
| 26 |
test_deps = [libm, thread_dep, libgirepository_dep] |
| 27 |
test_cargs = ['-DG_LOG_DOMAIN="GIRepository"', '-UG_DISABLE_ASSERT'] |
| 28 |
test_cpp_args = test_cargs |
| 29 |
|
| 30 |
foreach test_name, extra_args : girepository_tests |
| 31 |
source = extra_args.get('source', test_name + '.c') |
| 32 |
install = installed_tests_enabled and extra_args.get('install', true) |
| 33 |
installed_tests_env = extra_args.get('installed_tests_env', {}) |
| 34 |
|
| 35 |
if install |
| 36 |
test_conf = configuration_data() |
| 37 |
test_conf.set('installed_tests_dir', installed_tests_execdir) |
| 38 |
test_conf.set('program', test_name) |
| 39 |
test_env_override = '' |
| 40 |
if installed_tests_env != {} |
| 41 |
envs = [] |
| 42 |
foreach var, value : installed_tests_env |
| 43 |
envs += '@0@=@1@'.format(var, value) |
| 44 |
endforeach |
| 45 |
test_env_override = '@0@ @1@ '.format(env_program.full_path(), ' '.join(envs)) |
| 46 |
endif |
| 47 |
test_conf.set('env', test_env_override) |
| 48 |
configure_file( |
| 49 |
input: installed_tests_template_tap, |
| 50 |
output: test_name + '.test', |
| 51 |
install_dir: installed_tests_metadir, |
| 52 |
install_tag: 'tests', |
| 53 |
configuration: test_conf |
| 54 |
) |
| 55 |
endif |
| 56 |
|
| 57 |
exe = executable(test_name, source, |
| 58 |
c_args: test_cargs + extra_args.get('c_args', []), |
| 59 |
cpp_args: test_cpp_args + extra_args.get('cpp_args', []), |
| 60 |
link_args: extra_args.get('link_args', []), |
| 61 |
override_options: extra_args.get('override_options', []), |
| 62 |
dependencies: test_deps + extra_args.get('dependencies', []), |
| 63 |
link_with: extra_args.get('link_with', []), |
| 64 |
install_dir: installed_tests_execdir, |
| 65 |
install_tag: 'tests', |
| 66 |
install: install, |
| 67 |
) |
| 68 |
|
| 69 |
depends = [extra_args.get('depends', [])] |
| 70 |
suite = ['girepository', 'core'] + extra_args.get('suite', []) |
| 71 |
timeout = suite.contains('slow') ? test_timeout_slow : test_timeout |
| 72 |
|
| 73 |
if extra_args.get('can_fail', false) |
| 74 |
suite += 'failing' |
| 75 |
endif |
| 76 |
|
| 77 |
foreach program : extra_args.get('extra_programs', []) |
| 78 |
depends += test_extra_programs_targets[program] |
| 79 |
endforeach |
| 80 |
|
| 81 |
local_test_env = test_env |
| 82 |
foreach var, value : extra_args.get('env', {}) |
| 83 |
local_test_env.append(var, value) |
| 84 |
endforeach |
| 85 |
|
| 86 |
test(test_name, exe, |
| 87 |
args: extra_args.get('args', []), |
| 88 |
protocol: extra_args.get('protocol', test_protocol), |
| 89 |
depends: depends, |
| 90 |
env: local_test_env, |
| 91 |
timeout: timeout, |
| 92 |
suite: suite, |
| 93 |
should_fail: extra_args.get('should_fail', false), |
| 94 |
) |
| 95 |
endforeach |