if not get_option('tests') subdir_done() endif test_env = environment() test_env.set('G_TEST_SRCDIR', meson.current_source_dir()) test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) test_env.set('G_DEBUG', 'gc-friendly,fatal-warnings') test_env.set('GSETTINGS_BACKEND', 'memory') test_env.set('GSETTINGS_SCHEMA_DIR', '@0@/data'.format(meson.project_build_root())) test_env.set('PYTHONDONTWRITEBYTECODE', 'yes') test_env.set('MALLOC_CHECK_', '2') # as our libraries lack frame pointers since otherwise back traces are incomplete test_env.set('ASAN_OPTIONS', 'fast_unwind_on_malloc=0') test_cflags = [ '-DTEST_DATABASE="@0@"'.format(meson.current_source_dir() / 'data' / 'serviceproviders.xml'), ] if get_option('daemon') cbd_test_sources = ['cbd-test.c'] cbd_test_lib = static_library( 'cbdtest', cbd_test_sources, c_args: test_cflags, dependencies: [glib, gio, cbd_dep], ) cbd_test_dep = declare_dependency( include_directories: [include_directories('.')], link_with: cbd_test_lib, ) # daemon tests tests = ['channel-manager', 'manager', 'service-providers'] foreach test : tests t = executable( 'test-@0@'.format(test), ['test-@0@.c'.format(test)], c_args: test_cflags, pie: true, dependencies: [cbd_dep, cbd_test_dep], ) test(test, t, depends: compile_schemas, env: test_env) endforeach endif # library tests tests = ['lcb-init', 'message', 'util'] foreach test : tests t = executable( 'test-@0@'.format(test), ['test-@0@.c'.format(test)], c_args: test_cflags, pie: true, dependencies: [libcellbroadcast_static_dep], ) test(test, t, env: test_env) endforeach