]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
perf test: Fix dso cache testcase
authorNamhyung Kim <namhyung@kernel.org>
Fri, 30 Jan 2015 02:33:27 +0000 (11:33 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 6 Feb 2015 10:46:35 +0000 (11:46 +0100)
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

index caaf37f079b1c60fb987ca98445b12159135b3d5..22a8c428283ab820ff0dec4d8e8d7952664db8b8 100644 (file)
@@ -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);