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) 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) 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') endif test('public-exports', python, args: [files('helpers/check_exports.py')] + export_args + [nm, yasl_lib.get_shared_lib(), exported_headers], ) 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') if not has_wayland keyboard_test_sources += files('../src/platform/wayland/keymap.c') endif if not has_x11 keyboard_test_sources += files('../src/platform/x11/keymap.c') endif if not has_cocoa keyboard_test_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) 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]) else test('desktop', desktop_test) 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_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) 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, ) 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, ) 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, ) 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)