Optionally install examples and tests

This makes it easier to test PipeWire in its "as-installed" state,
for example in an OS distribution.

The .test metadata files in ${datadir}/installed-tests/${package} are
a convention taken from GNOME's installed-tests initiative, allowing a
generic test-runner like gnome-desktop-testing to discover and run tests
in an automatic way.

The installation path ${libexecdir}/installed-tests/${package} is also
a convention borrowed from GNOME's installed-tests initiative.

In addition to the automated tests, I've installed example executables
in the same place, for manual testing. They could be separated into
a different directory if desired, but they seem like they have more
similarities with the automated tests than differences: both are there
to test that PipeWire works correctly, and neither should be relied on
for production use. Some examples are installed in deeper subdirectories
to avoid name clashes.

Signed-off-by: Simon McVittie <smcv@debian.org>
This commit is contained in:
Simon McVittie 2020-06-05 14:06:36 +01:00 committed by Wim Taymans
parent 8b97d2ae74
commit b852b58f82
10 changed files with 158 additions and 27 deletions

View file

@ -129,11 +129,25 @@ foreach a : test_apps
dependencies : [dl_lib, pthread_lib, mathlib ],
include_directories : [spa_inc ],
link_with : [ audioconvert, test_lib, audioconvertlib ],
install_rpath : join_paths(spa_plugindir, 'audioconvert'),
c_args : [ simd_cargs, '-D_GNU_SOURCE' ],
install : false),
install : installed_tests_enabled,
install_dir : join_paths(installed_tests_execdir, 'audioconvert')),
env : [
'SPA_PLUGIN_DIR=@0@/spa/plugins/'.format(meson.build_root()),
])
if installed_tests_enabled
test_conf = configuration_data()
test_conf.set('exec',
join_paths(installed_tests_execdir, 'audioconvert', a))
configure_file(
input: installed_tests_template,
output: a + '.test',
install_dir: join_paths(installed_tests_metadir, 'audioconvert'),
configuration: test_conf
)
endif
endforeach
benchmark_apps = [
@ -148,10 +162,24 @@ foreach a : benchmark_apps
include_directories : [spa_inc ],
c_args : [ simd_cargs, '-D_GNU_SOURCE' ],
link_with : [ audioconvert, audioconvertlib ],
install : false),
install_rpath : join_paths(spa_plugindir, 'audioconvert'),
install : installed_tests_enabled,
install_dir : join_paths(installed_tests_execdir, 'audioconvert')),
env : [
'SPA_PLUGIN_DIR=@0@/spa/plugins/'.format(meson.build_root()),
])
if installed_tests_enabled
test_conf = configuration_data()
test_conf.set('exec',
join_paths(installed_tests_execdir, 'audioconvert', a))
configure_file(
input: installed_tests_template,
output: a + '.test',
install_dir: join_paths(installed_tests_metadir, 'audioconvert'),
configuration: test_conf
)
endif
endforeach
if sndfile_dep.found()
@ -161,9 +189,10 @@ if sndfile_dep.found()
executable('spa-resample',
sparesample_sources,
c_args : [ simd_cargs, '-D_GNU_SOURCE' ],
install: false,
include_directories : [spa_inc ],
link_with : [ audioconvert, test_lib ],
dependencies : [sndfile_dep, mathlib],
install : installed_tests_enabled,
install_dir : join_paths(installed_tests_execdir, 'examples', 'audioconvert'),
)
endif