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