[PATCH v2 1/8] test: Introduce VIR_MOCK_REAL_INIT_VERSIONED()

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

 



This will be used later on to choose the modern implementation
of the functions we need to mock instead of the default, and
broken, one.

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 tests/virmock.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tests/virmock.h b/tests/virmock.h
index 914d5141c9..d35b1176fc 100644
--- a/tests/virmock.h
+++ b/tests/virmock.h
@@ -302,4 +302,17 @@
         } \
     } while (0)
 
+# define VIR_MOCK_REAL_INIT_VERSIONED(name, version) \
+    do { \
+        if (real_##name == NULL && \
+            !(real_##name = dlvsym(RTLD_NEXT, \
+                                   #name, \
+                                   version))) { \
+            fprintf(stderr, "Missing symbol '%s@%s'\n", \
+                            #name, \
+                            version); \
+            abort(); \
+        } \
+    } while (0)
+
 #endif /* __VIR_MOCK_H__ */
-- 
2.14.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux