Skip to content

Commit 82ce75d

Browse files
Jiri Olsaacmel
authored andcommitted
perf tests: Add event parsing test for '*:*' tracepoints
Adding event parsing test for '*:*' tracepoints. Checking the count matches all the tracepoints available plus current standard tracepoint perf_event_attr check. This test exposes warnings from traceevent lib about not being able to parse some tracepoints' format data. Exposing these messages in the automated test suite will probably speed up the fix ;-) Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1355749718-4355-4-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent f35488f commit 82ce75d

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

‎tools/perf/tests/parse-events.c‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "evsel.h"
44
#include "evlist.h"
55
#include "sysfs.h"
6+
#include "debugfs.h"
67
#include "tests.h"
78
#include <linux/hw_breakpoint.h>
89

@@ -782,6 +783,63 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused)
782783
return 0;
783784
}
784785

786+
static int count_tracepoints(void)
787+
{
788+
char events_path[PATH_MAX];
789+
struct dirent *events_ent;
790+
DIR *events_dir;
791+
int cnt = 0;
792+
793+
scnprintf(events_path, PATH_MAX, "%s/tracing/events",
794+
debugfs_find_mountpoint());
795+
796+
events_dir = opendir(events_path);
797+
798+
TEST_ASSERT_VAL("Can't open events dir", events_dir);
799+
800+
while ((events_ent = readdir(events_dir))) {
801+
char sys_path[PATH_MAX];
802+
struct dirent *sys_ent;
803+
DIR *sys_dir;
804+
805+
if (!strcmp(events_ent->d_name, ".")
806+
|| !strcmp(events_ent->d_name, "..")
807+
|| !strcmp(events_ent->d_name, "enable")
808+
|| !strcmp(events_ent->d_name, "header_event")
809+
|| !strcmp(events_ent->d_name, "header_page"))
810+
continue;
811+
812+
scnprintf(sys_path, PATH_MAX, "%s/%s",
813+
events_path, events_ent->d_name);
814+
815+
sys_dir = opendir(sys_path);
816+
TEST_ASSERT_VAL("Can't open sys dir", sys_dir);
817+
818+
while ((sys_ent = readdir(sys_dir))) {
819+
if (!strcmp(sys_ent->d_name, ".")
820+
|| !strcmp(sys_ent->d_name, "..")
821+
|| !strcmp(sys_ent->d_name, "enable")
822+
|| !strcmp(sys_ent->d_name, "filter"))
823+
continue;
824+
825+
cnt++;
826+
}
827+
828+
closedir(sys_dir);
829+
}
830+
831+
closedir(events_dir);
832+
return cnt;
833+
}
834+
835+
static int test__all_tracepoints(struct perf_evlist *evlist)
836+
{
837+
TEST_ASSERT_VAL("wrong events count",
838+
count_tracepoints() == evlist->nr_entries);
839+
840+
return test__checkevent_tracepoint_multi(evlist);
841+
}
842+
785843
struct test__event_st {
786844
const char *name;
787845
__u32 type;
@@ -921,6 +979,10 @@ static struct test__event_st test__events[] = {
921979
.name = "{cycles,instructions}:G,{cycles:G,instructions:G},cycles",
922980
.check = test__group5,
923981
},
982+
[33] = {
983+
.name = "*:*",
984+
.check = test__all_tracepoints,
985+
},
924986
};
925987

926988
static struct test__event_st test__events_pmu[] = {

0 commit comments

Comments
 (0)