Re: [PATCH v2 5/6] tests: Delay mock creation

2020-11-27 Thread Michal Prívozník

On 11/23/20 11:10 PM, Roman Bolshakov wrote:

There might be mocks that need to reference qemu test driver and link
with it. It's not possible now because qemu test driver is defined after
mocks.

While at it, add 'link_with' parameter to mock definition that allows to
specify a set of libraries the mock has to be linked with.

Signed-off-by: Roman Bolshakov 
---
  tests/meson.build | 36 ++--
  1 file changed, 18 insertions(+), 18 deletions(-)


Reviewed-by: Michal Privoznik 

Although I'd expect these foreach loops run only after the whole file 
was processed. Just like 'make' does.


Michal



[PATCH v2 5/6] tests: Delay mock creation

2020-11-23 Thread Roman Bolshakov
There might be mocks that need to reference qemu test driver and link
with it. It's not possible now because qemu test driver is defined after
mocks.

While at it, add 'link_with' parameter to mock definition that allows to
specify a set of libraries the mock has to be linked with.

Signed-off-by: Roman Bolshakov 
---
 tests/meson.build | 36 ++--
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/tests/meson.build b/tests/meson.build
index cb06873ba5..ef8ded1ea4 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -115,24 +115,6 @@ if conf.has('WITH_SECDRIVER_SELINUX')
   ]
 endif
 
-foreach mock : mock_libs
-  shared_library(
-mock['name'],
-mock.get('sources', [ '@0@.c'.format(mock['name']) ]),
-override_options: [
- 'b_asneeded=false',
- 'b_lundef=false',
-],
-dependencies: [
-  tests_dep,
-  mock.get('deps', []),
-],
-link_with: [
-  libvirt_lib,
-],
-  )
-endforeach
-
 
 # build libraries used by tests
 
@@ -201,6 +183,24 @@ test_file_wrapper_lib = static_library(
   dependencies: [ tests_dep ],
 )
 
+foreach mock : mock_libs
+  shared_library(
+mock['name'],
+mock.get('sources', [ '@0@.c'.format(mock['name']) ]),
+override_options: [
+ 'b_asneeded=false',
+ 'b_lundef=false',
+],
+dependencies: [
+  tests_dep,
+  mock.get('deps', []),
+],
+link_with: [
+  libvirt_lib,
+  mock.get('link_with', []),
+],
+  )
+endforeach
 
 # build helpers used by tests
 
-- 
2.29.2