Compare commits

...

1 Commits

Author SHA1 Message Date
Matthias Clasen
4847666a12 build: Add a build-internal-tests option
Internal tests link against the static library,
which takes a *long* time. Making it possible
to run only the public api tests is good for
faster turnaround times.
2021-09-14 11:36:02 -04:00
4 changed files with 88 additions and 79 deletions

View File

@@ -119,6 +119,11 @@ option('build-tests',
value: 'true',
description : 'Build tests')
option('build-internal-tests',
type: 'boolean',
value: 'true',
description : 'Build tests for internal apis')
option('install-tests',
type: 'boolean',
value: 'false',

View File

@@ -30,34 +30,36 @@ test('api', test_api,
suite: 'css',
)
test_data = executable('data', 'data.c',
c_args: common_cflags,
include_directories: [confinc, ],
dependencies: libgtk_static_dep,
install: get_option('install-tests'),
install_dir: testexecdir,
)
if get_option('build-internal-tests')
test_data = executable('data', 'data.c',
c_args: common_cflags,
include_directories: [confinc, ],
dependencies: libgtk_static_dep,
install: get_option('install-tests'),
install_dir: testexecdir,
)
test('data', test_data,
args: ['--tap', '-k' ],
protocol: 'tap',
env: csstest_env,
suite: 'css',
)
test('data', test_data,
args: ['--tap', '-k' ],
protocol: 'tap',
env: csstest_env,
suite: 'css',
)
transition = executable('transition', 'transition.c',
c_args: common_cflags,
dependencies: libgtk_static_dep,
install: get_option('install-tests'),
install_dir: testexecdir,
)
transition = executable('transition', 'transition.c',
c_args: common_cflags,
dependencies: libgtk_static_dep,
install: get_option('install-tests'),
install_dir: testexecdir,
)
test('transition', transition,
args: [ '--tap', '-k' ],
protocol: 'tap',
env: csstest_env,
suite: 'css'
)
test('transition', transition,
args: [ '--tap', '-k' ],
protocol: 'tap',
env: csstest_env,
suite: 'css'
)
endif
if get_option('install-tests')
conf = configuration_data()

View File

@@ -239,31 +239,31 @@ internal_tests = [
[ 'half-float' ],
]
foreach t : internal_tests
test_name = t.get(0)
test_srcs = ['@0@.c'.format(test_name)] + t.get(1, [])
test_extra_cargs = t.get(2, [])
test_extra_ldflags = t.get(3, [])
test_exe = executable(test_name, test_srcs,
c_args : test_cargs + test_extra_cargs + common_cflags,
link_args : test_extra_ldflags,
dependencies : libgtk_static_dep,
install: get_option('install-tests'),
install_dir: testexecdir,
)
test(test_name, test_exe,
args: [ '--tap', '-k' ],
protocol: 'tap',
env: [
'GSK_RENDERER=cairo',
'GTK_A11Y=test',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
],
suite: 'gsk',
)
endforeach
if get_option('build-internal-tests')
foreach t : internal_tests
test_name = t.get(0)
test_srcs = ['@0@.c'.format(test_name)] + t.get(1, [])
test_extra_cargs = t.get(2, [])
test_extra_ldflags = t.get(3, [])
test_exe = executable(test_name, test_srcs,
c_args : test_cargs + test_extra_cargs + common_cflags,
link_args : test_extra_ldflags,
dependencies : libgtk_static_dep,
install: get_option('install-tests'),
install_dir: testexecdir,
)
test(test_name, test_exe,
args: [ '--tap', '-k' ],
protocol: 'tap',
env: [
'GSK_RENDERER=cairo',
'GTK_A11Y=test',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
],
suite: 'gsk',
)
endforeach
endif

View File

@@ -190,38 +190,40 @@ foreach t : tests
)
endforeach
foreach t : internal_tests
test_name = t.get('name')
test_srcs = ['@0@.c'.format(test_name)] + t.get('sources', [])
test_extra_cargs = t.get('c_args', [])
test_extra_ldflags = t.get('link_args', [])
test_extra_suites = t.get('suites', [])
test_timeout = 60
if get_option('build-internal-tests')
foreach t : internal_tests
test_name = t.get('name')
test_srcs = ['@0@.c'.format(test_name)] + t.get('sources', [])
test_extra_cargs = t.get('c_args', [])
test_extra_ldflags = t.get('link_args', [])
test_extra_suites = t.get('suites', [])
test_timeout = 60
test_exe = executable(test_name,
sources: test_srcs,
c_args: test_cargs + test_extra_cargs,
link_args: test_extra_ldflags,
dependencies: libgtk_static_dep,
install: get_option('install-tests'),
install_dir: testexecdir,
)
test_exe = executable(test_name,
sources: test_srcs,
c_args: test_cargs + test_extra_cargs,
link_args: test_extra_ldflags,
dependencies: libgtk_static_dep,
install: get_option('install-tests'),
install_dir: testexecdir,
)
expect_fail = xfail.contains(test_name)
expect_fail = xfail.contains(test_name)
if test_extra_suites.contains('slow')
test_timeout = 90
endif
if test_extra_suites.contains('slow')
test_timeout = 90
endif
test(test_name, test_exe,
args: [ '--tap', '-k' ],
protocol: 'tap',
timeout: test_timeout,
env: test_env,
suite: ['gtk'] + test_extra_suites,
should_fail: expect_fail,
)
endforeach
test(test_name, test_exe,
args: [ '--tap', '-k' ],
protocol: 'tap',
timeout: test_timeout,
env: test_env,
suite: ['gtk'] + test_extra_suites,
should_fail: expect_fail,
)
endforeach
endif
# FIXME: if objc autotestkeywords_CPPFLAGS += -DHAVE_OBJC=1 -x objective-c++
if add_languages('cpp', required: false, native: false)