summaryrefslogtreecommitdiffstats
path: root/test/meson.build
blob: 1ce7d0089acd929cbb51bf2603098cf371a24708 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
pwtest_sources = [
  'pwtest.h',
  'pwtest-implementation.h',
  'pwtest.c',
  'pwtest-compat.c',
]

pwtest_deps = [
  pipewire_dep,
  mathlib,
  dl_lib,
  cap_lib,
  epoll_shim_dep
]

pwtest_c_args = [
  '-DBUILD_ROOT="@0@"'.format(meson.project_build_root()),
  '-DSOURCE_ROOT="@0@"'.format(meson.project_source_root()),
]

pwtest_inc = [
  pipewire_inc,
  configinc,
  includes_inc,
]

pwtest_lib = static_library(
  'pwtest',
  pwtest_sources,
  c_args: pwtest_c_args,
  dependencies: pwtest_deps,
  include_directories: pwtest_inc,
)

test('test-pwtest',
    executable('test-pwtest',
               'test-pwtest.c',
               include_directories: pwtest_inc,
               dependencies: [ spa_dep ],
               link_with: pwtest_lib)
)

# Compilation only, this is the example file for how pwtest works and most
# of its tests will fail.
executable('test-example',
  'test-example.c',
  include_directories: pwtest_inc,
  dependencies: [ spa_dep ],
  link_with: pwtest_lib)

test('test-pw-utils',
    executable('test-pw-utils',
               'test-properties.c',
               'test-array.c',
               'test-map.c',
               'test-utils.c',
               include_directories: pwtest_inc,
               dependencies: [ spa_dep ],
               link_with: pwtest_lib)
)

test('test-lib',
    executable('test-lib',
               'test-lib.c',
               include_directories: pwtest_inc,
               dependencies: [ spa_dep ],
               link_with: pwtest_lib)
)

test('test-client',
    executable('test-client',
               'test-client.c',
               include_directories: pwtest_inc,
               dependencies: [ spa_dep ],
               link_with: pwtest_lib)
)

test('test-loop',
    executable('test-loop',
               'test-loop.c',
               include_directories: pwtest_inc,
               dependencies: [ spa_dep ],
               link_with: pwtest_lib)
)

test('test-context',
    executable('test-context',
               'test-context.c',
               'test-config.c',
               include_directories: pwtest_inc,
               dependencies: [spa_dep, spa_support_dep, spa_dbus_dep],
               link_with: [pwtest_lib,
                            pipewire_module_protocol_native,
                            pipewire_module_client_node,
                            pipewire_module_client_device,
                            pipewire_module_adapter,
                            pipewire_module_metadata,
                            pipewire_module_session_manager])
)

test('test-support',
    executable('test-support',
               'test-support.c',
               'test-logger.c',
               include_directories: pwtest_inc,
               dependencies: [spa_dep, systemd_dep, spa_support_dep, spa_journal_dep],
               link_with: [pwtest_lib])
)
test('test-spa',
    executable('test-spa',
               'test-spa-buffer.c',
               'test-spa-json.c',
               'test-spa-utils.c',
               'test-spa-log.c',
               'test-spa-node.c',
               'test-spa-pod.c',
               include_directories: pwtest_inc,
               dependencies: [ spa_dep ],
               link_with: pwtest_lib)
)

openal_info = find_program('openal-info', required: false)
if openal_info.found()
    cdata.set_quoted('OPENAL_INFO_PATH', openal_info.full_path())
endif
summary({'openal-info': openal_info.found()}, bool_yn: true, section: 'Functional test programs')

pactl = find_program('pactl', required: false)
if pactl.found()
    cdata.set_quoted('PACTL_PATH', pactl.full_path())
endif
summary({'pactl': pactl.found()}, bool_yn: true, section: 'Functional test programs')

if default_sm == 'media-session' or default_sm == 'wireplumber'
  test('test-functional',
    executable('test-functional',
               'test-functional.c',
               include_directories: pwtest_inc,
               dependencies: [ spa_dep ],
               link_with: pwtest_lib)
  )
endif

valgrind = find_program('valgrind', required: false)
summary({'valgrind (test setup)': valgrind.found()}, bool_yn: true, section: 'Optional programs')
if valgrind.found()
  valgrind_env = environment({'PIPEWIRE_DEBUG': 'D'})
  add_test_setup('valgrind',
                 exe_wrapper : [ valgrind,
                   '--leak-check=full',
                   '--gen-suppressions=all',
                   '--error-exitcode=3',
                   ],
                 env :  valgrind_env,
                 timeout_multiplier : 3)
endif