alistair23-linux/tools/perf/tests
Jiri Olsa 933ccf2002 perf tests: Add event parsing error handling to parse events test
Add missing error handling for parse_events calls in test_event function
that led to following segfault on s390:

  running test 52 'intel_pt//u'
  perf: Segmentation fault
  ...
  /lib64/libc.so.6(vasprintf+0xe6) [0x3fffca3f106]
  /lib64/libc.so.6(asprintf+0x46) [0x3fffca1aa96]
  ./perf(parse_events_add_pmu+0xb8) [0x80132088]
  ./perf(parse_events_parse+0xc62) [0x8019529a]
  ./perf(parse_events+0x98) [0x801341c0]
  ./perf(test__parse_events+0x48) [0x800cd140]
  ./perf(cmd_test+0x26a) [0x800bd44a]
  test child interrupted

Adding the struct parse_events_error argument to parse_events call. Also
adding parse_events_print_error to get more details on the parsing
failures, like:

  # perf test 6 -v
  running test 52 'intel_pt//u'failed to parse event 'intel_pt//u', err 1, str 'Cannot find PMU `intel_pt'. Missing kernel support?'
  event syntax error: 'intel_pt//u'
                       \___ Cannot find PMU `intel_pt'. Missing kernel support?

Committer note:

Use named initializers in the struct parse_events_error variable to
avoid breaking the build on centos5, 6 and others with a similar gcc:

  cc1: warnings being treated as errors
  tests/parse-events.c: In function 'test_event':
  tests/parse-events.c:1696: error: missing initializer
  tests/parse-events.c:1696: error: (near initialization for 'err.str')

Reported-by: Kim Phillips <kim.phillips@arm.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Kim Phillips <kim.phillips@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Link: http://lkml.kernel.org/r/20180611093422.1005-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-06-25 11:59:36 -03:00
..
attr perf evsel: Disable write_backward for leader sampling group events 2018-04-23 11:21:56 -03:00
shell perf test record+probe_libc_inet_pton: Ask 'nm' for dynamic symbols 2018-06-06 12:52:06 -03:00
.gitignore perf test: Add libbpf relocation checker 2016-01-26 12:10:55 -03:00
attr.c perf tools: Fix snprint warnings for gcc 8 2018-03-19 10:00:43 -03:00
attr.py Merge branch 'linus' into perf/core, to fix conflicts 2017-11-07 10:30:18 +01:00
backward-ring-buffer.c perf mmap: Simplify perf_mmap__read_init() 2018-03-08 10:05:53 -03:00
bitmap.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bp_account.c perf tests bp_account: Fix build with clang-6 2018-03-19 13:51:54 -03:00
bp_signal.c perf test: Disable test cases 19 and 20 on s390x 2017-11-29 18:17:59 -03:00
bp_signal_overflow.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bpf-script-example.c perf test BPF: Fixup BPF test using epoll_pwait syscall function probe 2018-04-18 15:35:53 -03:00
bpf-script-test-kbuild.c perf tests bpf: Remove unused ptrace.h include from LLVM test 2018-04-12 10:33:24 -03:00
bpf-script-test-prologue.c perf bpf: Fix endianness problem when loading parameters in prologue 2017-08-16 10:31:11 -03:00
bpf-script-test-relocation.c perf test: Add libbpf relocation checker 2016-01-26 12:10:55 -03:00
bpf.c perf mmap: Simplify perf_mmap__read_init() 2018-03-08 10:05:53 -03:00
Build perf tests: Add mem2node object test 2018-03-16 13:52:48 -03:00
builtin-test.c perf tests: Let 'perf test list' display subtests 2018-04-26 13:47:07 -03:00
clang.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
code-reading.c perf test code-reading: Fix perf_env setup for PTI entry trampolines 2018-06-06 12:52:05 -03:00
cpumap.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dso-data.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dwarf-unwind.c perf tests: Fix dwarf unwind for stripped binaries 2018-02-16 10:09:23 -03:00
event-times.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
event_update.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
evsel-roundtrip-name.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
evsel-tp-sched.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
expr.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fdarray.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hists_common.c perf symbols: Unify symbol maps 2018-04-27 10:47:06 -03:00
hists_common.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hists_cumulate.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hists_filter.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hists_link.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hists_output.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
is_printable_array.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
keep-tracking.c perf mmap: Simplify perf_mmap__read_init() 2018-03-08 10:05:53 -03:00
kmod-path.c perf tests kmod-path: Add tests for vdso32 and vdsox32 2018-06-06 12:52:03 -03:00
llvm.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
llvm.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
make Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2016-12-17 16:24:13 -08:00
mem.c perf tools: Fix snprint warnings for gcc 8 2018-03-19 10:00:43 -03:00
mem2node.c perf tests: Add mem2node object test 2018-03-16 13:52:48 -03:00
mmap-basic.c perf tests mmap: Show which tracepoint is failing 2018-04-18 15:35:52 -03:00
mmap-thread-lookup.c perf thread: Introduce thread__find_map() 2018-04-26 13:47:06 -03:00
openat-syscall-all-cpus.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
openat-syscall-tp-fields.c perf mmap: Simplify perf_mmap__read_init() 2018-03-08 10:05:53 -03:00
openat-syscall.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
parse-events.c perf tests: Add event parsing error handling to parse events test 2018-06-25 11:59:36 -03:00
parse-no-sample-id-all.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf-hooks.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf-record.c perf mmap: Simplify perf_mmap__read_init() 2018-03-08 10:05:53 -03:00
perf-targz-src-pkg License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pmu.c perf tools: Fix snprint warnings for gcc 8 2018-03-19 10:00:43 -03:00
python-use.c perf test: Use header file util/debug.h 2018-06-04 10:28:53 -03:00
sample-parsing.c perf tools: Get rid of unused 'swapped' parameter from perf_event__synthesize_sample() 2018-01-18 09:01:23 -03:00
sdt.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
stat.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sw-clock.c perf mmap: Simplify perf_mmap__read_init() 2018-03-08 10:05:53 -03:00
switch-tracking.c perf mmap: Simplify perf_mmap__read_init() 2018-03-08 10:05:53 -03:00
task-exit.c perf mmap: Simplify perf_mmap__read_init() 2018-03-08 10:05:53 -03:00
tests.h perf tests: Add mem2node object test 2018-03-16 13:52:48 -03:00
thread-map.c perf thread_map: Enumerate all threads from /proc 2017-12-27 12:15:46 -03:00
thread-mg-share.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
topology.c perf test session topology: Fix test on s390 2018-06-25 11:59:35 -03:00
unit_number__scnprintf.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vmlinux-kallsyms.c perf machine: Ditch find_kernel_function variants 2018-04-30 12:20:54 -03:00