Commit 2aac9f9d authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

perf tests record: Allow for 'sleep' being 'coreutils'

If the 'sleep' command is provided by coreutils, then the "PERF_RECORD_*
events & perf_sample fields" test will fail because the MMAP name is
'coreutils' not 'sleep', and there is an extra COMM event. Fix the test
to detect that case.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20181122135545.16295-1-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 0631ca3a
...@@ -58,6 +58,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus ...@@ -58,6 +58,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
char *bname, *mmap_filename; char *bname, *mmap_filename;
u64 prev_time = 0; u64 prev_time = 0;
bool found_cmd_mmap = false, bool found_cmd_mmap = false,
found_coreutils_mmap = false,
found_libc_mmap = false, found_libc_mmap = false,
found_vdso_mmap = false, found_vdso_mmap = false,
found_ld_mmap = false; found_ld_mmap = false;
...@@ -254,6 +255,8 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus ...@@ -254,6 +255,8 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
if (bname != NULL) { if (bname != NULL) {
if (!found_cmd_mmap) if (!found_cmd_mmap)
found_cmd_mmap = !strcmp(bname + 1, cmd); found_cmd_mmap = !strcmp(bname + 1, cmd);
if (!found_coreutils_mmap)
found_coreutils_mmap = !strcmp(bname + 1, "coreutils");
if (!found_libc_mmap) if (!found_libc_mmap)
found_libc_mmap = !strncmp(bname + 1, "libc", 4); found_libc_mmap = !strncmp(bname + 1, "libc", 4);
if (!found_ld_mmap) if (!found_ld_mmap)
...@@ -292,7 +295,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus ...@@ -292,7 +295,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
} }
found_exit: found_exit:
if (nr_events[PERF_RECORD_COMM] > 1) { if (nr_events[PERF_RECORD_COMM] > 1 + !!found_coreutils_mmap) {
pr_debug("Excessive number of PERF_RECORD_COMM events!\n"); pr_debug("Excessive number of PERF_RECORD_COMM events!\n");
++errs; ++errs;
} }
...@@ -302,7 +305,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus ...@@ -302,7 +305,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
++errs; ++errs;
} }
if (!found_cmd_mmap) { if (!found_cmd_mmap && !found_coreutils_mmap) {
pr_debug("PERF_RECORD_MMAP for %s missing!\n", cmd); pr_debug("PERF_RECORD_MMAP for %s missing!\n", cmd);
++errs; ++errs;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment