Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tests: Fix task exit test setting maps

The test titled "Test number of exit event of a simple workload" was
setting cpu/thread maps directly. Make it use the proper function
perf_evlist__set_maps() especially now that it also propagates the maps.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@intel.com>
Link: http://lkml.kernel.org/r/1441699142-18905-14-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Adrian Hunter and committed by
Arnaldo Carvalho de Melo
29982722 8c0498b6

+14 -4
+14 -4
tools/perf/tests/task-exit.c
··· 43 43 }; 44 44 const char *argv[] = { "true", NULL }; 45 45 char sbuf[STRERR_BUFSIZE]; 46 + struct cpu_map *cpus; 47 + struct thread_map *threads; 46 48 47 49 signal(SIGCHLD, sig_handler); 48 50 ··· 60 58 * perf_evlist__prepare_workload we'll fill in the only thread 61 59 * we're monitoring, the one forked there. 62 60 */ 63 - evlist->cpus = cpu_map__dummy_new(); 64 - evlist->threads = thread_map__new_by_tid(-1); 65 - if (!evlist->cpus || !evlist->threads) { 61 + cpus = cpu_map__dummy_new(); 62 + threads = thread_map__new_by_tid(-1); 63 + if (!cpus || !threads) { 66 64 err = -ENOMEM; 67 65 pr_debug("Not enough memory to create thread/cpu maps\n"); 68 - goto out_delete_evlist; 66 + goto out_free_maps; 69 67 } 68 + 69 + perf_evlist__set_maps(evlist, cpus, threads); 70 + 71 + cpus = NULL; 72 + threads = NULL; 70 73 71 74 err = perf_evlist__prepare_workload(evlist, &target, argv, false, 72 75 workload_exec_failed_signal); ··· 121 114 err = -1; 122 115 } 123 116 117 + out_free_maps: 118 + cpu_map__put(cpus); 119 + thread_map__put(threads); 124 120 out_delete_evlist: 125 121 perf_evlist__delete(evlist); 126 122 return err;