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

perf tests: Move x86 tests into arch directory

Move out the x86-specific tests into tools/perf/arch/x86/tests and
define an 'arch_tests' array, which is the list of tests that only apply
to the build architecture.

We can also now begin to get rid of some of the #ifdef code that is
present in the generic perf tests.

Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kanaka Juvva <kanaka.d.juvva@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Vikas Shivappa <vikas.shivappa@intel.com>
Cc: Vince Weaver <vince@deater.net>
Link: http://lkml.kernel.org/n/tip-9s68h4ptg06ah0lgnjz55mqn@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Matt Fleming and committed by
Arnaldo Carvalho de Melo
d8b167f9 31b6753f

+48 -45
+12
tools/perf/arch/x86/include/arch-tests.h
··· 1 1 #ifndef ARCH_TESTS_H 2 2 #define ARCH_TESTS_H 3 3 4 + /* Tests */ 5 + int test__rdpmc(void); 6 + int test__perf_time_to_tsc(void); 7 + int test__insn_x86(void); 8 + 9 + #ifdef HAVE_DWARF_UNWIND_SUPPORT 10 + struct thread; 11 + struct perf_sample; 12 + int test__arch_unwind_sample(struct perf_sample *sample, 13 + struct thread *thread); 14 + #endif 15 + 4 16 extern struct test arch_tests[]; 5 17 6 18 #endif
+3
tools/perf/arch/x86/tests/Build
··· 2 2 libperf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o 3 3 4 4 libperf-y += arch-tests.o 5 + libperf-y += rdpmc.o 6 + libperf-y += perf-time-to-tsc.o 7 + libperf-$(CONFIG_AUXTRACE) += insn-x86.o
+20
tools/perf/arch/x86/tests/arch-tests.c
··· 4 4 5 5 struct test arch_tests[] = { 6 6 { 7 + .desc = "x86 rdpmc test", 8 + .func = test__rdpmc, 9 + }, 10 + { 11 + .desc = "Test converting perf time to TSC", 12 + .func = test__perf_time_to_tsc, 13 + }, 14 + #ifdef HAVE_DWARF_UNWIND_SUPPORT 15 + { 16 + .desc = "Test dwarf unwind", 17 + .func = test__dwarf_unwind, 18 + }, 19 + #endif 20 + #ifdef HAVE_AUXTRACE_SUPPORT 21 + { 22 + .desc = "Test x86 instruction decoder - new instructions", 23 + .func = test__insn_x86, 24 + }, 25 + #endif 26 + { 7 27 .func = NULL, 8 28 }, 9 29
+1
tools/perf/arch/x86/tests/dwarf-unwind.c
··· 5 5 #include "event.h" 6 6 #include "debug.h" 7 7 #include "tests/tests.h" 8 + #include "arch-tests.h" 8 9 9 10 #define STACK_SIZE 8192 10 11
-6
tools/perf/tests/Build
··· 8 8 perf-y += openat-syscall-tp-fields.o 9 9 perf-y += mmap-basic.o 10 10 perf-y += perf-record.o 11 - perf-y += rdpmc.o 12 11 perf-y += evsel-roundtrip-name.o 13 12 perf-y += evsel-tp-sched.o 14 13 perf-y += fdarray.o ··· 33 34 perf-y += thread-map.o 34 35 perf-y += llvm.o 35 36 perf-y += topology.o 36 - 37 - perf-$(CONFIG_X86) += perf-time-to-tsc.o 38 - ifdef CONFIG_AUXTRACE 39 - perf-$(CONFIG_X86) += insn-x86.o 40 - endif 41 37 42 38 ifeq ($(ARCH),$(filter $(ARCH),x86 arm arm64)) 43 39 perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
-28
tools/perf/tests/builtin-test.c
··· 41 41 .desc = "parse events tests", 42 42 .func = test__parse_events, 43 43 }, 44 - #if defined(__x86_64__) || defined(__i386__) 45 - { 46 - .desc = "x86 rdpmc test", 47 - .func = test__rdpmc, 48 - }, 49 - #endif 50 44 { 51 45 .desc = "Validate PERF_RECORD_* events & perf_sample fields", 52 46 .func = test__PERF_RECORD, ··· 101 107 .desc = "Test software clock events have valid period values", 102 108 .func = test__sw_clock_freq, 103 109 }, 104 - #if defined(__x86_64__) || defined(__i386__) 105 - { 106 - .desc = "Test converting perf time to TSC", 107 - .func = test__perf_time_to_tsc, 108 - }, 109 - #endif 110 110 { 111 111 .desc = "Test object code reading", 112 112 .func = test__code_reading, ··· 117 129 .desc = "Test parsing with no sample_id_all bit set", 118 130 .func = test__parse_no_sample_id_all, 119 131 }, 120 - #if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__) 121 - #ifdef HAVE_DWARF_UNWIND_SUPPORT 122 - { 123 - .desc = "Test dwarf unwind", 124 - .func = test__dwarf_unwind, 125 - }, 126 - #endif 127 - #endif 128 132 { 129 133 .desc = "Test filtering hist entries", 130 134 .func = test__hists_filter, ··· 161 181 .desc = "Test LLVM searching and compiling", 162 182 .func = test__llvm, 163 183 }, 164 - #ifdef HAVE_AUXTRACE_SUPPORT 165 - #if defined(__x86_64__) || defined(__i386__) 166 - { 167 - .desc = "Test x86 instruction decoder - new instructions", 168 - .func = test__insn_x86, 169 - }, 170 - #endif 171 - #endif 172 184 { 173 185 .desc = "Test topology in session", 174 186 .func = test_session_topology,
+4
tools/perf/tests/dwarf-unwind.c
··· 11 11 #include "thread.h" 12 12 #include "callchain.h" 13 13 14 + #if defined (__x86_64__) || defined (__i386__) 15 + #include "arch-tests.h" 16 + #endif 17 + 14 18 /* For bsearch. We try to unwind functions in shared object. */ 15 19 #include <stdlib.h> 16 20
tools/perf/tests/gen-insn-x86-dat.awk tools/perf/arch/x86/tests/gen-insn-x86-dat.awk
tools/perf/tests/gen-insn-x86-dat.sh tools/perf/arch/x86/tests/gen-insn-x86-dat.sh
tools/perf/tests/insn-x86-dat-32.c tools/perf/arch/x86/tests/insn-x86-dat-32.c
tools/perf/tests/insn-x86-dat-64.c tools/perf/arch/x86/tests/insn-x86-dat-64.c
tools/perf/tests/insn-x86-dat-src.c tools/perf/arch/x86/tests/insn-x86-dat-src.c
+2 -1
tools/perf/tests/insn-x86.c tools/perf/arch/x86/tests/insn-x86.c
··· 1 1 #include <linux/types.h> 2 2 3 3 #include "debug.h" 4 - #include "tests.h" 4 + #include "tests/tests.h" 5 + #include "arch-tests.h" 5 6 6 7 #include "intel-pt-decoder/insn.h" 7 8 #include "intel-pt-decoder/intel-pt-insn-decoder.h"
+3 -1
tools/perf/tests/perf-time-to-tsc.c tools/perf/arch/x86/tests/perf-time-to-tsc.c
··· 9 9 #include "thread_map.h" 10 10 #include "cpumap.h" 11 11 #include "tsc.h" 12 - #include "tests.h" 12 + #include "tests/tests.h" 13 + 14 + #include "arch-tests.h" 13 15 14 16 #define CHECK__(x) { \ 15 17 while ((x) < 0) { \
+2 -5
tools/perf/tests/rdpmc.c tools/perf/arch/x86/tests/rdpmc.c
··· 5 5 #include <linux/types.h> 6 6 #include "perf.h" 7 7 #include "debug.h" 8 - #include "tests.h" 8 + #include "tests/tests.h" 9 9 #include "cloexec.h" 10 - 11 - #if defined(__x86_64__) || defined(__i386__) 10 + #include "arch-tests.h" 12 11 13 12 static u64 rdpmc(unsigned int counter) 14 13 { ··· 172 173 173 174 return 0; 174 175 } 175 - 176 - #endif
+1 -4
tools/perf/tests/tests.h
··· 35 35 int test__openat_syscall_event_on_all_cpus(void); 36 36 int test__basic_mmap(void); 37 37 int test__PERF_RECORD(void); 38 - int test__rdpmc(void); 39 38 int test__perf_evsel__roundtrip_name_test(void); 40 39 int test__perf_evsel__tp_sched_test(void); 41 40 int test__syscall_openat_tp_fields(void); ··· 50 51 int test__bp_signal_overflow(void); 51 52 int test__task_exit(void); 52 53 int test__sw_clock_freq(void); 53 - int test__perf_time_to_tsc(void); 54 54 int test__code_reading(void); 55 55 int test__sample_parsing(void); 56 56 int test__keep_tracking(void); ··· 66 68 int test__kmod_path__parse(void); 67 69 int test__thread_map(void); 68 70 int test__llvm(void); 69 - int test__insn_x86(void); 70 71 int test_session_topology(void); 71 72 72 - #if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__) 73 + #if defined(__arm__) || defined(__aarch64__) 73 74 #ifdef HAVE_DWARF_UNWIND_SUPPORT 74 75 struct thread; 75 76 struct perf_sample;