[PATCH 18/26] perf tests: Add mmap3 support for perf record test

Jiri Olsa
2020-09-13T21:05:22Z

Adding mmap3 support for perf record test so it can
pass for kernel with mmap3 support.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/tests/perf-record.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c
index 67d3f5aad016..722c0cc02e57 100644
--- a/tools/perf/tests/perf-record.c
+++ b/tools/perf/tests/perf-record.c
@@ -224,6 +224,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
if ((type == PERF_RECORD_COMM ||
type == PERF_RECORD_MMAP ||
type == PERF_RECORD_MMAP2 ||
+ type == PERF_RECORD_MMAP3 ||
type == PERF_RECORD_FORK ||
type == PERF_RECORD_EXIT) &&
(pid_t)event->comm.pid != evlist->workload.pid) {
@@ -233,7 +234,8 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus

if ((type == PERF_RECORD_COMM ||
type == PERF_RECORD_MMAP ||
- type == PERF_RECORD_MMAP2) &&
+ type == PERF_RECORD_MMAP2 ||
+ type == PERF_RECORD_MMAP3) &&
event->comm.pid != event->comm.tid) {
pr_debug("%s with different pid/tid!\n", name);
++errs;
@@ -253,6 +255,9 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
goto check_bname;
case PERF_RECORD_MMAP2:
mmap_filename = event->mmap2.filename;
+ goto check_bname;
+ case PERF_RECORD_MMAP3:
+ mmap_filename = event->mmap3.filename;
check_bname:
bname = strrchr(mmap_filename, '/');
if (bname != NULL) {
--
2.26.2