Revert "kdbus: selftests extended"
authorKonrad Lipinski <konrad.l@samsung.com>
Thu, 8 Sep 2016 14:47:31 +0000 (16:47 +0200)
committerKonrad Lipinski <konrad.l@samsung.com>
Fri, 9 Sep 2016 11:26:22 +0000 (13:26 +0200)
This reverts commit 76f2f0ce4d28dcf5bffa2fe205a955f30064d78d.

17 files changed:
tools/testing/selftests/kdbus/Makefile
tools/testing/selftests/kdbus/kdbus-test.c
tools/testing/selftests/kdbus/kdbus-test.h
tools/testing/selftests/kdbus/kdbus-util.c
tools/testing/selftests/kdbus/kdbus-util.h
tools/testing/selftests/kdbus/test-activator.c
tools/testing/selftests/kdbus/test-chat.c
tools/testing/selftests/kdbus/test-connection.c
tools/testing/selftests/kdbus/test-fd.c
tools/testing/selftests/kdbus/test-message.c
tools/testing/selftests/kdbus/test-metadata-ns.c
tools/testing/selftests/kdbus/test-monitor.c
tools/testing/selftests/kdbus/test-policy-ns.c
tools/testing/selftests/kdbus/test-policy-priv.c
tools/testing/selftests/kdbus/test-send.c [deleted file]
tools/testing/selftests/kdbus/test-sync.c
tools/testing/selftests/kdbus/test-timeout.c

index 0a5afe3f7b6de8b9fe21a7d82a364035937aa0e0..de8242f9b00e4f08d2ebb996befc241be8c17f8b 100644 (file)
@@ -28,7 +28,6 @@ OBJS= \
        test-policy.o           \
        test-policy-ns.o        \
        test-policy-priv.o      \
-       test-send.o             \
        test-sync.o             \
        test-timeout.o
 
index 526f25fbd79cc3f82908edbc1d5fbe3e1e2d637b..bf1a69c59365ee06b6bcd1799027522594238b83 100644 (file)
@@ -25,7 +25,6 @@
 enum {
        TEST_CREATE_BUS         = 1 << 0,
        TEST_CREATE_CONN        = 1 << 1,
-       TEST_CREATE_CAN_FAIL    = 1 << 2,
 };
 
 struct kdbus_test {
@@ -149,12 +148,6 @@ static const struct kdbus_test tests[] = {
                .func   = kdbus_test_timeout,
                .flags  = TEST_CREATE_BUS,
        },
-       {
-               .name   = "send",
-               .desc   = "send",
-               .func   = kdbus_test_send,
-               .flags  = TEST_CREATE_CONN | TEST_CREATE_CAN_FAIL,
-       },
        {
                .name   = "sync-byebye",
                .desc   = "synchronous replies vs. BYEBYE",
@@ -317,7 +310,7 @@ static int test_prepare_env(const struct kdbus_test *t,
                                       _KDBUS_ATTACH_ALL,
                                       _KDBUS_ATTACH_ALL, &s);
                free(n);
-               ASSERT_RETURN((ret == 0) || (t->flags & TEST_CREATE_CAN_FAIL));
+               ASSERT_RETURN(ret == 0);
 
                asprintf(&env->buspath, "%s/%s/bus", args->root, s);
                free(s);
@@ -346,7 +339,7 @@ static int test_prepare_env(const struct kdbus_test *t,
                }
                ASSERT_RETURN(env->buspath);
                env->conn = kdbus_hello(env->buspath, 0, NULL, 0);
-               ASSERT_RETURN(env->conn || (t->flags & TEST_CREATE_CAN_FAIL));
+               ASSERT_RETURN(env->conn);
        }
 
        env->root = args->root;
index 826b9f45bfdd63cd55643f1575ea72b530aec143..647331883763abd8e96463be18ca5f024c52c92b 100644 (file)
@@ -77,7 +77,6 @@ int kdbus_test_name_queue(struct kdbus_test_env *env);
 int kdbus_test_policy(struct kdbus_test_env *env);
 int kdbus_test_policy_ns(struct kdbus_test_env *env);
 int kdbus_test_policy_priv(struct kdbus_test_env *env);
-int kdbus_test_send(struct kdbus_test_env *env);
 int kdbus_test_sync_byebye(struct kdbus_test_env *env);
 int kdbus_test_sync_reply(struct kdbus_test_env *env);
 int kdbus_test_timeout(struct kdbus_test_env *env);
index 6677dadd1109cc0cab10999ab4f2b98f104f3b76..0849f5ef81ff3c6acd130f52c43dbfa1598d973e 100644 (file)
@@ -456,9 +456,7 @@ static int __kdbus_msg_send(const struct kdbus_conn *conn,
                            int64_t priority,
                            uint64_t dst_id,
                            uint64_t cmd_flags,
-                           int cancel_fd,
-                           int fds_count,
-                           int fds[])
+                           int cancel_fd)
 {
        struct kdbus_cmd_send *cmd;
        struct kdbus_msg *msg;
@@ -474,7 +472,6 @@ static int __kdbus_msg_send(const struct kdbus_conn *conn,
        size += KDBUS_ITEM_SIZE(sizeof(struct kdbus_vec));
        size += KDBUS_ITEM_SIZE(sizeof(struct kdbus_vec));
        size += KDBUS_ITEM_SIZE(sizeof(struct kdbus_vec));
-       size += fds_count > 0 ? KDBUS_ITEM_SIZE(sizeof(int) * fds_count) : 0;
 
        if (dst_id == KDBUS_DST_ID_BROADCAST)
                size += KDBUS_ITEM_SIZE(sizeof(struct kdbus_bloom_filter)) + 64;
@@ -572,23 +569,11 @@ static int __kdbus_msg_send(const struct kdbus_conn *conn,
        }
        item = KDBUS_ITEM_NEXT(item);
 
-       if (fds_count > 0) {
-               item->type = KDBUS_ITEM_FDS;
-               item->size = KDBUS_ITEM_HEADER_SIZE + sizeof(int) * fds_count;
-               memcpy(&item->fds, fds, sizeof(int) * fds_count);
-               item = KDBUS_ITEM_NEXT(item);
-       }
-
        size = sizeof(*cmd);
        if (cancel_fd != -1)
                size += KDBUS_ITEM_SIZE(sizeof(cancel_fd));
 
        cmd = malloc(size);
-       if (!cmd) {
-               ret = -errno;
-               kdbus_printf("unable to malloc(%ld)!?\n", (long)size);
-               return ret;
-       }
        cmd->size = size;
        cmd->flags = cmd_flags;
        cmd->msg_address = (uintptr_t)msg;
@@ -602,7 +587,6 @@ static int __kdbus_msg_send(const struct kdbus_conn *conn,
                item = KDBUS_ITEM_NEXT(item);
        }
 
-
        ret = kdbus_cmd_send(conn->fd, cmd);
        if (memfd >= 0)
                close(memfd);
@@ -634,10 +618,10 @@ static int __kdbus_msg_send(const struct kdbus_conn *conn,
 
 int kdbus_msg_send(const struct kdbus_conn *conn, const char *name,
                   uint64_t cookie, uint64_t flags, uint64_t timeout,
-                  int64_t priority, uint64_t dst_id, int fds_count, int fds[])
+                  int64_t priority, uint64_t dst_id)
 {
        return __kdbus_msg_send(conn, name, cookie, flags, timeout, priority,
-                               dst_id, 0, -1, fds_count, fds);
+                               dst_id, 0, -1);
 }
 
 int kdbus_msg_send_sync(const struct kdbus_conn *conn, const char *name,
@@ -645,8 +629,7 @@ int kdbus_msg_send_sync(const struct kdbus_conn *conn, const char *name,
                        int64_t priority, uint64_t dst_id, int cancel_fd)
 {
        return __kdbus_msg_send(conn, name, cookie, flags, timeout, priority,
-                               dst_id, KDBUS_SEND_SYNC_REPLY, cancel_fd,
-                               0, NULL);
+                               dst_id, KDBUS_SEND_SYNC_REPLY, cancel_fd);
 }
 
 int kdbus_msg_send_reply(const struct kdbus_conn *conn,
index 652d957eac95bce5e2875248aa8a11687c0d1504..50ff07140bdd63d6f2b4c99d3bbf1d7354a0bb5b 100644 (file)
@@ -173,7 +173,7 @@ int kdbus_create_bus(int control_fd, const char *name,
                     char **path);
 int kdbus_msg_send(const struct kdbus_conn *conn, const char *name,
                   uint64_t cookie, uint64_t flags, uint64_t timeout,
-                  int64_t priority, uint64_t dst_id, int fds_count, int fds[]);
+                  int64_t priority, uint64_t dst_id);
 int kdbus_msg_send_sync(const struct kdbus_conn *conn, const char *name,
                        uint64_t cookie, uint64_t flags, uint64_t timeout,
                        int64_t priority, uint64_t dst_id, int cancel_fd);
index c70fafe83759c385ede96fdc156f8edbfca19aea..3d1b76370ce8207ab7705fbd4dfd0938e8b73e73 100644 (file)
@@ -84,13 +84,13 @@ static int kdbus_priv_activator(struct kdbus_test_env *env)
        ret = RUN_UNPRIVILEGED_CONN(unpriv, env->buspath, ({
                /* Try to talk using the ID */
                ret = kdbus_msg_send(unpriv, NULL, 0xdeadbeef, 0, 0,
-                                    0, activator->id, 0, NULL);
+                                    0, activator->id);
                ASSERT_EXIT(ret == -ENXIO);
 
                /* Try to talk to the name */
                ret = kdbus_msg_send(unpriv, "foo.priv.activator",
                                     0xdeadbeef, 0, 0, 0,
-                                    KDBUS_DST_ID_NAME, 0, NULL);
+                                    KDBUS_DST_ID_NAME);
                ASSERT_EXIT(ret == -EPERM);
        }));
        ASSERT_RETURN(ret >= 0);
