summaryrefslogtreecommitdiff
path: root/tests/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'tests/meson.build')
-rw-r--r--tests/meson.build348
1 files changed, 81 insertions, 267 deletions
diff --git a/tests/meson.build b/tests/meson.build
index cac62db..4cbf082 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,291 +1,105 @@
-test_exe = executable(
- 'yasl-test',
- 'test_lifecycle.c',
- include_directories: inc,
- link_with: yasl_lib.get_static_lib(),
- dependencies: deps,
-)
-
-add_test_setup('asan')
-add_test_setup('tsan')
-add_test_setup('msan')
-
-test('basic', test_exe)
-
-shared_dep = declare_dependency(
- link_with: yasl_lib.get_shared_lib(),
- include_directories: include_directories('../include'),
-)
-
-shared_api_test = executable(
- 'yasl-shared-api-test',
- 'test_lifecycle.c',
- dependencies: shared_dep,
-)
-test('shared-api', shared_api_test)
-
+python = find_program('python3', native: true)
+shared_dep = declare_dependency(link_with: yasl_lib.get_shared_lib(),
+ include_directories: include_directories('../include'))
+foreach kind : ['static', 'shared']
+ dep = kind == 'static' ? yasl_dep : shared_dep
+ public_test = executable('yasl-' + kind + '-api-test', 'test_lifecycle.c', dependencies: dep)
+ test(kind + '-api', public_test)
+endforeach
if add_languages('cpp', native: false, required: false)
- cpp = meson.get_compiler('cpp')
- cpp_api_test = executable(
- 'yasl-cpp-api-test',
- 'test_api.cpp',
- dependencies: shared_dep,
- cpp_args: cpp.get_supported_arguments('-pedantic-errors') + [
- '-DYASL_HAS_WAYLAND=' + (has_wayland ? '1' : '0'),
- '-DYASL_HAS_X11=' + (has_x11 ? '1' : '0'),
- '-DYASL_HAS_COCOA=' + (has_cocoa ? '1' : '0'),
- ],
- override_options: ['cpp_std=c++11'],
- )
- test('cpp-api', cpp_api_test)
+ cpp_api = executable('yasl-cpp-api-test', 'test_api.cpp', dependencies: shared_dep,
+ cpp_args: ['-pedantic-errors'], override_options: ['cpp_std=c++11'])
+ test('cpp-api', cpp_api)
endif
-
-python = find_program('python3', native: true)
-if system == 'linux' or system == 'darwin'
- nm = find_program('nm', native: false)
- export_args = ['--platform=' + system]
- if get_option('b_sanitize').contains('address')
- # Clang's ASan instrumentation exports these linker-generated markers.
- export_args += ['--allow-export=__start_asan_globals',
- '--allow-export=__stop_asan_globals']
- endif
- exported_headers = files(
- '../include/yasl/yasl.h',
- '../include/yasl/app.h',
- '../include/yasl/desktop.h',
- '../include/yasl/timing.h',
- '../include/yasl/loop.h',
- '../include/yasl/native.h',
- )
- if has_wayland
- exported_headers += files('../include/yasl/native/wayland.h')
- endif
- if has_x11
- exported_headers += files('../include/yasl/native/x11.h')
- endif
- if has_cocoa
- exported_headers += files('../include/yasl/native/cocoa.h')
+headers = files('../include/yasl/yasl.h', '../include/yasl/cpu.h', '../include/yasl/gl.h',
+ '../include/yasl/metal.h', '../include/yasl/desktop.h')
+if has_vulkan
+ headers += files('../include/yasl/vulkan.h')
+endif
+foreach backend : ['wayland', 'x11', 'cocoa']
+ enabled = {'wayland': has_wayland, 'x11': has_x11, 'cocoa': has_cocoa}[backend]
+ if enabled
+ headers += files('../include/yasl/native/' + backend + '.h')
endif
- test('public-exports', python,
- args: [files('helpers/check_exports.py')] + export_args +
- [nm, yasl_lib.get_shared_lib(), exported_headers],
- )
+endforeach
+nm = find_program('nm')
+export_args = ['--platform=' + system]
+if get_option('b_sanitize').contains('address')
+ export_args += ['--allow-export=__start_asan_globals', '--allow-export=__stop_asan_globals']
endif
-
-contracts_test = executable(
- 'yasl-contracts-test',
- 'common/test_contracts.c',
- include_directories: inc,
- dependencies: yasl_dep,
-)
-test('contracts', contracts_test)
-
-# Exercise the SDK-independent mappings even when their backend is disabled.
-# Enabled backends already provide their mapping through yasl_dep.
-keyboard_test_sources = files('common/test_keyboard.c')
+test('public-exports', python, args: [files('helpers/check_exports.py')] + export_args +
+ [nm, yasl_lib.get_shared_lib(), headers])
+
+foreach unit : ['contracts', 'utf8', 'timers', 'loop', 'selection', 'events', 'gl_options']
+ exe = executable('yasl-' + unit + '-test', 'common/test_' + unit + '.c',
+ include_directories: inc, dependencies: yasl_dep)
+ test(unit, exe)
+endforeach
+keyboard_sources = files('common/test_keyboard.c')
if not has_wayland
- keyboard_test_sources += files('../src/platform/wayland/keymap.c')
+ keyboard_sources += files('../src/platform/wayland/keymap.c')
endif
if not has_x11
- keyboard_test_sources += files('../src/platform/x11/keymap.c')
+ keyboard_sources += files('../src/platform/x11/keymap.c')
endif
if not has_cocoa
- keyboard_test_sources += files('../src/platform/cocoa/keymap.c')
+ keyboard_sources += files('../src/platform/cocoa/keymap.c')
endif
-keyboard_test = executable('yasl-keyboard-test', keyboard_test_sources,
- include_directories: inc, dependencies: yasl_dep,
-)
-test('keyboard', keyboard_test)
-
-utf8_test = executable('yasl-utf8-test', 'common/test_utf8.c',
- include_directories: inc, dependencies: yasl_dep,
-)
-test('utf8', utf8_test)
-
-timer_test = executable(
- 'yasl-timer-test',
- 'common/test_timers.c',
- include_directories: inc,
- dependencies: yasl_dep,
-)
-test('timers', timer_test)
-
-loop_test = executable(
- 'yasl-loop-test',
- 'common/test_loop.c',
- include_directories: inc,
- dependencies: [yasl_dep, dependency('threads')],
-)
-test('loop', loop_test)
-
+keyboard = executable('yasl-keyboard-test', keyboard_sources, include_directories: inc, dependencies: yasl_dep)
+test('keyboard', keyboard)
+alloc = executable('yasl-input-alloc-test', ['common/test_input_alloc.c', '../src/common/input.c'],
+ include_directories: inc, c_args: ['-Dmalloc=yasl_private_test_malloc'])
+test('input-allocation-failure', alloc)
if system == 'linux'
- desktop_test = executable(
- 'yasl-desktop-test',
- 'common/test_desktop.c',
- include_directories: inc,
- dependencies: [yasl_dep, dependency('threads')],
- )
- # A private session bus keeps the notification and portal checks away
- # from the user's desktop.
- dbus_run_session = find_program('dbus-run-session', required: false)
- if has_dbus and dbus_run_session.found()
- test('desktop', dbus_run_session, args: ['--', desktop_test])
+ desktop = executable('yasl-desktop-test', 'common/test_desktop.c', include_directories: inc, dependencies: yasl_dep)
+ dbus_run = find_program('dbus-run-session', required: false)
+ if has_dbus and dbus_run.found()
+ test('desktop', dbus_run, args: ['--', desktop])
else
- test('desktop', desktop_test)
+ test('desktop', desktop)
endif
endif
-
-app_test = executable(
- 'yasl-app-test',
- 'common/test_app.c',
- include_directories: inc,
- dependencies: yasl_dep,
-)
-test('app-runner', app_test)
-
-input_alloc_test = executable(
- 'yasl-input-alloc-test',
- ['common/test_input_alloc.c', '../src/common/input.c'],
- include_directories: inc,
- c_args: ['-Dmalloc=yasl_test_malloc'],
-)
-test('input-allocation-failure', input_alloc_test)
-
-selection_test = executable(
- 'yasl-selection-test',
- 'common/test_selection.c',
- dependencies: yasl_dep,
-)
-test('selection', selection_test)
-
-tablet_example_test = executable('yasl-tablet-example-test', 'common/test_tablet_example.c',
- dependencies: yasl_dep,
-)
-test('tablet-example', tablet_example_test)
-
+if has_wayland
+ foreach unit : ['state', 'clipboard', 'keyboard', 'input', 'tablet', 'cursor', 'relative_pointer', 'app_input', 'popup_positioner']
+ exe = executable('yasl-' + unit + '-wayland-test', 'wayland/test_' + unit + '.c',
+ include_directories: inc, dependencies: yasl_dep)
+ test(unit + '-wayland', exe)
+ endforeach
+endif
if has_x11
- state_x11_test = executable('yasl-state-x11-test', 'x11/test_state.c',
- include_directories: inc, dependencies: yasl_dep,
- )
- test('state-x11', state_x11_test)
- tablet_x11_test = executable('yasl-tablet-x11-test', 'x11/test_tablet.c',
- include_directories: inc, dependencies: yasl_dep,
- )
- test('tablet-x11', tablet_x11_test)
+ foreach unit : ['state', 'tablet']
+ exe = executable('yasl-' + unit + '-x11-test', 'x11/test_' + unit + '.c',
+ include_directories: inc, dependencies: yasl_dep)
+ test(unit + '-x11', exe)
+ endforeach
if get_option('x11_tablet_tests')
xorg = find_program('/usr/lib/Xorg', '/usr/lib/xorg/Xorg', 'Xorg')
- native_tablet_test = executable('yasl-tablet-x11-native-test', 'x11/test_tablet_native.c',
- dependencies: yasl_dep,
- )
- test('tablet-x11-native', python,
- args: [files('helpers/run_x11_tablet.py'), xorg, native_tablet_test], timeout: 30,
- )
+ native_tablet = executable('yasl-tablet-x11-native-test', 'x11/test_tablet_native.c',
+ include_directories: inc, dependencies: yasl_dep)
+ test('tablet-x11-native', python, args: [files('helpers/run_x11_tablet.py'), xorg, native_tablet], timeout: 30)
endif
-elif get_option('x11_tablet_tests')
- error('Native X11 tablet tests require the X11 backend.')
endif
-
-if has_wayland
- state_wayland_test = executable('yasl-state-wayland-test', 'wayland/test_state.c',
- include_directories: inc, dependencies: yasl_dep,
- )
- test('state-wayland', state_wayland_test)
- clipboard_wayland_test = executable('yasl-clipboard-wayland-test', 'wayland/test_clipboard.c',
- include_directories: inc, dependencies: yasl_dep,
- )
- test('clipboard-wayland', clipboard_wayland_test)
- keyboard_wayland_test = executable('yasl-keyboard-wayland-test', 'wayland/test_keyboard.c',
- include_directories: inc, dependencies: yasl_dep,
- )
- test('keyboard-wayland', keyboard_wayland_test)
- ime_test = executable('yasl-ime-test', 'wayland/test_input.c',
- include_directories: inc,
- dependencies: yasl_dep,
- )
- test('ime-ownership', ime_test)
- app_input_test = executable('yasl-app-input-test', 'wayland/test_app_input.c',
- include_directories: inc, dependencies: yasl_dep,
- )
- test('app-input-destroy', app_input_test)
- tablet_wayland_test = executable('yasl-tablet-wayland-test', 'wayland/test_tablet.c',
- include_directories: inc, dependencies: yasl_dep,
- )
- test('tablet-wayland', tablet_wayland_test)
- cursor_wayland_test = executable('yasl-cursor-wayland-test', 'wayland/test_cursor.c',
- include_directories: inc, dependencies: yasl_dep,
- )
- test('cursor-wayland', cursor_wayland_test)
- relative_pointer_test = executable('yasl-relative-pointer-wayland-test',
- 'wayland/test_relative_pointer.c',
- include_directories: inc, dependencies: yasl_dep,
- )
- test('relative-pointer-wayland', relative_pointer_test)
-endif
-
-benchmark_exe = executable(
- 'yasl-benchmark',
- 'benchmark.c',
- include_directories: inc,
- dependencies: yasl_dep,
-)
-benchmark('performance', benchmark_exe)
-
if get_option('integration_tests')
- hello_example_test = executable('yasl-hello-example-test', 'common/test_hello_example.c',
- dependencies: shared_dep,
- )
- if has_cocoa
- test('hello-cocoa-window', hello_example_test, timeout: 20)
- test('interactive-cocoa-window', interactive_example,
- args: ['--smoke-test'], timeout: 20,
- )
- native_test = executable('yasl-native-test', 'cocoa/test_native.c',
- dependencies: shared_dep,
- )
- test('native', native_test, timeout: 20)
- ownership_test = executable('yasl-ownership-test', 'cocoa/test_ownership.m',
- dependencies: [shared_dep, deps],
- )
- test('native-ownership', ownership_test, timeout: 20)
- keyboard_cocoa_test = executable('yasl-keyboard-cocoa-test', 'cocoa/test_keyboard.m',
- dependencies: [shared_dep, deps],
- )
- test('keyboard-cocoa', keyboard_cocoa_test, timeout: 20)
- tablet_cocoa_test = executable('yasl-tablet-cocoa-test', 'cocoa/test_tablet.m',
- dependencies: [shared_dep, deps],
- )
- test('tablet-cocoa', tablet_cocoa_test, timeout: 20)
- cursor_cocoa_test = executable('yasl-cursor-cocoa-test', 'cocoa/test_cursor.m',
- dependencies: [shared_dep, deps],
- )
- test('cursor-cocoa', cursor_cocoa_test, timeout: 20)
- test('tablet-cocoa-window', tablet_example,
- args: ['--backend', 'cocoa', '--smoke-test'], timeout: 20,
- )
- else
- if not has_wayland or not has_x11
- error('Linux integration tests require Wayland and X11.')
- endif
- backend_test = executable(
- 'yasl-backend-test',
- 'common/test_backends.c',
- dependencies: [shared_dep, deps],
- )
- input_x11_test = executable('yasl-input-x11-test', 'x11/test_input.c',
- include_directories: inc, dependencies: yasl_dep,
- )
+ integration = executable('yasl-surface-integration', 'common/test_surface_integration.c',
+ include_directories: inc, dependencies: yasl_dep)
+ gl_integration = executable('yasl-gl-integration', 'common/test_gl.c',
+ dependencies: yasl_dep)
+ vulkan_integration = '-'
+ if has_vulkan
+ vulkan_integration = executable('yasl-vulkan-integration', 'common/test_vulkan.c', dependencies: yasl_dep)
+ endif
+ if system == 'linux'
weston = find_program('weston')
xwayland = find_program('Xwayland')
- test('backends', python,
- args: [files('helpers/run_backends.py'), weston, xwayland,
- backend_test, timer_test, tablet_example, hello_example_test, input_x11_test,
- interactive_example, app_test, app_input_test],
- timeout: 60,
- )
+ test('surface-backends', python, args: [files('helpers/run_surfaces.py'), weston, xwayland,
+ integration, hello_example, tablet_example, gl_integration, vulkan_integration, notepad_example], timeout: 120)
+ elif has_cocoa
+ test('surface-cocoa', integration, args: ['cocoa'], timeout: 30)
+ foreach unit : ['native', 'ownership', 'keyboard', 'tablet', 'cursor']
+ extension = unit == 'native' ? '.c' : '.m'
+ exe = executable('yasl-' + unit + '-cocoa-test', 'cocoa/test_' + unit + extension,
+ include_directories: inc, dependencies: yasl_dep)
+ test(unit + '-cocoa', exe, timeout: 30)
+ endforeach
endif
endif
-
-events_test = executable('yasl-events-test', 'common/test_events.c',
- include_directories: inc, dependencies: [yasl_dep, dependency('threads')],
-)
-test('event-contracts', events_test)