From: Pavel Hrdina Date: Thu, 25 Jun 2020 11:05:51 +0000 (+0200) Subject: meson: tests: add test binaries build support X-Git-Tag: v6.7.0-rc1~318 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d11bf90f9091c176aef5faf060471a084147eb92;p=thirdparty%2Flibvirt.git meson: tests: add test binaries build support Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa Reviewed-by: Neal Gompa --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 9f5f5d12fb..1c467f5719 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -16,18 +16,6 @@ ## License along with this library. If not, see ## . -PROBES_O = -if WITH_DTRACE_PROBES -PROBES_O += ../src/libvirt_probes.lo -endif WITH_DTRACE_PROBES - -LDADDS = \ - $(NO_INDIRECT_LDFLAGS) \ - $(PROBES_O) \ - ../src/libvirt.la \ - $(GLIB_LIBS) \ - $(NULL) - test_programs = virshtest sockettest \ virhostcputest virbuftest \ commandtest seclabeltest \ diff --git a/tests/meson.build b/tests/meson.build index cdcb87453f..a0dd204845 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -228,3 +228,52 @@ executable( coverage_flags, ], ) + + +# build and define libvirt tests + +# tests: +# each entry is a dictionary with following items: +# * name - name of the test which is also used as default source file name (required) +# * sources - override default sources based on name (optional, default [ '$name.c' ]) +# * c_args - args used by test (optional, default []) +# * deps - additional dependencies (optional, default []) +# * include - include_directories (optional, default []) +# * link_with - compiled libraries to link with (optional, default []) +# * link_whole - compiled libraries to link whole (optional, default []) + +tests = [] + +foreach data : tests + test_sources = '@0@.c'.format(data['name']) + test_bin = executable( + data['name'], + [ + data.get('sources', test_sources), + dtrace_gen_objects, + ], + c_args: [ + data.get('c_args', []), + ], + dependencies: [ + tests_dep, + data.get('deps', []), + ], + include_directories: [ + data.get('include', []), + ], + link_args: [ + libvirt_no_indirect, + ], + link_with: [ + libvirt_lib, + data.get('link_with', []), + ], + link_whole: [ + test_utils_lib, + data.get('link_whole', []), + ], + export_dynamic: true, + ) + test(data['name'], test_bin, env: tests_env) +endforeach