• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Note that a few tests have dependencies on src/modules.
2#
3# The syntax for tests declaration is:
4#
5#   test name, sources, deps, [extra libs, extra flags]
6#
7
8# Default tests
9
10default_tests = [
11  [ 'asyncmsgq-test', 'asyncmsgq-test.c',
12    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
13  [ 'asyncq-test', 'asyncq-test.c',
14    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
15  [ 'channelmap-test', 'channelmap-test.c',
16    [ check_dep, libpulse_dep ] ],
17  [ 'close-test', 'close-test.c',
18    [            libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
19  [ 'core-util-test', 'core-util-test.c',
20    [ check_dep, libpulse_dep, libpulsecommon_dep ] ],
21  [ 'cpu-mix-test', [ 'cpu-mix-test.c', 'runtime-test-util.h' ],
22    [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
23  [ 'cpu-remap-test', [ 'cpu-remap-test.c', 'runtime-test-util.h' ],
24    [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
25  [ 'cpu-sconv-test', [ 'cpu-sconv-test.c', 'runtime-test-util.h' ],
26    [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
27  [ 'cpu-volume-test', [ 'cpu-volume-test.c', 'runtime-test-util.h' ],
28    [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
29  [ 'format-test', 'format-test.c',
30    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
31  [ 'get-binary-name-test', 'get-binary-name-test.c',
32    [ check_dep, libpulse_dep, libpulsecommon_dep ] ],
33  [ 'hashmap-test', 'hashmap-test.c',
34    [ check_dep, libpulse_dep, libpulsecommon_dep ] ],
35  [ 'hook-list-test', 'hook-list-test.c',
36    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
37  [ 'json-test', 'json-test.c',
38    [ check_dep, libpulse_dep, libpulsecommon_dep ] ],
39  [ 'lfe-filter-test', 'lfe-filter-test.c',
40    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
41  [ 'lock-autospawn-test', 'lock-autospawn-test.c',
42    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
43  [ 'mainloop-test', 'mainloop-test.c',
44    [ check_dep, libpulse_dep, libpulsecommon_dep ] ],
45  [ 'memblock-test', 'memblock-test.c',
46    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
47  [ 'memblockq-test', 'memblockq-test.c',
48    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
49  [ 'mix-test', 'mix-test.c',
50    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
51  [ 'mult-s16-test', [ 'mult-s16-test.c', 'runtime-test-util.h' ],
52    [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
53  [ 'proplist-test', 'proplist-test.c',
54    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
55  [ 'queue-test', 'queue-test.c',
56    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
57  [ 'resampler-test', 'resampler-test.c',
58    [            libpulse_dep, libpulsecommon_dep, libpulsecore_dep, libintl_dep ] ],
59  [ 'rtpoll-test', 'rtpoll-test.c',
60    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
61  [ 'smoother-test', 'smoother-test.c',
62    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
63  [ 'strlist-test', 'strlist-test.c',
64    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
65  [ 'thread-mainloop-test', 'thread-mainloop-test.c',
66    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
67  [ 'thread-test', 'thread-test.c',
68    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
69  [ 'utf8-test', 'utf8-test.c',
70    [ check_dep, libpulse_dep, libpulsecommon_dep ] ],
71  [ 'volume-test', 'volume-test.c',
72    [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep ] ],
73]
74
75if host_machine.system() != 'windows'
76  default_tests += [
77    [ 'sigbus-test', 'sigbus-test.c',
78      [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
79    [ 'usergroup-test', 'usergroup-test.c',
80      [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
81  ]
82endif
83
84if host_machine.system() != 'darwin'
85  default_tests += [
86    [ 'once-test', 'once-test.c',
87      [ check_dep, thread_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep, libatomic_ops_dep ] ],
88  ]
89endif
90
91if cc.has_header('sys/eventfd.h')
92  default_tests += [
93    [ 'srbchannel-test', 'srbchannel-test.c',
94      [ check_dep, libpulse_dep, libpulsecommon_dep ] ]
95  ]
96endif
97
98if alsa_dep.found()
99  default_tests += [
100    [ 'alsa-mixer-path-test', 'alsa-mixer-path-test.c',
101      [ alsa_dep, check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ],
102      libalsa_util ]
103  ]
104endif
105
106if glib_dep.found()
107  default_tests += [
108    [ 'mainloop-test-glib', 'mainloop-test.c',
109      [ check_dep, glib_dep, libpulse_dep, libpulsecommon_dep, libpulse_mainloop_glib_dep ],
110      [], ['-DGLIB_MAIN_LOOP'] ]
111  ]
112endif
113
114# No-run tests
115
116norun_tests = [
117  [ 'flist-test', 'flist-test.c',
118    [ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
119  [ 'ipacl-test', 'ipacl-test.c',
120    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
121  [ 'lo-latency-test', [ 'lo-latency-test.c', 'lo-test-util.c', 'lo-test-util.h' ],
122    [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
123  [ 'mcalign-test', 'mcalign-test.c',
124    [ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
125  [ 'pacat-simple', 'pacat-simple.c',
126    [ libpulse_dep, libpulse_simple_dep ] ],
127  [ 'parec-simple', 'parec-simple.c',
128    [ libpulse_dep, libpulse_simple_dep ] ],
129  [ 'remix-test', 'remix-test.c',
130    [ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
131  [ 'rtstutter', 'rtstutter.c',
132    [ thread_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
133  [ 'sig2str-test', 'sig2str-test.c',
134    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
135  [ 'stripnul', 'stripnul.c',
136    [ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
137]
138
139# echo-cancel test is a bit tedious to handle
140echo_cancel_test_sources = []
141foreach s : module_echo_cancel_sources
142  echo_cancel_test_sources += '../modules/' + s
143endforeach
144echo_cancel_test_sources += module_echo_cancel_orc_sources
145
146norun_tests += [
147  [ 'echo-cancel-test', echo_cancel_test_sources,
148    module_echo_cancel_deps + [ libpulse_dep, libpulsecommon_dep, libpulsecore_dep, libintl_dep ],
149    module_echo_cancel_libs,
150    module_echo_cancel_flags + server_c_args + [ '-DPA_MODULE_NAME=module_echo_cancel', '-DECHO_CANCEL_TEST=1' ] ]
151]
152
153if cc.has_header_symbol('signal.h', 'SIGXCPU')
154  norun_tests += [
155    [ 'cpulimit-test', [ 'cpulimit-test.c', '../daemon/cpulimit.c', '../daemon/cpulimit.h' ],
156      [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
157    [ 'cpulimit-test2', [ 'cpulimit-test.c', '../daemon/cpulimit.c', '../daemon/cpulimit.h' ],
158      [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ],
159      [], ['-DTEST2'] ],
160  ]
161endif
162
163if cc.has_function('pthread_setaffinity_np', dependencies : thread_dep)
164  norun_tests += [
165    [ 'atomic-test', 'atomic-test.c',
166      [ check_dep, libpulsecommon_dep, thread_dep ] ]
167  ]
168endif
169
170if alsa_dep.found()
171  norun_tests += [
172    [ 'alsa-time-test', 'alsa-time-test.c', [ alsa_dep ] ]
173  ]
174endif
175
176if gtk_dep.found() and glib_dep.found()
177  norun_tests += [
178    [ 'gtk-test', 'gtk-test.c',
179      [ gtk_dep, libpulse_dep, libpulse_mainloop_glib_dep ] ]
180  ]
181endif
182
183# Generate tests
184
185test_env = environment()
186test_env.set('MAKE_CHECK', '1')
187
188foreach t : default_tests + norun_tests
189  name = t[0]
190  sources = t[1]
191  deps = t[2]
192  extra_libs = t.get(3, [])
193  extra_flags = t.get(4, [])
194
195  exe = executable(name, sources,
196    c_args : pa_c_args + extra_flags,
197    include_directories : [ configinc, topinc ],
198    dependencies : deps,
199    link_with : extra_libs,
200  )
201
202  if default_tests.contains(t)
203    test(name, exe,
204      env : test_env,
205      timeout : 300,
206    )
207  endif
208endforeach
209
210# These tests need a running pulseaudio daemon
211
212daemon_tests = [
213  [ 'extended-test', 'extended-test.c',
214    [ check_dep, libm_dep, libpulse_dep ] ],
215  [ 'sync-playback', 'sync-playback.c',
216    [ check_dep, libm_dep, libpulse_dep ] ],
217]
218
219daemon_tests_long = [
220  [ 'connect-stress', 'connect-stress.c',
221    [ check_dep, libpulse_dep ] ],
222  [ 'interpol-test', 'interpol-test.c',
223    [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ],
224]
225
226daemon_test_names = []
227daemon_test_long_names = []
228
229foreach t : daemon_tests + daemon_tests_long
230  name = t[0]
231  sources = t[1]
232  deps = t[2]
233
234  if daemon_tests.contains(t)
235    daemon_test_names += name
236  else
237    daemon_test_long_names += name
238  endif
239
240  executable(name, sources,
241    c_args : pa_c_args,
242    include_directories : [ configinc, topinc ],
243    dependencies : deps,
244  )
245endforeach
246
247test_daemon_meson_sh = find_program('test-daemon.meson.sh')
248run_target('test-daemon',
249  command : [ test_daemon_meson_sh ] + daemon_test_names
250)
251run_target('test-daemon-long',
252  command : [ test_daemon_meson_sh ] + daemon_test_long_names
253)
254