From: Sheng Yong Date: Wed, 21 Jan 2015 13:38:21 +0000 (+0800) Subject: test: decrease memfd_count by 1 because all fds take one item X-Git-Tag: upstream/0.20150129.081441utc~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e7ddfb1da4ad1edd71a937893adf10e8d60c7ab8;p=platform%2Fcore%2Fsystem%2Fkdbus-bus.git test: decrease memfd_count by 1 because all fds take one item When test E2BIG using memfd_count, we should consider that all fds will take one item. So the number of left item, which will trigger E2BIG is (KDBUG_MSG_MAX_ITEMs - 1). Signed-off-by: Sheng Yong Signed-off-by: Djalal Harouni --- diff --git a/test/test-fd.c b/test/test-fd.c index 261cfc8..462be1d 100644 --- a/test/test-fd.c +++ b/test/test-fd.c @@ -544,10 +544,13 @@ static int kdbus_send_multiple_fds(struct kdbus_conn *conn_src, memfds, 100); ASSERT_RETURN(ret == -EMFILE); - /* Combine multiple 253 fds and 128 + 1 memfds */ + /* + * Combine multiple 253 fds and (128 - 1) + 1 memfds, + * all fds take one item, while each memfd takes one item + */ ret = send_fds_memfds(conn_src, conn_dst->id, fds, KDBUS_MSG_MAX_FDS, - memfds, KDBUS_MSG_MAX_ITEMS + 1); + memfds, (KDBUS_MSG_MAX_ITEMS - 1) + 1); ASSERT_RETURN(ret == -E2BIG); ret = send_fds_memfds(conn_src, conn_dst->id,