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.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libsystemd-rtnl/test-rtnl.c b/src/libsystemd-rtnl/test-rtnl.c
index 75a210d3fb..4b62c02361 100644
--- a/src/libsystemd-rtnl/test-rtnl.c
+++ b/src/libsystemd-rtnl/test-rtnl.c
@@ -206,6 +206,30 @@ static void test_pipe(int ifindex) {
}
}
+static void test_container(void) {
+ _cleanup_sd_rtnl_message_unref_ sd_rtnl_message *m = NULL;
+ uint16_t type;
+ void *data;
+
+ assert(sd_rtnl_message_link_new(RTM_NEWLINK, 0, 0, 0, &m) >= 0);
+
+ assert(sd_rtnl_message_open_container(m, IFLA_LINKINFO) >= 0);
+ assert(sd_rtnl_message_open_container(m, IFLA_LINKINFO) == -EINVAL);
+ assert(sd_rtnl_message_append(m, IFLA_INFO_KIND, "kind") >= 0);
+ assert(sd_rtnl_message_close_container(m) >= 0);
+ assert(sd_rtnl_message_close_container(m) == -EINVAL);
+
+ assert(sd_rtnl_message_read(m, &type, &data) == -EINVAL);
+
+/* TODO: add support for entering containers
+ assert(sd_rtnl_message_read(m, &type, &data) > 0);
+ assert(type == IFLA_INFO_KIND);
+ assert(streq("kind", (char *) data));
+
+ assert(sd_rtnl_message_read(m, &type, &data) == 0);
+*/
+}
+
int main(void) {
sd_rtnl *rtnl;
sd_rtnl_message *m;
@@ -220,6 +244,8 @@ int main(void) {
test_route();
+ test_container();
+
assert(sd_rtnl_open(0, &rtnl) >= 0);
assert(rtnl);