Skip to contentSkip to conversation

unit: Added generic netlink family unit test

PATCH In review Ossama Othman 2 participants 2 messages Mar 21, 2017 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 unit: Added generic netlink family unit test

---
 Makefile.am             |   3 ++
 unit/test-genl-family.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 103 insertions(+)
 create mode 100644 unit/test-genl-family.c
Makefile.am +3 -0
index d2e33de..39ebe66 100644
@@ -119,6 +119,7 @@ unit_tests = unit/test-unit \
 			unit/test-settings \
 			unit/test-netlink \
 			unit/test-genl \
+			unit/test-genl-family \
 			unit/test-genl-msg \
 			unit/test-siphash \
 			unit/test-hwdb \
@@ -174,6 +175,8 @@ unit_test_netlink_LDADD = ell/libell-private.la
 
 unit_test_genl_LDADD = ell/libell-private.la
 
+unit_test_genl_family_LDADD = ell/libell-private.la
+
 unit_test_genl_msg_LDADD = ell/libell-private.la
 
 unit_test_dbus_LDADD = ell/libell-private.la
unit/test-genl-family.c new file +100 -0

100 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

Hi,

unit/test-genl-family.c line 43

Quoted 8 lines · Ossama Othman
unit/test-genl-family.c new file +6 -0
+static void family_vanished(void *user_data)
+{
+       bool *vanished_called = user_data;
+
+       *vanished_called = true;
+       l_main_quit();

I just noticed this extraneous l_main_quit() call. It doesn't affect the unit test result but I'll resend the patch with it removed.

unit/test-genl-family.c line 56

Quoted 13 lines
unit/test-genl-family.c new file +13 -0
+}
+
+static void idle_handler(struct l_idle *idle, void *user_data)
+{
+       static int count = 0;
+
+       /*
+        * Allow the main loop to iterate at least once.  Otherwise
+        * the generic netlink watches won't be called.
+        */
+       if (count++ == 1)
+               l_main_quit();
+}

Thanks,
-Ossama