[PATCH spice-gtk v6 14/18] build: Use a convenience library for tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of linking all object inside spice-client-glib build a library
from these object and link to each test.
This will allow to override some object file for mocking purposes.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 tests/meson.build | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/meson.build b/tests/meson.build
index 39eac9c9..57bd2cc5 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -21,12 +21,18 @@ if spice_gtk_has_polkit
   ]
 endif
 
+# create a static library from a shared one extracting all objects
+# this allows to rewrite part of it if necessary for mocking
+test_lib = \
+  static_library('test-lib',
+                 objects : spice_client_glib_lib.extract_all_objects())
+
 foreach src : tests_sources
   name = 'test-@0@'.format(src).split('.')[0]
   exe = executable(name,
                    sources : src,
                    c_args : '-DTESTDIR="@0@"'.format(meson.current_build_dir()),
-                   objects : spice_client_glib_lib.extract_all_objects(),
+                   link_with : test_lib,
                    dependencies : spice_client_glib_dep)
   if not name.contains('mock-acl-helper')
     test(name, exe)
-- 
2.20.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]