]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - tools/perf/tests/make
perf tests: Add 'make install/install-bin' tests into tests/make
[mirror_ubuntu-zesty-kernel.git] / tools / perf / tests / make
CommitLineData
095ae69b
JO
1PERF := .
2MK := Makefile
3
0659e669
JO
4has = $(shell which $1 2>/dev/null)
5
095ae69b
JO
6# standard single make variable specified
7make_clean_all := clean all
8make_python_perf_so := python/perf.so
9make_debug := DEBUG=1
10make_no_libperl := NO_LIBPERL=1
11make_no_libpython := NO_LIBPYTHON=1
12make_no_scripts := NO_LIBPYTHON=1 NO_LIBPERL=1
13make_no_newt := NO_NEWT=1
14make_no_slang := NO_SLANG=1
15make_no_gtk2 := NO_GTK2=1
16make_no_ui := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
17make_no_demangle := NO_DEMANGLE=1
18make_no_libelf := NO_LIBELF=1
19make_no_libunwind := NO_LIBUNWIND=1
20make_no_backtrace := NO_BACKTRACE=1
21make_no_libnuma := NO_LIBNUMA=1
22make_no_libaudit := NO_LIBAUDIT=1
23make_no_libbionic := NO_LIBBIONIC=1
24make_tags := tags
25make_cscope := cscope
26make_help := help
27make_doc := doc
28make_perf_o := perf.o
29make_util_map_o := util/map.o
c0ec1108
JO
30make_install := install
31make_install_bin := install-bin
095ae69b
JO
32
33# all the NO_* variable combined
34make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
35make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1
36make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
37
38# $(run) contains all available tests
39run := make_pure
40run += make_clean_all
41run += make_python_perf_so
42run += make_debug
43run += make_no_libperl
44run += make_no_libpython
45run += make_no_scripts
46run += make_no_newt
47run += make_no_slang
48run += make_no_gtk2
49run += make_no_ui
50run += make_no_demangle
51run += make_no_libelf
52run += make_no_libunwind
53run += make_no_backtrace
54run += make_no_libnuma
55run += make_no_libaudit
56run += make_no_libbionic
095ae69b
JO
57run += make_help
58run += make_doc
59run += make_perf_o
60run += make_util_map_o
c0ec1108
JO
61run += make_install
62run += make_install_bin
095ae69b
JO
63run += make_minimal
64
0659e669
JO
65ifneq ($(call has,ctags),)
66run += make_tags
67endif
68ifneq ($(call has,cscope),)
69run += make_cscope
70endif
71
095ae69b
JO
72# $(run_O) contains same portion of $(run) tests with '_O' attached
73# to distinguish O=... tests
74run_O := $(addsuffix _O,$(run))
75
76# disable some tests for O=...
77run_O := $(filter-out make_python_perf_so_O,$(run_O))
78
79# define test for each compile as 'test_NAME' variable
80# with the test itself as a value
81test_make_tags = test -f tags
82test_make_cscope = test -f cscope.out
83
84test_make_tags_O := $(test_make_tags)
85test_make_cscope_O := $(test_make_cscope)
86
87test_ok := true
88test_make_help := $(test_ok)
89test_make_doc := $(test_ok)
90test_make_help_O := $(test_ok)
91test_make_doc_O := $(test_ok)
92
93test_make_python_perf_so := test -f $(PERF)/python/perf.so
94
95test_make_perf_o := test -f $(PERF)/perf.o
96test_make_util_map_o := test -f $(PERF)/util/map.o
97
c0ec1108
JO
98test_make_install := test -x $$TMP_DEST/bin/perf
99test_make_install_O := $(test_make_install)
100test_make_install_bin := $(test_make_install)
101test_make_install_bin_O := $(test_make_install)
102
095ae69b
JO
103# Kbuild tests only
104#test_make_python_perf_so_O := test -f $$TMP/tools/perf/python/perf.so
105#test_make_perf_o_O := test -f $$TMP/tools/perf/perf.o
106#test_make_util_map_o_O := test -f $$TMP/tools/perf/util/map.o
107
108test_make_perf_o_O := true
109test_make_util_map_o_O := true
110
111test_default = test -x $(PERF)/perf
112test = $(if $(test_$1),$(test_$1),$(test_default))
113
8ba7cdea 114test_default_O = test -x $$TMP_O/perf
095ae69b
JO
115test_O = $(if $(test_$1),$(test_$1),$(test_default_O))
116
117all:
118
119ifdef DEBUG
120d := $(info run $(run))
121d := $(info run_O $(run_O))
122endif
123
124MAKEFLAGS := --no-print-directory
125
126clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
127
128$(run):
129 $(call clean)
c9311674
JO
130 @TMP_DEST=$$(mktemp -d); \
131 cmd="cd $(PERF) && make -f $(MK) DESTDIR=$$TMP_DEST $($@)"; \
095ae69b
JO
132 echo "- $@: $$cmd" && echo $$cmd > $@ && \
133 ( eval $$cmd ) >> $@ 2>&1; \
134 echo " test: $(call test,$@)"; \
135 $(call test,$@) && \
c9311674
JO
136 rm -f $@ \
137 rm -rf $$TMP_DEST
095ae69b
JO
138
139$(run_O):
140 $(call clean)
8ba7cdea 141 @TMP_O=$$(mktemp -d); \
c9311674
JO
142 TMP_DEST=$$(mktemp -d); \
143 cmd="cd $(PERF) && make -f $(MK) O=$$TMP_O DESTDIR=$$TMP_DEST $($(patsubst %_O,%,$@))"; \
095ae69b
JO
144 echo "- $@: $$cmd" && echo $$cmd > $@ && \
145 ( eval $$cmd ) >> $@ 2>&1 && \
146 echo " test: $(call test_O,$@)"; \
147 $(call test_O,$@) && \
148 rm -f $@ && \
c9311674
JO
149 rm -rf $$TMP_O \
150 rm -rf $$TMP_DEST
095ae69b
JO
151
152all: $(run) $(run_O)
153 @echo OK
154
155out: $(run_O)
156 @echo OK
157
158.PHONY: all $(run) $(run_O) clean