mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-10-29 05:40:23 -04:00 
			
		
		
		
	meson: Enable (almost) all tests
Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
This commit is contained in:
		
							parent
							
								
									35ed95df0d
								
							
						
					
					
						commit
						6dbb0774b2
					
				
					 5 changed files with 239 additions and 1 deletions
				
			
		|  | @ -416,6 +416,10 @@ if webrtc_dep.found() | ||||||
|   cdata.set('HAVE_WEBRTC', 1) |   cdata.set('HAVE_WEBRTC', 1) | ||||||
| endif | endif | ||||||
| 
 | 
 | ||||||
|  | # Test dependencies | ||||||
|  | 
 | ||||||
|  | check_dep = dependency('check', version : '>= 0.9.10', required : get_option('tests')) | ||||||
|  | 
 | ||||||
| # Now generate config.h from everything above | # Now generate config.h from everything above | ||||||
| configure_file(output : 'config.h', configuration : cdata) | configure_file(output : 'config.h', configuration : cdata) | ||||||
| 
 | 
 | ||||||
|  | @ -483,7 +487,7 @@ summary = [ | ||||||
|   'Enable SoXR (resampler):       @0@'.format(soxr_dep.found()), |   'Enable SoXR (resampler):       @0@'.format(soxr_dep.found()), | ||||||
|   'Enable WebRTC echo canceller:  @0@'.format(webrtc_dep.found()), |   'Enable WebRTC echo canceller:  @0@'.format(webrtc_dep.found()), | ||||||
| #  'Enable gcov coverage:          @0@'.format(${ENABLE_GCOV}), | #  'Enable gcov coverage:          @0@'.format(${ENABLE_GCOV}), | ||||||
| #  'Enable unit tests:             @0@'.format(${ENABLE_TESTS}), |   'Enable unit tests:             @0@'.format(get_option('tests')), | ||||||
|   '', |   '', | ||||||
|   'Database:                      @0@'.format(get_option('database')), |   'Database:                      @0@'.format(get_option('database')), | ||||||
|   'Legacy Database Entry Support: @0@'.format(get_option('legacy-database-entry-format')), |   'Legacy Database Entry Support: @0@'.format(get_option('legacy-database-entry-format')), | ||||||
|  |  | ||||||
|  | @ -1,3 +1,7 @@ | ||||||
|  | option('tests', | ||||||
|  |        type : 'boolean', | ||||||
|  |        description : 'Enable unit tests') | ||||||
|  | 
 | ||||||
| option('system_user', | option('system_user', | ||||||
|         type : 'string', value : 'pulse', |         type : 'string', value : 'pulse', | ||||||
|         description : 'User for running the PulseAudio daemon as a system-wide instance (pulse)') |         description : 'User for running the PulseAudio daemon as a system-wide instance (pulse)') | ||||||
|  |  | ||||||
|  | @ -192,4 +192,7 @@ subdir('pulse') | ||||||
| subdir('pulsecore') | subdir('pulsecore') | ||||||
| subdir('daemon') | subdir('daemon') | ||||||
| subdir('modules') | subdir('modules') | ||||||
|  | if get_option('tests') | ||||||
|  |   subdir('tests') | ||||||
|  | endif | ||||||
| subdir('utils') | subdir('utils') | ||||||
|  |  | ||||||
							
								
								
									
										218
									
								
								src/tests/meson.build
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										218
									
								
								src/tests/meson.build
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,218 @@ | ||||||
|  | # Note that a few tests have dependencies on src/modules. | ||||||
|  | # | ||||||
|  | # The syntax for tests declaration is: | ||||||
|  | # | ||||||
|  | #   test name, sources, deps, [extra libs, extra flags] | ||||||
|  | # | ||||||
|  | 
 | ||||||
|  | # Default tests | ||||||
|  | 
 | ||||||
|  | default_tests = [ | ||||||
|  |   [ 'asyncmsgq-test', 'asyncmsgq-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'asyncq-test', 'asyncq-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'channelmap-test', 'channelmap-test.c', | ||||||
|  |     [ check_dep, libpulse_dep ] ], | ||||||
|  |   [ 'close-test', 'close-test.c', | ||||||
|  |     [            libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'core-util-test', 'core-util-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep ] ], | ||||||
|  |   [ 'cpu-mix-test', [ 'cpu-mix-test.c', 'runtime-test-util.h' ], | ||||||
|  |     [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'cpu-remap-test', [ 'cpu-remap-test.c', 'runtime-test-util.h' ], | ||||||
|  |     [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'cpu-sconv-test', [ 'cpu-sconv-test.c', 'runtime-test-util.h' ], | ||||||
|  |     [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'cpu-volume-test', [ 'cpu-volume-test.c', 'runtime-test-util.h' ], | ||||||
|  |     [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'format-test', 'format-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'get-binary-name-test', 'get-binary-name-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep ] ], | ||||||
|  |   [ 'hook-list-test', 'hook-list-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'json-test', 'json-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep ] ], | ||||||
|  |   [ 'lfe-filter-test', 'lfe-filter-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'lock-autospawn-test', 'lock-autospawn-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'mainloop-test', 'mainloop-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep ] ], | ||||||
|  |   [ 'memblock-test', 'memblock-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'memblockq-test', 'memblockq-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'mix-test', 'mix-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'mult-s16-test', [ 'mult-s16-test.c', 'runtime-test-util.h' ], | ||||||
|  |     [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'proplist-test', 'proplist-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'queue-test', 'queue-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'resampler-test', 'resampler-test.c', | ||||||
|  |     [            libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'rtpoll-test', 'rtpoll-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'smoother-test', 'smoother-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'strlist-test', 'strlist-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'thread-mainloop-test', 'thread-mainloop-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'thread-test', 'thread-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'utf8-test', 'utf8-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep ] ], | ||||||
|  |   [ 'volume-test', 'volume-test.c', | ||||||
|  |     [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep ] ], | ||||||
|  | ] | ||||||
|  | 
 | ||||||
|  | if host_machine.system() != 'windows' | ||||||
|  |   default_tests += [ | ||||||
|  |     [ 'sigbus-test', 'sigbus-test.c', | ||||||
|  |       [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |     [ 'usergroup-test', 'usergroup-test.c', | ||||||
|  |       [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   ] | ||||||
|  | endif | ||||||
|  | 
 | ||||||
|  | if host_machine.system() != 'darwin' | ||||||
|  |   default_tests += [ | ||||||
|  |     [ 'once-test', 'once-test.c', | ||||||
|  |       [ check_dep, thread_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   ] | ||||||
|  | endif | ||||||
|  | 
 | ||||||
|  | if cc.has_header('sys/eventfd.h') | ||||||
|  |   default_tests += [ | ||||||
|  |     [ 'srbchannel-test', 'srbchannel-test.c', | ||||||
|  |       [ check_dep, libpulse_dep, libpulsecommon_dep ] ] | ||||||
|  |   ] | ||||||
|  | endif | ||||||
|  | 
 | ||||||
|  | if alsa_dep.found() | ||||||
|  |   default_tests += [ | ||||||
|  |     [ 'alsa-mixer-path-test', 'alsa-mixer-path-test.c', | ||||||
|  |       [ alsa_dep, check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ], | ||||||
|  |       libalsa_util ] | ||||||
|  |   ] | ||||||
|  | endif | ||||||
|  | 
 | ||||||
|  | if glib_dep.found() | ||||||
|  |   default_tests += [ | ||||||
|  |     [ 'mainloop-test-glib', 'mainloop-test.c', | ||||||
|  |       [ check_dep, glib_dep, libpulse_dep, libpulsecommon_dep, libpulse_mainloop_glib_dep ], | ||||||
|  |       [], ['-DGLIB_MAIN_LOOP'] ] | ||||||
|  |   ] | ||||||
|  | endif | ||||||
|  | 
 | ||||||
|  | # No-run tests | ||||||
|  | 
 | ||||||
|  | norun_tests = [ | ||||||
|  |   [ 'flist-test', 'flist-test.c', | ||||||
|  |     [ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'ipacl-test', 'ipacl-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'lo-latency-test', [ 'lo-latency-test.c', 'lo-test-util.c', 'lo-test-util.h' ], | ||||||
|  |     [ check_dep, libm_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'mcalign-test', 'mcalign-test.c', | ||||||
|  |     [ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'pacat-simple', 'pacat-simple.c', | ||||||
|  |     [ libpulse_dep, libpulse_simple_dep ] ], | ||||||
|  |   [ 'parec-simple', 'parec-simple.c', | ||||||
|  |     [ libpulse_dep, libpulse_simple_dep ] ], | ||||||
|  |   [ 'remix-test', 'remix-test.c', | ||||||
|  |     [ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'rtstutter', 'rtstutter.c', | ||||||
|  |     [ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'sig2str-test', 'sig2str-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'stripnul', 'stripnul.c', | ||||||
|  |     [ libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  | # TODO | ||||||
|  | #  [ 'echo-cancel-test'], | ||||||
|  | ] | ||||||
|  | 
 | ||||||
|  | if cc.has_header_symbol('signal.h', 'SIGXCPU') | ||||||
|  |   norun_tests += [ | ||||||
|  |     [ 'cpulimit-test', [ 'cpulimit-test.c', '../daemon/cpulimit.c', '../daemon/cpulimit.h' ], | ||||||
|  |       [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |     [ 'cpulimit-test2', [ 'cpulimit-test.c', '../daemon/cpulimit.c', '../daemon/cpulimit.h' ], | ||||||
|  |       [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ], | ||||||
|  |       [], ['-DTEST2'] ], | ||||||
|  |   ] | ||||||
|  | endif | ||||||
|  | 
 | ||||||
|  | if alsa_dep.found() | ||||||
|  |   norun_tests += [ | ||||||
|  |     [ 'alsa-time-test', 'alsa-time-test.c', [ alsa_dep ] ] | ||||||
|  |   ] | ||||||
|  | endif | ||||||
|  | 
 | ||||||
|  | if gtk_dep.found() and glib_dep.found() | ||||||
|  |   norun_tests += [ | ||||||
|  |     [ 'gtk-test', 'gtk-test.c', | ||||||
|  |       [ gtk_dep, libpulse_dep, libpulse_mainloop_glib_dep ] ] | ||||||
|  |   ] | ||||||
|  | endif | ||||||
|  | 
 | ||||||
|  | # Generate tests | ||||||
|  | 
 | ||||||
|  | test_env = environment() | ||||||
|  | test_env.set('MAKE_CHECK', '1') | ||||||
|  | 
 | ||||||
|  | foreach t : default_tests + norun_tests | ||||||
|  |   name = t[0] | ||||||
|  |   sources = t[1] | ||||||
|  |   deps = t[2] | ||||||
|  |   extra_libs = t.get(3, []) | ||||||
|  |   extra_flags = t.get(4, []) | ||||||
|  | 
 | ||||||
|  |   exe = executable(name, sources, | ||||||
|  |     c_args : pa_c_args + extra_flags, | ||||||
|  |     include_directories : [ configinc, topinc ], | ||||||
|  |     dependencies : deps, | ||||||
|  |     link_with : extra_libs, | ||||||
|  |   ) | ||||||
|  | 
 | ||||||
|  |   test(name, exe, | ||||||
|  |     env : test_env | ||||||
|  |   ) | ||||||
|  | endforeach | ||||||
|  | 
 | ||||||
|  | # These tests need a running pulseaudio daemon | ||||||
|  | 
 | ||||||
|  | daemon_tests = [ | ||||||
|  |   [ 'connect-stress', 'connect-stress.c', | ||||||
|  |     [ check_dep, libpulse_dep ] ], | ||||||
|  |   [ 'extended-test', 'extended-test.c', | ||||||
|  |     [ check_dep, libm_dep, libpulse_dep ] ], | ||||||
|  |   [ 'interpol-test', 'interpol-test.c', | ||||||
|  |     [ check_dep, libpulse_dep, libpulsecommon_dep, libpulsecore_dep ] ], | ||||||
|  |   [ 'sync-playback', 'sync-playback.c', | ||||||
|  |     [ check_dep, libm_dep, libpulse_dep ] ], | ||||||
|  | ] | ||||||
|  | 
 | ||||||
|  | daemon_test_names = [] | ||||||
|  | 
 | ||||||
|  | foreach t : daemon_tests | ||||||
|  |   name = t[0] | ||||||
|  |   sources = t[1] | ||||||
|  |   deps = t[2] | ||||||
|  | 
 | ||||||
|  |   daemon_test_names += name | ||||||
|  | 
 | ||||||
|  |   executable(name, sources, | ||||||
|  |     c_args : pa_c_args, | ||||||
|  |     include_directories : [ configinc, topinc ], | ||||||
|  |     dependencies : deps, | ||||||
|  |   ) | ||||||
|  | endforeach | ||||||
|  | 
 | ||||||
|  | test_daemon_meson_sh = find_program('test-daemon.meson.sh') | ||||||
|  | run_target('test-daemon', | ||||||
|  |   command : [ test_daemon_meson_sh ] + daemon_test_names | ||||||
|  | ) | ||||||
							
								
								
									
										9
									
								
								src/tests/test-daemon.meson.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								src/tests/test-daemon.meson.sh
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | ||||||
|  | #!/bin/sh | ||||||
|  | 
 | ||||||
|  | set -e | ||||||
|  | set -u | ||||||
|  | 
 | ||||||
|  | PATH=${MESON_BUILD_ROOT}/src/daemon:${MESON_BUILD_ROOT}/src/tests:${MESON_BUILD_ROOT}/src/utils:${PATH} | ||||||
|  | export PATH | ||||||
|  | 
 | ||||||
|  | ${MESON_SOURCE_ROOT}/src/tests/test-daemon.sh $@ | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Arnaud Rebillout
						Arnaud Rebillout