@@ -110,7 +110,7 @@ static int kdbus_priv_activator(struct kdbus_test_env *env)
 
        cookie++;
        ret = kdbus_msg_send(service, "foo.priv.activator", cookie,
-                            0, 0, 0, KDBUS_DST_ID_NAME, 0, NULL);
+                            0, 0, 0, KDBUS_DST_ID_NAME);
        ASSERT_RETURN(ret == 0);
 
        ret = kdbus_starter_poll(activator);
@@ -141,7 +141,7 @@ static int kdbus_priv_activator(struct kdbus_test_env *env)
                /* Try to talk to the name */
                ret = kdbus_msg_send(unpriv, "foo.priv.activator",
                                     cookie, 0, 0, 0,
-                                    KDBUS_DST_ID_NAME, 0, NULL);
+                                    KDBUS_DST_ID_NAME);
                ASSERT_EXIT(ret == -EPERM);
        }));
        ASSERT_RETURN(ret >= 0);
@@ -155,7 +155,7 @@ static int kdbus_priv_activator(struct kdbus_test_env *env)
 
        cookie++;
        ret = kdbus_msg_send(client, "foo.priv.activator", cookie,
-                            0, 0, 0, KDBUS_DST_ID_NAME, 0, NULL);
+                            0, 0, 0, KDBUS_DST_ID_NAME);
        ASSERT_RETURN(ret == 0);
        ret = kdbus_msg_recv_poll(service, 100, &msg, NULL);
        ASSERT_RETURN(ret == 0 && msg->cookie == cookie);
@@ -170,8 +170,7 @@ static int kdbus_priv_activator(struct kdbus_test_env *env)
                /* Try to talk to the name */
                ret = kdbus_msg_send(unpriv, "foo.priv.activator",
                                     cookie, 0, 0, 0,
-                                    KDBUS_DST_ID_NAME,
-                                    0, NULL);
+                                    KDBUS_DST_ID_NAME);
                ASSERT_EXIT(ret == -EPERM);
        }));
        ASSERT_RETURN(ret >= 0);
@@ -182,7 +181,7 @@ static int kdbus_priv_activator(struct kdbus_test_env *env)
        /* Same user is able to TALK */
        cookie++;
        ret = kdbus_msg_send(client, "foo.priv.activator", cookie,
-                            0, 0, 0, KDBUS_DST_ID_NAME, 0, NULL);
+                            0, 0, 0, KDBUS_DST_ID_NAME);
        ASSERT_RETURN(ret == 0);
        ret = kdbus_msg_recv_poll(service, 100, &msg, NULL);
        ASSERT_RETURN(ret == 0 && msg->cookie == cookie);
@@ -208,8 +207,7 @@ static int kdbus_priv_activator(struct kdbus_test_env *env)
                /* Try to talk to the name */
                ret = kdbus_msg_send(unpriv, "foo.priv.activator",
                                     cookie, 0, 0, 0,
-                                    KDBUS_DST_ID_NAME,
-                                    0, NULL);
+                                    KDBUS_DST_ID_NAME);
                ASSERT_EXIT(ret == 0);
        }));
        ASSERT_RETURN(ret >= 0);
@@ -260,7 +258,7 @@ int kdbus_test_activator(struct kdbus_test_env *env)
        ASSERT_RETURN(ret == 0);
 
        ret = kdbus_msg_send(env->conn, "foo.test.activator", 0xdeafbeef,
-                            0, 0, 0, KDBUS_DST_ID_NAME, 0, NULL);
+                            0, 0, 0, KDBUS_DST_ID_NAME);
        ASSERT_RETURN(ret == 0);
 
        fds[0].fd = activator->fd;
index e19f595283cd08c489a9333a73abeb57e8398500..71a92d8b7c85073a9671d7ea5b927778de5611d1 100644 (file)
@@ -64,7 +64,7 @@ int kdbus_test_chat(struct kdbus_test_env *env)
 
        cookie = 0;
        ret = kdbus_msg_send(conn_b, NULL, 0xc0000000 | cookie, 0, 0, 0,
-                            KDBUS_DST_ID_BROADCAST, 0, NULL);
+                            KDBUS_DST_ID_BROADCAST);
        ASSERT_RETURN(ret == 0);
 
        fds[0].fd = conn_a->fd;
@@ -91,7 +91,7 @@ int kdbus_test_chat(struct kdbus_test_env *env)
                        ASSERT_RETURN(ret == 0);
                        ret = kdbus_msg_send(conn_a, NULL,
                                             0xc0000000 | cookie++,
-                                            0, 0, 0, conn_b->id, 0, NULL);
+                                            0, 0, 0, conn_b->id);
                        ASSERT_RETURN(ret == 0);
                }
 
@@ -100,7 +100,7 @@ int kdbus_test_chat(struct kdbus_test_env *env)
                        ASSERT_RETURN(ret == 0);
                        ret = kdbus_msg_send(conn_b, NULL,
                                             0xc0000000 | cookie++,
-                                            0, 0, 0, conn_a->id, 0, NULL);
+                                            0, 0, 0, conn_a->id);
                        ASSERT_RETURN(ret == 0);
                }
 
index 7afb76fdf7da081131a6ecfa65cbee3f5eb16c8a..5c2bf3511daa85769c4d44b46e3021f8a83598a5 100644 (file)
@@ -127,7 +127,7 @@ int kdbus_test_byebye(struct kdbus_test_env *env)
 
        /* send over 1st connection */
        ret = kdbus_msg_send(env->conn, NULL, 0, 0, 0, 0,
-                            KDBUS_DST_ID_BROADCAST, 0, NULL);
+                            KDBUS_DST_ID_BROADCAST);
        ASSERT_RETURN(ret == 0);
 
        /* say byebye on the 2nd, which must fail */
@@ -523,8 +523,7 @@ int kdbus_test_conn_update(struct kdbus_test_env *env)
        conn = kdbus_hello(env->buspath, 0, NULL, 0);
        ASSERT_RETURN(conn);
 
-       ret = kdbus_msg_send(env->conn, NULL, 0x12345678, 0, 0, 0, conn->id,
-                            0, NULL);
+       ret = kdbus_msg_send(env->conn, NULL, 0x12345678, 0, 0, 0, conn->id);
        ASSERT_RETURN(ret == 0);
 
        ret = kdbus_msg_recv(conn, &msg, NULL);
@@ -547,8 +546,7 @@ int kdbus_test_conn_update(struct kdbus_test_env *env)
                                             ~KDBUS_ATTACH_TIMESTAMP);
        ASSERT_RETURN(ret == 0);
 
-       ret = kdbus_msg_send(env->conn, NULL, 0x12345678, 0, 0, 0, conn->id,
-                            0, NULL);
+       ret = kdbus_msg_send(env->conn, NULL, 0x12345678, 0, 0, 0, conn->id);
        ASSERT_RETURN(ret == 0);
 
        ret = kdbus_msg_recv(conn, &msg, NULL);
index bfd8980e00049c2d923b3dbf964522883ff2d6e8..2ae0f5ae8fd0f25b03c03fa33aea5142d75715e1 100644 (file)
@@ -466,7 +466,7 @@ static int kdbus_test_no_fds(struct kdbus_test_env *env,
         */
        cookie++;
        ret = kdbus_msg_send(conn_src, NULL, cookie, 0, 0, 0,
-                            conn_dst->id, 0, NULL);
+                            conn_dst->id);
        ASSERT_RETURN(ret == 0);
 
        ret = waitpid(pid, &status, 0);
index d9b8fbddb1da821750de3ffccf5b19375227e1c1..f1615dafb7f12745135bbd305aed70429f6948c4 100644 (file)
@@ -51,7 +51,7 @@ int kdbus_test_message_basic(struct kdbus_test_env *env)
 
        /* send over 1st connection */
        ret = kdbus_msg_send(sender, NULL, cookie, 0, 0, 0,
-                            KDBUS_DST_ID_BROADCAST, 0, NULL);
+                            KDBUS_DST_ID_BROADCAST);
        ASSERT_RETURN(ret == 0);
 
        /* Make sure that we do not get our own broadcasts */
@@ -67,7 +67,7 @@ int kdbus_test_message_basic(struct kdbus_test_env *env)
 
        /* Msgs that expect a reply must have timeout and cookie */
        ret = kdbus_msg_send(sender, NULL, 0, KDBUS_MSG_EXPECT_REPLY,
-                            0, 0, conn->id, 0, NULL);
+                            0, 0, conn->id);
        ASSERT_RETURN(ret == -EINVAL);
 
        /* Faked replies with a valid reply cookie are rejected */
@@ -123,36 +123,23 @@ int kdbus_test_message_prio(struct kdbus_test_env *env)
 {
        struct kdbus_conn *a, *b;
        uint64_t cookie = 0;
-       int ret;
 
        a = kdbus_hello(env->buspath, 0, NULL, 0);
        b = kdbus_hello(env->buspath, 0, NULL, 0);
        ASSERT_RETURN(a && b);
 
-       ret = kdbus_msg_send(b, NULL, ++cookie, 0, 0,   25, a->id, 0, NULL);
-       ASSERT_RETURN(ret == 0);
-       ret = kdbus_msg_send(b, NULL, ++cookie, 0, 0, -600, a->id, 0, NULL);
-       ASSERT_RETURN(ret == 0);
-       ret = kdbus_msg_send(b, NULL, ++cookie, 0, 0,   10, a->id, 0, NULL);
-       ASSERT_RETURN(ret == 0);
-       ret = kdbus_msg_send(b, NULL, ++cookie, 0, 0,  -35, a->id, 0, NULL);
-       ASSERT_RETURN(ret == 0);
-       ret = kdbus_msg_send(b, NULL, ++cookie, 0, 0, -100, a->id, 0, NULL);
-       ASSERT_RETURN(ret == 0);
-       ret = kdbus_msg_send(b, NULL, ++cookie, 0, 0,   20, a->id, 0, NULL);
-       ASSERT_RETURN(ret == 0);
-       ret = kdbus_msg_send(b, NULL, ++cookie, 0, 0,  -15, a->id, 0, NULL);
-       ASSERT_RETURN(ret == 0);
-       ret = kdbus_msg_send(b, NULL, ++cookie, 0, 0, -800, a->id, 0, NULL);
-       ASSERT_RETURN(ret == 0);
-       ret = kdbus_msg_send(b, NULL, ++cookie, 0, 0, -150, a->id, 0, NULL);
-       ASSERT_RETURN(ret == 0);
-       ret = kdbus_msg_send(b, NULL, ++cookie, 0, 0,   10, a->id, 0, NULL);
-       ASSERT_RETURN(ret == 0);
-       ret = kdbus_msg_send(b, NULL, ++cookie, 0, 0, -800, a->id, 0, NULL);
-       ASSERT_RETURN(ret == 0);
-       ret = kdbus_msg_send(b, NULL, ++cookie, 0, 0,  -10, a->id, 0, NULL);
-       ASSERT_RETURN(ret == 0);
+       ASSERT_RETURN(kdbus_msg_send(b, NULL, ++cookie, 0, 0,   25, a->id) == 0);
+       ASSERT_RETURN(kdbus_msg_send(b, NULL, ++cookie, 0, 0, -600, a->id) == 0);
+       ASSERT_RETURN(kdbus_msg_send(b, NULL, ++cookie, 0, 0,   10, a->id) == 0);
+       ASSERT_RETURN(kdbus_msg_send(b, NULL, ++cookie, 0, 0,  -35, a->id) == 0);
+       ASSERT_RETURN(kdbus_msg_send(b, NULL, ++cookie, 0, 0, -100, a->id) == 0);
+       ASSERT_RETURN(kdbus_msg_send(b, NULL, ++cookie, 0, 0,   20, a->id) == 0);
+       ASSERT_RETURN(kdbus_msg_send(b, NULL, ++cookie, 0, 0,  -15, a->id) == 0);
+       ASSERT_RETURN(kdbus_msg_send(b, NULL, ++cookie, 0, 0, -800, a->id) == 0);
+       ASSERT_RETURN(kdbus_msg_send(b, NULL, ++cookie, 0, 0, -150, a->id) == 0);
+       ASSERT_RETURN(kdbus_msg_send(b, NULL, ++cookie, 0, 0,   10, a->id) == 0);
+       ASSERT_RETURN(kdbus_msg_send(b, NULL, ++cookie, 0, 0, -800, a->id) == 0);
+       ASSERT_RETURN(kdbus_msg_send(b, NULL, ++cookie, 0, 0,  -10, a->id) == 0);
 
        ASSERT_RETURN(msg_recv_prio(a, -200, -800) == 0);
        ASSERT_RETURN(msg_recv_prio(a, -100, -800) == 0);
@@ -208,8 +195,7 @@ static int kdbus_test_notify_kernel_quota(struct kdbus_test_env *env)
         * Now the reader queue is full with kernel notfications,
         * but as a user we still have room to push our messages.
         */
-       ret = kdbus_msg_send(conn, NULL, 0xdeadbeef, 0, 0, 0, reader->id,
-                            0, NULL);
+       ret = kdbus_msg_send(conn, NULL, 0xdeadbeef, 0, 0, 0, reader->id);
        ASSERT_RETURN(ret == 0);
 
        /* More ID kernel notifications that will be lost */
@@ -329,8 +315,7 @@ static int kdbus_test_activator_quota(struct kdbus_test_env *env)
        for (i = 0; i < KDBUS_CONN_MAX_MSGS; i++) {
                ret = kdbus_msg_send(sender, "foo.test.activator",
                                     cookie++, 0, 0, 0,
-                                    KDBUS_DST_ID_NAME,
-                                    0, NULL);
+                                    KDBUS_DST_ID_NAME);
                if (ret < 0)
                        break;
                activator_msgs_count++;
@@ -343,18 +328,17 @@ static int kdbus_test_activator_quota(struct kdbus_test_env *env)
        /* Good, activator queue is full now */
 
        /* ENXIO on direct send (activators can never be addressed by ID) */
-       ret = kdbus_msg_send(conn, NULL, cookie++, 0, 0, 0, activator->id,
-                            0, NULL);
+       ret = kdbus_msg_send(conn, NULL, cookie++, 0, 0, 0, activator->id);
        ASSERT_RETURN(ret == -ENXIO);
 
        /* can't queue more */
        ret = kdbus_msg_send(conn, "foo.test.activator", cookie++,
-                            0, 0, 0, KDBUS_DST_ID_NAME, 0, NULL);
+                            0, 0, 0, KDBUS_DST_ID_NAME);
        ASSERT_RETURN(ret == -ENOBUFS);
 
        /* no match installed, so the broadcast will not inc dropped_msgs */
        ret = kdbus_msg_send(sender, NULL, cookie++, 0, 0, 0,
-                            KDBUS_DST_ID_BROADCAST, 0, NULL);
+                            KDBUS_DST_ID_BROADCAST);
        ASSERT_RETURN(ret == 0);
 
        /* Check activator queue */
@@ -373,7 +357,7 @@ static int kdbus_test_activator_quota(struct kdbus_test_env *env)
        /* Consume the connection pool memory */
        for (i = 0; i < KDBUS_CONN_MAX_MSGS; i++) {
                ret = kdbus_msg_send(sender, NULL,
-                                    cookie++, 0, 0, 0, conn->id, 0, NULL);
+                                    cookie++, 0, 0, 0, conn->id);
                if (ret < 0)
                        break;
        }
@@ -440,7 +424,7 @@ static int kdbus_test_activator_quota(struct kdbus_test_env *env)
 
        /* This one is lost but it is not accounted */
        ret = kdbus_msg_send(sender, NULL,
-                            cookie++, 0, 0, 0, conn->id, 0, NULL);
+                            cookie++, 0, 0, 0, conn->id);
        ASSERT_RETURN(ret == -ENOBUFS);
 
        /* Acquire the name again */
@@ -493,8 +477,7 @@ static int kdbus_test_expected_reply_quota(struct kdbus_test_env *env)
                        ret = kdbus_msg_send(conn, NULL, cookie++,
                                             KDBUS_MSG_EXPECT_REPLY,
                                             100000000ULL, 0,
-                                            connections[i]->id,
-                                            0, NULL);
+                                            connections[i]->id);
                        if (ret < 0)
                                break;
 
@@ -514,7 +497,7 @@ static int kdbus_test_expected_reply_quota(struct kdbus_test_env *env)
         * no further requests are allowed
         */
        ret = kdbus_msg_send(conn, NULL, cookie++, KDBUS_MSG_EXPECT_REPLY,
-                            1000000000ULL, 0, connections[8]->id, 0, NULL);
+                            1000000000ULL, 0, connections[8]->id);
        ASSERT_RETURN(ret == -EMLINK);
 
        for (i = 0; i < 9; i++)
@@ -592,7 +575,7 @@ int kdbus_test_pool_quota(struct kdbus_test_env *env)
        ASSERT_RETURN(ret == -ENOBUFS);
 
        /* We still can pass small messages */
-       ret = kdbus_msg_send(b, NULL, cookie++, 0, 0, 0, c->id, 0, NULL);
+       ret = kdbus_msg_send(b, NULL, cookie++, 0, 0, 0, c->id);
        ASSERT_RETURN(ret == 0);
 
        for (i = size; i < (POOL_SIZE / 2 / 3); i += size) {
@@ -647,7 +630,7 @@ int kdbus_test_message_quota(struct kdbus_test_env *env)
        ret = kdbus_fill_conn_queue(b, a->id, KDBUS_CONN_MAX_MSGS);
        ASSERT_RETURN(ret == KDBUS_CONN_MAX_MSGS);
 
-       ret = kdbus_msg_send(b, NULL, ++cookie, 0, 0, 0, a->id, 0, NULL);
+       ret = kdbus_msg_send(b, NULL, ++cookie, 0, 0, 0, a->id);
        ASSERT_RETURN(ret == -ENOBUFS);
 
        for (i = 0; i < KDBUS_CONN_MAX_MSGS; ++i) {
@@ -661,7 +644,7 @@ int kdbus_test_message_quota(struct kdbus_test_env *env)
        ret = kdbus_fill_conn_queue(b, a->id, KDBUS_CONN_MAX_MSGS + 1);
        ASSERT_RETURN(ret == KDBUS_CONN_MAX_MSGS);
 
-       ret = kdbus_msg_send(b, NULL, ++cookie, 0, 0, 0, a->id, 0, NULL);
+       ret = kdbus_msg_send(b, NULL, ++cookie, 0, 0, 0, a->id);
        ASSERT_RETURN(ret == -ENOBUFS);
 
        kdbus_conn_free(a);
index 395a3faabf0715830a1a3c9ac65eb3ae0aed7b3e..2cb1d4d2a5bebe748b85a60063fadac2317a1285 100644 (file)
@@ -115,7 +115,7 @@ static int __kdbus_clone_userns_test(const char *bus,
         */
 
        ret = kdbus_msg_send(unpriv_conn, NULL, cookie, 0, 0,
-                            0, conn->id, 0, NULL);
+                            0, conn->id);
        ASSERT_EXIT(ret == 0);
 
        /*
@@ -151,7 +151,7 @@ static int __kdbus_clone_userns_test(const char *bus,
 
                cookie++;
                ret = kdbus_msg_send(userns_conn, NULL, cookie,
-                                    0, 0, 0, conn->id, 0, NULL);
+                                    0, 0, 0, conn->id);
                ASSERT_EXIT(ret == 0);
 
                /* Parent did send */
@@ -397,7 +397,7 @@ static int kdbus_clone_userns_test(const char *bus,
         * Sending to unprivileged connections a unicast
         */
        ret = kdbus_msg_send(conn, NULL, 0xdeadbeef, 0, 0,
-                            0, unpriv_conn_id, 0, NULL);
+                            0, unpriv_conn_id);
        ASSERT_RETURN(ret == 0);
 
        /* signal to child that is in its userns */
@@ -409,14 +409,14 @@ static int kdbus_clone_userns_test(const char *bus,
         * connections a unicast
         */
        ret = kdbus_msg_send(conn, NULL, 0xdeadbeef, 0, 0,
-                            0, userns_conn_id, 0, NULL);
+                            0, userns_conn_id);
        ASSERT_RETURN(ret == 0);
 
        /*
         * Sending to unprivileged connections a broadcast
         */
        ret = kdbus_msg_send(conn, NULL, 0xdeadbeef, 0, 0,
-                            0, KDBUS_DST_ID_BROADCAST, 0, NULL);
+                            0, KDBUS_DST_ID_BROADCAST);
        ASSERT_RETURN(ret == 0);
 
 
index ae87d879716cbd74a478fd96cfb6e1a7fdbb1daa..e00d738a3986353e0370756b744728a9027875e7 100644 (file)
@@ -56,8 +56,7 @@ int kdbus_test_monitor(struct kdbus_test_env *env)
        ret = kdbus_name_acquire(monitor, "foo.bar.baz", NULL);
        ASSERT_RETURN(ret == -EOPNOTSUPP);
 
-       ret = kdbus_msg_send(env->conn, NULL, cookie, 0, 0,  0, conn->id,
-                            0, NULL);
+       ret = kdbus_msg_send(env->conn, NULL, cookie, 0, 0,  0, conn->id);
        ASSERT_RETURN(ret == 0);
 
        /* the recipient should have gotten the message */
@@ -81,7 +80,7 @@ int kdbus_test_monitor(struct kdbus_test_env *env)
 
        cookie++;
        ret = kdbus_msg_send(env->conn, NULL, cookie, 0, 0, 0,
-                            KDBUS_DST_ID_BROADCAST, 0, NULL);
+                            KDBUS_DST_ID_BROADCAST);
        ASSERT_RETURN(ret == 0);
 
        /* The monitor should get the message. */
@@ -104,7 +103,7 @@ int kdbus_test_monitor(struct kdbus_test_env *env)
 
        cookie++;
        ret = kdbus_msg_send(env->conn, NULL, cookie, 0, 0, 0,
-                            KDBUS_DST_ID_BROADCAST, 0, NULL);
+                            KDBUS_DST_ID_BROADCAST);
        ASSERT_RETURN(ret == 0);
 
        ret = kdbus_msg_recv_poll(monitor, 100, &msg, &offset);
@@ -129,7 +128,7 @@ int kdbus_test_monitor(struct kdbus_test_env *env)
 
        cookie++;
        ret = kdbus_msg_send(env->conn, NULL, cookie, 0, 0, 0,
-                            KDBUS_DST_ID_BROADCAST, 0, NULL);
+                            KDBUS_DST_ID_BROADCAST);
        ASSERT_RETURN(ret == 0);
 
        ret = kdbus_msg_recv_poll(monitor, 100, &msg, &offset);
index 2d70ee486e76f124202d0653112429e9a1d0451f..3437012f90afc9d6fc4671796178feba06596458 100644 (file)
@@ -180,7 +180,7 @@ static int kdbus_recv_in_threads(const char *bus, const char *name,
                        break;
 
                ret = kdbus_msg_send(conn_db[i], name, cookie++,
-                                    0, 0, 0, dst_id, 0, NULL);
+                                    0, 0, 0, dst_id);
                if (ret < 0) {
                        /*
                         * Receivers are not reading their messages,
@@ -295,7 +295,7 @@ static int kdbus_fork_test_by_id(const char *bus,
                 * EXIT_FAILURE.
                 */
                ret = kdbus_msg_send(conn_src, NULL, cookie,
-                                    0, 0, 0, conn_db[0]->id, 0, NULL);
+                                    0, 0, 0, conn_db[0]->id);
                ASSERT_EXIT(ret == child_status);
 
                ret = kdbus_msg_recv_poll(conn_src, 100, NULL, NULL);
@@ -331,7 +331,7 @@ static int kdbus_fork_test_by_id(const char *bus,
        }
 
        ret = kdbus_msg_send(conn_db[0], NULL, ++cookie,
-                            0, 0, 0, msg->src_id, 0, NULL);
+                            0, 0, 0, msg->src_id);
        /*
         * parent_status is checked against send operations,
         * on failures always return TEST_ERR.
@@ -454,7 +454,7 @@ static int __kdbus_clone_userns_test(const char *bus,
                ASSERT_EXIT(ret == 0);
 
                ret = kdbus_msg_send(conn_src, name, 0xabcd1234,
-                                    0, 0, 0, KDBUS_DST_ID_NAME, 0, NULL);
+                                    0, 0, 0, KDBUS_DST_ID_NAME);
                kdbus_conn_free(conn_src);
 
                _exit(ret == expected_status ? EXIT_SUCCESS : EXIT_FAILURE);
index 14a09c6b98d0ed3b82de9ce563462a993038fc9b..a318cccad0d54594cc829ac2b89b941359a3c912 100644 (file)
@@ -29,7 +29,7 @@ static int test_policy_priv_by_id(const char *bus,
        ret = RUN_UNPRIVILEGED_CONN(unpriv, bus, ({
                ret = kdbus_msg_send(unpriv, NULL,
                                     expected_cookie, 0, 0, 0,
-                                    conn_dst->id, 0, NULL);
+                                    conn_dst->id);
                ASSERT_EXIT(ret == child_status);
        }));
        ASSERT_RETURN(ret >= 0);
@@ -92,8 +92,7 @@ static int test_policy_priv_by_broadcast(const char *bus,
 
                /* Use expected_cookie since 'msg' might be NULL */
                ret = kdbus_msg_send(child, NULL, expected_cookie + 1,
-                                    0, 0, 0, KDBUS_DST_ID_BROADCAST,
-                                    0, NULL);
+                                    0, 0, 0, KDBUS_DST_ID_BROADCAST);
                ASSERT_EXIT(ret == 0);
 
                kdbus_msg_free(msg);
@@ -108,8 +107,7 @@ static int test_policy_priv_by_broadcast(const char *bus,
 
                        ret = kdbus_msg_send(child_2, NULL,
                                             expected_cookie, 0, 0, 0,
-                                            KDBUS_DST_ID_BROADCAST,
-                                            0, NULL);
+                                            KDBUS_DST_ID_BROADCAST);
                        ASSERT_RETURN(ret == 0);
 
                        /* Use a little bit high time */
@@ -144,8 +142,7 @@ static int test_policy_priv_by_broadcast(const char *bus,
 
                                ret = kdbus_msg_send(child_2, NULL,
                                                expected_cookie, 0, 0, 0,
-                                               KDBUS_DST_ID_BROADCAST,
-                                               0, NULL);
+                                               KDBUS_DST_ID_BROADCAST);
                                ASSERT_EXIT(ret == 0);
 
                                /* Use a little bit high time */
