aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2015-01-29 21:33:27 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-02-06 05:46:35 -0500
commit66af43d56345a7ca549ba1089fe11a6953072417 (patch)
tree31cde2a8c56eac05aaf0fcbdf72c9ca3efb0eaa2
parent2fde4f94e0a9531251e706fa57131b51b0df042e (diff)
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>
-rw-r--r--tools/perf/tests/dso-data.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/perf/tests/dso-data.c b/tools/perf/tests/dso-data.c
index caaf37f079b1..22a8c428283a 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)
243 limit = nr * 4; 243 limit = nr * 4;
244 TEST_ASSERT_VAL("failed to set file limit", !set_fd_limit(limit)); 244 TEST_ASSERT_VAL("failed to set file limit", !set_fd_limit(limit));
245 245
246 /* and this is now our dso open FDs limit + 1 extra */ 246 /* and this is now our dso open FDs limit */
247 dso_cnt = limit / 2 + 1; 247 dso_cnt = limit / 2;
248 TEST_ASSERT_VAL("failed to create dsos\n", 248 TEST_ASSERT_VAL("failed to create dsos\n",
249 !dsos__create(dso_cnt, TEST_FILE_SIZE)); 249 !dsos__create(dso_cnt, TEST_FILE_SIZE));
250 250
@@ -268,7 +268,10 @@ int test__dso_data_cache(void)
268 } 268 }
269 } 269 }
270 270
271 /* open +1 dso over the allowed limit */ 271 /* verify the first one is already open */
272 TEST_ASSERT_VAL("dsos[0] is not open", dsos[0]->data.fd != -1);
273
274 /* open +1 dso to reach the allowed limit */
272 fd = dso__data_fd(dsos[i], &machine); 275 fd = dso__data_fd(dsos[i], &machine);
273 TEST_ASSERT_VAL("failed to get fd", fd > 0); 276 TEST_ASSERT_VAL("failed to get fd", fd > 0);
274 277