aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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[] = {