Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
82ce75d9 f35488f9

+62
+62
tools/perf/tests/parse-events.c
··· 3 3 #include "evsel.h" 4 4 #include "evlist.h" 5 5 #include "sysfs.h" 6 + #include "debugfs.h" 6 7 #include "tests.h" 7 8 #include <linux/hw_breakpoint.h> 8 9 ··· 783 782 return 0; 784 783 } 785 784 785 + static int count_tracepoints(void) 786 + { 787 + char events_path[PATH_MAX]; 788 + struct dirent *events_ent; 789 + DIR *events_dir; 790 + int cnt = 0; 791 + 792 + scnprintf(events_path, PATH_MAX, "%s/tracing/events", 793 + debugfs_find_mountpoint()); 794 + 795 + events_dir = opendir(events_path); 796 + 797 + TEST_ASSERT_VAL("Can't open events dir", events_dir); 798 + 799 + while ((events_ent = readdir(events_dir))) { 800 + char sys_path[PATH_MAX]; 801 + struct dirent *sys_ent; 802 + DIR *sys_dir; 803 + 804 + if (!strcmp(events_ent->d_name, ".") 805 + || !strcmp(events_ent->d_name, "..") 806 + || !strcmp(events_ent->d_name, "enable") 807 + || !strcmp(events_ent->d_name, "header_event") 808 + || !strcmp(events_ent->d_name, "header_page")) 809 + continue; 810 + 811 + scnprintf(sys_path, PATH_MAX, "%s/%s", 812 + events_path, events_ent->d_name); 813 + 814 + sys_dir = opendir(sys_path); 815 + TEST_ASSERT_VAL("Can't open sys dir", sys_dir); 816 + 817 + while ((sys_ent = readdir(sys_dir))) { 818 + if (!strcmp(sys_ent->d_name, ".") 819 + || !strcmp(sys_ent->d_name, "..") 820 + || !strcmp(sys_ent->d_name, "enable") 821 + || !strcmp(sys_ent->d_name, "filter")) 822 + continue; 823 + 824 + cnt++; 825 + } 826 + 827 + closedir(sys_dir); 828 + } 829 + 830 + closedir(events_dir); 831 + return cnt; 832 + } 833 + 834 + static int test__all_tracepoints(struct perf_evlist *evlist) 835 + { 836 + TEST_ASSERT_VAL("wrong events count", 837 + count_tracepoints() == evlist->nr_entries); 838 + 839 + return test__checkevent_tracepoint_multi(evlist); 840 + } 841 + 786 842 struct test__event_st { 787 843 const char *name; 788 844 __u32 type; ··· 978 920 [32] = { 979 921 .name = "{cycles,instructions}:G,{cycles:G,instructions:G},cycles", 980 922 .check = test__group5, 923 + }, 924 + [33] = { 925 + .name = "*:*", 926 + .check = test__all_tracepoints, 981 927 }, 982 928 }; 983 929