Meson: Run in TAP mode installed tests that support it

This commit is contained in:
Xavier Claessens 2018-09-23 13:44:15 -04:00
parent 032f1a9782
commit 8391219e4c
7 changed files with 15 additions and 8 deletions

View File

@ -464,7 +464,7 @@ foreach test_dict : gio_tests
test_conf.set('installed_tests_dir', installed_tests_execdir) test_conf.set('installed_tests_dir', installed_tests_execdir)
test_conf.set('program', test_name) test_conf.set('program', test_name)
configure_file( configure_file(
input: installed_tests_template, input: installed_tests_template_tap,
output: test_name + '.test', output: test_name + '.test',
install_dir: installed_tests_metadir, install_dir: installed_tests_metadir,
configuration: test_conf configuration: test_conf

View File

@ -170,7 +170,7 @@ foreach test_name, extra_args : glib_tests
test_conf.set('installed_tests_dir', installed_tests_execdir) test_conf.set('installed_tests_dir', installed_tests_execdir)
test_conf.set('program', test_name) test_conf.set('program', test_name)
configure_file( configure_file(
input: installed_tests_template, input: installed_tests_template_tap,
output: test_name + '.test', output: test_name + '.test',
install_dir: installed_tests_metadir, install_dir: installed_tests_metadir,
configuration: test_conf configuration: test_conf

View File

@ -73,7 +73,7 @@ foreach test_name, extra_args : gobject_tests
test_conf.set('installed_tests_dir', installed_tests_execdir) test_conf.set('installed_tests_dir', installed_tests_execdir)
test_conf.set('program', test_name) test_conf.set('program', test_name)
configure_file( configure_file(
input: installed_tests_template, input: installed_tests_template_tap,
output: test_name + '.test', output: test_name + '.test',
install_dir: installed_tests_metadir, install_dir: installed_tests_metadir,
configuration: test_conf configuration: test_conf

View File

@ -71,6 +71,7 @@ installed_tests_metadir = join_paths(glib_datadir, 'installed-tests', meson.proj
installed_tests_execdir = join_paths(glib_libexecdir, '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_enabled = get_option('installed_tests')
installed_tests_template = files('template.test.in') installed_tests_template = files('template.test.in')
installed_tests_template_tap = files('template-tap.test.in')
add_project_arguments('-D_GNU_SOURCE', language: 'c') add_project_arguments('-D_GNU_SOURCE', language: 'c')

4
template-tap.test.in Normal file
View File

@ -0,0 +1,4 @@
[Test]
Type=session
Exec=@installed_tests_dir@/@program@ --tap
Output=TAP

View File

@ -27,8 +27,8 @@ testmarshal_c = custom_target('testmarshal_c',
) )
gobject_tests = { gobject_tests = {
'gvalue-test' : {}, 'gvalue-test' : {'tap' : true},
'paramspec-test' : {}, 'paramspec-test' : {'tap' : true},
'deftype' : {}, 'deftype' : {},
'defaultiface' : { 'defaultiface' : {
'extra_sources' : ['testmodule.c'], 'extra_sources' : ['testmodule.c'],
@ -53,13 +53,14 @@ foreach test_name, extra_args : gobject_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', [])
install = installed_tests_enabled and extra_args.get('install', true) install = installed_tests_enabled and extra_args.get('install', true)
template = extra_args.get('tap', false) ? installed_tests_template_tap : installed_tests_template
if install if install
test_conf = configuration_data() test_conf = configuration_data()
test_conf.set('installed_tests_dir', installed_tests_execdir) test_conf.set('installed_tests_dir', installed_tests_execdir)
test_conf.set('program', test_name) test_conf.set('program', test_name)
configure_file( configure_file(
input: installed_tests_template, input: template,
output: test_name + '.test', output: test_name + '.test',
install_dir: installed_tests_metadir, install_dir: installed_tests_metadir,
configuration: test_conf configuration: test_conf

View File

@ -18,7 +18,7 @@ subdir('refcount')
# FIXME: We are using list of dictionnaries until we can depend on Meson 0.48.0 # FIXME: We are using list of dictionnaries until we can depend on Meson 0.48.0
# that supports '+=' operator on dictionnaries. # that supports '+=' operator on dictionnaries.
tests = [{ tests = [{
'testglib' : {}, 'testglib' : {'tap' : true},
'testgdate' : {}, 'testgdate' : {},
'datetime' : {}, 'datetime' : {},
'atomic-test' : {}, 'atomic-test' : {},
@ -101,13 +101,14 @@ foreach test_dict : 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', [])
install = installed_tests_enabled and extra_args.get('install', true) install = installed_tests_enabled and extra_args.get('install', true)
template = extra_args.get('tap', false) ? installed_tests_template_tap : installed_tests_template
if install if install
test_conf = configuration_data() test_conf = configuration_data()
test_conf.set('installed_tests_dir', installed_tests_execdir) test_conf.set('installed_tests_dir', installed_tests_execdir)
test_conf.set('program', test_name) test_conf.set('program', test_name)
configure_file( configure_file(
input: installed_tests_template, input: template,
output: test_name + '.test', output: test_name + '.test',
install_dir: installed_tests_metadir, install_dir: installed_tests_metadir,
configuration: test_conf configuration: test_conf