Start aligning perf test with kunit style
Subsystems (2)
Ian Rogers
reviewercover Start aligning perf test with kunit style
Perf test uses its own structs and code layout that differs from kunit that was more recently introduced to the kernel. Besides consistency, it is hoped that moving in the direction of kunit style will enable reuse of infrastructure like test output formatting for continuous testing systems. For example:
https://lore.kernel.org/linux-kselftest/CA+GJov6tdjvY9x12JsJT14qn6c7NViJxqaJk+r-K1YJzPggFDQ@mail.gmail.com/
The motivation for this restructuring comes from wanting to be able to tag tests with a size:
https://lore.kernel.org/linux-perf-users/CAP-5=fWmGyuqFKc-EMP3rbmTkjZ3MS+YSajGZfeRMc38HS82gw@mail.gmail.com/
To have more exhaustive and slower running tests. This isn't something kunit currently supports, nor is the execution of python and shell tests, but it seems sensible to work on an approach with kunit rather to invent a new wheel inside of perf.
These initial patches are just refactoring the main test suite definitions to be in a more kunit style. Kunit isn't depended upon, it is hoped that this can be done in later patches for the sake of consistency.
v1. Built/tested on x86.
Ian Rogers (5):
perf test: Use macro for "suite" declarations perf test: Use macro for "suite" definitions perf test: Make each test/suite its own struct. perf test: Move each test suite struct to its test perf test: Rename struct test to test_suite
tools/perf/arch/arm/include/arch-tests.h | 2 +- tools/perf/arch/arm/tests/arch-tests.c | 21 +- tools/perf/arch/arm/tests/vectors-page.c | 2 +- tools/perf/arch/arm64/include/arch-tests.h | 2 +- tools/perf/arch/arm64/tests/arch-tests.c | 15 +- tools/perf/arch/powerpc/include/arch-tests.h | 2 +- tools/perf/arch/powerpc/tests/arch-tests.c | 15 +- tools/perf/arch/x86/include/arch-tests.h | 14 +- tools/perf/arch/x86/tests/arch-tests.c | 47 +- tools/perf/arch/x86/tests/bp-modify.c | 2 +- tools/perf/arch/x86/tests/insn-x86.c | 2 +- tools/perf/arch/x86/tests/intel-cqm.c | 2 +- .../x86/tests/intel-pt-pkt-decoder-test.c | 2 +- tools/perf/arch/x86/tests/rdpmc.c | 2 +- tools/perf/arch/x86/tests/sample-parsing.c | 2 +- tools/perf/tests/api-io.c | 6 +- tools/perf/tests/attr.c | 4 +- tools/perf/tests/backward-ring-buffer.c | 4 +- tools/perf/tests/bitmap.c | 4 +- tools/perf/tests/bp_account.c | 10 +- tools/perf/tests/bp_signal.c | 8 +- tools/perf/tests/bp_signal_overflow.c | 8 +- tools/perf/tests/bpf.c | 22 +- tools/perf/tests/builtin-test.c | 441 ++++-------------- tools/perf/tests/clang.c | 18 +- tools/perf/tests/code-reading.c | 4 +- tools/perf/tests/cpumap.c | 10 +- tools/perf/tests/demangle-java-test.c | 4 +- tools/perf/tests/demangle-ocaml-test.c | 4 +- tools/perf/tests/dlfilter-test.c | 4 +- tools/perf/tests/dso-data.c | 10 +- tools/perf/tests/dwarf-unwind.c | 2 +- tools/perf/tests/event-times.c | 4 +- tools/perf/tests/event_update.c | 4 +- tools/perf/tests/evsel-roundtrip-name.c | 4 +- tools/perf/tests/evsel-tp-sched.c | 4 +- tools/perf/tests/expand-cgroup.c | 6 +- tools/perf/tests/expr.c | 4 +- tools/perf/tests/fdarray.c | 7 +- tools/perf/tests/genelf.c | 6 +- tools/perf/tests/hists_cumulate.c | 4 +- tools/perf/tests/hists_filter.c | 4 +- tools/perf/tests/hists_link.c | 4 +- tools/perf/tests/hists_output.c | 4 +- tools/perf/tests/is_printable_array.c | 4 +- tools/perf/tests/keep-tracking.c | 4 +- tools/perf/tests/kmod-path.c | 4 +- tools/perf/tests/llvm.c | 22 +- tools/perf/tests/maps.c | 4 +- tools/perf/tests/mem.c | 4 +- tools/perf/tests/mem2node.c | 4 +- tools/perf/tests/mmap-basic.c | 4 +- tools/perf/tests/mmap-thread-lookup.c | 4 +- tools/perf/tests/openat-syscall-all-cpus.c | 5 +- tools/perf/tests/openat-syscall-tp-fields.c | 4 +- tools/perf/tests/openat-syscall.c | 5 +- tools/perf/tests/parse-events.c | 4 +- tools/perf/tests/parse-metric.c | 4 +- tools/perf/tests/parse-no-sample-id-all.c | 4 +- tools/perf/tests/pe-file-parsing.c | 6 +- tools/perf/tests/perf-hooks.c | 4 +- tools/perf/tests/perf-record.c | 4 +- tools/perf/tests/perf-time-to-tsc.c | 10 +- tools/perf/tests/pfm.c | 16 +- tools/perf/tests/pmu-events.c | 19 +- tools/perf/tests/pmu.c | 4 +- tools/perf/tests/python-use.c | 4 +- tools/perf/tests/sample-parsing.c | 4 +- tools/perf/tests/sdt.c | 6 +- tools/perf/tests/stat.c | 10 +- tools/perf/tests/sw-clock.c | 4 +- tools/perf/tests/switch-tracking.c | 4 +- tools/perf/tests/task-exit.c | 4 +- tools/perf/tests/tests.h | 179 ++++--- tools/perf/tests/thread-map.c | 10 +- tools/perf/tests/thread-maps-share.c | 4 +- tools/perf/tests/time-utils-test.c | 4 +- tools/perf/tests/topology.c | 4 +- tools/perf/tests/unit_number__scnprintf.c | 4 +- tools/perf/tests/vmlinux-kallsyms.c | 5 +- tools/perf/tests/wp.c | 22 +- 81 files changed, 543 insertions(+), 618 deletions(-)
Signature · 1 line
2.33.0.464.g1972c5931b-goog
Ian Rogers
reviewerRFC PATCH 1/5 perf test: Use macro for "suite" declarations
Currently tests are setup in builtin-test with function pointers. Kunit exposes tests as a kunit_suite with a null terminated array of test cases. Use a macro to aid transition from one to the other in later changes.
--- tools/perf/tests/tests.h | 151 ++++++++++++++++++++------------------- 1 file changed, 77 insertions(+), 74 deletions(-)
tools/perf/tests/tests.h +77 -74
@@ -40,94 +40,97 @@ struct test {void *priv; }; +#define DECLARE_SUITE (name) \ + int test__##name(struct test *test, int subtest) +/* Tests */ -int test__vmlinux_matches_kallsyms (struct test *test,int subtest); -int test__openat_syscall_event (struct test *test,int subtest); -int test__openat_syscall_event_on_all_cpus (struct test *test,int subtest); -int test__basic_mmap (struct test *test,int subtest); -int test__PERF_RECORD (struct test *test,int subtest); -int test__perf_evsel__roundtrip_name_test (struct test *test,int subtest); -int test__perf_evsel__tp_sched_test (struct test *test,int subtest); -int test__syscall_openat_tp_fields (struct test *test,int subtest); -int test__pmu (struct test *test,int subtest); -int test__pmu_events (struct test *test,int subtest); +DECLARE_SUITE (vmlinux_matches_kallsyms); +DECLARE_SUITE (openat_syscall_event); +DECLARE_SUITE (openat_syscall_event_on_all_cpus); +DECLARE_SUITE (basic_mmap); +DECLARE_SUITE (PERF_RECORD ); +DECLARE_SUITE (perf_evsel__roundtrip_name_test); +DECLARE_SUITE (perf_evsel__tp_sched_test); +DECLARE_SUITE (syscall_openat_tp_fields); +DECLARE_SUITE (pmu); +DECLARE_SUITE (pmu_events);const char *test__pmu_events_subtest_get_desc (int subtest);const char *test__pmu_events_subtest_skip_reason (int subtest);int test__pmu_events_subtest_get_nr (void ); -int test__attr (struct test *test,int subtest); -int test__dso_data (struct test *test,int subtest); -int test__dso_data_cache (struct test *test,int subtest); -int test__dso_data_reopen (struct test *test,int subtest); -int test__parse_events (struct test *test,int subtest); -int test__hists_link (struct test *test,int subtest); -int test__python_use (struct test *test,int subtest); -int test__bp_signal (struct test *test,int subtest); -int test__bp_signal_overflow (struct test *test,int subtest); -int test__bp_accounting (struct test *test,int subtest); -int test__wp (struct test *test,int subtest); +DECLARE_SUITE (attr); +DECLARE_SUITE (dso_data); +DECLARE_SUITE (dso_data_cache); +DECLARE_SUITE (dso_data_reopen); +DECLARE_SUITE (parse_events); +DECLARE_SUITE (hists_link); +DECLARE_SUITE (python_use); +DECLARE_SUITE (bp_signal); +DECLARE_SUITE (bp_signal_overflow); +DECLARE_SUITE (bp_accounting); +DECLARE_SUITE (wp);const char *test__wp_subtest_get_desc (int subtest);const char *test__wp_subtest_skip_reason (int subtest);int test__wp_subtest_get_nr (void ); -int test__task_exit (struct test *test,int subtest); -int test__mem (struct test *test,int subtest); -int test__sw_clock_freq (struct test *test,int subtest); -int test__code_reading (struct test *test,int subtest); -int test__sample_parsing (struct test *test,int subtest); -int test__keep_tracking (struct test *test,int subtest); -int test__parse_no_sample_id_all (struct test *test,int subtest); -int test__dwarf_unwind (struct test *test,int subtest); -int test__expr (struct test *test,int subtest); -int test__hists_filter (struct test *test,int subtest); -int test__mmap_thread_lookup (struct test *test,int subtest); -int test__thread_maps_share (struct test *test,int subtest); -int test__hists_output (struct test *test,int subtest); -int test__hists_cumulate (struct test *test,int subtest); -int test__switch_tracking (struct test *test,int subtest); -int test__fdarray__filter (struct test *test,int subtest); -int test__fdarray__add (struct test *test,int subtest); -int test__kmod_path__parse (struct test *test,int subtest); -int test__thread_map (struct test *test,int subtest); -int test__llvm (struct test *test,int subtest); +DECLARE_SUITE (task_exit); +DECLARE_SUITE (mem); +DECLARE_SUITE (sw_clock_freq); +DECLARE_SUITE (code_reading); +DECLARE_SUITE (sample_parsing); +DECLARE_SUITE (keep_tracking); +DECLARE_SUITE (parse_no_sample_id_all); +DECLARE_SUITE (dwarf_unwind); +DECLARE_SUITE (expr); +DECLARE_SUITE (hists_filter); +DECLARE_SUITE (mmap_thread_lookup); +DECLARE_SUITE (thread_maps_share); +DECLARE_SUITE (hists_output); +DECLARE_SUITE (hists_cumulate); +DECLARE_SUITE (switch_tracking); +DECLARE_SUITE (fdarray__filter); +DECLARE_SUITE (fdarray__add); +DECLARE_SUITE (kmod_path__parse); +DECLARE_SUITE (thread_map); +DECLARE_SUITE (llvm);const char *test__llvm_subtest_get_desc (int subtest);int test__llvm_subtest_get_nr (void ); -int test__bpf (struct test *test,int subtest); +DECLARE_SUITE (bpf);const char *test__bpf_subtest_get_desc (int subtest);int test__bpf_subtest_get_nr (void ); -int test__session_topology (struct test *test,int subtest); -int test__thread_map_synthesize (struct test *test,int subtest); -int test__thread_map_remove (struct test *test,int subtest); -int test__cpu_map_synthesize (struct test *test,int subtest); -int test__synthesize_stat_config (struct test *test,int subtest); -int test__synthesize_stat (struct test *test,int subtest); -int test__synthesize_stat_round (struct test *test,int subtest); -int test__event_update (struct test *test,int subtest); -int test__event_times (struct test *test,int subtest); -int test__backward_ring_buffer (struct test *test,int subtest); -int test__cpu_map_print (struct test *test,int subtest); -int test__cpu_map_merge (struct test *test,int subtest); -int test__sdt_event (struct test *test,int subtest); -int test__is_printable_array (struct test *test,int subtest); -int test__bitmap_print (struct test *test,int subtest); -int test__perf_hooks (struct test *test,int subtest); -int test__clang (struct test *test,int subtest); +DECLARE_SUITE (session_topology); +DECLARE_SUITE (thread_map_synthesize); +DECLARE_SUITE (thread_map_remove); +DECLARE_SUITE (cpu_map_synthesize); +DECLARE_SUITE (synthesize_stat_config); +DECLARE_SUITE (synthesize_stat); +DECLARE_SUITE (synthesize_stat_round); +DECLARE_SUITE (event_update); +DECLARE_SUITE (event_times); +DECLARE_SUITE (backward_ring_buffer); +DECLARE_SUITE (cpu_map_print); +DECLARE_SUITE (cpu_map_merge); +DECLARE_SUITE (sdt_event); +DECLARE_SUITE (is_printable_array); +DECLARE_SUITE (bitmap_print); +DECLARE_SUITE (perf_hooks); +DECLARE_SUITE (clang);const char *test__clang_subtest_get_desc (int subtest);int test__clang_subtest_get_nr (void ); -int test__unit_number__scnprint (struct test *test,int subtest); -int test__mem2node (struct test *t,int subtest); -int test__maps__merge_in (struct test *t,int subtest); -int test__time_utils (struct test *t,int subtest); -int test__jit_write_elf (struct test *test,int subtest); -int test__api_io (struct test *test,int subtest); -int test__demangle_java (struct test *test,int subtest); -int test__demangle_ocaml (struct test *test,int subtest); -int test__pfm (struct test *test,int subtest); +DECLARE_SUITE (unit_number__scnprint); +DECLARE_SUITE (mem2node); +DECLARE_SUITE (maps__merge_in); +DECLARE_SUITE (time_utils); +DECLARE_SUITE (jit_write_elf); +DECLARE_SUITE (api_io); +DECLARE_SUITE (demangle_java); +DECLARE_SUITE (demangle_ocaml); +DECLARE_SUITE (pfm);const char *test__pfm_subtest_get_desc (int subtest);int test__pfm_subtest_get_nr (void ); -int test__parse_metric (struct test *test,int subtest); -int test__pe_file_parsing (struct test *test,int subtest); -int test__expand_cgroup_events (struct test *test,int subtest); -int test__perf_time_to_tsc (struct test *test,int subtest); -int test__dlfilter (struct test *test,int subtest); +DECLARE_SUITE (parse_metric); +DECLARE_SUITE (pe_file_parsing); +DECLARE_SUITE (expand_cgroup_events); +DECLARE_SUITE (perf_time_to_tsc); +DECLARE_SUITE (dlfilter);bool test__bp_signal_is_supported (void );bool test__bp_account_is_supported (void );
@@ -142,7 +145,7 @@ int test__arch_unwind_sample(struct perf_sample *sample,#endif #if defined(__arm__) -int test__vectors_page (struct test *test,int subtest); +DECLARE_SUITE (vectors_page);#endif #endif /* TESTS_H */
Signature · 1 line
2.33.0.464.g1972c5931b-goog
Ian Rogers
reviewerRFC PATCH 2/5 perf test: Use macro for "suite" definitions
In reply to Ian RogersAdd a macro to simplify later refactoring. No functional change.
--- tools/perf/tests/builtin-test.c | 479 ++++++++++---------------------- 1 file changed, 149 insertions(+), 330 deletions(-)
tools/perf/tests/builtin-test.c +149 -330
@@ -36,337 +36,156 @@ struct test __weak arch_tests[] = { }, }; -static struct test generic_tests[] = { - { - .desc ="vmlinux symtab matches kallsyms" , - .func = test__vmlinux_matches_kallsyms, - }, - { - .desc ="Detect openat syscall event" , - .func = test__openat_syscall_event, - }, - { - .desc ="Detect openat syscall event on all cpus" , - .func = test__openat_syscall_event_on_all_cpus, - }, - { - .desc ="Read samples using the mmap interface" , - .func = test__basic_mmap, - }, - { - .desc ="Test data source output" , - .func = test__mem, - }, - { - .desc ="Parse event definition strings" , - .func = test__parse_events, - }, - { - .desc ="Simple expression parser" , - .func = test__expr, - }, - { - .desc ="PERF_RECORD_* events & perf_sample fields" , - .func = test__PERF_RECORD, - }, - { - .desc ="Parse perf pmu format" , - .func = test__pmu, - }, - { - .desc ="PMU events" , - .func = test__pmu_events, - .subtest = { - .skip_if_fail = false, - .get_nr = test__pmu_events_subtest_get_nr, - .get_desc = test__pmu_events_subtest_get_desc, - .skip_reason = test__pmu_events_subtest_skip_reason, - }, - - }, - { - .desc ="DSO data read" , - .func = test__dso_data, - }, - { - .desc ="DSO data cache" , - .func = test__dso_data_cache, - }, - { - .desc ="DSO data reopen" , - .func = test__dso_data_reopen, - }, - { - .desc ="Roundtrip evsel->name" , - .func = test__perf_evsel__roundtrip_name_test, - }, - { - .desc ="Parse sched tracepoints fields" , - .func = test__perf_evsel__tp_sched_test, - }, - { - .desc ="syscalls:sys_enter_openat event fields" , - .func = test__syscall_openat_tp_fields, - }, - { - .desc ="Setup struct perf_event_attr" , - .func = test__attr, - }, - { - .desc ="Match and link multiple hists" , - .func = test__hists_link, - }, - { - .desc ="'import perf' in python" , - .func = test__python_use, - }, - { - .desc ="Breakpoint overflow signal handler" , - .func = test__bp_signal, - .is_supported = test__bp_signal_is_supported, - }, - { - .desc ="Breakpoint overflow sampling" , - .func = test__bp_signal_overflow, - .is_supported = test__bp_signal_is_supported, - }, - { - .desc ="Breakpoint accounting" , - .func = test__bp_accounting, - .is_supported = test__bp_account_is_supported, - }, - { - .desc ="Watchpoint" , - .func = test__wp, - .is_supported = test__wp_is_supported, - .subtest = { - .skip_if_fail = false, - .get_nr = test__wp_subtest_get_nr, - .get_desc = test__wp_subtest_get_desc, - .skip_reason = test__wp_subtest_skip_reason, - }, - }, - { - .desc ="Number of exit events of a simple workload" , - .func = test__task_exit, - }, - { - .desc ="Software clock events period values" , - .func = test__sw_clock_freq, - }, - { - .desc ="Object code reading" , - .func = test__code_reading, - }, - { - .desc ="Sample parsing" , - .func = test__sample_parsing, - }, - { - .desc ="Use a dummy software event to keep tracking" , - .func = test__keep_tracking, - }, - { - .desc ="Parse with no sample_id_all bit set" , - .func = test__parse_no_sample_id_all, - }, - { - .desc ="Filter hist entries" , - .func = test__hists_filter, - }, - { - .desc ="Lookup mmap thread" , - .func = test__mmap_thread_lookup, - }, - { - .desc ="Share thread maps" , - .func = test__thread_maps_share, - }, - { - .desc ="Sort output of hist entries" , - .func = test__hists_output, - }, - { - .desc ="Cumulate child hist entries" , - .func = test__hists_cumulate, - }, - { - .desc ="Track with sched_switch" , - .func = test__switch_tracking, - }, - { - .desc ="Filter fds with revents mask in a fdarray" , - .func = test__fdarray__filter, - }, - { - .desc ="Add fd to a fdarray, making it autogrow" , - .func = test__fdarray__add, - }, - { - .desc ="kmod_path__parse" , - .func = test__kmod_path__parse, - }, - { - .desc ="Thread map" , - .func = test__thread_map, - }, - { - .desc ="LLVM search and compile" , - .func = test__llvm, - .subtest = { - .skip_if_fail = true, - .get_nr = test__llvm_subtest_get_nr, - .get_desc = test__llvm_subtest_get_desc, - }, - }, - { - .desc ="Session topology" , - .func = test__session_topology, - }, - { - .desc ="BPF filter" , - .func = test__bpf, - .subtest = { - .skip_if_fail = true, - .get_nr = test__bpf_subtest_get_nr, - .get_desc = test__bpf_subtest_get_desc, - }, - }, - { - .desc ="Synthesize thread map" , - .func = test__thread_map_synthesize, - }, - { - .desc ="Remove thread map" , - .func = test__thread_map_remove, - }, - { - .desc ="Synthesize cpu map" , - .func = test__cpu_map_synthesize, - }, - { - .desc ="Synthesize stat config" , - .func = test__synthesize_stat_config, - }, - { - .desc ="Synthesize stat" , - .func = test__synthesize_stat, - }, - { - .desc ="Synthesize stat round" , - .func = test__synthesize_stat_round, - }, - { - .desc ="Synthesize attr update" , - .func = test__event_update, - }, - { - .desc ="Event times" , - .func = test__event_times, - }, - { - .desc ="Read backward ring buffer" , - .func = test__backward_ring_buffer, - }, - { - .desc ="Print cpu map" , - .func = test__cpu_map_print, - }, - { - .desc ="Merge cpu map" , - .func = test__cpu_map_merge, - }, +#define DEFINE_SUITE (description, name) \ + { \ + .desc = description, \ + .func = test__##name, \ + } - { - .desc ="Probe SDT events" , - .func = test__sdt_event, - }, - { - .desc ="is_printable_array" , - .func = test__is_printable_array, - }, - { - .desc ="Print bitmap" , - .func = test__bitmap_print, - }, - { - .desc ="perf hooks" , - .func = test__perf_hooks, - }, - { - .desc ="builtin clang support" , - .func = test__clang, - .subtest = { - .skip_if_fail = true, - .get_nr = test__clang_subtest_get_nr, - .get_desc = test__clang_subtest_get_desc, - } - }, - { - .desc ="unit_number__scnprintf" , - .func = test__unit_number__scnprint, - }, - { - .desc ="mem2node" , - .func = test__mem2node, - }, - { - .desc ="time utils" , - .func = test__time_utils, - }, - { - .desc ="Test jit_write_elf" , - .func = test__jit_write_elf, - }, - { - .desc ="Test libpfm4 support" , - .func = test__pfm, - .subtest = { - .skip_if_fail = true, - .get_nr = test__pfm_subtest_get_nr, - .get_desc = test__pfm_subtest_get_desc, - } - }, - { - .desc ="Test api io" , - .func = test__api_io, - }, - { - .desc ="maps__merge_in" , - .func = test__maps__merge_in, - }, - { - .desc ="Demangle Java" , - .func = test__demangle_java, - }, - { - .desc ="Demangle OCaml" , - .func = test__demangle_ocaml, - }, - { - .desc ="Parse and process metrics" , - .func = test__parse_metric, - }, - { - .desc ="PE file support" , - .func = test__pe_file_parsing, - }, - { - .desc ="Event expansion for cgroups" , - .func = test__expand_cgroup_events, - }, - { - .desc ="Convert perf time to TSC" , - .func = test__perf_time_to_tsc, - .is_supported = test__tsc_is_supported, - }, - { - .desc ="dlfilter C API" , - .func = test__dlfilter, - }, - { - .func =NULL , - }, +static struct test generic_tests[] = { +DEFINE_SUITE ("vmlinux symtab matches kallsyms" , vmlinux_matches_kallsyms), +DEFINE_SUITE ("Detect openat syscall event" , openat_syscall_event), +DEFINE_SUITE ("Detect openat syscall event on all cpus" , openat_syscall_event_on_all_cpus), +DEFINE_SUITE ("Read samples using the mmap interface" , basic_mmap), +DEFINE_SUITE ("Test data source output" , mem), +DEFINE_SUITE ("Parse event definition strings" , parse_events), +DEFINE_SUITE ("Simple expression parser" , expr), +DEFINE_SUITE ("PERF_RECORD_* events & perf_sample fields" ,PERF_RECORD ), +DEFINE_SUITE ("Parse perf pmu format" , pmu), +{ + .desc ="PMU events" , + .func = test__pmu_events, + .subtest = { + .skip_if_fail = false, + .get_nr = test__pmu_events_subtest_get_nr, + .get_desc = test__pmu_events_subtest_get_desc, + .skip_reason = test__pmu_events_subtest_skip_reason, + }, + +}, +DEFINE_SUITE ("DSO data read" , dso_data), +DEFINE_SUITE ("DSO data cache" , dso_data_cache), +DEFINE_SUITE ("DSO data reopen" , dso_data_reopen), +DEFINE_SUITE ("Roundtrip evsel->name" , perf_evsel__roundtrip_name_test), +DEFINE_SUITE ("Parse sched tracepoints fields" , perf_evsel__tp_sched_test), +DEFINE_SUITE ("syscalls:sys_enter_openat event fields" , syscall_openat_tp_fields), +DEFINE_SUITE ("Setup struct perf_event_attr" , attr), +DEFINE_SUITE ("Match and link multiple hists" , hists_link), +DEFINE_SUITE ("'import perf' in python" , python_use), +{ + .desc ="Breakpoint overflow signal handler" , + .func = test__bp_signal, + .is_supported = test__bp_signal_is_supported, +}, +{ + .desc ="Breakpoint overflow sampling" , + .func = test__bp_signal_overflow, + .is_supported = test__bp_signal_is_supported, +}, +{ + .desc ="Breakpoint accounting" , + .func = test__bp_accounting, + .is_supported = test__bp_account_is_supported, +}, +{ + .desc ="Watchpoint" , + .func = test__wp, + .is_supported = test__wp_is_supported, + .subtest = { + .skip_if_fail = false, + .get_nr = test__wp_subtest_get_nr, + .get_desc = test__wp_subtest_get_desc, + .skip_reason = test__wp_subtest_skip_reason, + }, +}, +DEFINE_SUITE ("Number of exit events of a simple workload" , task_exit), +DEFINE_SUITE ("Software clock events period values" , sw_clock_freq), +DEFINE_SUITE ("Object code reading" , code_reading), +DEFINE_SUITE ("Sample parsing" , sample_parsing), +DEFINE_SUITE ("Use a dummy software event to keep tracking" , keep_tracking), +DEFINE_SUITE ("Parse with no sample_id_all bit set" , parse_no_sample_id_all), +DEFINE_SUITE ("Filter hist entries" , hists_filter), +DEFINE_SUITE ("Lookup mmap thread" , mmap_thread_lookup), +DEFINE_SUITE ("Share thread maps" , thread_maps_share), +DEFINE_SUITE ("Sort output of hist entries" , hists_output), +DEFINE_SUITE ("Cumulate child hist entries" , hists_cumulate), +DEFINE_SUITE ("Track with sched_switch" , switch_tracking), +DEFINE_SUITE ("Filter fds with revents mask in a fdarray" , fdarray__filter), +DEFINE_SUITE ("Add fd to a fdarray, making it autogrow" , fdarray__add), +DEFINE_SUITE ("kmod_path__parse" , kmod_path__parse), +DEFINE_SUITE ("Thread map" , thread_map), +{ + .desc ="LLVM search and compile" , + .func = test__llvm, + .subtest = { + .skip_if_fail = true, + .get_nr = test__llvm_subtest_get_nr, + .get_desc = test__llvm_subtest_get_desc, + }, +}, +DEFINE_SUITE ("Session topology" , session_topology), +{ + .desc ="BPF filter" , + .func = test__bpf, + .subtest = { + .skip_if_fail = true, + .get_nr = test__bpf_subtest_get_nr, + .get_desc = test__bpf_subtest_get_desc, + }, +}, +DEFINE_SUITE ("Synthesize thread map" , thread_map_synthesize), +DEFINE_SUITE ("Remove thread map" , thread_map_remove), +DEFINE_SUITE ("Synthesize cpu map" , cpu_map_synthesize), +DEFINE_SUITE ("Synthesize stat config" , synthesize_stat_config), +DEFINE_SUITE ("Synthesize stat" , synthesize_stat), +DEFINE_SUITE ("Synthesize stat round" , synthesize_stat_round), +DEFINE_SUITE ("Synthesize attr update" , event_update), +DEFINE_SUITE ("Event times" , event_times), +DEFINE_SUITE ("Read backward ring buffer" , backward_ring_buffer), +DEFINE_SUITE ("Print cpu map" , cpu_map_print), +DEFINE_SUITE ("Merge cpu map" , cpu_map_merge), +DEFINE_SUITE ("Probe SDT events" , sdt_event), +DEFINE_SUITE ("is_printable_array" , is_printable_array), +DEFINE_SUITE ("Print bitmap" , bitmap_print), +DEFINE_SUITE ("perf hooks" , perf_hooks), +{ + .desc ="builtin clang support" , + .func = test__clang, + .subtest = { + .skip_if_fail = true, + .get_nr = test__clang_subtest_get_nr, + .get_desc = test__clang_subtest_get_desc, + } +}, +DEFINE_SUITE ("unit_number__scnprintf" , unit_number__scnprint), +DEFINE_SUITE ("mem2node" , mem2node), +DEFINE_SUITE ("time utils" , time_utils), +DEFINE_SUITE ("Test jit_write_elf" , jit_write_elf), +{ + .desc ="Test libpfm4 support" , + .func = test__pfm, + .subtest = { + .skip_if_fail = true, + .get_nr = test__pfm_subtest_get_nr, + .get_desc = test__pfm_subtest_get_desc, + } +}, +DEFINE_SUITE ("Test api io" , api_io), +DEFINE_SUITE ("maps__merge_in" , maps__merge_in), +DEFINE_SUITE ("Demangle Java" , demangle_java), +DEFINE_SUITE ("Demangle OCaml" , demangle_ocaml), +DEFINE_SUITE ("Parse and process metrics" , parse_metric), +DEFINE_SUITE ("PE file support" , pe_file_parsing), +DEFINE_SUITE ("Event expansion for cgroups" , expand_cgroup_events), +{ + .desc ="Convert perf time to TSC" , + .func = test__perf_time_to_tsc, + .is_supported = test__tsc_is_supported, +}, +DEFINE_SUITE ("dlfilter C API" , dlfilter), +{ + .func =NULL , +}, };static struct test *tests[] = {
Signature · 1 line
2.33.0.464.g1972c5931b-goog
Ian Rogers
reviewerRFC PATCH 3/5 perf test: Make each test/suite its own struct.
In reply to Ian RogersBy switching to an array of pointers to tests (later to be suites) the definition of the tests can be moved to the file containing the tests.
--- tools/perf/arch/arm/include/arch-tests.h | 2 +- tools/perf/arch/arm/tests/arch-tests.c | 21 +- tools/perf/arch/arm64/include/arch-tests.h | 2 +- tools/perf/arch/arm64/tests/arch-tests.c | 15 +- tools/perf/arch/powerpc/include/arch-tests.h | 2 +- tools/perf/arch/powerpc/tests/arch-tests.c | 15 +- tools/perf/arch/x86/include/arch-tests.h | 2 +- tools/perf/arch/x86/tests/arch-tests.c | 47 ++-- tools/perf/tests/builtin-test.c | 273 ++++++++++++------- tools/perf/tests/tests.h | 6 + 10 files changed, 220 insertions(+), 165 deletions(-)
tools/perf/arch/arm/include/arch-tests.h +1 -1
@@ -2,6 +2,6 @@#ifndef ARCH_TESTS_H #define ARCH_TESTS_H -extern struct test arch_tests[]; +extern struct test *arch_tests[];#endif
tools/perf/arch/arm/tests/arch-tests.c +9 -12
@@ -3,18 +3,15 @@#include "tests/tests.h" #include "arch-tests.h" -struct test arch_tests[] = {#ifdef HAVE_DWARF_UNWIND_SUPPORT - { - .desc = "DWARF unwind", - .func = test__dwarf_unwind, - }, +DEFINE_SUITE ("DWARF unwind" , dwarf_unwind);#endif - { - .desc = "Vectors page", - .func = test__vectors_page, - }, - { - .func = NULL, - }, +DEFINE_SUITE ("Vectors page" , vectors_page); + +struct test *arch_tests[] = { +#ifdef HAVE_DWARF_UNWIND_SUPPORT + &dwarf_unwind, +#endif + &vectors_pages, +NULL , };
tools/perf/arch/arm64/include/arch-tests.h +1 -1
@@ -2,6 +2,6 @@#ifndef ARCH_TESTS_H #define ARCH_TESTS_H -extern struct test arch_tests[]; +extern struct test *arch_tests[];#endif
tools/perf/arch/arm64/tests/arch-tests.c +7 -8
@@ -3,14 +3,13 @@#include "tests/tests.h" #include "arch-tests.h" -struct test arch_tests[] = {#ifdef HAVE_DWARF_UNWIND_SUPPORT - { - .desc = "DWARF unwind", - .func = test__dwarf_unwind, - }, +DEFINE_SUITE ("DWARF unwind" , dwarf_unwind);#endif - { - .func = NULL, - }, + +struct test *arch_tests[] = { +#ifdef HAVE_DWARF_UNWIND_SUPPORT + &dwarf_unwind, +#endif +NULL , };
tools/perf/arch/powerpc/include/arch-tests.h +1 -1
@@ -2,6 +2,6 @@#ifndef ARCH_TESTS_H #define ARCH_TESTS_H -extern struct test arch_tests[]; +extern struct test *arch_tests[];#endif
tools/perf/arch/powerpc/tests/arch-tests.c +7 -8
@@ -3,14 +3,13 @@#include "tests/tests.h" #include "arch-tests.h" -struct test arch_tests[] = {#ifdef HAVE_DWARF_UNWIND_SUPPORT - { - .desc = "Test dwarf unwind", - .func = test__dwarf_unwind, - }, +DEFINE_SUITE ("DWARF unwind" , dwarf_unwind);#endif - { - .func = NULL, - }, + +struct test *arch_tests[] = { +#ifdef HAVE_DWARF_UNWIND_SUPPORT + &dwarf_unwind, +#endif +NULL , };
tools/perf/arch/x86/include/arch-tests.h +1 -1
@@ -11,6 +11,6 @@ int test__intel_pt_pkt_decoder(struct test *test, int subtest);int test__bp_modify (struct test *test,int subtest);int test__x86_sample_parsing (struct test *test,int subtest); -extern struct test arch_tests[]; +extern struct test *arch_tests[];#endif
tools/perf/arch/x86/tests/arch-tests.c +19 -28
58 lines not on this page · raw message
tools/perf/tests/builtin-test.c +168 -105
362 lines not on this page · raw message
tools/perf/tests/tests.h +6 -0
@@ -43,6 +43,12 @@ struct test {#define DECLARE_SUITE (name) \ int test__##name(struct test *test, int subtest) +#define DEFINE_SUITE (description, name) \ + static struct test name = { \ + .desc = description, \ + .func = test__##name, \ + }; +/* Tests */ DECLARE_SUITE (vmlinux_matches_kallsyms);DECLARE_SUITE (openat_syscall_event);
Signature · 1 line
2.33.0.464.g1972c5931b-goog
Re: [RFC PATCH 3/5] perf test: Make each test/suite its own struct.
Quoted 35 lines · Ian Rogers
By switching to an array of pointers to tests (later to be suites) the definition of the tests can be moved to the file containing the tests.
Signed-off-by Ian Rogers <[email protected]>--- tools/perf/arch/arm/include/arch-tests.h | 2 +- tools/perf/arch/arm/tests/arch-tests.c | 21 +- tools/perf/arch/arm64/include/arch-tests.h | 2 +- tools/perf/arch/arm64/tests/arch-tests.c | 15 +- tools/perf/arch/powerpc/include/arch-tests.h | 2 +- tools/perf/arch/powerpc/tests/arch-tests.c | 15 +- tools/perf/arch/x86/include/arch-tests.h | 2 +- tools/perf/arch/x86/tests/arch-tests.c | 47 ++-- tools/perf/tests/builtin-test.c | 273 ++++++++++++------- tools/perf/tests/tests.h | 6 + 10 files changed, 220 insertions(+), 165 deletions(-)tools/perf/arch/arm/include/arch-tests.h +1
-1@@ -2,6 +2,6 @@#ifndef ARCH_TESTS_H #define ARCH_TESTS_H -extern struct test arch_tests[]; +extern struct test *arch_tests[];#endif tools/perf/arch/arm/tests/arch-tests.c +0
-0
tools/perf/arch/arm/tests/arch-tests.c line 7
Quoted 10 lines
tools/perf/arch/arm/tests/arch-tests.c +1
-5@@ -3,18 +3,15 @@#include "tests/tests.h" #include "arch-tests.h" -struct test arch_tests[] = {#ifdef HAVE_DWARF_UNWIND_SUPPORT - { - .desc = "DWARF unwind", - .func = test__dwarf_unwind, - }, +DEFINE_SUITE ("DWARF unwind" , dwarf_unwind);
why not having this and other in here DEFINE_SUITE in tests/dwarf-unwind.c ? it seems to get compiled in only for supported arch
jirka
Quoted 17 lines
tools/perf/arch/arm/tests/arch-tests.c +8
-7#endif - { - .desc = "Vectors page", - .func = test__vectors_page, - }, - { - .func = NULL, - }, +DEFINE_SUITE ("Vectors page" , vectors_page); + +struct test *arch_tests[] = { +#ifdef HAVE_DWARF_UNWIND_SUPPORT + &dwarf_unwind, +#endif + &vectors_pages, +NULL , };
SNIP
Ian Rogers
reviewerRe: [RFC PATCH 3/5] perf test: Make each test/suite its own struct.
Quoted 40 lines · Jiri Olsa
Quoted 38 lines · Ian Rogers
By switching to an array of pointers to tests (later to be suites) the definition of the tests can be moved to the file containing the tests.
Signed-off-by Ian Rogers <[email protected]>--- tools/perf/arch/arm/include/arch-tests.h | 2 +- tools/perf/arch/arm/tests/arch-tests.c | 21 +- tools/perf/arch/arm64/include/arch-tests.h | 2 +- tools/perf/arch/arm64/tests/arch-tests.c | 15 +- tools/perf/arch/powerpc/include/arch-tests.h | 2 +- tools/perf/arch/powerpc/tests/arch-tests.c | 15 +- tools/perf/arch/x86/include/arch-tests.h | 2 +- tools/perf/arch/x86/tests/arch-tests.c | 47 ++-- tools/perf/tests/builtin-test.c | 273 ++++++++++++------- tools/perf/tests/tests.h | 6 + 10 files changed, 220 insertions(+), 165 deletions(-)tools/perf/arch/arm/include/arch-tests.h +1
-1@@ -2,6 +2,6 @@#ifndef ARCH_TESTS_H #define ARCH_TESTS_H -extern struct test arch_tests[]; +extern struct test *arch_tests[];#endif tools/perf/arch/arm/tests/arch-tests.c +0
-0@@ -3,18 +3,15 @@#include "tests/tests.h" #include "arch-tests.h"
Quoted 11 lines
tools/perf/arch/arm/tests/arch-tests.c line 7
Quoted 7 lines
tools/perf/arch/arm/tests/arch-tests.c +1
-5-struct test arch_tests[] = {#ifdef HAVE_DWARF_UNWIND_SUPPORT - { - .desc = "DWARF unwind", - .func = test__dwarf_unwind, - }, +DEFINE_SUITE ("DWARF unwind" , dwarf_unwind);why not having this and other in here
DEFINE_SUITEintests/dwarf-unwind.c? it seems to get compiled in only for supported arch
Not sure I follow. In these changes I've just tried to move things around without changing the logic behind things. This sounds like a sensible follow up clean up.
Thanks,
Ian
Quoted 22 lines
jirka
Quoted 17 lines
tools/perf/arch/arm/tests/arch-tests.c +8
-7#endif - { - .desc = "Vectors page", - .func = test__vectors_page, - }, - { - .func = NULL, - }, +DEFINE_SUITE ("Vectors page" , vectors_page); + +struct test *arch_tests[] = { +#ifdef HAVE_DWARF_UNWIND_SUPPORT + &dwarf_unwind, +#endif + &vectors_pages, +NULL , };SNIP
Re: [RFC PATCH 3/5] perf test: Make each test/suite its own struct.
Quoted 53 lines · Ian Rogers
Quoted 40 lines · Jiri Olsa
Quoted 38 lines · Ian Rogers
By switching to an array of pointers to tests (later to be suites) the definition of the tests can be moved to the file containing the tests.
Signed-off-by Ian Rogers <[email protected]>--- tools/perf/arch/arm/include/arch-tests.h | 2 +- tools/perf/arch/arm/tests/arch-tests.c | 21 +- tools/perf/arch/arm64/include/arch-tests.h | 2 +- tools/perf/arch/arm64/tests/arch-tests.c | 15 +- tools/perf/arch/powerpc/include/arch-tests.h | 2 +- tools/perf/arch/powerpc/tests/arch-tests.c | 15 +- tools/perf/arch/x86/include/arch-tests.h | 2 +- tools/perf/arch/x86/tests/arch-tests.c | 47 ++-- tools/perf/tests/builtin-test.c | 273 ++++++++++++------- tools/perf/tests/tests.h | 6 + 10 files changed, 220 insertions(+), 165 deletions(-)tools/perf/arch/arm/include/arch-tests.h +1
-1@@ -2,6 +2,6 @@#ifndef ARCH_TESTS_H #define ARCH_TESTS_H -extern struct test arch_tests[]; +extern struct test *arch_tests[];#endif tools/perf/arch/arm/tests/arch-tests.c +0
-0@@ -3,18 +3,15 @@#include "tests/tests.h" #include "arch-tests.h" Quoted 11 lines
tools/perf/arch/arm/tests/arch-tests.c line 7
Quoted 7 lines
tools/perf/arch/arm/tests/arch-tests.c +1
-5-struct test arch_tests[] = {#ifdef HAVE_DWARF_UNWIND_SUPPORT - { - .desc = "DWARF unwind", - .func = test__dwarf_unwind, - }, +DEFINE_SUITE ("DWARF unwind" , dwarf_unwind);why not having this and other in here
DEFINE_SUITEintests/dwarf-unwind.c? it seems to get compiled in only for supported arch
Quoted 3 lines
Not sure I follow. In these changes I've just tried to move things around without changing the logic behind things. This sounds like a sensible follow up clean up.
ah ok, maybe I mixed the proper patch to adress this, sry
the question I have is why DEFINE_SUITE("DWARF unwind" .. is not moved to dwarf unwind test object, like you did for other tests
thanks,
jirka
Quoted 27 lines
Thanks,
IanQuoted 22 lines
jirka
Quoted 17 lines
tools/perf/arch/arm/tests/arch-tests.c +8
-7#endif - { - .desc = "Vectors page", - .func = test__vectors_page, - }, - { - .func = NULL, - }, +DEFINE_SUITE ("Vectors page" , vectors_page); + +struct test *arch_tests[] = { +#ifdef HAVE_DWARF_UNWIND_SUPPORT + &dwarf_unwind, +#endif + &vectors_pages, +NULL , };SNIP
Ian Rogers
reviewerRFC PATCH 4/5 perf test: Move each test suite struct to its test
In reply to Ian RogersRather than export test functions, export the test struct. Rename with a suite__ prefix to avoid name collisions.
--- tools/perf/arch/arm/tests/arch-tests.c | 4 +- tools/perf/arch/arm64/tests/arch-tests.c | 2 +- tools/perf/arch/powerpc/tests/arch-tests.c | 2 +- tools/perf/arch/x86/tests/arch-tests.c | 12 +- tools/perf/tests/api-io.c | 6 +- tools/perf/tests/attr.c | 4 +- tools/perf/tests/backward-ring-buffer.c | 4 +- tools/perf/tests/bitmap.c | 4 +- tools/perf/tests/bp_account.c | 10 +- tools/perf/tests/bp_signal.c | 8 +- tools/perf/tests/bp_signal_overflow.c | 8 +- tools/perf/tests/bpf.c | 22 +- tools/perf/tests/builtin-test.c | 285 +++++--------------- tools/perf/tests/clang.c | 18 +- tools/perf/tests/code-reading.c | 4 +- tools/perf/tests/cpumap.c | 10 +- tools/perf/tests/demangle-java-test.c | 4 +- tools/perf/tests/demangle-ocaml-test.c | 4 +- tools/perf/tests/dlfilter-test.c | 4 +- tools/perf/tests/dso-data.c | 10 +- tools/perf/tests/event-times.c | 4 +- tools/perf/tests/event_update.c | 4 +- tools/perf/tests/evsel-roundtrip-name.c | 4 +- tools/perf/tests/evsel-tp-sched.c | 4 +- tools/perf/tests/expand-cgroup.c | 6 +- tools/perf/tests/expr.c | 4 +- tools/perf/tests/fdarray.c | 7 +- tools/perf/tests/genelf.c | 6 +- tools/perf/tests/hists_cumulate.c | 4 +- tools/perf/tests/hists_filter.c | 4 +- tools/perf/tests/hists_link.c | 4 +- tools/perf/tests/hists_output.c | 4 +- tools/perf/tests/is_printable_array.c | 4 +- tools/perf/tests/keep-tracking.c | 4 +- tools/perf/tests/kmod-path.c | 4 +- tools/perf/tests/llvm.c | 22 +- tools/perf/tests/maps.c | 4 +- tools/perf/tests/mem.c | 4 +- tools/perf/tests/mem2node.c | 4 +- tools/perf/tests/mmap-basic.c | 4 +- tools/perf/tests/mmap-thread-lookup.c | 4 +- tools/perf/tests/openat-syscall-all-cpus.c | 5 +- tools/perf/tests/openat-syscall-tp-fields.c | 4 +- tools/perf/tests/openat-syscall.c | 5 +- tools/perf/tests/parse-events.c | 4 +- tools/perf/tests/parse-metric.c | 4 +- tools/perf/tests/parse-no-sample-id-all.c | 4 +- tools/perf/tests/pe-file-parsing.c | 6 +- tools/perf/tests/perf-hooks.c | 4 +- tools/perf/tests/perf-record.c | 4 +- tools/perf/tests/perf-time-to-tsc.c | 10 +- tools/perf/tests/pfm.c | 16 +- tools/perf/tests/pmu-events.c | 19 +- tools/perf/tests/pmu.c | 4 +- tools/perf/tests/python-use.c | 4 +- tools/perf/tests/sample-parsing.c | 4 +- tools/perf/tests/sdt.c | 6 +- tools/perf/tests/stat.c | 10 +- tools/perf/tests/sw-clock.c | 4 +- tools/perf/tests/switch-tracking.c | 4 +- tools/perf/tests/task-exit.c | 4 +- tools/perf/tests/tests.h | 22 +- tools/perf/tests/thread-map.c | 10 +- tools/perf/tests/thread-maps-share.c | 4 +- tools/perf/tests/time-utils-test.c | 4 +- tools/perf/tests/topology.c | 4 +- tools/perf/tests/unit_number__scnprintf.c | 4 +- tools/perf/tests/vmlinux-kallsyms.c | 5 +- tools/perf/tests/wp.c | 22 +- 69 files changed, 391 insertions(+), 343 deletions(-)
tools/perf/arch/arm/tests/arch-tests.c +2 -2
@@ -10,8 +10,8 @@ DEFINE_SUITE("Vectors page", vectors_page);struct test *arch_tests[] = { #ifdef HAVE_DWARF_UNWIND_SUPPORT - &dwarf_unwind, + &suite__dwarf_unwind, #endif - &vectors_pages, + &suite__vectors_pages,NULL , };
tools/perf/arch/arm64/tests/arch-tests.c +1 -1
@@ -9,7 +9,7 @@ DEFINE_SUITE("DWARF unwind", dwarf_unwind);struct test *arch_tests[] = { #ifdef HAVE_DWARF_UNWIND_SUPPORT - &dwarf_unwind, + &suite__dwarf_unwind, #endifNULL , };
tools/perf/arch/powerpc/tests/arch-tests.c +1 -1
@@ -9,7 +9,7 @@ DEFINE_SUITE("DWARF unwind", dwarf_unwind);struct test *arch_tests[] = { #ifdef HAVE_DWARF_UNWIND_SUPPORT - &dwarf_unwind, + &suite__dwarf_unwind, #endifNULL , };
tools/perf/arch/x86/tests/arch-tests.c +6 -6
@@ -17,16 +17,16 @@ DEFINE_SUITE("x86 bp modify", bp_modify);DEFINE_SUITE ("x86 Sample parsing" , x86_sample_parsing);struct test *arch_tests[] = { - &rdpmc, + &suite__rdpmc, #ifdef HAVE_DWARF_UNWIND_SUPPORT - &dwarf_unwind, + &suite__dwarf_unwind, #endif #ifdef HAVE_AUXTRACE_SUPPORT - &insn_x86, - &intel_pt_pkt_decoder, + &suite__insn_x86, + &suite__intel_pt_pkt_decoder, #endif #if defined(__x86_64__) - &bp_modify, + &suite__bp_modify, #endif - &x86_sample_parsing, + &suite__x86_sample_parsing, };
tools/perf/tests/api-io.c +4 -2
@@ -289,8 +289,8 @@ static int test_get_dec(void)return ret; } -int test__api_io (struct test *test__maybe_unused , -int subtest__maybe_unused ) +static int test__api_io (struct test *test__maybe_unused , +int subtest__maybe_unused ) {int ret =0 ;
@@ -302,3 +302,5 @@ int test__api_io(struct test *test __maybe_unused, ret =TEST_FAIL ;return ret; } + +DEFINE_SUITE ("Test api io" , api_io);
tools/perf/tests/attr.c +3 -1
@@ -178,7 +178,7 @@ static int run_dir(const char *d, const char *perf)return system (cmd) ?TEST_FAIL :TEST_OK ; } -int test__attr (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__attr (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct stat st;char path_perf[PATH_MAX ];
@@ -207,3 +207,5 @@ int test__attr(struct test *test __maybe_unused, int subtest __maybe_unused)return TEST_SKIP ; } + +DEFINE_SUITE ("Setup struct perf_event_attr" , attr);
tools/perf/tests/backward-ring-buffer.c +3 -1
@@ -82,7 +82,7 @@ static int do_test(struct evlist *evlist, int mmap_pages, } -int test__backward_ring_buffer (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__backward_ring_buffer (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int ret =TEST_SKIP , err, sample_count =0 , comm_count =0 ;char pid[16 ], sbuf[STRERR_BUFSIZE ];
@@ -166,3 +166,5 @@ int test__backward_ring_buffer(struct test *test __maybe_unused, int subtest __mevlist__delete (evlist);return ret; } + +DEFINE_SUITE ("Read backward ring buffer" , backward_ring_buffer);
tools/perf/tests/bitmap.c +3 -1
@@ -40,7 +40,7 @@ static int test_bitmap(const char *str)return ret; } -int test__bitmap_print (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__bitmap_print (struct test *test__maybe_unused ,int subtest__maybe_unused ) {TEST_ASSERT_VAL ("failed to convert map" ,test_bitmap ("1" ));TEST_ASSERT_VAL ("failed to convert map" ,test_bitmap ("1,5" ));
@@ -51,3 +51,5 @@ int test__bitmap_print(struct test *test __maybe_unused, int subtest __maybe_unuTEST_ASSERT_VAL ("failed to convert map" ,test_bitmap ("1-10,12-20,22-30,32-40" ));return 0 ; } + +DEFINE_SUITE ("Print bitmap" , bitmap_print);
tools/perf/tests/bp_account.c +8 -2
@@ -173,7 +173,7 @@ static int detect_share(int wp_cnt, int bp_cnt)* we create another watchpoint to ensure * the slot accounting is correct */ -int test__bp_accounting (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__bp_accounting (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int has_ioctl =detect_ioctl ();int wp_cnt =detect_cnt (false);
@@ -189,7 +189,7 @@ int test__bp_accounting(struct test *test __maybe_unused, int subtest __maybe_unreturn bp_accounting (wp_cnt, share); } -bool test__bp_account_is_supported (void ) +static bool test__bp_account_is_supported (void ) {/* * PowerPC and S390 do not support creation of instruction
@@ -204,3 +204,9 @@ bool test__bp_account_is_supported(void)return true;#endif } + +struct test suite__bp_accounting = { + .desc ="Breakpoint accounting" , + .func = test__bp_accounting, + .is_supported = test__bp_account_is_supported, +};
tools/perf/tests/bp_signal.c +7 -1
@@ -161,7 +161,7 @@ static long long bp_count(int fd)return count; } -int test__bp_signal (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__bp_signal (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct sigaction sa;long long count1, count2, count3;
@@ -311,3 +311,9 @@ bool test__bp_signal_is_supported(void)return true;#endif } + +struct test suite__bp_signal = { + .desc ="Breakpoint overflow signal handler" , + .func = test__bp_signal, + .is_supported = test__bp_signal_is_supported, +};
tools/perf/tests/bp_signal_overflow.c +7 -1
@@ -59,7 +59,7 @@ static long long bp_count(int fd)#define EXECUTIONS 10000#define THRESHOLD 100 -int test__bp_signal_overflow (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__bp_signal_overflow (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct perf_event_attr pe;struct sigaction sa;
@@ -133,3 +133,9 @@ int test__bp_signal_overflow(struct test *test __maybe_unused, int subtest __mayreturn fails ?TEST_FAIL :TEST_OK ; } + +struct test suite__bp_signal_overflow = { + .desc ="Breakpoint overflow sampling" , + .func = test__bp_signal_overflow, + .is_supported = test__bp_signal_is_supported, +};
tools/perf/tests/bpf.c +16 -6
@@ -282,12 +282,12 @@ static int __test__bpf(int idx)return ret; } -int test__bpf_subtest_get_nr (void ) +static int test__bpf_subtest_get_nr (void ) {return (int )ARRAY_SIZE (bpf_testcase_table); } -const char *test__bpf_subtest_get_desc (int i) +static const char *test__bpf_subtest_get_desc (int i) {if (i <0 || i >= (int )ARRAY_SIZE (bpf_testcase_table))return NULL ;
@@ -324,7 +324,7 @@ static int check_env(void)return 0 ; } -int test__bpf (struct test *test__maybe_unused ,int i) +static int test__bpf (struct test *test__maybe_unused ,int i) {int err;
@@ -344,19 +344,29 @@ int test__bpf(struct test *test __maybe_unused, int i) }#else -int test__bpf_subtest_get_nr (void ) +static int test__bpf_subtest_get_nr (void ) {return 0 ; } -const char *test__bpf_subtest_get_desc (int i__maybe_unused ) +static const char *test__bpf_subtest_get_desc (int i__maybe_unused ) {return NULL ; } -int test__bpf (struct test *test__maybe_unused ,int i__maybe_unused ) +static int test__bpf (struct test *test__maybe_unused ,int i__maybe_unused ) {pr_debug ("Skip BPF test because BPF support is not compiled\n" );return TEST_SKIP ; }#endif + +struct test suite__bpf = { + .desc ="BPF filter" , + .func = test__bpf, + .subtest = { + .skip_if_fail = true, + .get_nr = test__bpf_subtest_get_nr, + .get_desc = test__bpf_subtest_get_desc, + }, +};
tools/perf/tests/builtin-test.c +72 -213
292 lines not on this page · raw message
tools/perf/tests/clang.c +14 -4
@@ -19,12 +19,12 @@ static struct {#endif }; -int test__clang_subtest_get_nr (void ) +static int test__clang_subtest_get_nr (void ) {return (int )ARRAY_SIZE (clang_testcase_table); } -const char *test__clang_subtest_get_desc (int i) +static const char *test__clang_subtest_get_desc (int i) {if (i <0 || i >= (int )ARRAY_SIZE (clang_testcase_table))return NULL ;
@@ -32,15 +32,25 @@ const char *test__clang_subtest_get_desc(int i) }#ifndef HAVE_LIBCLANGLLVM_SUPPORT -int test__clang (struct test *test__maybe_unused ,int i__maybe_unused ) +static int test__clang (struct test *test__maybe_unused ,int i__maybe_unused ) {return TEST_SKIP ; }#else -int test__clang (struct test *test__maybe_unused ,int i) +static int test__clang (struct test *test__maybe_unused ,int i) {if (i <0 || i >= (int )ARRAY_SIZE (clang_testcase_table))return TEST_FAIL ;return clang_testcase_table[i].func (); }#endif + +struct test suite__clang = { + .desc ="builtin clang support" , + .func = test__clang, + .subtest = { + .skip_if_fail = true, + .get_nr = test__clang_subtest_get_nr, + .get_desc = test__clang_subtest_get_desc, + } +};
tools/perf/tests/code-reading.c +3 -1
@@ -715,7 +715,7 @@ static int do_test_code_reading(bool try_kcore)return err; } -int test__code_reading (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__code_reading (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int ret;
@@ -742,3 +742,5 @@ int test__code_reading(struct test *test __maybe_unused, int subtest __maybe_unureturn -1 ; }; } + +DEFINE_SUITE ("Object code reading" , code_reading);
tools/perf/tests/cpumap.c +7 -3
@@ -75,7 +75,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused, } -int test__cpu_map_synthesize (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__cpu_map_synthesize (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct perf_cpu_map *cpus;
@@ -111,7 +111,7 @@ static int cpu_map_print(const char *str)return !strcmp (buf, str); } -int test__cpu_map_print (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__cpu_map_print (struct test *test__maybe_unused ,int subtest__maybe_unused ) {TEST_ASSERT_VAL ("failed to convert map" ,cpu_map_print ("1" ));TEST_ASSERT_VAL ("failed to convert map" ,cpu_map_print ("1,5" ));
@@ -123,7 +123,7 @@ int test__cpu_map_print(struct test *test __maybe_unused, int subtest __maybe_unreturn 0 ; } -int test__cpu_map_merge (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__cpu_map_merge (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct perf_cpu_map *a =perf_cpu_map__new ("4,2,1" );struct perf_cpu_map *b =perf_cpu_map__new ("4,5,7" );
@@ -137,3 +137,7 @@ int test__cpu_map_merge(struct test *test __maybe_unused, int subtest __maybe_unperf_cpu_map__put (c);return 0 ; } + +DEFINE_SUITE ("Synthesize cpu map" , cpu_map_synthesize); +DEFINE_SUITE ("Print cpu map" , cpu_map_print); +DEFINE_SUITE ("Merge cpu map" , cpu_map_merge);
tools/perf/tests/demangle-java-test.c +3 -1
@@ -7,7 +7,7 @@#include "debug.h" #include "demangle-java.h" -int test__demangle_java (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__demangle_java (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int ret =TEST_OK ;char *buf =NULL ;
@@ -40,3 +40,5 @@ int test__demangle_java(struct test *test __maybe_unused, int subtest __maybe_unreturn ret; } + +DEFINE_SUITE ("Demangle Java" , demangle_java);
tools/perf/tests/demangle-ocaml-test.c +3 -1
@@ -7,7 +7,7 @@#include "debug.h" #include "demangle-ocaml.h" -int test__demangle_ocaml (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__demangle_ocaml (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int ret =TEST_OK ;char *buf =NULL ;
@@ -41,3 +41,5 @@ int test__demangle_ocaml(struct test *test __maybe_unused, int subtest __maybe_ureturn ret; } + +DEFINE_SUITE ("Demangle OCaml" , demangle_ocaml);
tools/perf/tests/dlfilter-test.c +3 -1
@@ -398,7 +398,7 @@ static void test_data__free(struct test_data *td) } } -int test__dlfilter (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__dlfilter (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct test_data td = {.fd =-1 };int pid =getpid ();
@@ -414,3 +414,5 @@ int test__dlfilter(struct test *test __maybe_unused, int subtest __maybe_unused)test_data__free (&td);return err; } + +DEFINE_SUITE ("dlfilter C API" , dlfilter);
tools/perf/tests/dso-data.c +7 -3
@@ -113,7 +113,7 @@ static int dso__data_fd(struct dso *dso, struct machine *machine)return fd; } -int test__dso_data (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__dso_data (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct machine machine;struct dso *dso;
@@ -248,7 +248,7 @@ static int set_fd_limit(int n)return setrlimit (RLIMIT_NOFILE , &rlim); } -int test__dso_data_cache (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__dso_data_cache (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct machine machine;long nr_end, nr =open_files_cnt ();
@@ -318,7 +318,7 @@ static long new_limit(int count)return ret; } -int test__dso_data_reopen (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__dso_data_reopen (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct machine machine;long nr_end, nr =open_files_cnt (), lim =new_limit (3 );
@@ -393,3 +393,7 @@ int test__dso_data_reopen(struct test *test __maybe_unused, int subtest __maybe_TEST_ASSERT_VAL ("failed leaking files" , nr == nr_end);return 0 ; } + +DEFINE_SUITE ("DSO data read" , dso_data); +DEFINE_SUITE ("DSO data cache" , dso_data_cache); +DEFINE_SUITE ("DSO data reopen" , dso_data_reopen);
tools/perf/tests/event-times.c +3 -1
@@ -216,7 +216,7 @@ static int test_times(int (attach)(struct evlist *),* and checks that enabled and running times * match. */ -int test__event_times (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__event_times (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int err, ret =0 ;
@@ -239,3 +239,5 @@ int test__event_times(struct test *test __maybe_unused, int subtest __maybe_unus#undef _Treturn ret; } + +DEFINE_SUITE ("Event times" , event_times);
tools/perf/tests/event_update.c +3 -1
@@ -83,7 +83,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused,return 0 ; } -int test__event_update (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__event_update (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct evsel *evsel;struct event_name tmp;
@@ -123,3 +123,5 @@ int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unuevlist__delete (evlist);return 0 ; } + +DEFINE_SUITE ("Synthesize attr update" , event_update);
tools/perf/tests/evsel-roundtrip-name.c +3 -1
@@ -99,7 +99,7 @@ static int __perf_evsel__name_array_test(const char *names[], int nr_names,#define perf_evsel__name_array_test (names, distance) \ __perf_evsel__name_array_test(names, ARRAY_SIZE(names), distance) -int test__perf_evsel__roundtrip_name_test (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__perf_evsel__roundtrip_name_test (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int err =0 , ret =0 ;
@@ -120,3 +120,5 @@ int test__perf_evsel__roundtrip_name_test(struct test *test __maybe_unused, intreturn ret; } + +DEFINE_SUITE ("Roundtrip evsel->name" , perf_evsel__roundtrip_name_test);
tools/perf/tests/evsel-tp-sched.c +3 -1
@@ -32,7 +32,7 @@ static int evsel__test_field(struct evsel *evsel, const char *name, int size, boreturn ret; } -int test__perf_evsel__tp_sched_test (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__perf_evsel__tp_sched_test (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct evsel *evsel =evsel__newtp ("sched" ,"sched_switch" );int ret =0 ;
@@ -87,3 +87,5 @@ int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtesevsel__delete (evsel);return ret; } + +DEFINE_SUITE ("Parse sched tracepoints fields" , perf_evsel__tp_sched_test);
tools/perf/tests/expand-cgroup.c +4 -2
@@ -219,8 +219,8 @@ static int expand_metric_events(void)return ret; } -int test__expand_cgroup_events (struct test *test__maybe_unused , -int subtest__maybe_unused ) +static int test__expand_cgroup_events (struct test *test__maybe_unused , +int subtest__maybe_unused ) {int ret;
@@ -238,3 +238,5 @@ int test__expand_cgroup_events(struct test *test __maybe_unused,return ret; } + +DEFINE_SUITE ("Event expansion for cgroups" , expand_cgroup_events);
tools/perf/tests/expr.c +3 -1
@@ -16,7 +16,7 @@ static int test(struct expr_parse_ctx *ctx, const char *e, double val2)return 0 ; } -int test__expr (struct test *t__maybe_unused ,int subtest__maybe_unused ) +static int test__expr (struct test *t__maybe_unused ,int subtest__maybe_unused ) {struct expr_id_data *val_ptr;const char *p;
@@ -86,3 +86,5 @@ int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused)return 0 ; } + +DEFINE_SUITE ("Simple expression parser" , expr);
tools/perf/tests/fdarray.c +5 -2
@@ -28,7 +28,7 @@ static int fdarray__fprintf_prefix(struct fdarray *fda, const char *prefix, FILEreturn printed +fdarray__fprintf (fda, fp); } -int test__fdarray__filter (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__fdarray__filter (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int nr_fds, err =TEST_FAIL ;struct fdarray *fda =fdarray__new (5 ,5 );
@@ -89,7 +89,7 @@ int test__fdarray__filter(struct test *test __maybe_unused, int subtest __maybe_return err; } -int test__fdarray__add (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__fdarray__add (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int err =TEST_FAIL ;struct fdarray *fda =fdarray__new (2 ,2 );
@@ -158,3 +158,6 @@ int test__fdarray__add(struct test *test __maybe_unused, int subtest __maybe_unu out:return err; } + +DEFINE_SUITE ("Filter fds with revents mask in a fdarray" , fdarray__filter); +DEFINE_SUITE ("Add fd to a fdarray, making it autogrow" , fdarray__add);
tools/perf/tests/genelf.c +4 -2
@@ -16,8 +16,8 @@#define TEMPL "/tmp/perf-test-XXXXXX" -int test__jit_write_elf (struct test *test__maybe_unused , -int subtest__maybe_unused ) +static int test__jit_write_elf (struct test *test__maybe_unused , +int subtest__maybe_unused ) {#ifdef HAVE_JITDUMP static unsigned char x86_code[] = {
@@ -49,3 +49,5 @@ int test__jit_write_elf(struct test *test __maybe_unused,return TEST_SKIP ;#endif } + +DEFINE_SUITE ("Test jit_write_elf" , jit_write_elf);
tools/perf/tests/hists_cumulate.c +3 -1
@@ -689,7 +689,7 @@ static int test4(struct evsel *evsel, struct machine *machine)return err; } -int test__hists_cumulate (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__hists_cumulate (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int err =TEST_FAIL ;struct machines machines;
@@ -736,3 +736,5 @@ int test__hists_cumulate(struct test *test __maybe_unused, int subtest __maybe_ureturn err; } + +DEFINE_SUITE ("Cumulate child hist entries" , hists_cumulate);
tools/perf/tests/hists_filter.c +3 -1
@@ -101,7 +101,7 @@ static int add_hist_entries(struct evlist *evlist,return TEST_FAIL ; } -int test__hists_filter (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__hists_filter (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int err =TEST_FAIL ;struct machines machines;
@@ -325,3 +325,5 @@ int test__hists_filter(struct test *test __maybe_unused, int subtest __maybe_unureturn err; } + +DEFINE_SUITE ("Filter hist entries" , hists_filter);
tools/perf/tests/hists_link.c +3 -1
@@ -264,7 +264,7 @@ static int validate_link(struct hists *leader, struct hists *other)return __validate_link (leader,0 ) ||__validate_link (other,1 ); } -int test__hists_link (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__hists_link (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int err =-1 ;struct hists *hists, *first_hists;
@@ -339,3 +339,5 @@ int test__hists_link(struct test *test __maybe_unused, int subtest __maybe_unusereturn err; } + +DEFINE_SUITE ("Match and link multiple hists" , hists_link);
tools/perf/tests/hists_output.c +3 -1
@@ -575,7 +575,7 @@ static int test5(struct evsel *evsel, struct machine *machine)return err; } -int test__hists_output (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__hists_output (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int err =TEST_FAIL ;struct machines machines;
@@ -623,3 +623,5 @@ int test__hists_output(struct test *test __maybe_unused, int subtest __maybe_unureturn err; } + +DEFINE_SUITE ("Sort output of hist entries" , hists_output);
tools/perf/tests/is_printable_array.c +3 -1
@@ -5,7 +5,7 @@#include "debug.h" #include "print_binary.h" -int test__is_printable_array (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__is_printable_array (struct test *test__maybe_unused ,int subtest__maybe_unused ) {char buf1[] = {'k' ,'r' ,4 ,'v' ,'a' ,0 };char buf2[] = {'k' ,'r' ,'a' ,'v' ,4 ,0 };
@@ -36,3 +36,5 @@ int test__is_printable_array(struct test *test __maybe_unused, int subtest __mayreturn TEST_OK ; } + +DEFINE_SUITE ("is_printable_array" , is_printable_array);
tools/perf/tests/keep-tracking.c +3 -1
@@ -61,7 +61,7 @@ static int find_comm(struct evlist *evlist, const char *comm)* when an event is disabled but a dummy software event is not disabled. If the * test passes %0 is returned, otherwise %-1 is returned. */ -int test__keep_tracking (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__keep_tracking (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct record_opts opts = { .mmap_pages =UINT_MAX ,
@@ -160,3 +160,5 @@ int test__keep_tracking(struct test *test __maybe_unused, int subtest __maybe_unreturn err; } + +DEFINE_SUITE ("Use a dummy software event to keep tracking" , keep_tracking);
tools/perf/tests/kmod-path.c +3 -1
@@ -47,7 +47,7 @@ static int test_is_kernel_module(const char *path, int cpumode, bool expect)#define M (path, c, e) \ TEST_ASSERT_VAL("failed", !test_is_kernel_module(path, c, e)) -int test__kmod_path__parse (struct test *t__maybe_unused ,int subtest__maybe_unused ) +static int test__kmod_path__parse (struct test *t__maybe_unused ,int subtest__maybe_unused ) {/* path alloc_name kmod comp name */ T ("/xxxx/xxxx/x-x.ko" , true , true,0 ,"[x_x]" );
@@ -159,3 +159,5 @@ int test__kmod_path__parse(struct test *t __maybe_unused, int subtest __maybe_unreturn 0 ; } + +DEFINE_SUITE ("kmod_path__parse" , kmod_path__parse);
tools/perf/tests/llvm.c +16 -6
@@ -124,7 +124,7 @@ test_llvm__fetch_bpf_obj(void **p_obj_buf,return ret; } -int test__llvm (struct test *test__maybe_unused ,int subtest) +static int test__llvm (struct test *test__maybe_unused ,int subtest) {int ret;void *obj_buf =NULL ;
@@ -149,12 +149,12 @@ int test__llvm(struct test *test __maybe_unused, int subtest)return ret; } -int test__llvm_subtest_get_nr (void ) +static int test__llvm_subtest_get_nr (void ) {return __LLVM_TESTCASE_MAX; } -const char *test__llvm_subtest_get_desc (int subtest) +static const char *test__llvm_subtest_get_desc (int subtest) {if ((subtest <0 ) || (subtest >= __LLVM_TESTCASE_MAX))return NULL ;
@@ -162,18 +162,28 @@ const char *test__llvm_subtest_get_desc(int subtest) return bpf_source_table[subtest].desc; }#else //HAVE_LIBBPF_SUPPORT -int test__llvm (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__llvm (struct test *test__maybe_unused ,int subtest__maybe_unused ) {return TEST_SKIP ; } -int test__llvm_subtest_get_nr (void ) +static int test__llvm_subtest_get_nr (void ) {return 0 ; } -const char *test__llvm_subtest_get_desc (int subtest__maybe_unused ) +static const char *test__llvm_subtest_get_desc (int subtest__maybe_unused ) {return NULL ; }#endif // HAVE_LIBBPF_SUPPORT + +struct test suite__llvm = { + .desc ="LLVM search and compile" , + .func = test__llvm, + .subtest = { + .skip_if_fail = true, + .get_nr = test__llvm_subtest_get_nr, + .get_desc = test__llvm_subtest_get_desc, + }, +};
tools/perf/tests/maps.c +3 -1
@@ -33,7 +33,7 @@ static int check_maps(struct map_def *merged, unsigned int size, struct maps *mareturn TEST_OK ; } -int test__maps__merge_in (struct test *t__maybe_unused ,int subtest__maybe_unused ) +static int test__maps__merge_in (struct test *t__maybe_unused ,int subtest__maybe_unused ) {struct maps maps;unsigned int i;
@@ -120,3 +120,5 @@ int test__maps__merge_in(struct test *t __maybe_unused, int subtest __maybe_unusmaps__exit (&maps);return TEST_OK ; } + +DEFINE_SUITE ("maps__merge_in" , maps__merge_in);
tools/perf/tests/mem.c +3 -1
@@ -23,7 +23,7 @@ static int check(union perf_mem_data_src data_src,return 0 ; } -int test__mem (struct test *text__maybe_unused ,int subtest__maybe_unused ) +static int test__mem (struct test *text__maybe_unused ,int subtest__maybe_unused ) {int ret =0 ;union perf_mem_data_src src;
@@ -56,3 +56,5 @@ int test__mem(struct test *text __maybe_unused, int subtest __maybe_unused)return ret; } + +DEFINE_SUITE ("Test data source output" , mem);
tools/perf/tests/mem2node.c +3 -1
@@ -43,7 +43,7 @@ static unsigned long *get_bitmap(const char *str, int nbits)return bm && map ? bm :NULL ; } -int test__mem2node (struct test *t__maybe_unused ,int subtest__maybe_unused ) +static int test__mem2node (struct test *t__maybe_unused ,int subtest__maybe_unused ) {struct mem2node map;struct memory_node nodes[3 ];
@@ -77,3 +77,5 @@ int test__mem2node(struct test *t __maybe_unused, int subtest __maybe_unused)mem2node__exit (&map);return 0 ; } + +DEFINE_SUITE ("mem2node" , mem2node);
tools/perf/tests/mmap-basic.c +3 -1
@@ -29,7 +29,7 @@* Then it checks if the number of syscalls reported as perf events by * the kernel corresponds to the number of syscalls made. */ -int test__basic_mmap (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__basic_mmap (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int err =-1 ;union perf_event *event;
@@ -164,3 +164,5 @@ int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unuseperf_thread_map__put (threads);return err; } + +DEFINE_SUITE ("Read samples using the mmap interface" , basic_mmap);
tools/perf/tests/mmap-thread-lookup.c +3 -1
@@ -224,7 +224,7 @@ static int mmap_events(synth_cb synth)* * by using all thread objects. */ -int test__mmap_thread_lookup (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__mmap_thread_lookup (struct test *test__maybe_unused ,int subtest__maybe_unused ) {/* perf_event__synthesize_threads synthesize */ TEST_ASSERT_VAL("failed with sythesizing all",
@@ -236,3 +236,5 @@ int test__mmap_thread_lookup(struct test *test __maybe_unused, int subtest __mayreturn 0 ; } + +DEFINE_SUITE ("Lookup mmap thread" , mmap_thread_lookup);
tools/perf/tests/openat-syscall-all-cpus.c +4 -1
@@ -19,7 +19,8 @@#include "stat.h" #include "util/counts.h" -int test__openat_syscall_event_on_all_cpus (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__openat_syscall_event_on_all_cpus (struct test *test__maybe_unused , +int subtest__maybe_unused ) {int err =-1 , fd, cpu;struct perf_cpu_map *cpus;
@@ -127,3 +128,5 @@ int test__openat_syscall_event_on_all_cpus(struct test *test __maybe_unused, intperf_thread_map__put (threads);return err; } + +DEFINE_SUITE ("Detect openat syscall event on all cpus" , openat_syscall_event_on_all_cpus);
tools/perf/tests/openat-syscall-tp-fields.c +3 -1
@@ -22,7 +22,7 @@#define AT_FDCWD -100#endif -int test__syscall_openat_tp_fields (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__syscall_openat_tp_fields (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct record_opts opts = { .target = {
@@ -142,3 +142,5 @@ int test__syscall_openat_tp_fields(struct test *test __maybe_unused, int subtest out:return err; } + +DEFINE_SUITE ("syscalls:sys_enter_openat event fields" , syscall_openat_tp_fields);
tools/perf/tests/openat-syscall.c +4 -1
@@ -13,7 +13,8 @@#include "tests.h" #include "util/counts.h" -int test__openat_syscall_event (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__openat_syscall_event (struct test *test__maybe_unused , +int subtest__maybe_unused ) {int err =-1 , fd;struct evsel *evsel;
@@ -66,3 +67,5 @@ int test__openat_syscall_event(struct test *test __maybe_unused, int subtest __mperf_thread_map__put (threads);return err; } + +DEFINE_SUITE ("Detect openat syscall event" , openat_syscall_event);
tools/perf/tests/parse-events.c +3 -1
@@ -2276,7 +2276,7 @@ static int test_pmu_events_alias(char *event, char *alias)return test_event (&e); } -int test__parse_events (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__parse_events (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int ret1, ret2 =0 ;char *event, *alias;
@@ -2319,3 +2319,5 @@ do { \return ret2; } + +DEFINE_SUITE ("Parse event definition strings" , parse_events);
tools/perf/tests/parse-metric.c +3 -1
@@ -369,7 +369,7 @@ static int test_metric_group(void)return 0 ; } -int test__parse_metric (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__parse_metric (struct test *test__maybe_unused ,int subtest__maybe_unused ) {TEST_ASSERT_VAL ("IPC failed" ,test_ipc () ==0 );TEST_ASSERT_VAL ("frontend failed" ,test_frontend () ==0 );
@@ -383,3 +383,5 @@ int test__parse_metric(struct test *test __maybe_unused, int subtest __maybe_unu }return 0 ; } + +DEFINE_SUITE ("Parse and process metrics" , parse_metric);
tools/perf/tests/parse-no-sample-id-all.c +3 -1
@@ -67,7 +67,7 @@ struct test_attr_event {* * Return: %0 on success, %-1 if the test fails. */ -int test__parse_no_sample_id_all (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__parse_no_sample_id_all (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int err;
@@ -103,3 +103,5 @@ int test__parse_no_sample_id_all(struct test *test __maybe_unused, int subtest _return 0 ; } + +DEFINE_SUITE ("Parse with no sample_id_all bit set" , parse_no_sample_id_all);
tools/perf/tests/pe-file-parsing.c +4 -2
@@ -68,7 +68,7 @@ static int run_dir(const char *d)return TEST_OK ; } -int test__pe_file_parsing (struct test *test__maybe_unused , +static int test__pe_file_parsing (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct stat st;
@@ -89,10 +89,12 @@ int test__pe_file_parsing(struct test *test __maybe_unused,#else -int test__pe_file_parsing (struct test *test__maybe_unused , +static int test__pe_file_parsing (struct test *test__maybe_unused ,int subtest__maybe_unused ) {return TEST_SKIP ; }#endif + +DEFINE_SUITE ("PE file support" , pe_file_parsing);
tools/perf/tests/perf-hooks.c +3 -1
@@ -26,7 +26,7 @@ static void the_hook(void *_hook_flags)raise (SIGSEGV ); } -int test__perf_hooks (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__perf_hooks (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int hook_flags =0 ;
@@ -45,3 +45,5 @@ int test__perf_hooks(struct test *test __maybe_unused, int subtest __maybe_unusereturn TEST_FAIL ;return TEST_OK ; } + +DEFINE_SUITE ("perf hooks" , perf_hooks);
tools/perf/tests/perf-record.c +3 -1
@@ -41,7 +41,7 @@ static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp)return cpu; } -int test__PERF_RECORD (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__PERF_RECORD (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct record_opts opts = { .target = {
@@ -332,3 +332,5 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus out:return (err <0 || errs >0 ) ?-1 :0 ; } + +DEFINE_SUITE ("PERF_RECORD_* events & perf_sample fields" ,PERF_RECORD );
tools/perf/tests/perf-time-to-tsc.c +8 -2
@@ -45,7 +45,7 @@* %0 is returned, otherwise %-1 is returned. If TSC conversion is not * supported then then the test passes but " (not supported)" is printed. */ -int test__perf_time_to_tsc (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__perf_time_to_tsc (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct record_opts opts = { .mmap_pages =UINT_MAX ,
@@ -185,7 +185,7 @@ int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybereturn err; } -bool test__tsc_is_supported (void ) +static bool test__tsc_is_supported (void ) {/* * Except x86_64/i386 and Arm64, other archs don't support TSC in perf.
@@ -197,3 +197,9 @@ bool test__tsc_is_supported(void)return false;#endif } + +struct test suite__perf_time_to_tsc = { + .desc ="Convert perf time to TSC" , + .func = test__perf_time_to_tsc, + .is_supported = test__tsc_is_supported, +};
tools/perf/tests/pfm.c +13 -3
@@ -189,19 +189,19 @@ static int test__pfm_group(void) }#endif -const char *test__pfm_subtest_get_desc (int i) +static const char *test__pfm_subtest_get_desc (int i) {if (i <0 || i >= (int )ARRAY_SIZE (pfm_testcase_table))return NULL ;return pfm_testcase_table[i].desc; } -int test__pfm_subtest_get_nr (void ) +static int test__pfm_subtest_get_nr (void ) {return (int )ARRAY_SIZE (pfm_testcase_table); } -int test__pfm (struct test *test__maybe_unused ,int i__maybe_unused ) +static int test__pfm (struct test *test__maybe_unused ,int i__maybe_unused ) {#ifdef HAVE_LIBPFM if (i <0 || i >= (int )ARRAY_SIZE (pfm_testcase_table))
@@ -211,3 +211,13 @@ int test__pfm(struct test *test __maybe_unused, int i __maybe_unused)return TEST_SKIP ;#endif } + +struct test suite__pfm = { + .desc ="Test libpfm4 support" , + .func = test__pfm, + .subtest = { + .skip_if_fail = true, + .get_nr = test__pfm_subtest_get_nr, + .get_desc = test__pfm_subtest_get_desc, + } +};
tools/perf/tests/pmu-events.c +15 -4
@@ -1018,7 +1018,7 @@ static const struct { }, }; -const char *test__pmu_events_subtest_get_desc (int subtest) +static const char *test__pmu_events_subtest_get_desc (int subtest) {if (subtest <0 || subtest >= (int )ARRAY_SIZE (pmu_events_testcase_table))
@@ -1026,7 +1026,7 @@ const char *test__pmu_events_subtest_get_desc(int subtest)return pmu_events_testcase_table[subtest].desc; } -const char *test__pmu_events_subtest_skip_reason (int subtest) +static const char *test__pmu_events_subtest_skip_reason (int subtest) {if (subtest <0 || subtest >= (int )ARRAY_SIZE (pmu_events_testcase_table))
@@ -1036,15 +1036,26 @@ const char *test__pmu_events_subtest_skip_reason(int subtest)return "some metrics failed" ; } -int test__pmu_events_subtest_get_nr (void ) +static int test__pmu_events_subtest_get_nr (void ) {return (int )ARRAY_SIZE (pmu_events_testcase_table); } -int test__pmu_events (struct test *test__maybe_unused ,int subtest) +static int test__pmu_events (struct test *test__maybe_unused ,int subtest) {if (subtest <0 || subtest >= (int )ARRAY_SIZE (pmu_events_testcase_table))return TEST_FAIL ;return pmu_events_testcase_table[subtest].func (); } + +struct test suite__pmu_events = { + .desc ="PMU events" , + .func = test__pmu_events, + .subtest = { + .skip_if_fail = false, + .get_nr = test__pmu_events_subtest_get_nr, + .get_desc = test__pmu_events_subtest_get_desc, + .skip_reason = test__pmu_events_subtest_skip_reason, + }, +};
tools/perf/tests/pmu.c +3 -1
@@ -137,7 +137,7 @@ static struct list_head *test_terms_list(void)return &terms; } -int test__pmu (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__pmu (struct test *test__maybe_unused ,int subtest__maybe_unused ) {char *format =test_format_dir_get ();LIST_HEAD (formats);
@@ -177,3 +177,5 @@ int test__pmu(struct test *test __maybe_unused, int subtest __maybe_unused)test_format_dir_put (format);return ret; } + +DEFINE_SUITE ("Parse perf pmu format" , pmu);
tools/perf/tests/python-use.c +3 -1
@@ -9,7 +9,7 @@#include "tests.h" #include "util/debug.h" -int test__python_use (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__python_use (struct test *test__maybe_unused ,int subtest__maybe_unused ) {char *cmd;int ret;
@@ -23,3 +23,5 @@ int test__python_use(struct test *test __maybe_unused, int subtest __maybe_unusefree (cmd);return ret; } + +DEFINE_SUITE ("'import perf' in python" , python_use);
tools/perf/tests/sample-parsing.c +3 -1
@@ -335,7 +335,7 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)* checks sample format bits separately and together. If the test passes %0 is * returned, otherwise %-1 is returned. */ -int test__sample_parsing (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__sample_parsing (struct test *test__maybe_unused ,int subtest__maybe_unused ) {const u64 rf[] = {4 ,5 ,6 ,7 ,12 ,13 ,14 ,15 };u64 sample_type;
@@ -393,3 +393,5 @@ int test__sample_parsing(struct test *test __maybe_unused, int subtest __maybe_ureturn 0 ; } + +DEFINE_SUITE ("Sample parsing" , sample_parsing);
tools/perf/tests/sdt.c +4 -2
@@ -76,7 +76,7 @@ static int search_cached_probe(const char *target,return ret; } -int test__sdt_event (struct test *test__maybe_unused ,int subtests__maybe_unused ) +static int test__sdt_event (struct test *test__maybe_unused ,int subtests__maybe_unused ) {int ret =TEST_FAIL ;char __tempdir[] ="./test-buildid-XXXXXX" ;
@@ -114,9 +114,11 @@ int test__sdt_event(struct test *test __maybe_unused, int subtests __maybe_unuse return ret; }#else -int test__sdt_event (struct test *test__maybe_unused ,int subtests__maybe_unused ) +static int test__sdt_event (struct test *test__maybe_unused ,int subtests__maybe_unused ) {pr_debug ("Skip SDT event test because SDT support is not compiled\n" );return TEST_SKIP ; }#endif + +DEFINE_SUITE ("Probe SDT events" , sdt_event);
tools/perf/tests/stat.c +7 -3
@@ -47,7 +47,7 @@ static int process_stat_config_event(struct perf_tool *tool __maybe_unused,return 0 ; } -int test__synthesize_stat_config (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__synthesize_stat_config (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct perf_stat_config stat_config = { .aggr_mode =AGGR_CORE ,
@@ -77,7 +77,7 @@ static int process_stat_event(struct perf_tool *tool __maybe_unused,return 0 ; } -int test__synthesize_stat (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__synthesize_stat (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct perf_counts_values count;
@@ -103,7 +103,7 @@ static int process_stat_round_event(struct perf_tool *tool __maybe_unused,return 0 ; } -int test__synthesize_stat_round(struct test *test __maybe_unused, int subtest __maybe_unused) +static int test__synthesize_stat_round(struct test *test __maybe_unused, int subtest __maybe_unused) { TEST_ASSERT_VAL("failed to synthesize stat_config", !perf_event__synthesize_stat_round(NULL, 0xdeadbeef, PERF_STAT_ROUND_TYPE__INTERVAL,
@@ -111,3 +111,7 @@ int test__synthesize_stat_round(struct test *test __maybe_unused, int subtest __return 0 ; } + +DEFINE_SUITE ("Synthesize stat config" , synthesize_stat_config); +DEFINE_SUITE ("Synthesize stat" , synthesize_stat); +DEFINE_SUITE ("Synthesize stat round" , synthesize_stat_round);
tools/perf/tests/sw-clock.c +3 -1
@@ -133,7 +133,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)return err; } -int test__sw_clock_freq (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__sw_clock_freq (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int ret;
@@ -143,3 +143,5 @@ int test__sw_clock_freq(struct test *test __maybe_unused, int subtest __maybe_unreturn ret; } + +DEFINE_SUITE ("Software clock events period values" , sw_clock_freq);
tools/perf/tests/switch-tracking.c +3 -1
@@ -321,7 +321,7 @@ static int process_events(struct evlist *evlist,* evsel->core.system_wide and evsel->tracking flags (respectively) with other events * sometimes enabled or disabled. */ -int test__switch_tracking (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__switch_tracking (struct test *test__maybe_unused ,int subtest__maybe_unused ) {const char *sched_switch ="sched:sched_switch" ;struct switch_tracking switch_tracking = { .tids =NULL , };
@@ -588,3 +588,5 @@ int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_ err =-1 ; goto out; } + +DEFINE_SUITE ("Track with sched_switch" , switch_tracking);
tools/perf/tests/task-exit.c +3 -1
@@ -39,7 +39,7 @@ static void workload_exec_failed_signal(int signo __maybe_unused,* if the number of exit event reported by the kernel is 1 or not * in order to check the kernel returns correct number of event. */ -int test__task_exit (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__task_exit (struct test *test__maybe_unused ,int subtest__maybe_unused ) {int err =-1 ;union perf_event *event;
@@ -151,3 +151,5 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unusedevlist__delete (evlist);return err; } + +DEFINE_SUITE ("Number of exit events of a simple workload" , task_exit);
tools/perf/tests/tests.h +3 -19
@@ -41,10 +41,10 @@ struct test { };#define DECLARE_SUITE (name) \ - int test__##name(struct test *test, int subtest) + extern struct test suite__##name;#define DEFINE_SUITE (description, name) \ - static struct test name = { \ + struct test suite__##name = { \ .desc = description, \ .func = test__##name, \ };
@@ -60,9 +60,6 @@ DECLARE_SUITE(perf_evsel__tp_sched_test);DECLARE_SUITE (syscall_openat_tp_fields);DECLARE_SUITE (pmu);DECLARE_SUITE (pmu_events); -const char *test__pmu_events_subtest_get_desc (int subtest); -const char *test__pmu_events_subtest_skip_reason (int subtest); -int test__pmu_events_subtest_get_nr (void );DECLARE_SUITE (attr);DECLARE_SUITE (dso_data);DECLARE_SUITE (dso_data_cache);
@@ -74,9 +71,6 @@ DECLARE_SUITE(bp_signal);DECLARE_SUITE (bp_signal_overflow);DECLARE_SUITE (bp_accounting);DECLARE_SUITE (wp); -const char *test__wp_subtest_get_desc (int subtest); -const char *test__wp_subtest_skip_reason (int subtest); -int test__wp_subtest_get_nr (void );DECLARE_SUITE (task_exit);DECLARE_SUITE (mem);DECLARE_SUITE (sw_clock_freq);
@@ -97,11 +91,7 @@ DECLARE_SUITE(fdarray__add);DECLARE_SUITE (kmod_path__parse);DECLARE_SUITE (thread_map);DECLARE_SUITE (llvm); -const char *test__llvm_subtest_get_desc (int subtest); -int test__llvm_subtest_get_nr (void );DECLARE_SUITE (bpf); -const char *test__bpf_subtest_get_desc (int subtest); -int test__bpf_subtest_get_nr (void );DECLARE_SUITE (session_topology);DECLARE_SUITE (thread_map_synthesize);DECLARE_SUITE (thread_map_remove);
@@ -119,8 +109,6 @@ DECLARE_SUITE(is_printable_array);DECLARE_SUITE (bitmap_print);DECLARE_SUITE (perf_hooks);DECLARE_SUITE (clang); -const char *test__clang_subtest_get_desc (int subtest); -int test__clang_subtest_get_nr (void );DECLARE_SUITE (unit_number__scnprint);DECLARE_SUITE (mem2node);DECLARE_SUITE (maps__merge_in);
@@ -130,18 +118,14 @@ DECLARE_SUITE(api_io);DECLARE_SUITE (demangle_java);DECLARE_SUITE (demangle_ocaml);DECLARE_SUITE (pfm); -const char *test__pfm_subtest_get_desc (int subtest); -int test__pfm_subtest_get_nr (void );DECLARE_SUITE (parse_metric);DECLARE_SUITE (pe_file_parsing);DECLARE_SUITE (expand_cgroup_events);DECLARE_SUITE (perf_time_to_tsc);DECLARE_SUITE (dlfilter); +int test__dwarf_unwind (struct test *test,int subtest);bool test__bp_signal_is_supported (void ); -bool test__bp_account_is_supported (void ); -bool test__wp_is_supported (void ); -bool test__tsc_is_supported (void );#ifdef HAVE_DWARF_UNWIND_SUPPORT struct thread ;
tools/perf/tests/thread-map.c +7 -3
@@ -19,7 +19,7 @@ struct machine;#define NAME (const char *) "perf"#define NAMEUL (unsigned long) NAME -int test__thread_map (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__thread_map (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct perf_thread_map *map;
@@ -86,7 +86,7 @@ static int process_event(struct perf_tool *tool __maybe_unused,return 0 ; } -int test__thread_map_synthesize (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__thread_map_synthesize (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct perf_thread_map *threads;
@@ -106,7 +106,7 @@ int test__thread_map_synthesize(struct test *test __maybe_unused, int subtest __return 0 ; } -int test__thread_map_remove (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__thread_map_remove (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct perf_thread_map *threads;char *str;
@@ -145,3 +145,7 @@ int test__thread_map_remove(struct test *test __maybe_unused, int subtest __maybperf_thread_map__put (threads);return 0 ; } + +DEFINE_SUITE ("Thread map" , thread_map); +DEFINE_SUITE ("Synthesize thread map" , thread_map_synthesize); +DEFINE_SUITE ("Remove thread map" , thread_map_remove);
tools/perf/tests/thread-maps-share.c +3 -1
@@ -4,7 +4,7 @@#include "thread.h" #include "debug.h" -int test__thread_maps_share (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__thread_maps_share (struct test *test__maybe_unused ,int subtest__maybe_unused ) {struct machines machines;struct machine *machine;
@@ -96,3 +96,5 @@ int test__thread_maps_share(struct test *test __maybe_unused, int subtest __maybmachines__exit (&machines);return 0 ; } + +DEFINE_SUITE ("Share thread maps" , thread_maps_share);
tools/perf/tests/time-utils-test.c +3 -1
@@ -131,7 +131,7 @@ static bool test__perf_time__parse_for_ranges(struct test_data *d)return pass; } -int test__time_utils (struct test *t__maybe_unused ,int subtest__maybe_unused ) +static int test__time_utils (struct test *t__maybe_unused ,int subtest__maybe_unused ) {bool pass = true;
@@ -249,3 +249,5 @@ int test__time_utils(struct test *t __maybe_unused, int subtest __maybe_unused)return pass ?0 :TEST_FAIL ; } + +DEFINE_SUITE ("time utils" , time_utils);
tools/perf/tests/topology.c +3 -1
@@ -173,7 +173,7 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)return 0 ; } -int test__session_topology (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__session_topology (struct test *test__maybe_unused ,int subtest__maybe_unused ) {char path[PATH_MAX ];struct perf_cpu_map *map;
@@ -199,3 +199,5 @@ int test__session_topology(struct test *test __maybe_unused, int subtest __maybeunlink (path);return ret; } + +DEFINE_SUITE ("Session topology" , session_topology);
tools/perf/tests/unit_number__scnprintf.c +3 -1
@@ -7,7 +7,7 @@#include "units.h" #include "debug.h" -int test__unit_number__scnprint (struct test *t__maybe_unused ,int subtest__maybe_unused ) +static int test__unit_number__scnprint (struct test *t__maybe_unused ,int subtest__maybe_unused ) {struct {u64 n;
@@ -38,3 +38,5 @@ int test__unit_number__scnprint(struct test *t __maybe_unused, int subtest __mayreturn TEST_OK ; } + +DEFINE_SUITE ("unit_number__scnprintf" , unit_number__scnprint);
tools/perf/tests/vmlinux-kallsyms.c +4 -1
@@ -14,7 +14,8 @@#define UM (x) kallsyms_map->unmap_ip(kallsyms_map, (x)) -int test__vmlinux_matches_kallsyms (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__vmlinux_matches_kallsyms (struct test *test__maybe_unused , +int subtest__maybe_unused ) {int err =-1 ;struct rb_node *nd;
@@ -250,3 +251,5 @@ int test__vmlinux_matches_kallsyms(struct test *test __maybe_unused, int subtestmachine__exit (&vmlinux);return err; } + +DEFINE_SUITE ("vmlinux symtab matches kallsyms" , vmlinux_matches_kallsyms);
tools/perf/tests/wp.c +17 -5
@@ -209,19 +209,19 @@ static struct { }, }; -int test__wp_subtest_get_nr (void ) +static int test__wp_subtest_get_nr (void ) {return (int )ARRAY_SIZE (wp_testcase_table); } -const char *test__wp_subtest_get_desc (int i) +static const char *test__wp_subtest_get_desc (int i) {if (i <0 || i >= (int )ARRAY_SIZE (wp_testcase_table))return NULL ;return wp_testcase_table[i].desc; } -const char *test__wp_subtest_skip_reason (int i) +static const char *test__wp_subtest_skip_reason (int i) {if (i <0 || i >= (int )ARRAY_SIZE (wp_testcase_table))return NULL ;
@@ -230,7 +230,7 @@ const char *test__wp_subtest_skip_reason(int i)return wp_testcase_table[i].skip_msg (); } -int test__wp (struct test *test__maybe_unused ,int i) +static int test__wp (struct test *test__maybe_unused ,int i) {if (i <0 || i >= (int )ARRAY_SIZE (wp_testcase_table))return TEST_FAIL ;
@@ -245,7 +245,7 @@ int test__wp(struct test *test __maybe_unused, int i)/* The s390 so far does not have support for * instruction breakpoint using the perf_event_open() system call. */ -bool test__wp_is_supported (void ) +static bool test__wp_is_supported (void ) {#if defined(__s390x__)return false;
@@ -253,3 +253,15 @@ bool test__wp_is_supported(void)return true;#endif } + +struct test suite__wp = { + .desc ="Watchpoint" , + .func = test__wp, + .is_supported = test__wp_is_supported, + .subtest = { + .skip_if_fail = false, + .get_nr = test__wp_subtest_get_nr, + .get_desc = test__wp_subtest_get_desc, + .skip_reason = test__wp_subtest_skip_reason, + }, +};
Signature · 1 line
2.33.0.464.g1972c5931b-goog
Ian Rogers
reviewerRFC PATCH 5/5 perf test: Rename struct test to test_suite
In reply to Ian RogersThis is to align with kunit's terminology.
--- tools/perf/arch/arm/include/arch-tests.h | 2 +- tools/perf/arch/arm/tests/arch-tests.c | 2 +- tools/perf/arch/arm/tests/vectors-page.c | 2 +- tools/perf/arch/arm64/include/arch-tests.h | 2 +- tools/perf/arch/arm64/tests/arch-tests.c | 2 +- tools/perf/arch/powerpc/include/arch-tests.h | 2 +- tools/perf/arch/powerpc/tests/arch-tests.c | 2 +- tools/perf/arch/x86/include/arch-tests.h | 14 ++++++------- tools/perf/arch/x86/tests/arch-tests.c | 2 +- tools/perf/arch/x86/tests/bp-modify.c | 2 +- tools/perf/arch/x86/tests/insn-x86.c | 2 +- tools/perf/arch/x86/tests/intel-cqm.c | 2 +- .../x86/tests/intel-pt-pkt-decoder-test.c | 2 +- tools/perf/arch/x86/tests/rdpmc.c | 2 +- tools/perf/arch/x86/tests/sample-parsing.c | 2 +- tools/perf/tests/api-io.c | 2 +- tools/perf/tests/attr.c | 2 +- tools/perf/tests/backward-ring-buffer.c | 2 +- tools/perf/tests/bitmap.c | 2 +- tools/perf/tests/bp_account.c | 4 ++-- tools/perf/tests/bp_signal.c | 4 ++-- tools/perf/tests/bp_signal_overflow.c | 4 ++-- tools/perf/tests/bpf.c | 6 +++--- tools/perf/tests/builtin-test.c | 20 +++++++++---------- tools/perf/tests/clang.c | 6 +++--- tools/perf/tests/code-reading.c | 2 +- tools/perf/tests/cpumap.c | 6 +++--- tools/perf/tests/demangle-java-test.c | 2 +- tools/perf/tests/demangle-ocaml-test.c | 2 +- tools/perf/tests/dlfilter-test.c | 2 +- tools/perf/tests/dso-data.c | 6 +++--- tools/perf/tests/dwarf-unwind.c | 2 +- tools/perf/tests/event-times.c | 2 +- tools/perf/tests/event_update.c | 2 +- tools/perf/tests/evsel-roundtrip-name.c | 2 +- tools/perf/tests/evsel-tp-sched.c | 2 +- tools/perf/tests/expand-cgroup.c | 2 +- tools/perf/tests/expr.c | 2 +- tools/perf/tests/fdarray.c | 4 ++-- tools/perf/tests/genelf.c | 2 +- tools/perf/tests/hists_cumulate.c | 2 +- tools/perf/tests/hists_filter.c | 2 +- tools/perf/tests/hists_link.c | 2 +- tools/perf/tests/hists_output.c | 2 +- tools/perf/tests/is_printable_array.c | 2 +- tools/perf/tests/keep-tracking.c | 2 +- tools/perf/tests/kmod-path.c | 2 +- tools/perf/tests/llvm.c | 6 +++--- tools/perf/tests/maps.c | 2 +- tools/perf/tests/mem.c | 2 +- tools/perf/tests/mem2node.c | 2 +- tools/perf/tests/mmap-basic.c | 2 +- tools/perf/tests/mmap-thread-lookup.c | 2 +- tools/perf/tests/openat-syscall-all-cpus.c | 2 +- tools/perf/tests/openat-syscall-tp-fields.c | 2 +- tools/perf/tests/openat-syscall.c | 2 +- tools/perf/tests/parse-events.c | 2 +- tools/perf/tests/parse-metric.c | 2 +- tools/perf/tests/parse-no-sample-id-all.c | 2 +- tools/perf/tests/pe-file-parsing.c | 4 ++-- tools/perf/tests/perf-hooks.c | 2 +- tools/perf/tests/perf-record.c | 2 +- tools/perf/tests/perf-time-to-tsc.c | 4 ++-- tools/perf/tests/pfm.c | 4 ++-- tools/perf/tests/pmu-events.c | 4 ++-- tools/perf/tests/pmu.c | 2 +- tools/perf/tests/python-use.c | 2 +- tools/perf/tests/sample-parsing.c | 2 +- tools/perf/tests/sdt.c | 4 ++-- tools/perf/tests/stat.c | 6 +++--- tools/perf/tests/sw-clock.c | 2 +- tools/perf/tests/switch-tracking.c | 2 +- tools/perf/tests/task-exit.c | 2 +- tools/perf/tests/tests.h | 10 +++++----- tools/perf/tests/thread-map.c | 6 +++--- tools/perf/tests/thread-maps-share.c | 2 +- tools/perf/tests/time-utils-test.c | 2 +- tools/perf/tests/topology.c | 2 +- tools/perf/tests/unit_number__scnprintf.c | 2 +- tools/perf/tests/vmlinux-kallsyms.c | 2 +- tools/perf/tests/wp.c | 4 ++-- 81 files changed, 124 insertions(+), 124 deletions(-)
tools/perf/arch/arm/include/arch-tests.h +1 -1
@@ -2,6 +2,6 @@#ifndef ARCH_TESTS_H #define ARCH_TESTS_H -extern struct test *arch_tests[]; +extern struct test_suite *arch_tests[];#endif
tools/perf/arch/arm/tests/arch-tests.c +1 -1
@@ -8,7 +8,7 @@ DEFINE_SUITE("DWARF unwind", dwarf_unwind);#endif DEFINE_SUITE ("Vectors page" , vectors_page); -struct test *arch_tests[] = { +struct test_suite *arch_tests[] = { #ifdef HAVE_DWARF_UNWIND_SUPPORT &suite__dwarf_unwind, #endif
tools/perf/arch/arm/tests/vectors-page.c +1 -1
@@ -9,7 +9,7 @@#define VECTORS__MAP_NAME "[vectors]" -int test__vectors_page (struct test *test__maybe_unused , +int test__vectors_page (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {void *start, *end;
tools/perf/arch/arm64/include/arch-tests.h +1 -1
@@ -2,6 +2,6 @@#ifndef ARCH_TESTS_H #define ARCH_TESTS_H -extern struct test *arch_tests[]; +extern struct test_suite *arch_tests[];#endif
tools/perf/arch/arm64/tests/arch-tests.c +1 -1
@@ -7,7 +7,7 @@DEFINE_SUITE ("DWARF unwind" , dwarf_unwind);#endif -struct test *arch_tests[] = { +struct test_suite *arch_tests[] = { #ifdef HAVE_DWARF_UNWIND_SUPPORT &suite__dwarf_unwind, #endif
tools/perf/arch/powerpc/include/arch-tests.h +1 -1
@@ -2,6 +2,6 @@#ifndef ARCH_TESTS_H #define ARCH_TESTS_H -extern struct test *arch_tests[]; +extern struct test_suite *arch_tests[];#endif
tools/perf/arch/powerpc/tests/arch-tests.c +1 -1
@@ -7,7 +7,7 @@DEFINE_SUITE ("DWARF unwind" , dwarf_unwind);#endif -struct test *arch_tests[] = { +struct test_suite *arch_tests[] = { #ifdef HAVE_DWARF_UNWIND_SUPPORT &suite__dwarf_unwind, #endif
tools/perf/arch/x86/include/arch-tests.h +7 -7
@@ -2,15 +2,15 @@#ifndef ARCH_TESTS_H #define ARCH_TESTS_H -struct test ; +struct test_suite ;/* Tests */ -int test__rdpmc (struct test *test,int subtest); -int test__insn_x86 (struct test *test,int subtest); -int test__intel_pt_pkt_decoder (struct test *test,int subtest); -int test__bp_modify (struct test *test,int subtest); -int test__x86_sample_parsing (struct test *test,int subtest); +int test__rdpmc (struct test_suite *test,int subtest); +int test__insn_x86 (struct test_suite *test,int subtest); +int test__intel_pt_pkt_decoder (struct test_suite *test,int subtest); +int test__bp_modify (struct test_suite *test,int subtest); +int test__x86_sample_parsing (struct test_suite *test,int subtest); -extern struct test *arch_tests[]; +extern struct test_suite *arch_tests[];#endif
tools/perf/arch/x86/tests/arch-tests.c +1 -1
@@ -16,7 +16,7 @@ DEFINE_SUITE("x86 bp modify", bp_modify);#endif DEFINE_SUITE ("x86 Sample parsing" , x86_sample_parsing); -struct test *arch_tests[] = { +struct test_suite *arch_tests[] = { &suite__rdpmc, #ifdef HAVE_DWARF_UNWIND_SUPPORT &suite__dwarf_unwind,
tools/perf/arch/x86/tests/bp-modify.c +1 -1
@@ -204,7 +204,7 @@ static int bp_modify2(void)return rip == (unsigned long ) bp_1 ?TEST_OK :TEST_FAIL ; } -int test__bp_modify (struct test *test__maybe_unused , +int test__bp_modify (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {TEST_ASSERT_VAL ("modify test 1 failed\n" , !bp_modify1 ());
tools/perf/arch/x86/tests/insn-x86.c +1 -1
@@ -173,7 +173,7 @@ static int test_data_set(struct test_data *dat_set, int x86_64)* verbose (-v) option to see all the instructions and whether or not they * decoded successfully. */ -int test__insn_x86 (struct test *test__maybe_unused ,int subtest__maybe_unused ) +int test__insn_x86 (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int ret =0 ;
tools/perf/arch/x86/tests/intel-cqm.c +1 -1
@@ -37,7 +37,7 @@ static pid_t spawn(void)* the last read counter value to avoid triggering a WARN_ON_ONCE() in * smp_call_function_many() caused by sending IPIs from NMI context. */ -int test__intel_cqm_count_nmi_context (struct test *test__maybe_unused ,int subtest__maybe_unused ) +int test__intel_cqm_count_nmi_context (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct evlist *evlist =NULL ;struct evsel *evsel =NULL ;
tools/perf/arch/x86/tests/intel-pt-pkt-decoder-test.c +1 -1
@@ -289,7 +289,7 @@ static int test_one(struct test_data *d)* This test feeds byte sequences to the Intel PT packet decoder and checks the * results. Changes to the packet context are also checked. */ -int test__intel_pt_pkt_decoder (struct test *test__maybe_unused ,int subtest__maybe_unused ) +int test__intel_pt_pkt_decoder (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct test_data *d = data;int ret;
tools/perf/arch/x86/tests/rdpmc.c +1 -1
@@ -157,7 +157,7 @@ static int __test__rdpmc(void)return 0 ; } -int test__rdpmc (struct test *test__maybe_unused ,int subtest__maybe_unused ) +int test__rdpmc (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int status =0 ;int wret =0 ;
tools/perf/arch/x86/tests/sample-parsing.c +1 -1
@@ -115,7 +115,7 @@ static int do_test(u64 sample_type)* For now, the PERF_SAMPLE_WEIGHT_STRUCT is the only X86 specific sample type. * The test only checks the PERF_SAMPLE_WEIGHT_STRUCT type. */ -int test__x86_sample_parsing (struct test *test__maybe_unused ,int subtest__maybe_unused ) +int test__x86_sample_parsing (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {return do_test (PERF_SAMPLE_WEIGHT_STRUCT ); }
tools/perf/tests/api-io.c +1 -1
@@ -289,7 +289,7 @@ static int test_get_dec(void)return ret; } -static int test__api_io (struct test *test__maybe_unused , +static int test__api_io (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int ret =0 ;
tools/perf/tests/attr.c +1 -1
@@ -178,7 +178,7 @@ static int run_dir(const char *d, const char *perf)return system (cmd) ?TEST_FAIL :TEST_OK ; } -static int test__attr (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__attr (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct stat st;char path_perf[PATH_MAX ];
tools/perf/tests/backward-ring-buffer.c +1 -1
@@ -82,7 +82,7 @@ static int do_test(struct evlist *evlist, int mmap_pages, } -static int test__backward_ring_buffer (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__backward_ring_buffer (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int ret =TEST_SKIP , err, sample_count =0 , comm_count =0 ;char pid[16 ], sbuf[STRERR_BUFSIZE ];
tools/perf/tests/bitmap.c +1 -1
@@ -40,7 +40,7 @@ static int test_bitmap(const char *str)return ret; } -static int test__bitmap_print (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__bitmap_print (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {TEST_ASSERT_VAL ("failed to convert map" ,test_bitmap ("1" ));TEST_ASSERT_VAL ("failed to convert map" ,test_bitmap ("1,5" ));
tools/perf/tests/bp_account.c +2 -2
@@ -173,7 +173,7 @@ static int detect_share(int wp_cnt, int bp_cnt)* we create another watchpoint to ensure * the slot accounting is correct */ -static int test__bp_accounting (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__bp_accounting (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int has_ioctl =detect_ioctl ();int wp_cnt =detect_cnt (false);
@@ -205,7 +205,7 @@ static bool test__bp_account_is_supported(void)#endif } -struct test suite__bp_accounting = { +struct test_suite suite__bp_accounting = { .desc ="Breakpoint accounting" , .func = test__bp_accounting, .is_supported = test__bp_account_is_supported,
tools/perf/tests/bp_signal.c +2 -2
@@ -161,7 +161,7 @@ static long long bp_count(int fd)return count; } -static int test__bp_signal (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__bp_signal (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct sigaction sa;long long count1, count2, count3;
@@ -312,7 +312,7 @@ bool test__bp_signal_is_supported(void)#endif } -struct test suite__bp_signal = { +struct test_suite suite__bp_signal = { .desc ="Breakpoint overflow signal handler" , .func = test__bp_signal, .is_supported = test__bp_signal_is_supported,
tools/perf/tests/bp_signal_overflow.c +2 -2
@@ -59,7 +59,7 @@ static long long bp_count(int fd)#define EXECUTIONS 10000#define THRESHOLD 100 -static int test__bp_signal_overflow (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__bp_signal_overflow (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct perf_event_attr pe;struct sigaction sa;
@@ -134,7 +134,7 @@ static int test__bp_signal_overflow(struct test *test __maybe_unused, int subtesreturn fails ?TEST_FAIL :TEST_OK ; } -struct test suite__bp_signal_overflow = { +struct test_suite suite__bp_signal_overflow = { .desc ="Breakpoint overflow sampling" , .func = test__bp_signal_overflow, .is_supported = test__bp_signal_is_supported,
tools/perf/tests/bpf.c +3 -3
@@ -324,7 +324,7 @@ static int check_env(void)return 0 ; } -static int test__bpf (struct test *test__maybe_unused ,int i) +static int test__bpf (struct test_suite *test__maybe_unused ,int i) {int err;
@@ -354,14 +354,14 @@ static const char *test__bpf_subtest_get_desc(int i __maybe_unused)return NULL ; } -static int test__bpf (struct test *test__maybe_unused ,int i__maybe_unused ) +static int test__bpf (struct test_suite *test__maybe_unused ,int i__maybe_unused ) {pr_debug ("Skip BPF test because BPF support is not compiled\n" );return TEST_SKIP ; }#endif -struct test suite__bpf = { +struct test_suite suite__bpf = { .desc ="BPF filter" , .func = test__bpf, .subtest = {
tools/perf/tests/builtin-test.c +10 -10
@@ -30,11 +30,11 @@static bool dont_fork; -struct test *__weak arch_tests[] = { +struct test_suite *__weak arch_tests[] = {NULL , }; -static struct test *generic_tests[] = { +static struct test_suite *generic_tests[] = { &suite__vmlinux_matches_kallsyms, &suite__openat_syscall_event, &suite__openat_syscall_event_on_all_cpus,
@@ -110,7 +110,7 @@ static struct test *generic_tests[] = { NULL, }; -static struct test **tests[] = { +static struct test_suite **tests[] = { generic_tests, arch_tests, };
@@ -139,7 +139,7 @@ static bool perf_test__matches(const char *desc, int curr, int argc, const charreturn false; } -static int run_test (struct test *test,int subtest) +static int run_test (struct test_suite *test,int subtest) {int status, err =-1 , child = dont_fork ?0 :fork ();char sbuf[STRERR_BUFSIZE ];
@@ -195,7 +195,7 @@ static int run_test(struct test *test, int subtest)for (j =0 ; j <ARRAY_SIZE (tests); j++) \for (k =0 , t = tests[j][k]; tests[j][k]; k++, t = tests[j][k]) -static int test_and_print(struct test *t, bool force_skip, int subtest) +static int test_and_print(struct test_suite *t, bool force_skip, int subtest) {int err;
@@ -321,7 +321,7 @@ struct shell_test {const char *file; }; -static int shell_test__run (struct test *test,int subdir__maybe_unused ) +static int shell_test__run (struct test_suite *test,int subdir__maybe_unused ) {int err;char script[PATH_MAX ];
@@ -363,7 +363,7 @@ static int run_shell_tests(int argc, const char *argv[], int i, int width,for_each_shell_test (entlist, n_dirs, st.dir, ent) {int curr = i++;char desc[256 ]; -struct test test = { +struct test_suite test = { .desc =shell_test__description (desc,sizeof (desc), st.dir, ent->d_name), .func = shell_test__run, .priv = &st,
@@ -391,7 +391,7 @@ static int run_shell_tests(int argc, const char *argv[], int i, int width,static int __cmd_test (int argc,const char *argv[],struct intlist *skiplist) { -struct test *t; +struct test_suite *t;unsigned int j, k;int i =0 ;int width =shell_tests__max_desc_width ();
@@ -500,7 +500,7 @@ static int perf_test__list_shell(int argc, const char **argv, int i)for_each_shell_test (entlist, n_dirs, path, ent) {int curr = i++;char bf[256 ]; -struct test t = { +struct test_suite t = { .desc =shell_test__description (bf,sizeof (bf), path, ent->d_name), };
@@ -520,7 +520,7 @@ static int perf_test__list_shell(int argc, const char **argv, int i)static int perf_test__list (int argc,const char **argv) {unsigned int j, k; -struct test *t; +struct test_suite *t;int i =0 ;for_each_test (j, k, t) {
tools/perf/tests/clang.c +3 -3
@@ -32,12 +32,12 @@ static const char *test__clang_subtest_get_desc(int i) }#ifndef HAVE_LIBCLANGLLVM_SUPPORT -static int test__clang (struct test *test__maybe_unused ,int i__maybe_unused ) +static int test__clang (struct test_suite *test__maybe_unused ,int i__maybe_unused ) {return TEST_SKIP ; }#else -static int test__clang (struct test *test__maybe_unused ,int i) +static int test__clang (struct test_suite *test__maybe_unused ,int i) {if (i <0 || i >= (int )ARRAY_SIZE (clang_testcase_table))return TEST_FAIL ;
@@ -45,7 +45,7 @@ static int test__clang(struct test *test __maybe_unused, int i) }#endif -struct test suite__clang = { +struct test_suite suite__clang = { .desc ="builtin clang support" , .func = test__clang, .subtest = {
tools/perf/tests/code-reading.c +1 -1
@@ -715,7 +715,7 @@ static int do_test_code_reading(bool try_kcore)return err; } -static int test__code_reading (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__code_reading (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int ret;
tools/perf/tests/cpumap.c +3 -3
@@ -75,7 +75,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused, } -static int test__cpu_map_synthesize (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__cpu_map_synthesize (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct perf_cpu_map *cpus;
@@ -111,7 +111,7 @@ static int cpu_map_print(const char *str)return !strcmp (buf, str); } -static int test__cpu_map_print (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__cpu_map_print (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {TEST_ASSERT_VAL ("failed to convert map" ,cpu_map_print ("1" ));TEST_ASSERT_VAL ("failed to convert map" ,cpu_map_print ("1,5" ));
@@ -123,7 +123,7 @@ static int test__cpu_map_print(struct test *test __maybe_unused, int subtest __mreturn 0 ; } -static int test__cpu_map_merge (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__cpu_map_merge (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct perf_cpu_map *a =perf_cpu_map__new ("4,2,1" );struct perf_cpu_map *b =perf_cpu_map__new ("4,5,7" );
tools/perf/tests/demangle-java-test.c +1 -1
@@ -7,7 +7,7 @@#include "debug.h" #include "demangle-java.h" -static int test__demangle_java (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__demangle_java (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int ret =TEST_OK ;char *buf =NULL ;
tools/perf/tests/demangle-ocaml-test.c +1 -1
@@ -7,7 +7,7 @@#include "debug.h" #include "demangle-ocaml.h" -static int test__demangle_ocaml (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__demangle_ocaml (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int ret =TEST_OK ;char *buf =NULL ;
tools/perf/tests/dlfilter-test.c +1 -1
@@ -398,7 +398,7 @@ static void test_data__free(struct test_data *td) } } -static int test__dlfilter (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__dlfilter (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct test_data td = {.fd =-1 };int pid =getpid ();
tools/perf/tests/dso-data.c +3 -3
@@ -113,7 +113,7 @@ static int dso__data_fd(struct dso *dso, struct machine *machine)return fd; } -static int test__dso_data (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__dso_data (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct machine machine;struct dso *dso;
@@ -248,7 +248,7 @@ static int set_fd_limit(int n)return setrlimit (RLIMIT_NOFILE , &rlim); } -static int test__dso_data_cache (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__dso_data_cache (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct machine machine;long nr_end, nr =open_files_cnt ();
@@ -318,7 +318,7 @@ static long new_limit(int count)return ret; } -static int test__dso_data_reopen (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__dso_data_reopen (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct machine machine;long nr_end, nr =open_files_cnt (), lim =new_limit (3 );
tools/perf/tests/dwarf-unwind.c +1 -1
@@ -170,7 +170,7 @@ noinline int test_dwarf_unwind__krava_1(struct thread *thread)return test_dwarf_unwind__krava_2 (thread); } -int test__dwarf_unwind (struct test *test__maybe_unused ,int subtest__maybe_unused ) +int test__dwarf_unwind (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct machine *machine;struct thread *thread;
tools/perf/tests/event-times.c +1 -1
@@ -216,7 +216,7 @@ static int test_times(int (attach)(struct evlist *),* and checks that enabled and running times * match. */ -static int test__event_times (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__event_times (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int err, ret =0 ;
tools/perf/tests/event_update.c +1 -1
@@ -83,7 +83,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused,return 0 ; } -static int test__event_update (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__event_update (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct evsel *evsel;struct event_name tmp;
tools/perf/tests/evsel-roundtrip-name.c +1 -1
@@ -99,7 +99,7 @@ static int __perf_evsel__name_array_test(const char *names[], int nr_names,#define perf_evsel__name_array_test (names, distance) \ __perf_evsel__name_array_test(names, ARRAY_SIZE(names), distance) -static int test__perf_evsel__roundtrip_name_test (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__perf_evsel__roundtrip_name_test (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int err =0 , ret =0 ;
tools/perf/tests/evsel-tp-sched.c +1 -1
@@ -32,7 +32,7 @@ static int evsel__test_field(struct evsel *evsel, const char *name, int size, boreturn ret; } -static int test__perf_evsel__tp_sched_test (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__perf_evsel__tp_sched_test (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct evsel *evsel =evsel__newtp ("sched" ,"sched_switch" );int ret =0 ;
tools/perf/tests/expand-cgroup.c +1 -1
@@ -219,7 +219,7 @@ static int expand_metric_events(void)return ret; } -static int test__expand_cgroup_events (struct test *test__maybe_unused , +static int test__expand_cgroup_events (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int ret;
tools/perf/tests/expr.c +1 -1
@@ -16,7 +16,7 @@ static int test(struct expr_parse_ctx *ctx, const char *e, double val2)return 0 ; } -static int test__expr (struct test *t__maybe_unused ,int subtest__maybe_unused ) +static int test__expr (struct test_suite *t__maybe_unused ,int subtest__maybe_unused ) {struct expr_id_data *val_ptr;const char *p;
tools/perf/tests/fdarray.c +2 -2
@@ -28,7 +28,7 @@ static int fdarray__fprintf_prefix(struct fdarray *fda, const char *prefix, FILEreturn printed +fdarray__fprintf (fda, fp); } -static int test__fdarray__filter (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__fdarray__filter (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int nr_fds, err =TEST_FAIL ;struct fdarray *fda =fdarray__new (5 ,5 );
@@ -89,7 +89,7 @@ static int test__fdarray__filter(struct test *test __maybe_unused, int subtest _return err; } -static int test__fdarray__add (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__fdarray__add (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int err =TEST_FAIL ;struct fdarray *fda =fdarray__new (2 ,2 );
tools/perf/tests/genelf.c +1 -1
@@ -16,7 +16,7 @@#define TEMPL "/tmp/perf-test-XXXXXX" -static int test__jit_write_elf (struct test *test__maybe_unused , +static int test__jit_write_elf (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {#ifdef HAVE_JITDUMP
tools/perf/tests/hists_cumulate.c +1 -1
@@ -689,7 +689,7 @@ static int test4(struct evsel *evsel, struct machine *machine)return err; } -static int test__hists_cumulate (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__hists_cumulate (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int err =TEST_FAIL ;struct machines machines;
tools/perf/tests/hists_filter.c +1 -1
@@ -101,7 +101,7 @@ static int add_hist_entries(struct evlist *evlist,return TEST_FAIL ; } -static int test__hists_filter (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__hists_filter (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int err =TEST_FAIL ;struct machines machines;
tools/perf/tests/hists_link.c +1 -1
@@ -264,7 +264,7 @@ static int validate_link(struct hists *leader, struct hists *other)return __validate_link (leader,0 ) ||__validate_link (other,1 ); } -static int test__hists_link (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__hists_link (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int err =-1 ;struct hists *hists, *first_hists;
tools/perf/tests/hists_output.c +1 -1
@@ -575,7 +575,7 @@ static int test5(struct evsel *evsel, struct machine *machine)return err; } -static int test__hists_output (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__hists_output (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int err =TEST_FAIL ;struct machines machines;
tools/perf/tests/is_printable_array.c +1 -1
@@ -5,7 +5,7 @@#include "debug.h" #include "print_binary.h" -static int test__is_printable_array (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__is_printable_array (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {char buf1[] = {'k' ,'r' ,4 ,'v' ,'a' ,0 };char buf2[] = {'k' ,'r' ,'a' ,'v' ,4 ,0 };
tools/perf/tests/keep-tracking.c +1 -1
@@ -61,7 +61,7 @@ static int find_comm(struct evlist *evlist, const char *comm)* when an event is disabled but a dummy software event is not disabled. If the * test passes %0 is returned, otherwise %-1 is returned. */ -static int test__keep_tracking (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__keep_tracking (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct record_opts opts = { .mmap_pages =UINT_MAX ,
tools/perf/tests/kmod-path.c +1 -1
@@ -47,7 +47,7 @@ static int test_is_kernel_module(const char *path, int cpumode, bool expect)#define M (path, c, e) \ TEST_ASSERT_VAL("failed", !test_is_kernel_module(path, c, e)) -static int test__kmod_path__parse (struct test *t__maybe_unused ,int subtest__maybe_unused ) +static int test__kmod_path__parse (struct test_suite *t__maybe_unused ,int subtest__maybe_unused ) {/* path alloc_name kmod comp name */ T ("/xxxx/xxxx/x-x.ko" , true , true,0 ,"[x_x]" );
tools/perf/tests/llvm.c +3 -3
@@ -124,7 +124,7 @@ test_llvm__fetch_bpf_obj(void **p_obj_buf,return ret; } -static int test__llvm (struct test *test__maybe_unused ,int subtest) +static int test__llvm (struct test_suite *test__maybe_unused ,int subtest) {int ret;void *obj_buf =NULL ;
@@ -162,7 +162,7 @@ static const char *test__llvm_subtest_get_desc(int subtest) return bpf_source_table[subtest].desc; }#else //HAVE_LIBBPF_SUPPORT -static int test__llvm (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__llvm (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {return TEST_SKIP ; }
@@ -178,7 +178,7 @@ static const char *test__llvm_subtest_get_desc(int subtest __maybe_unused) }#endif // HAVE_LIBBPF_SUPPORT -struct test suite__llvm = { +struct test_suite suite__llvm = { .desc ="LLVM search and compile" , .func = test__llvm, .subtest = {
tools/perf/tests/maps.c +1 -1
@@ -33,7 +33,7 @@ static int check_maps(struct map_def *merged, unsigned int size, struct maps *mareturn TEST_OK ; } -static int test__maps__merge_in (struct test *t__maybe_unused ,int subtest__maybe_unused ) +static int test__maps__merge_in (struct test_suite *t__maybe_unused ,int subtest__maybe_unused ) {struct maps maps;unsigned int i;
tools/perf/tests/mem.c +1 -1
@@ -23,7 +23,7 @@ static int check(union perf_mem_data_src data_src,return 0 ; } -static int test__mem (struct test *text__maybe_unused ,int subtest__maybe_unused ) +static int test__mem (struct test_suite *text__maybe_unused ,int subtest__maybe_unused ) {int ret =0 ;union perf_mem_data_src src;
tools/perf/tests/mem2node.c +1 -1
@@ -43,7 +43,7 @@ static unsigned long *get_bitmap(const char *str, int nbits)return bm && map ? bm :NULL ; } -static int test__mem2node (struct test *t__maybe_unused ,int subtest__maybe_unused ) +static int test__mem2node (struct test_suite *t__maybe_unused ,int subtest__maybe_unused ) {struct mem2node map;struct memory_node nodes[3 ];
tools/perf/tests/mmap-basic.c +1 -1
@@ -29,7 +29,7 @@* Then it checks if the number of syscalls reported as perf events by * the kernel corresponds to the number of syscalls made. */ -static int test__basic_mmap (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__basic_mmap (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int err =-1 ;union perf_event *event;
tools/perf/tests/mmap-thread-lookup.c +1 -1
@@ -224,7 +224,7 @@ static int mmap_events(synth_cb synth)* * by using all thread objects. */ -static int test__mmap_thread_lookup (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__mmap_thread_lookup (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {/* perf_event__synthesize_threads synthesize */ TEST_ASSERT_VAL("failed with sythesizing all",
tools/perf/tests/openat-syscall-all-cpus.c +1 -1
@@ -19,7 +19,7 @@#include "stat.h" #include "util/counts.h" -static int test__openat_syscall_event_on_all_cpus (struct test *test__maybe_unused , +static int test__openat_syscall_event_on_all_cpus (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int err =-1 , fd, cpu;
tools/perf/tests/openat-syscall-tp-fields.c +1 -1
@@ -22,7 +22,7 @@#define AT_FDCWD -100#endif -static int test__syscall_openat_tp_fields (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__syscall_openat_tp_fields (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct record_opts opts = { .target = {
tools/perf/tests/openat-syscall.c +1 -1
@@ -13,7 +13,7 @@#include "tests.h" #include "util/counts.h" -static int test__openat_syscall_event (struct test *test__maybe_unused , +static int test__openat_syscall_event (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int err =-1 , fd;
tools/perf/tests/parse-events.c +1 -1
@@ -2276,7 +2276,7 @@ static int test_pmu_events_alias(char *event, char *alias)return test_event (&e); } -static int test__parse_events (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__parse_events (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int ret1, ret2 =0 ;char *event, *alias;
tools/perf/tests/parse-metric.c +1 -1
@@ -369,7 +369,7 @@ static int test_metric_group(void)return 0 ; } -static int test__parse_metric (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__parse_metric (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {TEST_ASSERT_VAL ("IPC failed" ,test_ipc () ==0 );TEST_ASSERT_VAL ("frontend failed" ,test_frontend () ==0 );
tools/perf/tests/parse-no-sample-id-all.c +1 -1
@@ -67,7 +67,7 @@ struct test_attr_event {* * Return: %0 on success, %-1 if the test fails. */ -static int test__parse_no_sample_id_all (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__parse_no_sample_id_all (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int err;
tools/perf/tests/pe-file-parsing.c +2 -2
@@ -68,7 +68,7 @@ static int run_dir(const char *d)return TEST_OK ; } -static int test__pe_file_parsing (struct test *test__maybe_unused , +static int test__pe_file_parsing (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct stat st;
@@ -89,7 +89,7 @@ static int test__pe_file_parsing(struct test *test __maybe_unused,#else -static int test__pe_file_parsing (struct test *test__maybe_unused , +static int test__pe_file_parsing (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {return TEST_SKIP ;
tools/perf/tests/perf-hooks.c +1 -1
@@ -26,7 +26,7 @@ static void the_hook(void *_hook_flags)raise (SIGSEGV ); } -static int test__perf_hooks (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__perf_hooks (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int hook_flags =0 ;
tools/perf/tests/perf-record.c +1 -1
@@ -41,7 +41,7 @@ static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp)return cpu; } -static int test__PERF_RECORD (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__PERF_RECORD (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct record_opts opts = { .target = {
tools/perf/tests/perf-time-to-tsc.c +2 -2
@@ -45,7 +45,7 @@* %0 is returned, otherwise %-1 is returned. If TSC conversion is not * supported then then the test passes but " (not supported)" is printed. */ -static int test__perf_time_to_tsc (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__perf_time_to_tsc (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct record_opts opts = { .mmap_pages =UINT_MAX ,
@@ -198,7 +198,7 @@ static bool test__tsc_is_supported(void)#endif } -struct test suite__perf_time_to_tsc = { +struct test_suite suite__perf_time_to_tsc = { .desc ="Convert perf time to TSC" , .func = test__perf_time_to_tsc, .is_supported = test__tsc_is_supported,
tools/perf/tests/pfm.c +2 -2
@@ -201,7 +201,7 @@ static int test__pfm_subtest_get_nr(void)return (int )ARRAY_SIZE (pfm_testcase_table); } -static int test__pfm (struct test *test__maybe_unused ,int i__maybe_unused ) +static int test__pfm (struct test_suite *test__maybe_unused ,int i__maybe_unused ) {#ifdef HAVE_LIBPFM if (i <0 || i >= (int )ARRAY_SIZE (pfm_testcase_table))
@@ -212,7 +212,7 @@ static int test__pfm(struct test *test __maybe_unused, int i __maybe_unused)#endif } -struct test suite__pfm = { +struct test_suite suite__pfm = { .desc ="Test libpfm4 support" , .func = test__pfm, .subtest = {
tools/perf/tests/pmu-events.c +2 -2
@@ -1041,7 +1041,7 @@ static int test__pmu_events_subtest_get_nr(void)return (int )ARRAY_SIZE (pmu_events_testcase_table); } -static int test__pmu_events (struct test *test__maybe_unused ,int subtest) +static int test__pmu_events (struct test_suite *test__maybe_unused ,int subtest) {if (subtest <0 || subtest >= (int )ARRAY_SIZE (pmu_events_testcase_table))
@@ -1049,7 +1049,7 @@ static int test__pmu_events(struct test *test __maybe_unused, int subtest)return pmu_events_testcase_table[subtest].func (); } -struct test suite__pmu_events = { +struct test_suite suite__pmu_events = { .desc ="PMU events" , .func = test__pmu_events, .subtest = {
tools/perf/tests/pmu.c +1 -1
@@ -137,7 +137,7 @@ static struct list_head *test_terms_list(void)return &terms; } -static int test__pmu (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__pmu (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {char *format =test_format_dir_get ();LIST_HEAD (formats);
tools/perf/tests/python-use.c +1 -1
@@ -9,7 +9,7 @@#include "tests.h" #include "util/debug.h" -static int test__python_use (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__python_use (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {char *cmd;int ret;
tools/perf/tests/sample-parsing.c +1 -1
@@ -335,7 +335,7 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)* checks sample format bits separately and together. If the test passes %0 is * returned, otherwise %-1 is returned. */ -static int test__sample_parsing (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__sample_parsing (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {const u64 rf[] = {4 ,5 ,6 ,7 ,12 ,13 ,14 ,15 };u64 sample_type;
tools/perf/tests/sdt.c +2 -2
@@ -76,7 +76,7 @@ static int search_cached_probe(const char *target,return ret; } -static int test__sdt_event (struct test *test__maybe_unused ,int subtests__maybe_unused ) +static int test__sdt_event (struct test_suite *test__maybe_unused ,int subtests__maybe_unused ) {int ret =TEST_FAIL ;char __tempdir[] ="./test-buildid-XXXXXX" ;
@@ -114,7 +114,7 @@ static int test__sdt_event(struct test *test __maybe_unused, int subtests __mayb return ret; }#else -static int test__sdt_event (struct test *test__maybe_unused ,int subtests__maybe_unused ) +static int test__sdt_event (struct test_suite *test__maybe_unused ,int subtests__maybe_unused ) {pr_debug ("Skip SDT event test because SDT support is not compiled\n" );return TEST_SKIP ;
tools/perf/tests/stat.c +3 -3
@@ -47,7 +47,7 @@ static int process_stat_config_event(struct perf_tool *tool __maybe_unused,return 0 ; } -static int test__synthesize_stat_config (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__synthesize_stat_config (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct perf_stat_config stat_config = { .aggr_mode =AGGR_CORE ,
@@ -77,7 +77,7 @@ static int process_stat_event(struct perf_tool *tool __maybe_unused,return 0 ; } -static int test__synthesize_stat (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__synthesize_stat (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct perf_counts_values count;
@@ -103,7 +103,7 @@ static int process_stat_round_event(struct perf_tool *tool __maybe_unused,return 0 ; } -static int test__synthesize_stat_round(struct test *test __maybe_unused, int subtest __maybe_unused) +static int test__synthesize_stat_round(struct test_suite *test __maybe_unused, int subtest __maybe_unused) { TEST_ASSERT_VAL("failed to synthesize stat_config", !perf_event__synthesize_stat_round(NULL, 0xdeadbeef, PERF_STAT_ROUND_TYPE__INTERVAL,
tools/perf/tests/sw-clock.c +1 -1
@@ -133,7 +133,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)return err; } -static int test__sw_clock_freq (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__sw_clock_freq (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int ret;
tools/perf/tests/switch-tracking.c +1 -1
@@ -321,7 +321,7 @@ static int process_events(struct evlist *evlist,* evsel->core.system_wide and evsel->tracking flags (respectively) with other events * sometimes enabled or disabled. */ -static int test__switch_tracking (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__switch_tracking (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {const char *sched_switch ="sched:sched_switch" ;struct switch_tracking switch_tracking = { .tids =NULL , };
tools/perf/tests/task-exit.c +1 -1
@@ -39,7 +39,7 @@ static void workload_exec_failed_signal(int signo __maybe_unused,* if the number of exit event reported by the kernel is 1 or not * in order to check the kernel returns correct number of event. */ -static int test__task_exit (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__task_exit (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int err =-1 ;union perf_event *event;
tools/perf/tests/tests.h +5 -5
@@ -27,9 +27,9 @@ enum { TEST_SKIP = -2, }; -struct test { +struct test_suite {const char *desc; -int (*func)(struct test *test,int subtest); +int (*func)(struct test_suite *test,int subtest);struct {bool skip_if_fail;int (*get_nr)(void );
@@ -41,10 +41,10 @@ struct test { };#define DECLARE_SUITE (name) \ - extern struct test suite__##name; + extern struct test_suite suite__##name;#define DEFINE_SUITE (description, name) \ - struct test suite__##name = { \ + struct test_suite suite__##name = { \ .desc = description, \ .func = test__##name, \ };
@@ -124,7 +124,7 @@ DECLARE_SUITE(expand_cgroup_events);DECLARE_SUITE (perf_time_to_tsc);DECLARE_SUITE (dlfilter); -int test__dwarf_unwind (struct test *test,int subtest); +int test__dwarf_unwind (struct test_suite *test,int subtest);bool test__bp_signal_is_supported (void );#ifdef HAVE_DWARF_UNWIND_SUPPORT
tools/perf/tests/thread-map.c +3 -3
@@ -19,7 +19,7 @@ struct machine;#define NAME (const char *) "perf"#define NAMEUL (unsigned long) NAME -static int test__thread_map (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__thread_map (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct perf_thread_map *map;
@@ -86,7 +86,7 @@ static int process_event(struct perf_tool *tool __maybe_unused,return 0 ; } -static int test__thread_map_synthesize (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__thread_map_synthesize (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct perf_thread_map *threads;
@@ -106,7 +106,7 @@ static int test__thread_map_synthesize(struct test *test __maybe_unused, int subreturn 0 ; } -static int test__thread_map_remove (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__thread_map_remove (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct perf_thread_map *threads;char *str;
tools/perf/tests/thread-maps-share.c +1 -1
@@ -4,7 +4,7 @@#include "thread.h" #include "debug.h" -static int test__thread_maps_share (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__thread_maps_share (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {struct machines machines;struct machine *machine;
tools/perf/tests/time-utils-test.c +1 -1
@@ -131,7 +131,7 @@ static bool test__perf_time__parse_for_ranges(struct test_data *d)return pass; } -static int test__time_utils (struct test *t__maybe_unused ,int subtest__maybe_unused ) +static int test__time_utils (struct test_suite *t__maybe_unused ,int subtest__maybe_unused ) {bool pass = true;
tools/perf/tests/topology.c +1 -1
@@ -173,7 +173,7 @@ static int check_cpu_topology(char *path, struct perf_cpu_map *map)return 0 ; } -static int test__session_topology (struct test *test__maybe_unused ,int subtest__maybe_unused ) +static int test__session_topology (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {char path[PATH_MAX ];struct perf_cpu_map *map;
tools/perf/tests/unit_number__scnprintf.c +1 -1
@@ -7,7 +7,7 @@#include "units.h" #include "debug.h" -static int test__unit_number__scnprint (struct test *t__maybe_unused ,int subtest__maybe_unused ) +static int test__unit_number__scnprint (struct test_suite *t__maybe_unused ,int subtest__maybe_unused ) {struct {u64 n;
tools/perf/tests/vmlinux-kallsyms.c +1 -1
@@ -14,7 +14,7 @@#define UM (x) kallsyms_map->unmap_ip(kallsyms_map, (x)) -static int test__vmlinux_matches_kallsyms (struct test *test__maybe_unused , +static int test__vmlinux_matches_kallsyms (struct test_suite *test__maybe_unused ,int subtest__maybe_unused ) {int err =-1 ;
tools/perf/tests/wp.c +2 -2
@@ -230,7 +230,7 @@ static const char *test__wp_subtest_skip_reason(int i)return wp_testcase_table[i].skip_msg (); } -static int test__wp (struct test *test__maybe_unused ,int i) +static int test__wp (struct test_suite *test__maybe_unused ,int i) {if (i <0 || i >= (int )ARRAY_SIZE (wp_testcase_table))return TEST_FAIL ;
@@ -254,7 +254,7 @@ static bool test__wp_is_supported(void)#endif } -struct test suite__wp = { +struct test_suite suite__wp = { .desc ="Watchpoint" , .func = test__wp, .is_supported = test__wp_is_supported,
Signature · 1 line
2.33.0.464.g1972c5931b-goog
Quoted 15 lines · Ian Rogers
Perf test uses its own structs and code layout that differs from kunit that was more recently introduced to the kernel. Besides consistency, it is hoped that moving in the direction of kunit style will enable reuse of infrastructure like test output formatting for continuous testing systems. For example:
https://lore.kernel.org/linux-kselftest/CA+GJov6tdjvY9x12JsJT14qn6c7NViJxqaJk+r-K1YJzPggFDQ@mail.gmail.com/The motivation for this restructuring comes from wanting to be able to tag tests with a size:
https://lore.kernel.org/linux-perf-users/CAP-5=fWmGyuqFKc-EMP3rbmTkjZ3MS+YSajGZfeRMc38HS82gw@mail.gmail.com/
To have more exhaustive and slower running tests. This isn't something kunit currently supports, nor is the execution of python and shell tests, but it seems sensible to work on an approach with kunit rather to invent a new wheel inside of perf.
Quoted 4 lines
These initial patches are just refactoring the main test suite definitions to be in a more kunit style. Kunit isn't depended upon, it is hoped that this can be done in later patches for the sake of consistency.
seems good.. how far away from kunit is the code now?
Quoted 10 lines
v1. Built/tested on x86.
Ian Rogers (5):
perf test: Use macro for "suite" declarations perf test: Use macro for "suite" definitions perf test: Make each test/suite its own struct. perf test: Move each test suite struct to its test perf test: Rename struct test totest_suite
Quoted 7 lines
tools/perf/arch/arm/include/arch-tests.h | 2 +- tools/perf/arch/arm/tests/arch-tests.c | 21 +- tools/perf/arch/arm/tests/vectors-page.c | 2 +- tools/perf/arch/arm64/include/arch-tests.h | 2 +- tools/perf/arch/arm64/tests/arch-tests.c | 15 +- tools/perf/arch/powerpc/include/arch-tests.h | 2 +- tools/perf/arch/powerpc/tests/arch-tests.c | 15 +-
I can run/test this on ppc/arm if you don't have any
jirka
Quoted 79 lines
tools/perf/arch/x86/include/arch-tests.h | 14 +- tools/perf/arch/x86/tests/arch-tests.c | 47 +- tools/perf/arch/x86/tests/bp-modify.c | 2 +- tools/perf/arch/x86/tests/insn-x86.c | 2 +- tools/perf/arch/x86/tests/intel-cqm.c | 2 +- .../x86/tests/intel-pt-pkt-decoder-test.c | 2 +- tools/perf/arch/x86/tests/rdpmc.c | 2 +- tools/perf/arch/x86/tests/sample-parsing.c | 2 +- tools/perf/tests/api-io.c | 6 +- tools/perf/tests/attr.c | 4 +- tools/perf/tests/backward-ring-buffer.c | 4 +- tools/perf/tests/bitmap.c | 4 +- tools/perf/tests/bp_account.c | 10 +- tools/perf/tests/bp_signal.c | 8 +- tools/perf/tests/bp_signal_overflow.c | 8 +- tools/perf/tests/bpf.c | 22 +- tools/perf/tests/builtin-test.c | 441 ++++-------------- tools/perf/tests/clang.c | 18 +- tools/perf/tests/code-reading.c | 4 +- tools/perf/tests/cpumap.c | 10 +- tools/perf/tests/demangle-java-test.c | 4 +- tools/perf/tests/demangle-ocaml-test.c | 4 +- tools/perf/tests/dlfilter-test.c | 4 +- tools/perf/tests/dso-data.c | 10 +- tools/perf/tests/dwarf-unwind.c | 2 +- tools/perf/tests/event-times.c | 4 +- tools/perf/tests/event_update.c | 4 +- tools/perf/tests/evsel-roundtrip-name.c | 4 +- tools/perf/tests/evsel-tp-sched.c | 4 +- tools/perf/tests/expand-cgroup.c | 6 +- tools/perf/tests/expr.c | 4 +- tools/perf/tests/fdarray.c | 7 +- tools/perf/tests/genelf.c | 6 +- tools/perf/tests/hists_cumulate.c | 4 +- tools/perf/tests/hists_filter.c | 4 +- tools/perf/tests/hists_link.c | 4 +- tools/perf/tests/hists_output.c | 4 +- tools/perf/tests/is_printable_array.c | 4 +- tools/perf/tests/keep-tracking.c | 4 +- tools/perf/tests/kmod-path.c | 4 +- tools/perf/tests/llvm.c | 22 +- tools/perf/tests/maps.c | 4 +- tools/perf/tests/mem.c | 4 +- tools/perf/tests/mem2node.c | 4 +- tools/perf/tests/mmap-basic.c | 4 +- tools/perf/tests/mmap-thread-lookup.c | 4 +- tools/perf/tests/openat-syscall-all-cpus.c | 5 +- tools/perf/tests/openat-syscall-tp-fields.c | 4 +- tools/perf/tests/openat-syscall.c | 5 +- tools/perf/tests/parse-events.c | 4 +- tools/perf/tests/parse-metric.c | 4 +- tools/perf/tests/parse-no-sample-id-all.c | 4 +- tools/perf/tests/pe-file-parsing.c | 6 +- tools/perf/tests/perf-hooks.c | 4 +- tools/perf/tests/perf-record.c | 4 +- tools/perf/tests/perf-time-to-tsc.c | 10 +- tools/perf/tests/pfm.c | 16 +- tools/perf/tests/pmu-events.c | 19 +- tools/perf/tests/pmu.c | 4 +- tools/perf/tests/python-use.c | 4 +- tools/perf/tests/sample-parsing.c | 4 +- tools/perf/tests/sdt.c | 6 +- tools/perf/tests/stat.c | 10 +- tools/perf/tests/sw-clock.c | 4 +- tools/perf/tests/switch-tracking.c | 4 +- tools/perf/tests/task-exit.c | 4 +- tools/perf/tests/tests.h | 179 ++++--- tools/perf/tests/thread-map.c | 10 +- tools/perf/tests/thread-maps-share.c | 4 +- tools/perf/tests/time-utils-test.c | 4 +- tools/perf/tests/topology.c | 4 +- tools/perf/tests/unit_number__scnprintf.c | 4 +- tools/perf/tests/vmlinux-kallsyms.c | 5 +- tools/perf/tests/wp.c | 22 +- 81 files changed, 543 insertions(+), 618 deletions(-)Signature · 1 line
2.33.0.464.g1972c5931b-goog
Quoted 17 lines · Jiri Olsa
Quoted 15 lines · Ian Rogers
Perf test uses its own structs and code layout that differs from kunit that was more recently introduced to the kernel. Besides consistency, it is hoped that moving in the direction of kunit style will enable reuse of infrastructure like test output formatting for continuous testing systems. For example:
https://lore.kernel.org/linux-kselftest/CA+GJov6tdjvY9x12JsJT14qn6c7NViJxqaJk+r-K1YJzPggFDQ@mail.gmail.com/The motivation for this restructuring comes from wanting to be able to tag tests with a size:
https://lore.kernel.org/linux-perf-users/CAP-5=fWmGyuqFKc-EMP3rbmTkjZ3MS+YSajGZfeRMc38HS82gw@mail.gmail.com/
To have more exhaustive and slower running tests. This isn't something kunit currently supports, nor is the execution of python and shell tests, but it seems sensible to work on an approach with kunit rather to invent a new wheel inside of perf.
Quoted 6 lines
Quoted 4 lines
These initial patches are just refactoring the main test suite definitions to be in a more kunit style. Kunit isn't depended upon, it is hoped that this can be done in later patches for the sake of consistency.
seems good.. how far away from kunit is the code now?
For context, here's what an example kunit test looks like:
https://elixir.bootlin.com/linux/latest/source/lib/kunit/kunit-example-test.c
So having the hierarchy of test_suite => list of tests is a big step towards that.
A brief skim suggests we still have test funcs like __test_bpf(int idx), whereas normally KUnit has each test case as its own function. In the case of bpf.c, it has a test table, so it'd probably use
https://www.kernel.org/doc/html/latest/dev-tools/kunit/usage.html#parameterized-testing
So overall there would probably be a pretty big delta if/when moving to KUnit, but it should be quite a bit easier after these patches.
Quoted 103 lines
Quoted 11 lines
v1. Built/tested on x86.
Ian Rogers (5):
perf test: Use macro for "suite" declarations perf test: Use macro for "suite" definitions perf test: Make each test/suite its own struct. perf test: Move each test suite struct to its test perf test: Rename struct test totest_suiteQuoted 7 lines
tools/perf/arch/arm/include/arch-tests.h | 2 +- tools/perf/arch/arm/tests/arch-tests.c | 21 +- tools/perf/arch/arm/tests/vectors-page.c | 2 +- tools/perf/arch/arm64/include/arch-tests.h | 2 +- tools/perf/arch/arm64/tests/arch-tests.c | 15 +- tools/perf/arch/powerpc/include/arch-tests.h | 2 +- tools/perf/arch/powerpc/tests/arch-tests.c | 15 +-I can run/test this on ppc/arm if you don't have any
jirka
Quoted 79 lines
tools/perf/arch/x86/include/arch-tests.h | 14 +- tools/perf/arch/x86/tests/arch-tests.c | 47 +- tools/perf/arch/x86/tests/bp-modify.c | 2 +- tools/perf/arch/x86/tests/insn-x86.c | 2 +- tools/perf/arch/x86/tests/intel-cqm.c | 2 +- .../x86/tests/intel-pt-pkt-decoder-test.c | 2 +- tools/perf/arch/x86/tests/rdpmc.c | 2 +- tools/perf/arch/x86/tests/sample-parsing.c | 2 +- tools/perf/tests/api-io.c | 6 +- tools/perf/tests/attr.c | 4 +- tools/perf/tests/backward-ring-buffer.c | 4 +- tools/perf/tests/bitmap.c | 4 +- tools/perf/tests/bp_account.c | 10 +- tools/perf/tests/bp_signal.c | 8 +- tools/perf/tests/bp_signal_overflow.c | 8 +- tools/perf/tests/bpf.c | 22 +- tools/perf/tests/builtin-test.c | 441 ++++-------------- tools/perf/tests/clang.c | 18 +- tools/perf/tests/code-reading.c | 4 +- tools/perf/tests/cpumap.c | 10 +- tools/perf/tests/demangle-java-test.c | 4 +- tools/perf/tests/demangle-ocaml-test.c | 4 +- tools/perf/tests/dlfilter-test.c | 4 +- tools/perf/tests/dso-data.c | 10 +- tools/perf/tests/dwarf-unwind.c | 2 +- tools/perf/tests/event-times.c | 4 +- tools/perf/tests/event_update.c | 4 +- tools/perf/tests/evsel-roundtrip-name.c | 4 +- tools/perf/tests/evsel-tp-sched.c | 4 +- tools/perf/tests/expand-cgroup.c | 6 +- tools/perf/tests/expr.c | 4 +- tools/perf/tests/fdarray.c | 7 +- tools/perf/tests/genelf.c | 6 +- tools/perf/tests/hists_cumulate.c | 4 +- tools/perf/tests/hists_filter.c | 4 +- tools/perf/tests/hists_link.c | 4 +- tools/perf/tests/hists_output.c | 4 +- tools/perf/tests/is_printable_array.c | 4 +- tools/perf/tests/keep-tracking.c | 4 +- tools/perf/tests/kmod-path.c | 4 +- tools/perf/tests/llvm.c | 22 +- tools/perf/tests/maps.c | 4 +- tools/perf/tests/mem.c | 4 +- tools/perf/tests/mem2node.c | 4 +- tools/perf/tests/mmap-basic.c | 4 +- tools/perf/tests/mmap-thread-lookup.c | 4 +- tools/perf/tests/openat-syscall-all-cpus.c | 5 +- tools/perf/tests/openat-syscall-tp-fields.c | 4 +- tools/perf/tests/openat-syscall.c | 5 +- tools/perf/tests/parse-events.c | 4 +- tools/perf/tests/parse-metric.c | 4 +- tools/perf/tests/parse-no-sample-id-all.c | 4 +- tools/perf/tests/pe-file-parsing.c | 6 +- tools/perf/tests/perf-hooks.c | 4 +- tools/perf/tests/perf-record.c | 4 +- tools/perf/tests/perf-time-to-tsc.c | 10 +- tools/perf/tests/pfm.c | 16 +- tools/perf/tests/pmu-events.c | 19 +- tools/perf/tests/pmu.c | 4 +- tools/perf/tests/python-use.c | 4 +- tools/perf/tests/sample-parsing.c | 4 +- tools/perf/tests/sdt.c | 6 +- tools/perf/tests/stat.c | 10 +- tools/perf/tests/sw-clock.c | 4 +- tools/perf/tests/switch-tracking.c | 4 +- tools/perf/tests/task-exit.c | 4 +- tools/perf/tests/tests.h | 179 ++++--- tools/perf/tests/thread-map.c | 10 +- tools/perf/tests/thread-maps-share.c | 4 +- tools/perf/tests/time-utils-test.c | 4 +- tools/perf/tests/topology.c | 4 +- tools/perf/tests/unit_number__scnprintf.c | 4 +- tools/perf/tests/vmlinux-kallsyms.c | 5 +- tools/perf/tests/wp.c | 22 +- 81 files changed, 543 insertions(+), 618 deletions(-)--
2.33.0.464.g1972c5931b-goog
Ian Rogers
reviewerQuoted 17 lines · Jiri Olsa
Quoted 15 lines · Ian Rogers
Perf test uses its own structs and code layout that differs from kunit that was more recently introduced to the kernel. Besides consistency, it is hoped that moving in the direction of kunit style will enable reuse of infrastructure like test output formatting for continuous testing systems. For example:
https://lore.kernel.org/linux-kselftest/CA+GJov6tdjvY9x12JsJT14qn6c7NViJxqaJk+r-K1YJzPggFDQ@mail.gmail.com/The motivation for this restructuring comes from wanting to be able to tag tests with a size:
https://lore.kernel.org/linux-perf-users/CAP-5=fWmGyuqFKc-EMP3rbmTkjZ3MS+YSajGZfeRMc38HS82gw@mail.gmail.com/
To have more exhaustive and slower running tests. This isn't something kunit currently supports, nor is the execution of python and shell tests, but it seems sensible to work on an approach with kunit rather to invent a new wheel inside of perf.
Quoted 6 lines
Quoted 4 lines
These initial patches are just refactoring the main test suite definitions to be in a more kunit style. Kunit isn't depended upon, it is hoped that this can be done in later patches for the sake of consistency.
seems good.. how far away from kunit is the code now?
Thanks Jiri, It is a ways away from complete. I was thinking to follow up with:
* Migrate the current sub-test approach to use kunit style test cases within a suite.
* Combine what are currently independent test suites into one test suite with different test cases, for example stat.c contains stat, stat_config and stat_round tests.
Once this is done then to unify with kunit we need to work out a common pattern for skipping a test, etc. There's already a lot here and so I wanted to get an opinion before pushing along further.
Quoted 18 lines
Quoted 10 lines
v1. Built/tested on x86.
Ian Rogers (5):
perf test: Use macro for "suite" declarations perf test: Use macro for "suite" definitions perf test: Make each test/suite its own struct. perf test: Move each test suite struct to its test perf test: Rename struct test totest_suiteQuoted 7 lines
tools/perf/arch/arm/include/arch-tests.h | 2 +- tools/perf/arch/arm/tests/arch-tests.c | 21 +- tools/perf/arch/arm/tests/vectors-page.c | 2 +- tools/perf/arch/arm64/include/arch-tests.h | 2 +- tools/perf/arch/arm64/tests/arch-tests.c | 15 +- tools/perf/arch/powerpc/include/arch-tests.h | 2 +- tools/perf/arch/powerpc/tests/arch-tests.c | 15 +-
Quoted 1 line
I can run/test this on ppc/arm if you don't have any
I have pretty easy access to ARM but lost access to PowerPC. If we're happy with the direction then I can test ARM and ask for help on PowerPC.
Thanks,
Ian
Quoted 82 lines
jirka
Quoted 79 lines
tools/perf/arch/x86/include/arch-tests.h | 14 +- tools/perf/arch/x86/tests/arch-tests.c | 47 +- tools/perf/arch/x86/tests/bp-modify.c | 2 +- tools/perf/arch/x86/tests/insn-x86.c | 2 +- tools/perf/arch/x86/tests/intel-cqm.c | 2 +- .../x86/tests/intel-pt-pkt-decoder-test.c | 2 +- tools/perf/arch/x86/tests/rdpmc.c | 2 +- tools/perf/arch/x86/tests/sample-parsing.c | 2 +- tools/perf/tests/api-io.c | 6 +- tools/perf/tests/attr.c | 4 +- tools/perf/tests/backward-ring-buffer.c | 4 +- tools/perf/tests/bitmap.c | 4 +- tools/perf/tests/bp_account.c | 10 +- tools/perf/tests/bp_signal.c | 8 +- tools/perf/tests/bp_signal_overflow.c | 8 +- tools/perf/tests/bpf.c | 22 +- tools/perf/tests/builtin-test.c | 441 ++++-------------- tools/perf/tests/clang.c | 18 +- tools/perf/tests/code-reading.c | 4 +- tools/perf/tests/cpumap.c | 10 +- tools/perf/tests/demangle-java-test.c | 4 +- tools/perf/tests/demangle-ocaml-test.c | 4 +- tools/perf/tests/dlfilter-test.c | 4 +- tools/perf/tests/dso-data.c | 10 +- tools/perf/tests/dwarf-unwind.c | 2 +- tools/perf/tests/event-times.c | 4 +- tools/perf/tests/event_update.c | 4 +- tools/perf/tests/evsel-roundtrip-name.c | 4 +- tools/perf/tests/evsel-tp-sched.c | 4 +- tools/perf/tests/expand-cgroup.c | 6 +- tools/perf/tests/expr.c | 4 +- tools/perf/tests/fdarray.c | 7 +- tools/perf/tests/genelf.c | 6 +- tools/perf/tests/hists_cumulate.c | 4 +- tools/perf/tests/hists_filter.c | 4 +- tools/perf/tests/hists_link.c | 4 +- tools/perf/tests/hists_output.c | 4 +- tools/perf/tests/is_printable_array.c | 4 +- tools/perf/tests/keep-tracking.c | 4 +- tools/perf/tests/kmod-path.c | 4 +- tools/perf/tests/llvm.c | 22 +- tools/perf/tests/maps.c | 4 +- tools/perf/tests/mem.c | 4 +- tools/perf/tests/mem2node.c | 4 +- tools/perf/tests/mmap-basic.c | 4 +- tools/perf/tests/mmap-thread-lookup.c | 4 +- tools/perf/tests/openat-syscall-all-cpus.c | 5 +- tools/perf/tests/openat-syscall-tp-fields.c | 4 +- tools/perf/tests/openat-syscall.c | 5 +- tools/perf/tests/parse-events.c | 4 +- tools/perf/tests/parse-metric.c | 4 +- tools/perf/tests/parse-no-sample-id-all.c | 4 +- tools/perf/tests/pe-file-parsing.c | 6 +- tools/perf/tests/perf-hooks.c | 4 +- tools/perf/tests/perf-record.c | 4 +- tools/perf/tests/perf-time-to-tsc.c | 10 +- tools/perf/tests/pfm.c | 16 +- tools/perf/tests/pmu-events.c | 19 +- tools/perf/tests/pmu.c | 4 +- tools/perf/tests/python-use.c | 4 +- tools/perf/tests/sample-parsing.c | 4 +- tools/perf/tests/sdt.c | 6 +- tools/perf/tests/stat.c | 10 +- tools/perf/tests/sw-clock.c | 4 +- tools/perf/tests/switch-tracking.c | 4 +- tools/perf/tests/task-exit.c | 4 +- tools/perf/tests/tests.h | 179 ++++--- tools/perf/tests/thread-map.c | 10 +- tools/perf/tests/thread-maps-share.c | 4 +- tools/perf/tests/time-utils-test.c | 4 +- tools/perf/tests/topology.c | 4 +- tools/perf/tests/unit_number__scnprintf.c | 4 +- tools/perf/tests/vmlinux-kallsyms.c | 5 +- tools/perf/tests/wp.c | 22 +- 81 files changed, 543 insertions(+), 618 deletions(-)--
2.33.0.464.g1972c5931b-goog
Quoted 54 lines · Ian Rogers
Quoted 17 lines · Jiri Olsa
Quoted 15 lines · Ian Rogers
Perf test uses its own structs and code layout that differs from kunit that was more recently introduced to the kernel. Besides consistency, it is hoped that moving in the direction of kunit style will enable reuse of infrastructure like test output formatting for continuous testing systems. For example:
https://lore.kernel.org/linux-kselftest/CA+GJov6tdjvY9x12JsJT14qn6c7NViJxqaJk+r-K1YJzPggFDQ@mail.gmail.com/The motivation for this restructuring comes from wanting to be able to tag tests with a size:
https://lore.kernel.org/linux-perf-users/CAP-5=fWmGyuqFKc-EMP3rbmTkjZ3MS+YSajGZfeRMc38HS82gw@mail.gmail.com/
To have more exhaustive and slower running tests. This isn't something kunit currently supports, nor is the execution of python and shell tests, but it seems sensible to work on an approach with kunit rather to invent a new wheel inside of perf.Quoted 6 lines
Quoted 4 lines
These initial patches are just refactoring the main test suite definitions to be in a more kunit style. Kunit isn't depended upon, it is hoped that this can be done in later patches for the sake of consistency.
seems good.. how far away from kunit is the code now?
Thanks Jiri, It is a ways away from complete. I was thinking to follow up with:
* Migrate the current sub-test approach to use kunit style test cases within a suite.
* Combine what are currently independent test suites into one test suite with different test cases, for examplestat.ccontains stat,stat_configandstat_roundtests.Once this is done then to unify with kunit we need to work out a common pattern for skipping a test, etc. There's already a lot here and so I wanted to get an opinion before pushing along further.
Quoted 18 lines
Quoted 17 lines
v1. Built/tested on x86.
Ian Rogers (5):
perf test: Use macro for "suite" declarations perf test: Use macro for "suite" definitions perf test: Make each test/suite its own struct. perf test: Move each test suite struct to its test perf test: Rename struct test totest_suitetools/perf/arch/arm/include/arch-tests.h | 2 +- tools/perf/arch/arm/tests/arch-tests.c | 21 +- tools/perf/arch/arm/tests/vectors-page.c | 2 +- tools/perf/arch/arm64/include/arch-tests.h | 2 +- tools/perf/arch/arm64/tests/arch-tests.c | 15 +- tools/perf/arch/powerpc/include/arch-tests.h | 2 +- tools/perf/arch/powerpc/tests/arch-tests.c | 15 +-
Quoted 5 lines
Quoted 1 line
I can run/test this on ppc/arm if you don't have any
I have pretty easy access to ARM but lost access to PowerPC. If we're happy with the direction then I can test ARM and ask for help on PowerPC.
it compiles fine on powerpc and failed tests seem reasonable, before/after perf test output is same apart from this:
[root@ibm-p9z-06-lp7 perf]# diff -puw out.old out.new
out.new 2021-09-26 17:20:51.789918644 -0400 renamed from out.old 2021-09-26 17:15:57.947807813 -0400 +1 -1
@@ -81,7 +81,7 @@ 69: PE file support : Ok 70: Event expansion for cgroups : Ok 72: dlfilter C API : Ok -73: Test dwarf unwind : Ok +73: DWARF unwind : Ok 74: build id cache operations : Ok 75: daemon operations : Ok 76: perf pipe recording and injection test : Ok
not sure there's somebody out there parsing this output, maybe we can find out ;-)
jirka
Quoted 87 lines
Thanks,
IanQuoted 82 lines
jirka
Quoted 79 lines
tools/perf/arch/x86/include/arch-tests.h | 14 +- tools/perf/arch/x86/tests/arch-tests.c | 47 +- tools/perf/arch/x86/tests/bp-modify.c | 2 +- tools/perf/arch/x86/tests/insn-x86.c | 2 +- tools/perf/arch/x86/tests/intel-cqm.c | 2 +- .../x86/tests/intel-pt-pkt-decoder-test.c | 2 +- tools/perf/arch/x86/tests/rdpmc.c | 2 +- tools/perf/arch/x86/tests/sample-parsing.c | 2 +- tools/perf/tests/api-io.c | 6 +- tools/perf/tests/attr.c | 4 +- tools/perf/tests/backward-ring-buffer.c | 4 +- tools/perf/tests/bitmap.c | 4 +- tools/perf/tests/bp_account.c | 10 +- tools/perf/tests/bp_signal.c | 8 +- tools/perf/tests/bp_signal_overflow.c | 8 +- tools/perf/tests/bpf.c | 22 +- tools/perf/tests/builtin-test.c | 441 ++++-------------- tools/perf/tests/clang.c | 18 +- tools/perf/tests/code-reading.c | 4 +- tools/perf/tests/cpumap.c | 10 +- tools/perf/tests/demangle-java-test.c | 4 +- tools/perf/tests/demangle-ocaml-test.c | 4 +- tools/perf/tests/dlfilter-test.c | 4 +- tools/perf/tests/dso-data.c | 10 +- tools/perf/tests/dwarf-unwind.c | 2 +- tools/perf/tests/event-times.c | 4 +- tools/perf/tests/event_update.c | 4 +- tools/perf/tests/evsel-roundtrip-name.c | 4 +- tools/perf/tests/evsel-tp-sched.c | 4 +- tools/perf/tests/expand-cgroup.c | 6 +- tools/perf/tests/expr.c | 4 +- tools/perf/tests/fdarray.c | 7 +- tools/perf/tests/genelf.c | 6 +- tools/perf/tests/hists_cumulate.c | 4 +- tools/perf/tests/hists_filter.c | 4 +- tools/perf/tests/hists_link.c | 4 +- tools/perf/tests/hists_output.c | 4 +- tools/perf/tests/is_printable_array.c | 4 +- tools/perf/tests/keep-tracking.c | 4 +- tools/perf/tests/kmod-path.c | 4 +- tools/perf/tests/llvm.c | 22 +- tools/perf/tests/maps.c | 4 +- tools/perf/tests/mem.c | 4 +- tools/perf/tests/mem2node.c | 4 +- tools/perf/tests/mmap-basic.c | 4 +- tools/perf/tests/mmap-thread-lookup.c | 4 +- tools/perf/tests/openat-syscall-all-cpus.c | 5 +- tools/perf/tests/openat-syscall-tp-fields.c | 4 +- tools/perf/tests/openat-syscall.c | 5 +- tools/perf/tests/parse-events.c | 4 +- tools/perf/tests/parse-metric.c | 4 +- tools/perf/tests/parse-no-sample-id-all.c | 4 +- tools/perf/tests/pe-file-parsing.c | 6 +- tools/perf/tests/perf-hooks.c | 4 +- tools/perf/tests/perf-record.c | 4 +- tools/perf/tests/perf-time-to-tsc.c | 10 +- tools/perf/tests/pfm.c | 16 +- tools/perf/tests/pmu-events.c | 19 +- tools/perf/tests/pmu.c | 4 +- tools/perf/tests/python-use.c | 4 +- tools/perf/tests/sample-parsing.c | 4 +- tools/perf/tests/sdt.c | 6 +- tools/perf/tests/stat.c | 10 +- tools/perf/tests/sw-clock.c | 4 +- tools/perf/tests/switch-tracking.c | 4 +- tools/perf/tests/task-exit.c | 4 +- tools/perf/tests/tests.h | 179 ++++--- tools/perf/tests/thread-map.c | 10 +- tools/perf/tests/thread-maps-share.c | 4 +- tools/perf/tests/time-utils-test.c | 4 +- tools/perf/tests/topology.c | 4 +- tools/perf/tests/unit_number__scnprintf.c | 4 +- tools/perf/tests/vmlinux-kallsyms.c | 5 +- tools/perf/tests/wp.c | 22 +- 81 files changed, 543 insertions(+), 618 deletions(-)--
2.33.0.464.g1972c5931b-goog
Ian Rogers
reviewerQuoted 78 lines · Jiri Olsa
Quoted 54 lines · Ian Rogers
Quoted 17 lines · Jiri Olsa
Quoted 15 lines · Ian Rogers
Perf test uses its own structs and code layout that differs from kunit that was more recently introduced to the kernel. Besides consistency, it is hoped that moving in the direction of kunit style will enable reuse of infrastructure like test output formatting for continuous testing systems. For example:
https://lore.kernel.org/linux-kselftest/CA+GJov6tdjvY9x12JsJT14qn6c7NViJxqaJk+r-K1YJzPggFDQ@mail.gmail.com/The motivation for this restructuring comes from wanting to be able to tag tests with a size:
https://lore.kernel.org/linux-perf-users/CAP-5=fWmGyuqFKc-EMP3rbmTkjZ3MS+YSajGZfeRMc38HS82gw@mail.gmail.com/
To have more exhaustive and slower running tests. This isn't something kunit currently supports, nor is the execution of python and shell tests, but it seems sensible to work on an approach with kunit rather to invent a new wheel inside of perf.Quoted 6 lines
Quoted 4 lines
These initial patches are just refactoring the main test suite definitions to be in a more kunit style. Kunit isn't depended upon, it is hoped that this can be done in later patches for the sake of consistency.
seems good.. how far away from kunit is the code now?
Thanks Jiri, It is a ways away from complete. I was thinking to follow up with:
* Migrate the current sub-test approach to use kunit style test cases within a suite.
* Combine what are currently independent test suites into one test suite with different test cases, for examplestat.ccontains stat,stat_configandstat_roundtests.Once this is done then to unify with kunit we need to work out a common pattern for skipping a test, etc. There's already a lot here and so I wanted to get an opinion before pushing along further.
Quoted 18 lines
Quoted 17 lines
v1. Built/tested on x86.
Ian Rogers (5):
perf test: Use macro for "suite" declarations perf test: Use macro for "suite" definitions perf test: Make each test/suite its own struct. perf test: Move each test suite struct to its test perf test: Rename struct test totest_suitetools/perf/arch/arm/include/arch-tests.h | 2 +- tools/perf/arch/arm/tests/arch-tests.c | 21 +- tools/perf/arch/arm/tests/vectors-page.c | 2 +- tools/perf/arch/arm64/include/arch-tests.h | 2 +- tools/perf/arch/arm64/tests/arch-tests.c | 15 +- tools/perf/arch/powerpc/include/arch-tests.h | 2 +- tools/perf/arch/powerpc/tests/arch-tests.c | 15 +-Quoted 5 lines
Quoted 1 line
I can run/test this on ppc/arm if you don't have any
I have pretty easy access to ARM but lost access to PowerPC. If we're happy with the direction then I can test ARM and ask for help on PowerPC.
it compiles fine on powerpc and failed tests seem reasonable, before/after perf test output is same apart from this:
[root@ibm-p9z-06-lp7 perf]# diff -puw out.old out.new
out.new 2021-09-26 17:20:51.789918644 -0400 renamed from out.old 2021-09-26 17:15:57.947807813 -0400 +1
-1@@ -81,7 +81,7 @@ 69: PE file support : Ok 70: Event expansion for cgroups : Ok 72: dlfilter C API : Ok -73: Test dwarf unwind : Ok +73: DWARF unwind : Ok 74: build id cache operations : Ok 75: daemon operations : Ok 76: perf pipe recording and injection test : Ok
Quoted 2 lines
not sure there's somebody out there parsing this output, maybe we can find out ;-)
Thanks, actually we have a parser on this output :-) I will correct the issue.
Ian
Quoted 90 lines
jirka
Quoted 87 lines
Thanks,
IanQuoted 82 lines
jirka
Quoted 79 lines
tools/perf/arch/x86/include/arch-tests.h | 14 +- tools/perf/arch/x86/tests/arch-tests.c | 47 +- tools/perf/arch/x86/tests/bp-modify.c | 2 +- tools/perf/arch/x86/tests/insn-x86.c | 2 +- tools/perf/arch/x86/tests/intel-cqm.c | 2 +- .../x86/tests/intel-pt-pkt-decoder-test.c | 2 +- tools/perf/arch/x86/tests/rdpmc.c | 2 +- tools/perf/arch/x86/tests/sample-parsing.c | 2 +- tools/perf/tests/api-io.c | 6 +- tools/perf/tests/attr.c | 4 +- tools/perf/tests/backward-ring-buffer.c | 4 +- tools/perf/tests/bitmap.c | 4 +- tools/perf/tests/bp_account.c | 10 +- tools/perf/tests/bp_signal.c | 8 +- tools/perf/tests/bp_signal_overflow.c | 8 +- tools/perf/tests/bpf.c | 22 +- tools/perf/tests/builtin-test.c | 441 ++++-------------- tools/perf/tests/clang.c | 18 +- tools/perf/tests/code-reading.c | 4 +- tools/perf/tests/cpumap.c | 10 +- tools/perf/tests/demangle-java-test.c | 4 +- tools/perf/tests/demangle-ocaml-test.c | 4 +- tools/perf/tests/dlfilter-test.c | 4 +- tools/perf/tests/dso-data.c | 10 +- tools/perf/tests/dwarf-unwind.c | 2 +- tools/perf/tests/event-times.c | 4 +- tools/perf/tests/event_update.c | 4 +- tools/perf/tests/evsel-roundtrip-name.c | 4 +- tools/perf/tests/evsel-tp-sched.c | 4 +- tools/perf/tests/expand-cgroup.c | 6 +- tools/perf/tests/expr.c | 4 +- tools/perf/tests/fdarray.c | 7 +- tools/perf/tests/genelf.c | 6 +- tools/perf/tests/hists_cumulate.c | 4 +- tools/perf/tests/hists_filter.c | 4 +- tools/perf/tests/hists_link.c | 4 +- tools/perf/tests/hists_output.c | 4 +- tools/perf/tests/is_printable_array.c | 4 +- tools/perf/tests/keep-tracking.c | 4 +- tools/perf/tests/kmod-path.c | 4 +- tools/perf/tests/llvm.c | 22 +- tools/perf/tests/maps.c | 4 +- tools/perf/tests/mem.c | 4 +- tools/perf/tests/mem2node.c | 4 +- tools/perf/tests/mmap-basic.c | 4 +- tools/perf/tests/mmap-thread-lookup.c | 4 +- tools/perf/tests/openat-syscall-all-cpus.c | 5 +- tools/perf/tests/openat-syscall-tp-fields.c | 4 +- tools/perf/tests/openat-syscall.c | 5 +- tools/perf/tests/parse-events.c | 4 +- tools/perf/tests/parse-metric.c | 4 +- tools/perf/tests/parse-no-sample-id-all.c | 4 +- tools/perf/tests/pe-file-parsing.c | 6 +- tools/perf/tests/perf-hooks.c | 4 +- tools/perf/tests/perf-record.c | 4 +- tools/perf/tests/perf-time-to-tsc.c | 10 +- tools/perf/tests/pfm.c | 16 +- tools/perf/tests/pmu-events.c | 19 +- tools/perf/tests/pmu.c | 4 +- tools/perf/tests/python-use.c | 4 +- tools/perf/tests/sample-parsing.c | 4 +- tools/perf/tests/sdt.c | 6 +- tools/perf/tests/stat.c | 10 +- tools/perf/tests/sw-clock.c | 4 +- tools/perf/tests/switch-tracking.c | 4 +- tools/perf/tests/task-exit.c | 4 +- tools/perf/tests/tests.h | 179 ++++--- tools/perf/tests/thread-map.c | 10 +- tools/perf/tests/thread-maps-share.c | 4 +- tools/perf/tests/time-utils-test.c | 4 +- tools/perf/tests/topology.c | 4 +- tools/perf/tests/unit_number__scnprintf.c | 4 +- tools/perf/tests/vmlinux-kallsyms.c | 5 +- tools/perf/tests/wp.c | 22 +- 81 files changed, 543 insertions(+), 618 deletions(-)--
2.33.0.464.g1972c5931b-goog
Arnaldo Carvalho de Melo
maintainerEm Mon, Sep 27, 2021 at 09:09:43AM -0700, Ian Rogers escreveu:
Quoted 79 lines · Jiri Olsa
Quoted 78 lines · Ian Rogers
Quoted 54 lines · Jiri Olsa
Quoted 17 lines · Ian Rogers
Quoted 15 lines
Perf test uses its own structs and code layout that differs from kunit that was more recently introduced to the kernel. Besides consistency, it is hoped that moving in the direction of kunit style will enable reuse of infrastructure like test output formatting for continuous testing systems. For example:
https://lore.kernel.org/linux-kselftest/CA+GJov6tdjvY9x12JsJT14qn6c7NViJxqaJk+r-K1YJzPggFDQ@mail.gmail.com/The motivation for this restructuring comes from wanting to be able to tag tests with a size:
https://lore.kernel.org/linux-perf-users/CAP-5=fWmGyuqFKc-EMP3rbmTkjZ3MS+YSajGZfeRMc38HS82gw@mail.gmail.com/
To have more exhaustive and slower running tests. This isn't something kunit currently supports, nor is the execution of python and shell tests, but it seems sensible to work on an approach with kunit rather to invent a new wheel inside of perf.Quoted 6 lines
Quoted 4 lines
These initial patches are just refactoring the main test suite definitions to be in a more kunit style. Kunit isn't depended upon, it is hoped that this can be done in later patches for the sake of consistency.
seems good.. how far away from kunit is the code now?
Thanks Jiri, It is a ways away from complete. I was thinking to follow up with:
* Migrate the current sub-test approach to use kunit style test cases within a suite.
* Combine what are currently independent test suites into one test suite with different test cases, for examplestat.ccontains stat,stat_configandstat_roundtests.Once this is done then to unify with kunit we need to work out a common pattern for skipping a test, etc. There's already a lot here and so I wanted to get an opinion before pushing along further.
Quoted 18 lines
Quoted 17 lines
v1. Built/tested on x86.
Ian Rogers (5):
perf test: Use macro for "suite" declarations perf test: Use macro for "suite" definitions perf test: Make each test/suite its own struct. perf test: Move each test suite struct to its test perf test: Rename struct test totest_suitetools/perf/arch/arm/include/arch-tests.h | 2 +- tools/perf/arch/arm/tests/arch-tests.c | 21 +- tools/perf/arch/arm/tests/vectors-page.c | 2 +- tools/perf/arch/arm64/include/arch-tests.h | 2 +- tools/perf/arch/arm64/tests/arch-tests.c | 15 +- tools/perf/arch/powerpc/include/arch-tests.h | 2 +- tools/perf/arch/powerpc/tests/arch-tests.c | 15 +-Quoted 5 lines
Quoted 1 line
I can run/test this on ppc/arm if you don't have any
I have pretty easy access to ARM but lost access to PowerPC. If we're happy with the direction then I can test ARM and ask for help on PowerPC.
it compiles fine on powerpc and failed tests seem reasonable, before/after perf test output is same apart from this:
[root@ibm-p9z-06-lp7 perf]# diff -puw out.old out.new
out.new 2021-09-26 17:20:51.789918644 -0400 renamed from out.old 2021-09-26 17:15:57.947807813 -0400 +1
-1@@ -81,7 +81,7 @@ 69: PE file support : Ok 70: Event expansion for cgroups : Ok 72: dlfilter C API : Ok -73: Test dwarf unwind : Ok +73: DWARF unwind : Ok 74: build id cache operations : Ok 75: daemon operations : Ok 76: perf pipe recording and injection test : Ok
Quoted 4 lines
Quoted 2 lines
not sure there's somebody out there parsing this output, maybe we can find out ;-)
Thanks, actually we have a parser on this output :-) I will correct the issue.
Seems like the right direction, people are ok with it, v2 time?
- Arnaldo
Quoted 92 lines
Ian
Quoted 90 lines
jirka
Quoted 87 lines
Thanks,
IanQuoted 82 lines
jirka
Quoted 79 lines
tools/perf/arch/x86/include/arch-tests.h | 14 +- tools/perf/arch/x86/tests/arch-tests.c | 47 +- tools/perf/arch/x86/tests/bp-modify.c | 2 +- tools/perf/arch/x86/tests/insn-x86.c | 2 +- tools/perf/arch/x86/tests/intel-cqm.c | 2 +- .../x86/tests/intel-pt-pkt-decoder-test.c | 2 +- tools/perf/arch/x86/tests/rdpmc.c | 2 +- tools/perf/arch/x86/tests/sample-parsing.c | 2 +- tools/perf/tests/api-io.c | 6 +- tools/perf/tests/attr.c | 4 +- tools/perf/tests/backward-ring-buffer.c | 4 +- tools/perf/tests/bitmap.c | 4 +- tools/perf/tests/bp_account.c | 10 +- tools/perf/tests/bp_signal.c | 8 +- tools/perf/tests/bp_signal_overflow.c | 8 +- tools/perf/tests/bpf.c | 22 +- tools/perf/tests/builtin-test.c | 441 ++++-------------- tools/perf/tests/clang.c | 18 +- tools/perf/tests/code-reading.c | 4 +- tools/perf/tests/cpumap.c | 10 +- tools/perf/tests/demangle-java-test.c | 4 +- tools/perf/tests/demangle-ocaml-test.c | 4 +- tools/perf/tests/dlfilter-test.c | 4 +- tools/perf/tests/dso-data.c | 10 +- tools/perf/tests/dwarf-unwind.c | 2 +- tools/perf/tests/event-times.c | 4 +- tools/perf/tests/event_update.c | 4 +- tools/perf/tests/evsel-roundtrip-name.c | 4 +- tools/perf/tests/evsel-tp-sched.c | 4 +- tools/perf/tests/expand-cgroup.c | 6 +- tools/perf/tests/expr.c | 4 +- tools/perf/tests/fdarray.c | 7 +- tools/perf/tests/genelf.c | 6 +- tools/perf/tests/hists_cumulate.c | 4 +- tools/perf/tests/hists_filter.c | 4 +- tools/perf/tests/hists_link.c | 4 +- tools/perf/tests/hists_output.c | 4 +- tools/perf/tests/is_printable_array.c | 4 +- tools/perf/tests/keep-tracking.c | 4 +- tools/perf/tests/kmod-path.c | 4 +- tools/perf/tests/llvm.c | 22 +- tools/perf/tests/maps.c | 4 +- tools/perf/tests/mem.c | 4 +- tools/perf/tests/mem2node.c | 4 +- tools/perf/tests/mmap-basic.c | 4 +- tools/perf/tests/mmap-thread-lookup.c | 4 +- tools/perf/tests/openat-syscall-all-cpus.c | 5 +- tools/perf/tests/openat-syscall-tp-fields.c | 4 +- tools/perf/tests/openat-syscall.c | 5 +- tools/perf/tests/parse-events.c | 4 +- tools/perf/tests/parse-metric.c | 4 +- tools/perf/tests/parse-no-sample-id-all.c | 4 +- tools/perf/tests/pe-file-parsing.c | 6 +- tools/perf/tests/perf-hooks.c | 4 +- tools/perf/tests/perf-record.c | 4 +- tools/perf/tests/perf-time-to-tsc.c | 10 +- tools/perf/tests/pfm.c | 16 +- tools/perf/tests/pmu-events.c | 19 +- tools/perf/tests/pmu.c | 4 +- tools/perf/tests/python-use.c | 4 +- tools/perf/tests/sample-parsing.c | 4 +- tools/perf/tests/sdt.c | 6 +- tools/perf/tests/stat.c | 10 +- tools/perf/tests/sw-clock.c | 4 +- tools/perf/tests/switch-tracking.c | 4 +- tools/perf/tests/task-exit.c | 4 +- tools/perf/tests/tests.h | 179 ++++--- tools/perf/tests/thread-map.c | 10 +- tools/perf/tests/thread-maps-share.c | 4 +- tools/perf/tests/time-utils-test.c | 4 +- tools/perf/tests/topology.c | 4 +- tools/perf/tests/unit_number__scnprintf.c | 4 +- tools/perf/tests/vmlinux-kallsyms.c | 5 +- tools/perf/tests/wp.c | 22 +- 81 files changed, 543 insertions(+), 618 deletions(-)--
2.33.0.464.g1972c5931b-goog
Signature · 1 line
- Arnaldo
Ian Rogers
reviewerQuoted 81 lines · Arnaldo Carvalho de Melo
Em Mon, Sep 27, 2021 at 09:09:43AM -0700, Ian Rogers escreveu:
Quoted 79 lines · Jiri Olsa
Quoted 78 lines · Ian Rogers
Quoted 54 lines · Jiri Olsa
Quoted 17 lines · Ian Rogers
Quoted 15 lines
Perf test uses its own structs and code layout that differs from kunit that was more recently introduced to the kernel. Besides consistency, it is hoped that moving in the direction of kunit style will enable reuse of infrastructure like test output formatting for continuous testing systems. For example:
https://lore.kernel.org/linux-kselftest/CA+GJov6tdjvY9x12JsJT14qn6c7NViJxqaJk+r-K1YJzPggFDQ@mail.gmail.com/The motivation for this restructuring comes from wanting to be able to tag tests with a size:
https://lore.kernel.org/linux-perf-users/CAP-5=fWmGyuqFKc-EMP3rbmTkjZ3MS+YSajGZfeRMc38HS82gw@mail.gmail.com/
To have more exhaustive and slower running tests. This isn't something kunit currently supports, nor is the execution of python and shell tests, but it seems sensible to work on an approach with kunit rather to invent a new wheel inside of perf.Quoted 6 lines
Quoted 4 lines
These initial patches are just refactoring the main test suite definitions to be in a more kunit style. Kunit isn't depended upon, it is hoped that this can be done in later patches for the sake of consistency.
seems good.. how far away from kunit is the code now?
Thanks Jiri, It is a ways away from complete. I was thinking to follow up with:
* Migrate the current sub-test approach to use kunit style test cases within a suite.
* Combine what are currently independent test suites into one test suite with different test cases, for examplestat.ccontains stat,stat_configandstat_roundtests.Once this is done then to unify with kunit we need to work out a common pattern for skipping a test, etc. There's already a lot here and so I wanted to get an opinion before pushing along further.
Quoted 18 lines
Quoted 17 lines
v1. Built/tested on x86.
Ian Rogers (5):
perf test: Use macro for "suite" declarations perf test: Use macro for "suite" definitions perf test: Make each test/suite its own struct. perf test: Move each test suite struct to its test perf test: Rename struct test totest_suitetools/perf/arch/arm/include/arch-tests.h | 2 +- tools/perf/arch/arm/tests/arch-tests.c | 21 +- tools/perf/arch/arm/tests/vectors-page.c | 2 +- tools/perf/arch/arm64/include/arch-tests.h | 2 +- tools/perf/arch/arm64/tests/arch-tests.c | 15 +- tools/perf/arch/powerpc/include/arch-tests.h | 2 +- tools/perf/arch/powerpc/tests/arch-tests.c | 15 +-Quoted 5 lines
Quoted 1 line
I can run/test this on ppc/arm if you don't have any
I have pretty easy access to ARM but lost access to PowerPC. If we're happy with the direction then I can test ARM and ask for help on PowerPC.
it compiles fine on powerpc and failed tests seem reasonable, before/after perf test output is same apart from this:
[root@ibm-p9z-06-lp7 perf]# diff -puw out.old out.new
out.new 2021-09-26 17:20:51.789918644 -0400 renamed from out.old 2021-09-26 17:15:57.947807813 -0400 +1
-1@@ -81,7 +81,7 @@ 69: PE file support : Ok 70: Event expansion for cgroups : Ok 72: dlfilter C API : Ok -73: Test dwarf unwind : Ok +73: DWARF unwind : Ok 74: build id cache operations : Ok 75: daemon operations : Ok 76: perf pipe recording and injection test : Ok
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
not sure there's somebody out there parsing this output, maybe we can find out ;-)
Thanks, actually we have a parser on this output :-) I will correct the issue.
Seems like the right direction, people are ok with it, v2 time?
Thanks! I'm working on v2, I've fixed up wrt Jiri's comments and I'm working on using the test_case style for subtests. I hope to send it out soon-ish.
Thanks,
Ian
Quoted 98 lines
- Arnaldo
Quoted 92 lines
Ian
Quoted 90 lines
jirka
Quoted 87 lines
Thanks,
IanQuoted 82 lines
jirka
Quoted 79 lines
tools/perf/arch/x86/include/arch-tests.h | 14 +- tools/perf/arch/x86/tests/arch-tests.c | 47 +- tools/perf/arch/x86/tests/bp-modify.c | 2 +- tools/perf/arch/x86/tests/insn-x86.c | 2 +- tools/perf/arch/x86/tests/intel-cqm.c | 2 +- .../x86/tests/intel-pt-pkt-decoder-test.c | 2 +- tools/perf/arch/x86/tests/rdpmc.c | 2 +- tools/perf/arch/x86/tests/sample-parsing.c | 2 +- tools/perf/tests/api-io.c | 6 +- tools/perf/tests/attr.c | 4 +- tools/perf/tests/backward-ring-buffer.c | 4 +- tools/perf/tests/bitmap.c | 4 +- tools/perf/tests/bp_account.c | 10 +- tools/perf/tests/bp_signal.c | 8 +- tools/perf/tests/bp_signal_overflow.c | 8 +- tools/perf/tests/bpf.c | 22 +- tools/perf/tests/builtin-test.c | 441 ++++-------------- tools/perf/tests/clang.c | 18 +- tools/perf/tests/code-reading.c | 4 +- tools/perf/tests/cpumap.c | 10 +- tools/perf/tests/demangle-java-test.c | 4 +- tools/perf/tests/demangle-ocaml-test.c | 4 +- tools/perf/tests/dlfilter-test.c | 4 +- tools/perf/tests/dso-data.c | 10 +- tools/perf/tests/dwarf-unwind.c | 2 +- tools/perf/tests/event-times.c | 4 +- tools/perf/tests/event_update.c | 4 +- tools/perf/tests/evsel-roundtrip-name.c | 4 +- tools/perf/tests/evsel-tp-sched.c | 4 +- tools/perf/tests/expand-cgroup.c | 6 +- tools/perf/tests/expr.c | 4 +- tools/perf/tests/fdarray.c | 7 +- tools/perf/tests/genelf.c | 6 +- tools/perf/tests/hists_cumulate.c | 4 +- tools/perf/tests/hists_filter.c | 4 +- tools/perf/tests/hists_link.c | 4 +- tools/perf/tests/hists_output.c | 4 +- tools/perf/tests/is_printable_array.c | 4 +- tools/perf/tests/keep-tracking.c | 4 +- tools/perf/tests/kmod-path.c | 4 +- tools/perf/tests/llvm.c | 22 +- tools/perf/tests/maps.c | 4 +- tools/perf/tests/mem.c | 4 +- tools/perf/tests/mem2node.c | 4 +- tools/perf/tests/mmap-basic.c | 4 +- tools/perf/tests/mmap-thread-lookup.c | 4 +- tools/perf/tests/openat-syscall-all-cpus.c | 5 +- tools/perf/tests/openat-syscall-tp-fields.c | 4 +- tools/perf/tests/openat-syscall.c | 5 +- tools/perf/tests/parse-events.c | 4 +- tools/perf/tests/parse-metric.c | 4 +- tools/perf/tests/parse-no-sample-id-all.c | 4 +- tools/perf/tests/pe-file-parsing.c | 6 +- tools/perf/tests/perf-hooks.c | 4 +- tools/perf/tests/perf-record.c | 4 +- tools/perf/tests/perf-time-to-tsc.c | 10 +- tools/perf/tests/pfm.c | 16 +- tools/perf/tests/pmu-events.c | 19 +- tools/perf/tests/pmu.c | 4 +- tools/perf/tests/python-use.c | 4 +- tools/perf/tests/sample-parsing.c | 4 +- tools/perf/tests/sdt.c | 6 +- tools/perf/tests/stat.c | 10 +- tools/perf/tests/sw-clock.c | 4 +- tools/perf/tests/switch-tracking.c | 4 +- tools/perf/tests/task-exit.c | 4 +- tools/perf/tests/tests.h | 179 ++++--- tools/perf/tests/thread-map.c | 10 +- tools/perf/tests/thread-maps-share.c | 4 +- tools/perf/tests/time-utils-test.c | 4 +- tools/perf/tests/topology.c | 4 +- tools/perf/tests/unit_number__scnprintf.c | 4 +- tools/perf/tests/vmlinux-kallsyms.c | 5 +- tools/perf/tests/wp.c | 22 +- 81 files changed, 543 insertions(+), 618 deletions(-)--
2.33.0.464.g1972c5931b-goog--
- Arnaldo