diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2018-07-16 13:39:44 -0400 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.com> | 2018-07-16 15:36:20 -0400 |
commit | 1bba3276bb3b7a878860ac01483574599b23853c (patch) | |
tree | a33ec5a27fd0b2da5795354d283b8420bf6ca5fc | |
parent | a84cbf1434f7b2b5a19d800aa2b7ce294fed5f59 (diff) | |
download | glib-1bba3276bb3b7a878860ac01483574599b23853c.tar.gz |
Meson: Install glib tests
Fixes: #1444.
-rw-r--r-- | glib/tests/meson.build | 22 | ||||
-rw-r--r-- | meson.build | 6 | ||||
-rw-r--r-- | meson_options.txt | 5 | ||||
-rw-r--r-- | template.test.in | 3 |
4 files changed, 34 insertions, 2 deletions
diff --git a/glib/tests/meson.build b/glib/tests/meson.build index e684af45e..f5c0fbecb 100644 --- a/glib/tests/meson.build +++ b/glib/tests/meson.build @@ -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 diff --git a/meson.build b/meson.build index fa7357d40..15f895e7f 100644 --- a/meson.build +++ b/meson.build @@ -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; diff --git a/meson_options.txt b/meson_options.txt index 5245e0a8b..64accf68b 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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') diff --git a/template.test.in b/template.test.in new file mode 100644 index 000000000..f701627f8 --- /dev/null +++ b/template.test.in @@ -0,0 +1,3 @@ +[Test] +Type=session +Exec=@installed_tests_dir@/@program@ |