Skip to content

Commit d436373

Browse files
ahunter6acmel
authored andcommitted
perf tests: Make x86 new instructions test optional at build time
The "x86 instruction decoder - new instructions" test takes up space but is only really useful to developers. Make it optional at build time. Add variable EXTRA_TESTS which must be defined in order to build perf with the test. Example: Before: $ make -C tools/perf clean >/dev/null $ make -C tools/perf >/dev/null Makefile.config:650: No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR Makefile.config:1149: libpfm4 not found, disables libpfm4 support. Please install libpfm4-dev PERF_VERSION = 6.4.rc3.gd15b8c76c964 $ readelf -SW tools/perf/perf | grep '\.rela.dyn\|.rodata\|\.data.rel.ro' [10] .rela.dyn RELA 000000000002fcb0 02fcb0 0748b0 18 A 6 0 8 [18] .rodata PROGBITS 00000000002eb000 2eb000 6bac00 00 A 0 0 32 [25] .data.rel.ro PROGBITS 00000000009ea180 9e9180 04b540 00 WA 0 0 32 After: $ make -C tools/perf clean >/dev/null $ make -C tools/perf >/dev/null Makefile.config:650: No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR Makefile.config:1154: libpfm4 not found, disables libpfm4 support. Please install libpfm4-dev PERF_VERSION = 6.4.rc3.g4ea9c1569ea4 $ readelf -SW tools/perf/perf | grep '\.rela.dyn\|.rodata\|\.data.rel.ro' [10] .rela.dyn RELA 000000000002f3c8 02f3c8 036d68 18 A 6 0 8 [18] .rodata PROGBITS 00000000002ac000 2ac000 68da80 00 A 0 0 32 [25] .data.rel.ro PROGBITS 000000000097d440 97c440 022280 00 WA 0 0 32 Committer notes: Build with 'make EXTRA_TESTS=1 -C tools/perf O=/tmp/build/perf" and reproduced the ELF section size differences. Signed-off-by: Adrian Hunter <[email protected]> Acked-by: Ian Rogers <[email protected]> Tested-by: Arnaldo Carvalho de Melo <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 7f91190 commit d436373

File tree

6 files changed

+20
-1
lines changed

6 files changed

+20
-1
lines changed

tools/perf/Makefile.config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,11 @@ ifndef NO_AUXTRACE
10751075
endif
10761076
endif
10771077

1078+
ifdef EXTRA_TESTS
1079+
$(call detected,CONFIG_EXTRA_TESTS)
1080+
CFLAGS += -DHAVE_EXTRA_TESTS
1081+
endif
1082+
10781083
ifndef NO_JVMTI
10791084
ifneq (,$(wildcard /usr/sbin/update-java-alternatives))
10801085
JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | awk '{print $$3}')

tools/perf/Makefile.perf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ include ../scripts/utilities.mak
128128
#
129129
# Define BUILD_NONDISTRO to enable building an linking against libbfd and
130130
# libiberty distribution license incompatible libraries.
131+
#
132+
# Define EXTRA_TESTS to enable building extra tests useful mainly to perf
133+
# developers, such as:
134+
# x86 instruction decoder - new instructions test
131135

132136
# As per kernel Makefile, avoid funny character set dependencies
133137
unexport LC_ALL

tools/perf/arch/x86/include/arch-tests.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ struct test_suite;
66

77
/* Tests */
88
int test__rdpmc(struct test_suite *test, int subtest);
9+
#ifdef HAVE_EXTRA_TESTS
910
int test__insn_x86(struct test_suite *test, int subtest);
11+
#endif
1012
int test__intel_pt_pkt_decoder(struct test_suite *test, int subtest);
1113
int test__intel_pt_hybrid_compat(struct test_suite *test, int subtest);
1214
int test__bp_modify(struct test_suite *test, int subtest);

tools/perf/arch/x86/tests/Build

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@ perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
44
perf-y += arch-tests.o
55
perf-y += sample-parsing.o
66
perf-y += hybrid.o
7-
perf-$(CONFIG_AUXTRACE) += insn-x86.o intel-pt-test.o
7+
perf-$(CONFIG_AUXTRACE) += intel-pt-test.o
8+
ifeq ($(CONFIG_EXTRA_TESTS),y)
9+
perf-$(CONFIG_AUXTRACE) += insn-x86.o
10+
endif
811
perf-$(CONFIG_X86_64) += bp-modify.o

tools/perf/arch/x86/tests/arch-tests.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
#include "arch-tests.h"
55

66
#ifdef HAVE_AUXTRACE_SUPPORT
7+
#ifdef HAVE_EXTRA_TESTS
78
DEFINE_SUITE("x86 instruction decoder - new instructions", insn_x86);
9+
#endif
810

911
static struct test_case intel_pt_tests[] = {
1012
TEST_CASE("Intel PT packet decoder", intel_pt_pkt_decoder),
@@ -37,7 +39,9 @@ struct test_suite *arch_tests[] = {
3739
&suite__dwarf_unwind,
3840
#endif
3941
#ifdef HAVE_AUXTRACE_SUPPORT
42+
#ifdef HAVE_EXTRA_TESTS
4043
&suite__insn_x86,
44+
#endif
4145
&suite__intel_pt,
4246
#endif
4347
#if defined(__x86_64__)

tools/perf/tests/make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ make_clean_all := clean all
6969
make_python_perf_so := $(python_perf_so)
7070
make_debug := DEBUG=1
7171
make_nondistro := BUILD_NONDISTRO=1
72+
make_extra_tests := EXTRA_TESTS=1
7273
make_no_libperl := NO_LIBPERL=1
7374
make_no_libpython := NO_LIBPYTHON=1
7475
make_no_scripts := NO_LIBPYTHON=1 NO_LIBPERL=1

0 commit comments

Comments
 (0)