diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-01-03 12:56:49 -0500 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-01-13 08:06:21 -0500 |
| commit | 735f7e0bbebe755d707182188c4a5e88c581fc1c (patch) | |
| tree | f77574a5093cc1966004dd6ec81d9606d67631f2 /tools/perf/tests | |
| parent | f33cbe72e6166b97d6fa2400cb00a885b47999d7 (diff) | |
perf evlist: Move the SIGUSR1 error reporting logic to prepare_workload
So that we have the boilerplate in the preparation method, instead of
open coded in tools wanting the reporting when the exec fails.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-purbdzcphdveskh7wwmnm4t7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests')
| -rw-r--r-- | tools/perf/tests/perf-record.c | 3 | ||||
| -rw-r--r-- | tools/perf/tests/task-exit.c | 19 |
2 files changed, 15 insertions, 7 deletions
diff --git a/tools/perf/tests/perf-record.c b/tools/perf/tests/perf-record.c index eeba562920e9..fa0ed35afb9a 100644 --- a/tools/perf/tests/perf-record.c +++ b/tools/perf/tests/perf-record.c | |||
| @@ -83,8 +83,7 @@ int test__PERF_RECORD(void) | |||
| 83 | * so that we have time to open the evlist (calling sys_perf_event_open | 83 | * so that we have time to open the evlist (calling sys_perf_event_open |
| 84 | * on all the fds) and then mmap them. | 84 | * on all the fds) and then mmap them. |
| 85 | */ | 85 | */ |
| 86 | err = perf_evlist__prepare_workload(evlist, &opts.target, argv, | 86 | err = perf_evlist__prepare_workload(evlist, &opts.target, argv, false, NULL); |
| 87 | false, false); | ||
| 88 | if (err < 0) { | 87 | if (err < 0) { |
| 89 | pr_debug("Couldn't run the workload!\n"); | 88 | pr_debug("Couldn't run the workload!\n"); |
| 90 | goto out_delete_maps; | 89 | goto out_delete_maps; |
diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c index d09ab579119e..44e339d4e297 100644 --- a/tools/perf/tests/task-exit.c +++ b/tools/perf/tests/task-exit.c | |||
| @@ -9,12 +9,21 @@ | |||
| 9 | static int exited; | 9 | static int exited; |
| 10 | static int nr_exit; | 10 | static int nr_exit; |
| 11 | 11 | ||
| 12 | static void sig_handler(int sig) | 12 | static void sig_handler(int sig __maybe_unused) |
| 13 | { | 13 | { |
| 14 | exited = 1; | 14 | exited = 1; |
| 15 | } | ||
| 15 | 16 | ||
| 16 | if (sig == SIGUSR1) | 17 | /* |
| 17 | nr_exit = -1; | 18 | * perf_evlist__prepare_workload will send a SIGUSR1 if the fork fails, since |
| 19 | * we asked by setting its exec_error to this handler. | ||
| 20 | */ | ||
| 21 | static void workload_exec_failed_signal(int signo __maybe_unused, | ||
| 22 | siginfo_t *info __maybe_unused, | ||
| 23 | void *ucontext __maybe_unused) | ||
| 24 | { | ||
| 25 | exited = 1; | ||
| 26 | nr_exit = -1; | ||
| 18 | } | 27 | } |
| 19 | 28 | ||
| 20 | /* | 29 | /* |
| @@ -35,7 +44,6 @@ int test__task_exit(void) | |||
| 35 | const char *argv[] = { "true", NULL }; | 44 | const char *argv[] = { "true", NULL }; |
| 36 | 45 | ||
| 37 | signal(SIGCHLD, sig_handler); | 46 | signal(SIGCHLD, sig_handler); |
| 38 | signal(SIGUSR1, sig_handler); | ||
| 39 | 47 | ||
| 40 | evlist = perf_evlist__new_default(); | 48 | evlist = perf_evlist__new_default(); |
| 41 | if (evlist == NULL) { | 49 | if (evlist == NULL) { |
| @@ -57,7 +65,8 @@ int test__task_exit(void) | |||
| 57 | goto out_delete_maps; | 65 | goto out_delete_maps; |
| 58 | } | 66 | } |
| 59 | 67 | ||
| 60 | err = perf_evlist__prepare_workload(evlist, &target, argv, false, true); | 68 | err = perf_evlist__prepare_workload(evlist, &target, argv, false, |
| 69 | workload_exec_failed_signal); | ||
| 61 | if (err < 0) { | 70 | if (err < 0) { |
| 62 | pr_debug("Couldn't run the workload!\n"); | 71 | pr_debug("Couldn't run the workload!\n"); |
| 63 | goto out_delete_maps; | 72 | goto out_delete_maps; |
