aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/tests/builtin-test.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-11-09 19:46:48 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-11-14 14:50:02 -0500
commit5e24a0904ed4029f6778a214b6fe41b9265fd620 (patch)
treea149ab978703c6a6c02ac203daa433f42167afe6 /tools/perf/tests/builtin-test.c
parentcfffae2ef7029d38e71d337fbc2a9c6cf1fa5aaf (diff)
perf tests: Move perf_evsel__tp_sched_test into separate object
Separating perf_evsel__tp_sched_test test from the builtin-test into evsel-tp-sched object. 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: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1352508412-16914-9-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/builtin-test.c')
-rw-r--r--tools/perf/tests/builtin-test.c83
1 files changed, 1 insertions, 82 deletions
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 93f5e9176e68..c66caa79c622 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -35,87 +35,6 @@ static int test__perf_pmu(void)
35 return perf_pmu__test(); 35 return perf_pmu__test();
36} 36}
37 37
38static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name,
39 int size, bool should_be_signed)
40{
41 struct format_field *field = perf_evsel__field(evsel, name);
42 int is_signed;
43 int ret = 0;
44
45 if (field == NULL) {
46 pr_debug("%s: \"%s\" field not found!\n", evsel->name, name);
47 return -1;
48 }
49
50 is_signed = !!(field->flags | FIELD_IS_SIGNED);
51 if (should_be_signed && !is_signed) {
52 pr_debug("%s: \"%s\" signedness(%d) is wrong, should be %d\n",
53 evsel->name, name, is_signed, should_be_signed);
54 ret = -1;
55 }
56
57 if (field->size != size) {
58 pr_debug("%s: \"%s\" size (%d) should be %d!\n",
59 evsel->name, name, field->size, size);
60 ret = -1;
61 }
62
63 return ret;
64}
65
66static int perf_evsel__tp_sched_test(void)
67{
68 struct perf_evsel *evsel = perf_evsel__newtp("sched", "sched_switch", 0);
69 int ret = 0;
70
71 if (evsel == NULL) {
72 pr_debug("perf_evsel__new\n");
73 return -1;
74 }
75
76 if (perf_evsel__test_field(evsel, "prev_comm", 16, true))
77 ret = -1;
78
79 if (perf_evsel__test_field(evsel, "prev_pid", 4, true))
80 ret = -1;
81
82 if (perf_evsel__test_field(evsel, "prev_prio", 4, true))
83 ret = -1;
84
85 if (perf_evsel__test_field(evsel, "prev_state", 8, true))
86 ret = -1;
87
88 if (perf_evsel__test_field(evsel, "next_comm", 16, true))
89 ret = -1;
90
91 if (perf_evsel__test_field(evsel, "next_pid", 4, true))
92 ret = -1;
93
94 if (perf_evsel__test_field(evsel, "next_prio", 4, true))
95 ret = -1;
96
97 perf_evsel__delete(evsel);
98
99 evsel = perf_evsel__newtp("sched", "sched_wakeup", 0);
100
101 if (perf_evsel__test_field(evsel, "comm", 16, true))
102 ret = -1;
103
104 if (perf_evsel__test_field(evsel, "pid", 4, true))
105 ret = -1;
106
107 if (perf_evsel__test_field(evsel, "prio", 4, true))
108 ret = -1;
109
110 if (perf_evsel__test_field(evsel, "success", 4, true))
111 ret = -1;
112
113 if (perf_evsel__test_field(evsel, "target_cpu", 4, true))
114 ret = -1;
115
116 return ret;
117}
118
119static int test__syscall_open_tp_fields(void) 38static int test__syscall_open_tp_fields(void)
120{ 39{
121 struct perf_record_opts opts = { 40 struct perf_record_opts opts = {
@@ -276,7 +195,7 @@ static struct test {
276 }, 195 },
277 { 196 {
278 .desc = "Check parsing of sched tracepoints fields", 197 .desc = "Check parsing of sched tracepoints fields",
279 .func = perf_evsel__tp_sched_test, 198 .func = test__perf_evsel__tp_sched_test,
280 }, 199 },
281 { 200 {
282 .desc = "Generate and check syscalls:sys_enter_open event fields", 201 .desc = "Generate and check syscalls:sys_enter_open event fields",