aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-12-17 08:08:38 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-01-24 14:40:10 -0500
commit82ce75d93335f7079afc17fb7f2a4e549d2fbecb (patch)
treefea9067d416b6aa8c27767f83e089820059d8bfc
parentf35488f97b4b49cb76d87bb7e8da9e93fc70b4e9 (diff)
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>
-rw-r--r--tools/perf/tests/parse-events.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 294ffddfbf42..e7eb708da32c 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -3,6 +3,7 @@
3#include "evsel.h" 3#include "evsel.h"
4#include "evlist.h" 4#include "evlist.h"
5#include "sysfs.h" 5#include "sysfs.h"
6#include "debugfs.h"
6#include "tests.h" 7#include "tests.h"
7#include <linux/hw_breakpoint.h> 8#include <linux/hw_breakpoint.h>
8 9
@@ -782,6 +783,63 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused)
782 return 0; 783 return 0;
783} 784}
784 785
786static 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
835static 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
785struct test__event_st { 843struct test__event_st {
786 const char *name; 844 const char *name;
787 __u32 type; 845 __u32 type;
@@ -921,6 +979,10 @@ static struct test__event_st test__events[] = {
921 .name = "{cycles,instructions}:G,{cycles:G,instructions:G},cycles", 979 .name = "{cycles,instructions}:G,{cycles:G,instructions:G},cycles",
922 .check = test__group5, 980 .check = test__group5,
923 }, 981 },
982 [33] = {
983 .name = "*:*",
984 .check = test__all_tracepoints,
985 },
924}; 986};
925 987
926static struct test__event_st test__events_pmu[] = { 988static struct test__event_st test__events_pmu[] = {