summaryrefslogtreecommitdiff
path: root/src/libsystemd-rtnl/test-rtnl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd-rtnl/test-rtnl.c')
-rw-r--r--src/libsystemd-rtnl/test-rtnl.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libsystemd-rtnl/test-rtnl.c b/src/libsystemd-rtnl/test-rtnl.c
index 4b62c02361..a512a7b2f7 100644
--- a/src/libsystemd-rtnl/test-rtnl.c
+++ b/src/libsystemd-rtnl/test-rtnl.c
@@ -230,6 +230,21 @@ static void test_container(void) {
*/
}
+static void test_match(void) {
+ _cleanup_sd_rtnl_unref_ sd_rtnl *rtnl = NULL;
+
+ assert(sd_rtnl_open(0, &rtnl) >= 0);
+
+ assert(sd_rtnl_add_match(rtnl, 0, &link_handler, NULL) == -EINVAL);
+
+ assert(sd_rtnl_add_match(rtnl, RTMGRP_LINK, &link_handler, NULL) >= 0);
+ assert(sd_rtnl_add_match(rtnl, RTMGRP_LINK, &link_handler, NULL) >= 0);
+
+ assert(sd_rtnl_remove_match(rtnl, RTMGRP_LINK, &link_handler, NULL) == 1);
+ assert(sd_rtnl_remove_match(rtnl, RTMGRP_LINK, &link_handler, NULL) == 1);
+ assert(sd_rtnl_remove_match(rtnl, RTMGRP_LINK, &link_handler, NULL) == 0);
+}
+
int main(void) {
sd_rtnl *rtnl;
sd_rtnl_message *m;
@@ -240,6 +255,8 @@ int main(void) {
unsigned int mtu = 0;
unsigned int *mtu_reply;
+ test_match();
+
test_multiple();
test_route();