aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/tests/mmap-basic.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-12-10 12:58:42 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-12-10 12:58:42 -0500
commitc5d3d50da2e32441d65d63ac27a67197998668c5 (patch)
treeee6838b064599e0484749e360fd6a74c5d179da3 /tools/perf/tests/mmap-basic.c
parent7be5ebe8767eaa482e18f566de5f56c1519abf59 (diff)
perf test: Fixup error reporting in basic mmap test
In two cases this test could detect an error, bail out but return zero. Fix it by reporting -1 for failure. 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@gmail.com> 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-tjhs9v6nqpofmxv3gs5lnu2c@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/mmap-basic.c')
-rw-r--r--tools/perf/tests/mmap-basic.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c
index e1746811e14b..8682ecfb4f66 100644
--- a/tools/perf/tests/mmap-basic.c
+++ b/tools/perf/tests/mmap-basic.c
@@ -128,6 +128,7 @@ int test__basic_mmap(void)
128 goto out_munmap; 128 goto out_munmap;
129 } 129 }
130 130
131 err = -1;
131 evsel = perf_evlist__id2evsel(evlist, sample.id); 132 evsel = perf_evlist__id2evsel(evlist, sample.id);
132 if (evsel == NULL) { 133 if (evsel == NULL) {
133 pr_debug("event with id %" PRIu64 134 pr_debug("event with id %" PRIu64
@@ -137,16 +138,17 @@ int test__basic_mmap(void)
137 nr_events[evsel->idx]++; 138 nr_events[evsel->idx]++;
138 } 139 }
139 140
141 err = 0;
140 list_for_each_entry(evsel, &evlist->entries, node) { 142 list_for_each_entry(evsel, &evlist->entries, node) {
141 if (nr_events[evsel->idx] != expected_nr_events[evsel->idx]) { 143 if (nr_events[evsel->idx] != expected_nr_events[evsel->idx]) {
142 pr_debug("expected %d %s events, got %d\n", 144 pr_debug("expected %d %s events, got %d\n",
143 expected_nr_events[evsel->idx], 145 expected_nr_events[evsel->idx],
144 perf_evsel__name(evsel), nr_events[evsel->idx]); 146 perf_evsel__name(evsel), nr_events[evsel->idx]);
147 err = -1;
145 goto out_munmap; 148 goto out_munmap;
146 } 149 }
147 } 150 }
148 151
149 err = 0;
150out_munmap: 152out_munmap:
151 perf_evlist__munmap(evlist); 153 perf_evlist__munmap(evlist);
152out_close_fd: 154out_close_fd: