[PATCH] tests: add dependencies to meson declaration

Paolo Bonzini posted 1 patch 2 years, 1 month ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20220324093656.121802-1-pbonzini@redhat.com
tests/meson.build | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
[PATCH] tests: add dependencies to meson declaration
Posted by Paolo Bonzini 2 years, 1 month ago
Make sure that all tests are run after the helpers and mocks are
(re)built.  This enables for example using "meson test" as the
command line passed to "git bisect run".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/meson.build | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/meson.build b/tests/meson.build
index 8f92f2033f..fd78d8a2fd 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -191,8 +191,9 @@ test_file_wrapper_lib = static_library(
   dependencies: [ tests_dep ],
 )
 
+tests_deps = []
 foreach mock : mock_libs
-  shared_library(
+  tests_deps += shared_library(
     mock['name'],
     mock.get('sources', [ '@0@.c'.format(mock['name']) ]),
     override_options: [
@@ -215,7 +216,7 @@ endforeach
 # Must not link to any libvirt modules - libc only otherwise external
 # libraries might unexpectedly leak file descriptors into commandhelper
 # invalidating the test logic assumptions.
-executable(
+tests_deps += executable(
   'commandhelper',
   [ 'commandhelper.c' ],
   dependencies: [
@@ -227,7 +228,7 @@ executable(
 )
 
 # This is a fake SSH we use from virnetsockettest
-executable(
+tests_deps += executable(
   'ssh',
   [ 'ssh.c' ],
   dependencies: [
@@ -592,7 +593,7 @@ foreach data : tests
     # default meson timeout
     timeout = 30
   endif
-  test(data['name'], test_bin, env: tests_env, timeout: timeout)
+  test(data['name'], test_bin, env: tests_env, timeout: timeout, depends: tests_deps)
 endforeach
 
 
-- 
2.35.1
Re: [PATCH] tests: add dependencies to meson declaration
Posted by Michal Prívozník 2 years, 1 month ago
On 3/24/22 10:36, Paolo Bonzini wrote:
> Make sure that all tests are run after the helpers and mocks are
> (re)built.  This enables for example using "meson test" as the
> command line passed to "git bisect run".
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  tests/meson.build | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal