Commit 1bba3276 authored by Xavier Claessens's avatar Xavier Claessens

Meson: Install glib tests

Fixes: #1444.
parent a84cbf14
......@@ -30,11 +30,13 @@ glib_tests = {
},
'gwakeup' : {
'source' : ['gwakeuptest.c', '../gwakeup.c'],
'install' : false,
},
'gwakeup-fallback' : {
'skip' : not glib_conf.has('HAVE_EVENTFD'),
'source' : ['gwakeuptest.c', '../gwakeup.c'],
'c_args' : ['-DTEST_EVENTFD_FALLBACK'],
'install' : false,
},
'hash' : {},
'hmac' : {},
......@@ -115,6 +117,7 @@ glib_tests = {
'1bit-emufutex' : {
'source' : '1bit-mutex.c',
'c_args' : ['-DTEST_EMULATED_FUTEX'],
'install' : false,
},
'642026' : {
'suite' : ['slow'],
......@@ -145,11 +148,25 @@ foreach test_name, extra_args : glib_tests
# mutable to dictionaries (https://github.com/mesonbuild/meson/pull/3820).
if not extra_args.get('skip', false)
source = extra_args.get('source', test_name + '.c')
install = installed_tests_enabled and extra_args.get('install', true)
if install
test_conf = configuration_data()
test_conf.set('installed_tests_dir', installed_tests_execdir)
test_conf.set('program', test_name)
configure_file(
input: installed_tests_template,
output: test_name + '.test',
install_dir: installed_tests_metadir,
configuration: test_conf
)
endif
exe = executable(test_name, source,
c_args : test_cargs + extra_args.get('c_args', []),
dependencies : test_deps + extra_args.get('dependencies', []),
install: false,
install_dir: installed_tests_execdir,
install: install,
)
suite = ['glib'] + extra_args.get('suite', [])
......@@ -162,7 +179,8 @@ endforeach
executable('test-spawn-echo', 'test-spawn-echo.c',
c_args : test_cargs,
dependencies : test_deps,
install : false,
install_dir: installed_tests_execdir,
install: installed_tests_enabled,
)
# some testing of gtester functionality
......
......@@ -56,6 +56,7 @@ gioinc = include_directories('gio')
glib_prefix = get_option('prefix')
glib_bindir = join_paths(glib_prefix, get_option('bindir'))
glib_libdir = join_paths(glib_prefix, get_option('libdir'))
glib_libexecdir = join_paths(glib_prefix, get_option('libexecdir'))
glib_datadir = join_paths(glib_prefix, get_option('datadir'))
glib_pkgdatadir = join_paths(glib_datadir, 'glib-2.0')
glib_includedir = join_paths(glib_prefix, get_option('includedir'))
......@@ -66,6 +67,11 @@ endif
glib_pkgconfigreldir = join_paths(glib_libdir, 'pkgconfig')
installed_tests_metadir = join_paths(glib_datadir, 'installed-tests', meson.project_name())
installed_tests_execdir = join_paths(glib_libexecdir, 'installed-tests', meson.project_name())
installed_tests_enabled = get_option('installed_tests')
installed_tests_template = files('template.test.in')
add_project_arguments('-D_GNU_SOURCE', language: 'c')
# Disable strict aliasing;
......
......@@ -78,3 +78,8 @@ option('fam',
type : 'boolean',
value : false,
description : 'Use fam for file system monitoring')
option('installed_tests',
type : 'boolean',
value : false,
description : 'enable installed tests')
[Test]
Type=session
Exec=@installed_tests_dir@/@program@
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment