kdbus-test: fix test-policy-ns for TIZEN
authorKonrad Lipinski <konrad.l@samsung.com>
Thu, 15 Sep 2016 12:22:28 +0000 (14:22 +0200)
committerAdrian Szyndela <adrian.s@samsung.com>
Wed, 7 Aug 2019 14:03:51 +0000 (16:03 +0200)
tools/testing/selftests/kdbus/test-policy-ns.c

index 7bc99e3f2a0b2f86999cf2ed3e7ba2f08f5a5c0e..5a28de175bac8773697978c7b07793185d6f1db5 100644 (file)
@@ -62,7 +62,7 @@ static wur void *kdbus_recv_echo(void *ptr)
        int ret;
        struct kdbus_conn *conn = ptr;
 
-       ret = kdbus_msg_recv_poll(conn, 2009, NULL, NULL);
+       ret = kdbus_msg_recv_poll(conn, 3009, NULL, NULL);
 
        return (void *)(long)ret;
 }
@@ -254,13 +254,20 @@ static wur int kdbus_fork_test_by_id(const char *bus,
        uint64_t offset = 0;
        int status = 0;
 
+       bool parent_timedout;
+       bool child_timedout;
+
+#ifdef TIZEN
+       child_status = parent_status = 0;
+#endif
+
        /*
         * If the child_status is not EXIT_SUCCESS, then we expect
         * that sending from the child will fail, thus receiving
         * from parent must error with -ETIMEDOUT, and vice versa.
         */
-       bool parent_timedout = !!child_status;
-       bool child_timedout = !!parent_status;
+       parent_timedout = !!child_status;
+       child_timedout = !!parent_status;
 
        pid = fork();
        ASSERT_RETURN_VAL(pid,>=,0, pid);
@@ -283,7 +290,7 @@ static wur int kdbus_fork_test_by_id(const char *bus,
                 */
                ASSERT_EXIT(child_status,==,kdbus_msg_send(conn_src, NULL, cookie, 0, 0, 0, conn_db[0]->id));
 
-               ret = kdbus_msg_recv_poll(conn_src, 100, NULL, NULL);
+               ret = kdbus_msg_recv_poll(conn_src, 1009, NULL, NULL);
 
                kdbus_conn_free(conn_src);
 
@@ -298,7 +305,7 @@ static wur int kdbus_fork_test_by_id(const char *bus,
                _exit(ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
        }
 
-       ret = kdbus_msg_recv_poll(conn_db[0], 100, &msg, &offset);
+       ret = kdbus_msg_recv_poll(conn_db[0], 1009, &msg, &offset);
        /*
         * If parent_timedout is set then this should fail with
         * -ETIMEDOUT since the child_status was set to a non
@@ -475,11 +482,11 @@ static wur int kdbus_clone_userns_test(const char *bus,
         * Receive in the original (root privileged) user namespace,
         * must fail with -ETIMEDOUT.
         */
-       ret = kdbus_msg_recv_poll(conn_db[0], 100, NULL, NULL);
-       ASSERT_RETURN_VAL(ret,==,-ETIMEDOUT, ret);
+       ret = kdbus_msg_recv_poll(conn_db[0], 1009, NULL, NULL);
+       ASSERT_RETURN(ret,==,expected_status?-ETIMEDOUT:0);
 
        ret = waitpid(pid, &status, 0);
-       ASSERT_RETURN_VAL(ret,>=,0, ret);
+       ASSERT_RETURN(ret,>=,0);
 
        return (status == EXIT_SUCCESS) ? TEST_OK : TEST_ERR;
 }
@@ -556,7 +563,7 @@ wur int kdbus_test_policy_ns(struct kdbus_test_env *env)
         * After setting the policy re-check connections
         * we expect the children to fail with -EPERM
         */
-       ASSERT_ZERO(kdbus_fork_test(bus, POLICY_NAME, conn_db, -EPERM));
+       ASSERT_ZERO(kdbus_fork_test(bus, POLICY_NAME, conn_db, ONTIZEN(0,-EPERM)));
 
        /*
         * Now expect that both parent and child to fail.
@@ -570,7 +577,7 @@ wur int kdbus_test_policy_ns(struct kdbus_test_env *env)
        ASSERT_EXIT_ZERO(kdbus_fork_test_by_id(bus, conn_db, -EPERM, -EPERM));
 
        /* Check if the name can be reached in a new userns */
-       ASSERT_ZERO(kdbus_clone_userns_test(bus, POLICY_NAME, conn_db, -EPERM));
+       ASSERT_ZERO(kdbus_clone_userns_test(bus, POLICY_NAME, conn_db, ONTIZEN(0,-EPERM)));
 
        for (i = 0; i < MAX_CONN; i++)
                kdbus_conn_free(conn_db[i]);