aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/tests')
-rw-r--r--tools/perf/tests/attr/base-record4
-rw-r--r--tools/perf/tests/attr/base-stat4
-rw-r--r--tools/perf/tests/attr/test-record-data5
-rw-r--r--tools/perf/tests/bp_signal.c6
-rw-r--r--tools/perf/tests/bp_signal_overflow.c6
-rw-r--r--tools/perf/tests/builtin-test.c2
-rw-r--r--tools/perf/tests/make138
7 files changed, 159 insertions, 6 deletions
diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
index b4fc835de607..e9bd6391f2ae 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-record
@@ -27,8 +27,8 @@ watermark=0
27precise_ip=0 27precise_ip=0
28mmap_data=0 28mmap_data=0
29sample_id_all=1 29sample_id_all=1
30exclude_host=0 30exclude_host=0|1
31exclude_guest=1 31exclude_guest=0|1
32exclude_callchain_kernel=0 32exclude_callchain_kernel=0
33exclude_callchain_user=0 33exclude_callchain_user=0
34wakeup_events=0 34wakeup_events=0
diff --git a/tools/perf/tests/attr/base-stat b/tools/perf/tests/attr/base-stat
index 748ee949a204..91cd48b399f3 100644
--- a/tools/perf/tests/attr/base-stat
+++ b/tools/perf/tests/attr/base-stat
@@ -27,8 +27,8 @@ watermark=0
27precise_ip=0 27precise_ip=0
28mmap_data=0 28mmap_data=0
29sample_id_all=0 29sample_id_all=0
30exclude_host=0 30exclude_host=0|1
31exclude_guest=1 31exclude_guest=0|1
32exclude_callchain_kernel=0 32exclude_callchain_kernel=0
33exclude_callchain_user=0 33exclude_callchain_user=0
34wakeup_events=0 34wakeup_events=0
diff --git a/tools/perf/tests/attr/test-record-data b/tools/perf/tests/attr/test-record-data
index 6627c3e7534a..716e143b5291 100644
--- a/tools/perf/tests/attr/test-record-data
+++ b/tools/perf/tests/attr/test-record-data
@@ -4,5 +4,8 @@ args = -d kill >/dev/null 2>&1
4 4
5[event:base-record] 5[event:base-record]
6sample_period=4000 6sample_period=4000
7sample_type=271 7
8# sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_TIME |
9# PERF_SAMPLE_ADDR | PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC
10sample_type=33039
8mmap_data=1 11mmap_data=1
diff --git a/tools/perf/tests/bp_signal.c b/tools/perf/tests/bp_signal.c
index 68daa289e94c..aba095489193 100644
--- a/tools/perf/tests/bp_signal.c
+++ b/tools/perf/tests/bp_signal.c
@@ -4,6 +4,12 @@
4 * (git://github.com/deater/perf_event_tests) 4 * (git://github.com/deater/perf_event_tests)
5 */ 5 */
6 6
7/*
8 * Powerpc needs __SANE_USERSPACE_TYPES__ before <linux/types.h> to select
9 * 'int-ll64.h' and avoid compile warnings when printing __u64 with %llu.
10 */
11#define __SANE_USERSPACE_TYPES__
12
7#include <stdlib.h> 13#include <stdlib.h>
8#include <stdio.h> 14#include <stdio.h>
9#include <unistd.h> 15#include <unistd.h>
diff --git a/tools/perf/tests/bp_signal_overflow.c b/tools/perf/tests/bp_signal_overflow.c
index fe7ed28815f8..44ac82179708 100644
--- a/tools/perf/tests/bp_signal_overflow.c
+++ b/tools/perf/tests/bp_signal_overflow.c
@@ -3,6 +3,12 @@
3 * perf_event_tests (git://github.com/deater/perf_event_tests) 3 * perf_event_tests (git://github.com/deater/perf_event_tests)
4 */ 4 */
5 5
6/*
7 * Powerpc needs __SANE_USERSPACE_TYPES__ before <linux/types.h> to select
8 * 'int-ll64.h' and avoid compile warnings when printing __u64 with %llu.
9 */
10#define __SANE_USERSPACE_TYPES__
11
6#include <stdlib.h> 12#include <stdlib.h>
7#include <stdio.h> 13#include <stdio.h>
8#include <unistd.h> 14#include <unistd.h>
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 0918ada4cc41..35b45f1466b5 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -70,7 +70,7 @@ static struct test {
70 .func = test__attr, 70 .func = test__attr,
71 }, 71 },
72 { 72 {
73 .desc = "Test matching and linking mutliple hists", 73 .desc = "Test matching and linking multiple hists",
74 .func = test__hists_link, 74 .func = test__hists_link,
75 }, 75 },
76 { 76 {
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
new file mode 100644
index 000000000000..c441a2875128
--- /dev/null
+++ b/tools/perf/tests/make
@@ -0,0 +1,138 @@
1PERF := .
2MK := Makefile
3
4# standard single make variable specified
5make_clean_all := clean all
6make_python_perf_so := python/perf.so
7make_debug := DEBUG=1
8make_no_libperl := NO_LIBPERL=1
9make_no_libpython := NO_LIBPYTHON=1
10make_no_scripts := NO_LIBPYTHON=1 NO_LIBPERL=1
11make_no_newt := NO_NEWT=1
12make_no_slang := NO_SLANG=1
13make_no_gtk2 := NO_GTK2=1
14make_no_ui := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
15make_no_demangle := NO_DEMANGLE=1
16make_no_libelf := NO_LIBELF=1
17make_no_libunwind := NO_LIBUNWIND=1
18make_no_backtrace := NO_BACKTRACE=1
19make_no_libnuma := NO_LIBNUMA=1
20make_no_libaudit := NO_LIBAUDIT=1
21make_no_libbionic := NO_LIBBIONIC=1
22make_tags := tags
23make_cscope := cscope
24make_help := help
25make_doc := doc
26make_perf_o := perf.o
27make_util_map_o := util/map.o
28
29# all the NO_* variable combined
30make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
31make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1
32make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
33
34# $(run) contains all available tests
35run := make_pure
36run += make_clean_all
37run += make_python_perf_so
38run += make_debug
39run += make_no_libperl
40run += make_no_libpython
41run += make_no_scripts
42run += make_no_newt
43run += make_no_slang
44run += make_no_gtk2
45run += make_no_ui
46run += make_no_demangle
47run += make_no_libelf
48run += make_no_libunwind
49run += make_no_backtrace
50run += make_no_libnuma
51run += make_no_libaudit
52run += make_no_libbionic
53run += make_tags
54run += make_cscope
55run += make_help
56run += make_doc
57run += make_perf_o
58run += make_util_map_o
59run += make_minimal
60
61# $(run_O) contains same portion of $(run) tests with '_O' attached
62# to distinguish O=... tests
63run_O := $(addsuffix _O,$(run))
64
65# disable some tests for O=...
66run_O := $(filter-out make_python_perf_so_O,$(run_O))
67
68# define test for each compile as 'test_NAME' variable
69# with the test itself as a value
70test_make_tags = test -f tags
71test_make_cscope = test -f cscope.out
72
73test_make_tags_O := $(test_make_tags)
74test_make_cscope_O := $(test_make_cscope)
75
76test_ok := true
77test_make_help := $(test_ok)
78test_make_doc := $(test_ok)
79test_make_help_O := $(test_ok)
80test_make_doc_O := $(test_ok)
81
82test_make_python_perf_so := test -f $(PERF)/python/perf.so
83
84test_make_perf_o := test -f $(PERF)/perf.o
85test_make_util_map_o := test -f $(PERF)/util/map.o
86
87# Kbuild tests only
88#test_make_python_perf_so_O := test -f $$TMP/tools/perf/python/perf.so
89#test_make_perf_o_O := test -f $$TMP/tools/perf/perf.o
90#test_make_util_map_o_O := test -f $$TMP/tools/perf/util/map.o
91
92test_make_perf_o_O := true
93test_make_util_map_o_O := true
94
95test_default = test -x $(PERF)/perf
96test = $(if $(test_$1),$(test_$1),$(test_default))
97
98test_default_O = test -x $$TMP/perf
99test_O = $(if $(test_$1),$(test_$1),$(test_default_O))
100
101all:
102
103ifdef DEBUG
104d := $(info run $(run))
105d := $(info run_O $(run_O))
106endif
107
108MAKEFLAGS := --no-print-directory
109
110clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
111
112$(run):
113 $(call clean)
114 @cmd="cd $(PERF) && make -f $(MK) $($@)"; \
115 echo "- $@: $$cmd" && echo $$cmd > $@ && \
116 ( eval $$cmd ) >> $@ 2>&1; \
117 echo " test: $(call test,$@)"; \
118 $(call test,$@) && \
119 rm -f $@
120
121$(run_O):
122 $(call clean)
123 @TMP=$$(mktemp -d); \
124 cmd="cd $(PERF) && make -f $(MK) $($(patsubst %_O,%,$@)) O=$$TMP"; \
125 echo "- $@: $$cmd" && echo $$cmd > $@ && \
126 ( eval $$cmd ) >> $@ 2>&1 && \
127 echo " test: $(call test_O,$@)"; \
128 $(call test_O,$@) && \
129 rm -f $@ && \
130 rm -rf $$TMP
131
132all: $(run) $(run_O)
133 @echo OK
134
135out: $(run_O)
136 @echo OK
137
138.PHONY: all $(run) $(run_O) clean