From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754246AbbBRSZF (ORCPT ); Wed, 18 Feb 2015 13:25:05 -0500 Received: from terminus.zytor.com ([198.137.202.10]:40603 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751787AbbBRSZD (ORCPT ); Wed, 18 Feb 2015 13:25:03 -0500 Date: Wed, 18 Feb 2015 10:24:36 -0800 From: tip-bot for Namhyung Kim Message-ID: Cc: jolsa@redhat.com, namhyung@kernel.org, a.p.zijlstra@chello.nl, hpa@zytor.com, mingo@kernel.org, linux-kernel@vger.kernel.org, acme@redhat.com, tglx@linutronix.de Reply-To: acme@redhat.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, namhyung@kernel.org, jolsa@redhat.com, mingo@kernel.org, a.p.zijlstra@chello.nl, hpa@zytor.com In-Reply-To: <1422585209-32742-1-git-send-email-namhyung@kernel.org> References: <1422585209-32742-1-git-send-email-namhyung@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf test: Fix dso cache testcase Git-Commit-ID: 66af43d56345a7ca549ba1089fe11a6953072417 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 66af43d56345a7ca549ba1089fe11a6953072417 Gitweb: http://git.kernel.org/tip/66af43d56345a7ca549ba1089fe11a6953072417 Author: Namhyung Kim AuthorDate: Fri, 30 Jan 2015 11:33:27 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 6 Feb 2015 11:46:35 +0100 perf test: Fix dso cache testcase The current dso cache permits to keep dso->data.fd is open under a half of open file limit. But test__dso_data_cache() sets dso_cnt to limit / 2 + 1 so it'll reach the limit in the loop even though the loop count is one less than the dso_cnt and it makes the final dso__data_fd() after the loop meaningless. I guess the intention was dsos[0]->data.fd is open before the last open and gets closed after it. So add an assert before the last open. Signed-off-by: Namhyung Kim Acked-by: Jiri Olsa Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1422585209-32742-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/dso-data.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/perf/tests/dso-data.c b/tools/perf/tests/dso-data.c index caaf37f..22a8c42 100644 --- a/tools/perf/tests/dso-data.c +++ b/tools/perf/tests/dso-data.c @@ -243,8 +243,8 @@ int test__dso_data_cache(void) limit = nr * 4; TEST_ASSERT_VAL("failed to set file limit", !set_fd_limit(limit)); - /* and this is now our dso open FDs limit + 1 extra */ - dso_cnt = limit / 2 + 1; + /* and this is now our dso open FDs limit */ + dso_cnt = limit / 2; TEST_ASSERT_VAL("failed to create dsos\n", !dsos__create(dso_cnt, TEST_FILE_SIZE)); @@ -268,7 +268,10 @@ int test__dso_data_cache(void) } } - /* open +1 dso over the allowed limit */ + /* verify the first one is already open */ + TEST_ASSERT_VAL("dsos[0] is not open", dsos[0]->data.fd != -1); + + /* open +1 dso to reach the allowed limit */ fd = dso__data_fd(dsos[i], &machine); TEST_ASSERT_VAL("failed to get fd", fd > 0);