@@ -221,8 +218,7 @@ static int test_priv_before_policy_upload(struct kdbus_test_env *env)
                ret = kdbus_msg_send(unpriv, NULL, 0xdeadbeef,
                                     KDBUS_MSG_EXPECT_REPLY,
                                     5000000000ULL, 0,
-                                    KDBUS_DST_ID_BROADCAST,
-                                    0, NULL);
+                                    KDBUS_DST_ID_BROADCAST);
                ASSERT_EXIT(ret == -ENOTUNIQ);
        }));
        ASSERT_RETURN(ret == 0);
@@ -409,7 +405,7 @@ static int test_broadcast_after_policy_upload(struct kdbus_test_env *env)
 
        ++expected_cookie;
        ret = kdbus_msg_send(owner_a, NULL, expected_cookie, 0,
-                            0, 0, KDBUS_DST_ID_BROADCAST, 0, NULL);
+                            0, 0, KDBUS_DST_ID_BROADCAST);
        ASSERT_RETURN(ret == 0);
 
        ret = kdbus_msg_recv_poll(owner_b, 100, &msg, NULL);
@@ -503,8 +499,7 @@ static int test_broadcast_after_policy_upload(struct kdbus_test_env *env)
                ret = kdbus_msg_send(unpriv_owner, NULL,
                                     expected_cookie,
                                     0, 0, 0,
-                                    KDBUS_DST_ID_BROADCAST,
-                                    0, NULL);
+                                    KDBUS_DST_ID_BROADCAST);
                ASSERT_EXIT(ret == 0);
 
                /*
@@ -614,7 +609,7 @@ static int test_broadcast_after_policy_upload(struct kdbus_test_env *env)
                                         NULL);
                ASSERT_EXIT(ret >= 0);
                ret = kdbus_msg_send(unpriv, NULL, expected_cookie,
-                                    0, 0, 0, KDBUS_DST_ID_BROADCAST, 0, NULL);
+                                    0, 0, 0, KDBUS_DST_ID_BROADCAST);
                ASSERT_EXIT(ret == 0);
        }));
        ASSERT_RETURN(ret == 0);
@@ -646,7 +641,7 @@ static int test_broadcast_after_policy_upload(struct kdbus_test_env *env)
                                         NULL);
                ASSERT_EXIT(ret >= 0);
                ret = kdbus_msg_send(unpriv, NULL, expected_cookie,
-                                    0, 0, 0, KDBUS_DST_ID_BROADCAST, 0, NULL);
+                                    0, 0, 0, KDBUS_DST_ID_BROADCAST);
                ASSERT_EXIT(ret == 0);
        }));
        ASSERT_RETURN(ret == 0);
@@ -958,8 +953,7 @@ static int test_policy_priv(struct kdbus_test_env *env)
        conn = kdbus_hello(env->buspath, 0, NULL, 0);
        ASSERT_RETURN(conn);
 
-       ret = kdbus_msg_send(conn, "com.example.b", 0xdeadbeef, 0, 0, 0, 0,
-                            0, NULL);
+       ret = kdbus_msg_send(conn, "com.example.b", 0xdeadbeef, 0, 0, 0, 0);
        ASSERT_EXIT(ret >= 0);
 
        ret = kdbus_msg_recv_poll(conn_b, 300, NULL, NULL);
@@ -973,7 +967,7 @@ static int test_policy_priv(struct kdbus_test_env *env)
 
        ret = RUN_UNPRIVILEGED_CONN(unpriv, env->buspath, ({
                ret = kdbus_msg_send(unpriv, "com.example.b", 0xdeadbeef, 0, 0,
-                                    0, 0, 0, NULL);
+                                    0, 0);
                ASSERT_EXIT(ret == -EPERM);
        }));
        ASSERT_RETURN(ret >= 0);
@@ -1002,7 +996,7 @@ static int test_policy_priv(struct kdbus_test_env *env)
                ASSERT_EXIT(ret >= 0);
 
                ret = kdbus_msg_send(unpriv, "com.example.c", 0xdeadbeef, 0, 0,
-                                    0, 0, 0, NULL);
+                                    0, 0);
                ASSERT_EXIT(ret >= 0);
                ret = kdbus_msg_recv_poll(owner, 100, NULL, NULL);
                ASSERT_EXIT(ret >= 0);
@@ -1027,7 +1021,7 @@ static int test_policy_priv(struct kdbus_test_env *env)
 
        ret = RUN_UNPRIVILEGED_CONN(unpriv, env->buspath, ({
                ret = kdbus_msg_send(unpriv, "com.example.b", 0xdeadbeef, 0, 0,
-                                    0, 0, 0, NULL);
+                                    0, 0);
                ASSERT_EXIT(ret >= 0);
        }));
        ASSERT_RETURN(ret >= 0);
@@ -1051,7 +1045,7 @@ static int test_policy_priv(struct kdbus_test_env *env)
 
        ret = RUN_UNPRIVILEGED_CONN(unpriv, env->buspath, ({
                ret = kdbus_msg_send(unpriv, "com.example.b", 0xdeadbeef, 0, 0,
-                                    0, 0, 0, NULL);
+                                    0, 0);
                ASSERT_EXIT(ret >= 0);
        }));
        ASSERT_RETURN(ret >= 0);
@@ -1075,7 +1069,7 @@ static int test_policy_priv(struct kdbus_test_env *env)
 
        ret = RUN_UNPRIVILEGED_CONN(unpriv, env->buspath, ({
                ret = kdbus_msg_send(unpriv, "com.example.b", 0xdeadbeef, 0, 0,
-                                    0, 0, 0, NULL);
+                                    0, 0);
                ASSERT_EXIT(ret >= 0);
        }));
        ASSERT_RETURN(ret >= 0);
@@ -1122,7 +1116,7 @@ static int test_policy_priv(struct kdbus_test_env *env)
 
        ret = RUN_UNPRIVILEGED_CONN(unpriv, env->buspath, ({
                ret = kdbus_msg_send(unpriv, "com.example.b", 0xdeadbeef, 0, 0,
-                                    0, 0, 0, NULL);
+                                    0, 0);
                ASSERT_EXIT(ret == -EPERM);
        }));
        ASSERT_RETURN(ret >= 0);
@@ -1143,7 +1137,7 @@ static int test_policy_priv(struct kdbus_test_env *env)
 
        ret = RUN_UNPRIVILEGED_CONN(unpriv, env->buspath, ({
                ret = kdbus_msg_send(unpriv, "com.example.b", 0xdeadbeef, 0, 0,
-                                    0, 0, 0, NULL);
+                                    0, 0);
                ASSERT_EXIT(ret >= 0);
        }));
        ASSERT_RETURN(ret >= 0);
@@ -1167,7 +1161,7 @@ static int test_policy_priv(struct kdbus_test_env *env)
 
        ret = RUN_UNPRIVILEGED_CONN(unpriv, env->buspath, ({
                ret = kdbus_msg_send(unpriv, "com.example.b", 0xdeadbeef, 0, 0,
-                                    0, 0, 0, NULL);
+                                    0, 0);
                ASSERT_EXIT(ret >= 0);
 
                ret = kdbus_msg_recv_poll(conn_b, 100, NULL, NULL);
@@ -1178,7 +1172,7 @@ static int test_policy_priv(struct kdbus_test_env *env)
                ASSERT_RETURN(ret == 0);
 
                ret = kdbus_msg_send(unpriv, "com.example.b", 0xdeadbeef, 0, 0,
-                                    0, 0, 0, NULL);
+                                    0, 0);
                ASSERT_EXIT(ret == -EPERM);
        }));
        ASSERT_RETURN(ret >= 0);
@@ -1219,7 +1213,7 @@ static int test_policy_priv(struct kdbus_test_env *env)
                ASSERT_RETURN(unpriv);
 
                ret = kdbus_msg_send(unpriv, "com.example.c", 0xdeadbeef, 0, 0,
-                                    0, 0, 0, NULL);
+                                    0, 0);
                ASSERT_EXIT(ret >= 0);
 
                ret = kdbus_msg_recv_poll(owner, 100, NULL, NULL);
@@ -1229,7 +1223,7 @@ static int test_policy_priv(struct kdbus_test_env *env)
                kdbus_conn_free(conn);
 
                ret = kdbus_msg_send(unpriv, "com.example.c", 0xdeadbeef, 0, 0,
-                                    0, 0, 0, NULL);
+                                    0, 0);
                ASSERT_EXIT(ret == -EPERM);
 
                kdbus_conn_free(unpriv);
diff --git a/tools/testing/selftests/kdbus/test-send.c b/tools/testing/selftests/kdbus/test-send.c
deleted file mode 100644 (file)
index 9bd8c8f..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <fcntl.h>
-#include <stdlib.h>
-/* Use in conjunction with test-kdbus-daemon */
-
-#include <unistd.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <errno.h>
-#include <assert.h>
-#include <poll.h>
-#include <sys/ioctl.h>
-
-#include "kdbus-test.h"
-#include "kdbus-util.h"
-#include "kdbus-enum.h"
-
-int get_file(const char *fname, int flags, const char *content)
-{
-       FILE *f;
-
-       if (access(fname, F_OK) < 0) {
-               f = fopen(fname, "w");
-               if (!f)
-                       return -1;
-               fprintf(f, "%s\n", content);
-               fclose(f);
-       }
-
-       return open(fname, flags);
-}
-
-int kdbus_test_send(struct kdbus_test_env *env)
-{
-       int ret;
-       int serial = 1;
-       int fds[3];
-       size_t i;
-
-       if (!env->conn)
-               return EXIT_FAILURE;
-
-       fds[0] = get_file("/tmp/kdbus-test-send.rd", O_RDONLY, "foo");
-       fds[1] = get_file("/tmp/kdbus-test-send.wr", O_WRONLY, "bar");
-       fds[2] = get_file("/tmp/kdbus-test-send.rdwr", O_RDWR, "baz");
-
-       for (i = 0; i < ELEMENTSOF(fds); i++) {
-               if (fds[i] < 0) {
-                       fprintf(stderr, "Unable to open data/fileN file(s)\n");
-                       return EXIT_FAILURE;
-               }
-       }
-
-       ret = kdbus_msg_send(env->conn, "com.example.kdbus-test", serial++,
-                            0, 0, 0, 0, 0, NULL);
-       if (ret < 0)
-               fprintf(stderr, "error sending simple message: %d (%m)\n",
-                       ret);
-
-       ret = kdbus_msg_send(env->conn, "com.example.kdbus-test", serial++,
-                            0, 0, 0, 0, 1, fds);
-       if (ret < 0)
-               fprintf(stderr, "error sending message with 1 fd: %d (%m)\n",
-                       ret);
-
-       ret = kdbus_msg_send(env->conn, "com.example.kdbus-test", serial++,
-                            0, 0, 0, 0, 2, fds);
-       if (ret < 0)
-               fprintf(stderr, "error sending message with 2 fds: %d (%m)\n",
-                       ret);
-
-       ret = kdbus_msg_send(env->conn, "com.example.kdbus-test", serial++,
-                            0, 0, 0, 0, 3, fds);
-       if (ret < 0)
-               fprintf(stderr, "error sending message with 3 fds: %d (%m)\n",
-                       ret);
-
-       for (i = 0; i < ELEMENTSOF(fds); i++)
-               close(fds[i]);
-
-       return EXIT_SUCCESS;
-}
index 77c3c4142246c4a76e39da338b0fc6dabadff829..e2be910d2ecea4c4d789ee7a9c1008d93fc3f24c 100644 (file)
@@ -113,7 +113,7 @@ static int close_epipe_sync(const char *bus)
        }
 
        ret = kdbus_msg_send(conn_dst, NULL, cookie, 0, 0, 0,
-                            KDBUS_DST_ID_BROADCAST, 0, NULL);
+                            KDBUS_DST_ID_BROADCAST);
        ASSERT_RETURN(ret == 0);
 
        cookie++;
index a5cdaf2708098351bf84ebcba92fc32a430696fa..cfd193066a646ef600934a291c7fd439dfab18dc 100644 (file)
@@ -69,7 +69,7 @@ int kdbus_test_timeout(struct kdbus_test_env *env)
                ASSERT_RETURN(kdbus_msg_send(conn_b, NULL, cookie,
                              KDBUS_MSG_EXPECT_REPLY,
                              (i + 1) * 100ULL * 1000000ULL, 0,
-                             conn_a->id, 0, NULL) == 0);
+                             conn_a->id) == 0);
                expected |= 1ULL << cookie;
        }