[prev in list] [next in list] [prev in thread] [next in thread] 

List:       libvir-list
Subject:    [libvirt] [PATCH v2 1/8] test: Introduce VIR_MOCK_REAL_INIT_VERSIONED()
From:       Andrea Bolognani <abologna () redhat ! com>
Date:       2018-04-30 16:52:56
Message-ID: 20180430165303.6124-2-abologna () redhat ! com
[Download RAW message or body]

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@redhat.com>
---
 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@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic