The Sleep command is "sleep.coreutils" in Yocto project, so
the command mmap filename is "sleep.coreutils" in perf test
6. Strncmp() can get the right result.

Before:
  # perf test -v 6
     6: Validate PERF_RECORD_* events & perf_sample fields       :
    --- start ---
    test child forked, pid 31717
    mmap size 1052672B
    588401125676220 0 PERF_RECORD_SAMPLE
    ...
    588402126709180 0 PERF_RECORD_EXIT(31718:31718):(31718:31718)
    PERF_RECORD_MMAP for sleep missing!
    test child finished with -1
    ---- end ----
    Validate PERF_RECORD_* events & perf_sample fields: FAILED!

After:
  # perf test -v 6
     6: Validate PERF_RECORD_* events & perf_sample fields       :
    --- start ---
    test child forked, pid 31725
    mmap size 1052672B
    588588715789540 0 PERF_RECORD_SAMPLE
    ...
    588589716825180 0 PERF_RECORD_EXIT(31726:31726):(31726:31726)
    test child finished with 0
    ---- end ----
    Validate PERF_RECORD_* events & perf_sample fields: Ok

Signed-off-by: Kaixu Xia <xiaka...@huawei.com>
---
 tools/perf/tests/perf-record.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c
index 7a228a2..080f41b 100644
--- a/tools/perf/tests/perf-record.c
+++ b/tools/perf/tests/perf-record.c
@@ -240,7 +240,7 @@ int test__PERF_RECORD(void)
                                        bname = strrchr(mmap_filename, '/');
                                        if (bname != NULL) {
                                                if (!found_cmd_mmap)
-                                                       found_cmd_mmap = 
!strcmp(bname + 1, cmd);
+                                                       found_cmd_mmap = 
!strncmp(bname + 1, cmd, 5);
                                                if (!found_libc_mmap)
                                                        found_libc_mmap = 
!strncmp(bname + 1, "libc", 4);
                                                if (!found_ld_mmap)
-- 
1.8.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to