Debian Codegraph @

tests/meson.build

raw
1 if not get_option('tests')
2 subdir_done()
3 endif
4
5 test_env = environment()
6 test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
7 test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
8 test_env.set('G_DEBUG', 'gc-friendly,fatal-warnings')
9 test_env.set('GSETTINGS_BACKEND', 'memory')
10 test_env.set('GSETTINGS_SCHEMA_DIR', '@0@/data'.format(meson.project_build_root()))
11 test_env.set('PYTHONDONTWRITEBYTECODE', 'yes')
12 test_env.set('MALLOC_CHECK_', '2')
13 # as our libraries lack frame pointers since otherwise back traces are incomplete
14 test_env.set('ASAN_OPTIONS', 'fast_unwind_on_malloc=0')
15
16 test_cflags = [
17 '-DTEST_DATABASE="@0@"'.format(meson.current_source_dir() / 'data' / 'serviceproviders.xml'),
18 ]
19
20 if get_option('daemon')
21 cbd_test_sources = ['cbd-test.c']
22 cbd_test_lib = static_library(
23 'cbdtest',
24 cbd_test_sources,
25 c_args: test_cflags,
26 dependencies: [glib, gio, cbd_dep],
27 )
28 cbd_test_dep = declare_dependency(
29 include_directories: [include_directories('.')],
30 link_with: cbd_test_lib,
31 )
32
33 # daemon tests
34 tests = ['channel-manager', 'manager', 'service-providers']
35 foreach test : tests
36 t = executable(
37 'test-@0@'.format(test),
38 ['test-@[email protected]'.format(test)],
39 c_args: test_cflags,
40 pie: true,
41 dependencies: [cbd_dep, cbd_test_dep],
42 )
43 test(test, t, depends: compile_schemas, env: test_env)
44 endforeach
45 endif
46
47 # library tests
48 tests = ['lcb-init', 'message', 'util']
49 foreach test : tests
50 t = executable(
51 'test-@0@'.format(test),
52 ['test-@[email protected]'.format(test)],
53 c_args: test_cflags,
54 pie: true,
55 dependencies: [libcellbroadcast_static_dep],
56 )
57 test(test, t, env: test_env)
58 endforeach