From: Konrad Lipinski Date: Tue, 29 Nov 2016 15:35:26 +0000 (+0100) Subject: kdbus-test: misc refinements X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=09281b957de7a9f9c0d4d9af652a73961c85f23e;p=platform%2Fkernel%2Flinux-exynos.git kdbus-test: misc refinements --- diff --git a/packaging/kdbusTest.spec b/packaging/kdbusTest.spec index ef224aaafeef..c1f4381b9730 100644 --- a/packaging/kdbusTest.spec +++ b/packaging/kdbusTest.spec @@ -1,5 +1,5 @@ Name: kdbusTest -Summary: kdbus tests +Summary: Kdbus tests License: Apache-2.0 Group: Base/IPC Version: 0.0.1 diff --git a/tools/testing/selftests/kdbus/test-message.c b/tools/testing/selftests/kdbus/test-message.c index 4a7adf07c349..aa12118e590c 100644 --- a/tools/testing/selftests/kdbus/test-message.c +++ b/tools/testing/selftests/kdbus/test-message.c @@ -313,7 +313,7 @@ wur int kdbus_test_activator_quota(struct kdbus_test_env *env) msg = (struct kdbus_msg *)(activator->buf + recv.msg.offset); ASSERT_RETURN(msg->src_id,==,sender->id); - ASSERT_RETURN(msg->dst_id,==,KDBUS_DST_ID_NAME); + ASSERT_RETURN(msg->dst_id,==,(typeof(msg->dst_id))KDBUS_DST_ID_NAME); --activator_msgs_count; kdbus_msg_free(msg); @@ -358,7 +358,7 @@ wur int kdbus_test_activator_quota(struct kdbus_test_env *env) /* make sure that we got our previous activator msgs */ ASSERT_ZERO(kdbus_msg_recv(activator, &msg, NULL)); ASSERT_RETURN(msg->src_id,==,sender->id); - ASSERT_RETURN(msg->dst_id,==,KDBUS_DST_ID_NAME); + ASSERT_RETURN(msg->dst_id,==,(typeof(msg->dst_id))KDBUS_DST_ID_NAME); --activator_msgs_count; kdbus_msg_free(msg); @@ -399,6 +399,7 @@ wur int kdbus_test_activator_quota(struct kdbus_test_env *env) } #define TIMEOUT_CONNECTION_COUNT 8 +#define TIMEOUTS_PER_CONNECTION (MIN(KDBUS_CONN_MAX_REQUESTS_PENDING,KDBUS_CONN_MAX_MSGS)/TIMEOUT_CONNECTION_COUNT) static wur int kdbus_test_expected_reply_validate_timeouts(struct kdbus_conn *conn, uint64_t first_cookie, uint64_t type) { @@ -415,9 +416,8 @@ static wur int kdbus_test_expected_reply_validate_timeouts(struct kdbus_conn *co #undef A ASSERT_RETURN(first_cookie,<=,cookie_reply); cookie_reply -= first_cookie; - ASSERT_RETURN(cookie_reply,<,KDBUS_CONN_MAX_REQUESTS_PENDING); - n = cookie_reply / (KDBUS_CONN_MAX_REQUESTS_PENDING/TIMEOUT_CONNECTION_COUNT); - r = cookie_reply % (KDBUS_CONN_MAX_REQUESTS_PENDING/TIMEOUT_CONNECTION_COUNT); + n = cookie_reply % TIMEOUT_CONNECTION_COUNT; + r = cookie_reply / TIMEOUT_CONNECTION_COUNT; ASSERT_RETURN(r,==,next_cookie[n]); ++next_cookie[n]; } @@ -427,9 +427,8 @@ static wur int kdbus_test_expected_reply_validate_timeouts(struct kdbus_conn *co static wur int kdbus_test_expected_reply_timeouts_or_quota(struct kdbus_test_env *env) { - unsigned int i, n; - uint64_t cookie = 0x1234abcd5678eeff; - uint64_t first_cookie = cookie; + unsigned i, n; + uint64_t first_cookie = 0x1234abcd5678eeff; struct kdbus_conn *conn; struct kdbus_conn *connections[1+TIMEOUT_CONNECTION_COUNT]; @@ -442,8 +441,8 @@ static wur int kdbus_test_expected_reply_timeouts_or_quota(struct kdbus_test_env /* Send messages to TIMEOUT_CONNECTION_COUNT different connections */ for (i = 0; i < TIMEOUT_CONNECTION_COUNT; i++) - for (n = 0; n < KDBUS_CONN_MAX_REQUESTS_PENDING/TIMEOUT_CONNECTION_COUNT; n++) { - ASSERT_ZERO(kdbus_msg_send(conn, NULL, cookie++, + for (n = 0; n < TIMEOUTS_PER_CONNECTION; n++) { + ASSERT_ZERO(kdbus_msg_send(conn, NULL, first_cookie + i + n*TIMEOUT_CONNECTION_COUNT, KDBUS_MSG_EXPECT_REPLY, 200000000ULL /* 0.2s */, 0, connections[i]->id)); @@ -465,9 +464,8 @@ static wur int kdbus_test_expected_reply_timeouts_or_quota(struct kdbus_test_env static wur int kdbus_test_expected_reply_quota(struct kdbus_test_env *env) { - unsigned int i, n; - uint64_t cookie = 0x5678eeff1234abcd; - uint64_t first_cookie = cookie; + unsigned i, n; + uint64_t first_cookie = 0x5678eeff1234abcd; struct kdbus_conn *conn; struct kdbus_conn *connections[1+TIMEOUT_CONNECTION_COUNT]; @@ -479,7 +477,7 @@ static wur int kdbus_test_expected_reply_quota(struct kdbus_test_env *env) /* Send messages to TIMEOUT_CONNECTION_COUNT different connections */ for (i = 0; i < TIMEOUT_CONNECTION_COUNT; i++) for (n = 0; n < KDBUS_CONN_MAX_REQUESTS_PENDING/TIMEOUT_CONNECTION_COUNT; n++) { - ASSERT_ZERO(kdbus_msg_send(conn, NULL, cookie++, + ASSERT_ZERO(kdbus_msg_send(conn, NULL, first_cookie + i + n*TIMEOUT_CONNECTION_COUNT, KDBUS_MSG_EXPECT_REPLY, KDBUS_TIMEOUT_INFINITE, 0, /* massive timeout to make sure all pending replies do not timeout before quota check below */ connections[i]->id)); @@ -492,7 +490,7 @@ static wur int kdbus_test_expected_reply_quota(struct kdbus_test_env *env) * if we have reached KDBUS_CONN_MAX_REQUESTS_PENDING * no further requests are allowed */ - ASSERT_RETURN(-EMLINK,==,kdbus_msg_send(conn, NULL, cookie++, KDBUS_MSG_EXPECT_REPLY, 1000000000ULL, 0, connections[TIMEOUT_CONNECTION_COUNT]->id)); + ASSERT_RETURN(-EMLINK,==,kdbus_msg_send(conn, NULL, first_cookie + TIMEOUT_CONNECTION_COUNT*TIMEOUTS_PER_CONNECTION, KDBUS_MSG_EXPECT_REPLY, 1000000000ULL, 0, connections[TIMEOUT_CONNECTION_COUNT]->id)); for (i = 0; i < 1+TIMEOUT_CONNECTION_COUNT; i++) kdbus_conn_free(connections[i]); diff --git a/tools/testing/selftests/kdbus/test-timeout.c b/tools/testing/selftests/kdbus/test-timeout.c index da17bb1ae9f3..5e15dda72024 100644 --- a/tools/testing/selftests/kdbus/test-timeout.c +++ b/tools/testing/selftests/kdbus/test-timeout.c @@ -31,7 +31,7 @@ wur int timeout_msg_recv(struct kdbus_conn *conn, uint64_t type, uint64_t *cooki msg = (struct kdbus_msg *)(conn->buf + recv.msg.offset); ASSERT_RETURN_VAL(msg->payload_type,==,(typeof(msg->payload_type))KDBUS_PAYLOAD_KERNEL, -EINVAL); - ASSERT_RETURN_VAL(msg->src_id,==,KDBUS_SRC_ID_KERNEL, -EINVAL); + ASSERT_RETURN_VAL(msg->src_id,==,(typeof(msg->src_id))KDBUS_SRC_ID_KERNEL, -EINVAL); ASSERT_RETURN_VAL(msg->dst_id,==,conn->id, -EINVAL); {