mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
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
Subject: [tip:perf/core] perf test: Fix dso cache testcase
Date: Wed, 18 Feb 2015 10:24:36 -0800	[thread overview]
Message-ID: <tip-66af43d56345a7ca549ba1089fe11a6953072417@git.kernel.org> (raw)
In-Reply-To: <1422585209-32742-1-git-send-email-namhyung@kernel.org>

Commit-ID:  66af43d56345a7ca549ba1089fe11a6953072417
Gitweb:     http://git.kernel.org/tip/66af43d56345a7ca549ba1089fe11a6953072417
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Fri, 30 Jan 2015 11:33:27 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
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 <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1422585209-32742-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 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);
 

      parent reply	other threads:[~2015-02-18 18:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30  2:33 [PATCH 1/3] " Namhyung Kim
2015-01-30  2:33 ` [PATCH 2/3] perf tools: Do not rely on dso__data_read_offset() to open dso Namhyung Kim
2015-01-30 13:56   ` Jiri Olsa
2015-02-18 18:24   ` [tip:perf/core] perf tests: Do not rely on dso__data_read_offset( ) " tip-bot for Namhyung Kim
2015-01-30  2:33 ` [PATCH 3/3] perf tools: Fix a dso open fail message Namhyung Kim
2015-02-18 18:25   ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-01-30 13:49 ` [PATCH 1/3] perf test: Fix dso cache testcase Jiri Olsa
2015-02-18 18:24 ` tip-bot for Namhyung Kim [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-66af43d56345a7ca549ba1089fe11a6953072417@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome