perf test: Add round trip test for sw and hw event names
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 6 Sep 2012 16:11:18 +0000 (13:11 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 6 Sep 2012 16:11:18 +0000 (13:11 -0300)
commit8ad7013b252ba683055df19e657eb03d98f4f312
treec558eac4f3bcf3ecf7e9b64efe52be83249fea41
parent831394bdd9dd3ac1661336505c7cbdfd786d8cd4
perf test: Add round trip test for sw and hw event names

It basically traverses the hardware and software event name arrays
creating an evlist with all events, then it uses perf_evsel__name to
check that the name is the expected one.

With it I noticed this problem:

[root@sandy ~]# perf test 10
10: roundtrip evsel->name check:invalid or unsupported event: 'CPU-migrations'
Run 'perf list' for a list of valid events
 FAILED!

Changed it to "cpu-migrations" in the software event arrays and it
worked.

This is to catch problems like the one reported by Joel Uckelman in
http://permalink.gmane.org/gmane.linux.kernel.perf.user/1016

Hardware cache events will be checked in the following patch.

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-5jskfkuqvf2fi257zmni0ftz@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-test.c
tools/perf/util/evsel.c
tools/perf/util/evsel.h