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

perf test: Move each test suite struct to its test

Rather than export test functions, export the test struct. Rename with a
suite__ prefix to avoid name collisions.

Committer notes:

Its '&suite__vectors_page', not '&suite__vectors_pages', noticed when
cross building to arm (32-bit).

Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Brendan Higgins <brendanhiggins@google.com>
Cc: Daniel Latypov <dlatypov@google.com>
Cc: David Gow <davidgow@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Clarke <pc@us.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/r/20211104064208.3156807-5-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
d68f0365 df225205

+397 -348
+2 -2
tools/perf/arch/arm/tests/arch-tests.c
··· 5 5 6 6 struct test *arch_tests[] = { 7 7 #ifdef HAVE_DWARF_UNWIND_SUPPORT 8 - &dwarf_unwind, 8 + &suite__dwarf_unwind, 9 9 #endif 10 - &vectors_page, 10 + &suite__vectors_page, 11 11 NULL, 12 12 };
+1 -1
tools/perf/arch/arm64/tests/arch-tests.c
··· 5 5 6 6 struct test *arch_tests[] = { 7 7 #ifdef HAVE_DWARF_UNWIND_SUPPORT 8 - &dwarf_unwind, 8 + &suite__dwarf_unwind, 9 9 #endif 10 10 NULL, 11 11 };
+1 -1
tools/perf/arch/powerpc/tests/arch-tests.c
··· 5 5 6 6 struct test *arch_tests[] = { 7 7 #ifdef HAVE_DWARF_UNWIND_SUPPORT 8 - &dwarf_unwind, 8 + &suite__dwarf_unwind, 9 9 #endif 10 10 NULL, 11 11 };
+6 -6
tools/perf/arch/x86/tests/arch-tests.c
··· 14 14 DEFINE_SUITE("x86 Sample parsing", x86_sample_parsing); 15 15 16 16 struct test *arch_tests[] = { 17 - &rdpmc, 17 + &suite__rdpmc, 18 18 #ifdef HAVE_DWARF_UNWIND_SUPPORT 19 - &dwarf_unwind, 19 + &suite__dwarf_unwind, 20 20 #endif 21 21 #ifdef HAVE_AUXTRACE_SUPPORT 22 - &insn_x86, 23 - &intel_pt_pkt_decoder, 22 + &suite__insn_x86, 23 + &suite__intel_pt_pkt_decoder, 24 24 #endif 25 25 #if defined(__x86_64__) 26 - &bp_modify, 26 + &suite__bp_modify, 27 27 #endif 28 - &x86_sample_parsing, 28 + &suite__x86_sample_parsing, 29 29 NULL, 30 30 };
+4 -2
tools/perf/tests/api-io.c
··· 289 289 return ret; 290 290 } 291 291 292 - int test__api_io(struct test *test __maybe_unused, 293 - int subtest __maybe_unused) 292 + static int test__api_io(struct test *test __maybe_unused, 293 + int subtest __maybe_unused) 294 294 { 295 295 int ret = 0; 296 296 ··· 302 302 ret = TEST_FAIL; 303 303 return ret; 304 304 } 305 + 306 + DEFINE_SUITE("Test api io", api_io);
+3 -1
tools/perf/tests/attr.c
··· 178 178 return system(cmd) ? TEST_FAIL : TEST_OK; 179 179 } 180 180 181 - int test__attr(struct test *test __maybe_unused, int subtest __maybe_unused) 181 + static int test__attr(struct test *test __maybe_unused, int subtest __maybe_unused) 182 182 { 183 183 struct stat st; 184 184 char path_perf[PATH_MAX]; ··· 207 207 208 208 return TEST_SKIP; 209 209 } 210 + 211 + DEFINE_SUITE("Setup struct perf_event_attr", attr);
+3 -1
tools/perf/tests/backward-ring-buffer.c
··· 82 82 } 83 83 84 84 85 - int test__backward_ring_buffer(struct test *test __maybe_unused, int subtest __maybe_unused) 85 + static int test__backward_ring_buffer(struct test *test __maybe_unused, int subtest __maybe_unused) 86 86 { 87 87 int ret = TEST_SKIP, err, sample_count = 0, comm_count = 0; 88 88 char pid[16], sbuf[STRERR_BUFSIZE]; ··· 167 167 evlist__delete(evlist); 168 168 return ret; 169 169 } 170 + 171 + DEFINE_SUITE("Read backward ring buffer", backward_ring_buffer);
+3 -1
tools/perf/tests/bitmap.c
··· 40 40 return ret; 41 41 } 42 42 43 - int test__bitmap_print(struct test *test __maybe_unused, int subtest __maybe_unused) 43 + static int test__bitmap_print(struct test *test __maybe_unused, int subtest __maybe_unused) 44 44 { 45 45 TEST_ASSERT_VAL("failed to convert map", test_bitmap("1")); 46 46 TEST_ASSERT_VAL("failed to convert map", test_bitmap("1,5")); ··· 51 51 TEST_ASSERT_VAL("failed to convert map", test_bitmap("1-10,12-20,22-30,32-40")); 52 52 return 0; 53 53 } 54 + 55 + DEFINE_SUITE("Print bitmap", bitmap_print);
+8 -2
tools/perf/tests/bp_account.c
··· 173 173 * we create another watchpoint to ensure 174 174 * the slot accounting is correct 175 175 */ 176 - int test__bp_accounting(struct test *test __maybe_unused, int subtest __maybe_unused) 176 + static int test__bp_accounting(struct test *test __maybe_unused, int subtest __maybe_unused) 177 177 { 178 178 int has_ioctl = detect_ioctl(); 179 179 int wp_cnt = detect_cnt(false); ··· 189 189 return bp_accounting(wp_cnt, share); 190 190 } 191 191 192 - bool test__bp_account_is_supported(void) 192 + static bool test__bp_account_is_supported(void) 193 193 { 194 194 /* 195 195 * PowerPC and S390 do not support creation of instruction ··· 204 204 return true; 205 205 #endif 206 206 } 207 + 208 + struct test suite__bp_accounting = { 209 + .desc = "Breakpoint accounting", 210 + .func = test__bp_accounting, 211 + .is_supported = test__bp_account_is_supported, 212 + };
+7 -1
tools/perf/tests/bp_signal.c
··· 161 161 return count; 162 162 } 163 163 164 - int test__bp_signal(struct test *test __maybe_unused, int subtest __maybe_unused) 164 + static int test__bp_signal(struct test *test __maybe_unused, int subtest __maybe_unused) 165 165 { 166 166 struct sigaction sa; 167 167 long long count1, count2, count3; ··· 311 311 return true; 312 312 #endif 313 313 } 314 + 315 + struct test suite__bp_signal = { 316 + .desc = "Breakpoint overflow signal handler", 317 + .func = test__bp_signal, 318 + .is_supported = test__bp_signal_is_supported, 319 + };
+7 -1
tools/perf/tests/bp_signal_overflow.c
··· 59 59 #define EXECUTIONS 10000 60 60 #define THRESHOLD 100 61 61 62 - int test__bp_signal_overflow(struct test *test __maybe_unused, int subtest __maybe_unused) 62 + static int test__bp_signal_overflow(struct test *test __maybe_unused, int subtest __maybe_unused) 63 63 { 64 64 struct perf_event_attr pe; 65 65 struct sigaction sa; ··· 133 133 134 134 return fails ? TEST_FAIL : TEST_OK; 135 135 } 136 + 137 + struct test suite__bp_signal_overflow = { 138 + .desc = "Breakpoint overflow sampling", 139 + .func = test__bp_signal_overflow, 140 + .is_supported = test__bp_signal_is_supported, 141 + };
+16 -6
tools/perf/tests/bpf.c
··· 283 283 return ret; 284 284 } 285 285 286 - int test__bpf_subtest_get_nr(void) 286 + static int test__bpf_subtest_get_nr(void) 287 287 { 288 288 return (int)ARRAY_SIZE(bpf_testcase_table); 289 289 } 290 290 291 - const char *test__bpf_subtest_get_desc(int i) 291 + static const char *test__bpf_subtest_get_desc(int i) 292 292 { 293 293 if (i < 0 || i >= (int)ARRAY_SIZE(bpf_testcase_table)) 294 294 return NULL; ··· 325 325 return 0; 326 326 } 327 327 328 - int test__bpf(struct test *test __maybe_unused, int i) 328 + static int test__bpf(struct test *test __maybe_unused, int i) 329 329 { 330 330 int err; 331 331 ··· 345 345 } 346 346 347 347 #else 348 - int test__bpf_subtest_get_nr(void) 348 + static int test__bpf_subtest_get_nr(void) 349 349 { 350 350 return 0; 351 351 } 352 352 353 - const char *test__bpf_subtest_get_desc(int i __maybe_unused) 353 + static const char *test__bpf_subtest_get_desc(int i __maybe_unused) 354 354 { 355 355 return NULL; 356 356 } 357 357 358 - int test__bpf(struct test *test __maybe_unused, int i __maybe_unused) 358 + static int test__bpf(struct test *test __maybe_unused, int i __maybe_unused) 359 359 { 360 360 pr_debug("Skip BPF test because BPF support is not compiled\n"); 361 361 return TEST_SKIP; 362 362 } 363 363 #endif 364 + 365 + struct test suite__bpf = { 366 + .desc = "BPF filter", 367 + .func = test__bpf, 368 + .subtest = { 369 + .skip_if_fail = true, 370 + .get_nr = test__bpf_subtest_get_nr, 371 + .get_desc = test__bpf_subtest_get_desc, 372 + }, 373 + };
+72 -213
tools/perf/tests/builtin-test.c
··· 34 34 NULL, 35 35 }; 36 36 37 - DEFINE_SUITE("vmlinux symtab matches kallsyms", vmlinux_matches_kallsyms); 38 - DEFINE_SUITE("Detect openat syscall event", openat_syscall_event); 39 - DEFINE_SUITE("Detect openat syscall event on all cpus", openat_syscall_event_on_all_cpus); 40 - DEFINE_SUITE("Read samples using the mmap interface", basic_mmap); 41 - DEFINE_SUITE("Test data source output", mem); 42 - DEFINE_SUITE("Parse event definition strings", parse_events); 43 - DEFINE_SUITE("Simple expression parser", expr); 44 - DEFINE_SUITE("PERF_RECORD_* events & perf_sample fields", PERF_RECORD); 45 - DEFINE_SUITE("Parse perf pmu format", pmu); 46 - static struct test pmu_events = { 47 - .desc = "PMU events", 48 - .func = test__pmu_events, 49 - .subtest = { 50 - .skip_if_fail = false, 51 - .get_nr = test__pmu_events_subtest_get_nr, 52 - .get_desc = test__pmu_events_subtest_get_desc, 53 - .skip_reason = test__pmu_events_subtest_skip_reason, 54 - }, 55 - }; 56 - DEFINE_SUITE("DSO data read", dso_data); 57 - DEFINE_SUITE("DSO data cache", dso_data_cache); 58 - DEFINE_SUITE("DSO data reopen", dso_data_reopen); 59 - DEFINE_SUITE("Roundtrip evsel->name", perf_evsel__roundtrip_name_test); 60 - DEFINE_SUITE("Parse sched tracepoints fields", perf_evsel__tp_sched_test); 61 - DEFINE_SUITE("syscalls:sys_enter_openat event fields", syscall_openat_tp_fields); 62 - DEFINE_SUITE("Setup struct perf_event_attr", attr); 63 - DEFINE_SUITE("Match and link multiple hists", hists_link); 64 - DEFINE_SUITE("'import perf' in python", python_use); 65 - static struct test bp_signal = { 66 - .desc = "Breakpoint overflow signal handler", 67 - .func = test__bp_signal, 68 - .is_supported = test__bp_signal_is_supported, 69 - }; 70 - static struct test bp_signal_overflow = { 71 - .desc = "Breakpoint overflow sampling", 72 - .func = test__bp_signal_overflow, 73 - .is_supported = test__bp_signal_is_supported, 74 - }; 75 - static struct test bp_accounting = { 76 - .desc = "Breakpoint accounting", 77 - .func = test__bp_accounting, 78 - .is_supported = test__bp_account_is_supported, 79 - }; 80 - static struct test wp = { 81 - .desc = "Watchpoint", 82 - .func = test__wp, 83 - .is_supported = test__wp_is_supported, 84 - .subtest = { 85 - .skip_if_fail = false, 86 - .get_nr = test__wp_subtest_get_nr, 87 - .get_desc = test__wp_subtest_get_desc, 88 - .skip_reason = test__wp_subtest_skip_reason, 89 - }, 90 - }; 91 - DEFINE_SUITE("Number of exit events of a simple workload", task_exit); 92 - DEFINE_SUITE("Software clock events period values", sw_clock_freq); 93 - DEFINE_SUITE("Object code reading", code_reading); 94 - DEFINE_SUITE("Sample parsing", sample_parsing); 95 - DEFINE_SUITE("Use a dummy software event to keep tracking", keep_tracking); 96 - DEFINE_SUITE("Parse with no sample_id_all bit set", parse_no_sample_id_all); 97 - DEFINE_SUITE("Filter hist entries", hists_filter); 98 - DEFINE_SUITE("Lookup mmap thread", mmap_thread_lookup); 99 - DEFINE_SUITE("Share thread maps", thread_maps_share); 100 - DEFINE_SUITE("Sort output of hist entries", hists_output); 101 - DEFINE_SUITE("Cumulate child hist entries", hists_cumulate); 102 - DEFINE_SUITE("Track with sched_switch", switch_tracking); 103 - DEFINE_SUITE("Filter fds with revents mask in a fdarray", fdarray__filter); 104 - DEFINE_SUITE("Add fd to a fdarray, making it autogrow", fdarray__add); 105 - DEFINE_SUITE("kmod_path__parse", kmod_path__parse); 106 - DEFINE_SUITE("Thread map", thread_map); 107 - static struct test llvm = { 108 - .desc = "LLVM search and compile", 109 - .func = test__llvm, 110 - .subtest = { 111 - .skip_if_fail = true, 112 - .get_nr = test__llvm_subtest_get_nr, 113 - .get_desc = test__llvm_subtest_get_desc, 114 - }, 115 - }; 116 - DEFINE_SUITE("Session topology", session_topology); 117 - static struct test bpf = { 118 - .desc = "BPF filter", 119 - .func = test__bpf, 120 - .subtest = { 121 - .skip_if_fail = true, 122 - .get_nr = test__bpf_subtest_get_nr, 123 - .get_desc = test__bpf_subtest_get_desc, 124 - }, 125 - }; 126 - DEFINE_SUITE("Synthesize thread map", thread_map_synthesize); 127 - DEFINE_SUITE("Remove thread map", thread_map_remove); 128 - DEFINE_SUITE("Synthesize cpu map", cpu_map_synthesize); 129 - DEFINE_SUITE("Synthesize stat config", synthesize_stat_config); 130 - DEFINE_SUITE("Synthesize stat", synthesize_stat); 131 - DEFINE_SUITE("Synthesize stat round", synthesize_stat_round); 132 - DEFINE_SUITE("Synthesize attr update", event_update); 133 - DEFINE_SUITE("Event times", event_times); 134 - DEFINE_SUITE("Read backward ring buffer", backward_ring_buffer); 135 - DEFINE_SUITE("Print cpu map", cpu_map_print); 136 - DEFINE_SUITE("Merge cpu map", cpu_map_merge); 137 - DEFINE_SUITE("Probe SDT events", sdt_event); 138 - DEFINE_SUITE("is_printable_array", is_printable_array); 139 - DEFINE_SUITE("Print bitmap", bitmap_print); 140 - DEFINE_SUITE("perf hooks", perf_hooks); 141 - static struct test clang = { 142 - .desc = "builtin clang support", 143 - .func = test__clang, 144 - .subtest = { 145 - .skip_if_fail = true, 146 - .get_nr = test__clang_subtest_get_nr, 147 - .get_desc = test__clang_subtest_get_desc, 148 - } 149 - }; 150 - DEFINE_SUITE("unit_number__scnprintf", unit_number__scnprint); 151 - DEFINE_SUITE("mem2node", mem2node); 152 - DEFINE_SUITE("time utils", time_utils); 153 - DEFINE_SUITE("Test jit_write_elf", jit_write_elf); 154 - static struct test pfm = { 155 - .desc = "Test libpfm4 support", 156 - .func = test__pfm, 157 - .subtest = { 158 - .skip_if_fail = true, 159 - .get_nr = test__pfm_subtest_get_nr, 160 - .get_desc = test__pfm_subtest_get_desc, 161 - } 162 - }; 163 - DEFINE_SUITE("Test api io", api_io); 164 - DEFINE_SUITE("maps__merge_in", maps__merge_in); 165 - DEFINE_SUITE("Demangle Java", demangle_java); 166 - DEFINE_SUITE("Demangle OCaml", demangle_ocaml); 167 - DEFINE_SUITE("Parse and process metrics", parse_metric); 168 - DEFINE_SUITE("PE file support", pe_file_parsing); 169 - DEFINE_SUITE("Event expansion for cgroups", expand_cgroup_events); 170 - static struct test perf_time_to_tsc = { 171 - .desc = "Convert perf time to TSC", 172 - .func = test__perf_time_to_tsc, 173 - .is_supported = test__tsc_is_supported, 174 - }; 175 - DEFINE_SUITE("dlfilter C API", dlfilter); 176 - 177 - 178 37 static struct test *generic_tests[] = { 179 - &vmlinux_matches_kallsyms, 180 - &openat_syscall_event, 181 - &openat_syscall_event_on_all_cpus, 182 - &basic_mmap, 183 - &mem, 184 - &parse_events, 185 - &expr, 186 - &PERF_RECORD, 187 - &pmu, 188 - &pmu_events, 189 - &dso_data, 190 - &dso_data_cache, 191 - &dso_data_reopen, 192 - &perf_evsel__roundtrip_name_test, 193 - &perf_evsel__tp_sched_test, 194 - &syscall_openat_tp_fields, 195 - &attr, 196 - &hists_link, 197 - &python_use, 198 - &bp_signal, 199 - &bp_signal_overflow, 200 - &bp_accounting, 201 - &wp, 202 - &task_exit, 203 - &sw_clock_freq, 204 - &code_reading, 205 - &sample_parsing, 206 - &keep_tracking, 207 - &parse_no_sample_id_all, 208 - &hists_filter, 209 - &mmap_thread_lookup, 210 - &thread_maps_share, 211 - &hists_output, 212 - &hists_cumulate, 213 - &switch_tracking, 214 - &fdarray__filter, 215 - &fdarray__add, 216 - &kmod_path__parse, 217 - &thread_map, 218 - &llvm, 219 - &session_topology, 220 - &bpf, 221 - &thread_map_synthesize, 222 - &thread_map_remove, 223 - &cpu_map_synthesize, 224 - &synthesize_stat_config, 225 - &synthesize_stat, 226 - &synthesize_stat_round, 227 - &event_update, 228 - &event_times, 229 - &backward_ring_buffer, 230 - &cpu_map_print, 231 - &cpu_map_merge, 232 - &sdt_event, 233 - &is_printable_array, 234 - &bitmap_print, 235 - &perf_hooks, 236 - &clang, 237 - &unit_number__scnprint, 238 - &mem2node, 239 - &time_utils, 240 - &jit_write_elf, 241 - &pfm, 242 - &api_io, 243 - &maps__merge_in, 244 - &demangle_java, 245 - &demangle_ocaml, 246 - &parse_metric, 247 - &pe_file_parsing, 248 - &expand_cgroup_events, 249 - &perf_time_to_tsc, 250 - &dlfilter, 38 + &suite__vmlinux_matches_kallsyms, 39 + &suite__openat_syscall_event, 40 + &suite__openat_syscall_event_on_all_cpus, 41 + &suite__basic_mmap, 42 + &suite__mem, 43 + &suite__parse_events, 44 + &suite__expr, 45 + &suite__PERF_RECORD, 46 + &suite__pmu, 47 + &suite__pmu_events, 48 + &suite__dso_data, 49 + &suite__dso_data_cache, 50 + &suite__dso_data_reopen, 51 + &suite__perf_evsel__roundtrip_name_test, 52 + &suite__perf_evsel__tp_sched_test, 53 + &suite__syscall_openat_tp_fields, 54 + &suite__attr, 55 + &suite__hists_link, 56 + &suite__python_use, 57 + &suite__bp_signal, 58 + &suite__bp_signal_overflow, 59 + &suite__bp_accounting, 60 + &suite__wp, 61 + &suite__task_exit, 62 + &suite__sw_clock_freq, 63 + &suite__code_reading, 64 + &suite__sample_parsing, 65 + &suite__keep_tracking, 66 + &suite__parse_no_sample_id_all, 67 + &suite__hists_filter, 68 + &suite__mmap_thread_lookup, 69 + &suite__thread_maps_share, 70 + &suite__hists_output, 71 + &suite__hists_cumulate, 72 + &suite__switch_tracking, 73 + &suite__fdarray__filter, 74 + &suite__fdarray__add, 75 + &suite__kmod_path__parse, 76 + &suite__thread_map, 77 + &suite__llvm, 78 + &suite__session_topology, 79 + &suite__bpf, 80 + &suite__thread_map_synthesize, 81 + &suite__thread_map_remove, 82 + &suite__cpu_map_synthesize, 83 + &suite__synthesize_stat_config, 84 + &suite__synthesize_stat, 85 + &suite__synthesize_stat_round, 86 + &suite__event_update, 87 + &suite__event_times, 88 + &suite__backward_ring_buffer, 89 + &suite__cpu_map_print, 90 + &suite__cpu_map_merge, 91 + &suite__sdt_event, 92 + &suite__is_printable_array, 93 + &suite__bitmap_print, 94 + &suite__perf_hooks, 95 + &suite__clang, 96 + &suite__unit_number__scnprint, 97 + &suite__mem2node, 98 + &suite__time_utils, 99 + &suite__jit_write_elf, 100 + &suite__pfm, 101 + &suite__api_io, 102 + &suite__maps__merge_in, 103 + &suite__demangle_java, 104 + &suite__demangle_ocaml, 105 + &suite__parse_metric, 106 + &suite__pe_file_parsing, 107 + &suite__expand_cgroup_events, 108 + &suite__perf_time_to_tsc, 109 + &suite__dlfilter, 251 110 NULL, 252 111 }; 253 112
+14 -4
tools/perf/tests/clang.c
··· 19 19 #endif 20 20 }; 21 21 22 - int test__clang_subtest_get_nr(void) 22 + static int test__clang_subtest_get_nr(void) 23 23 { 24 24 return (int)ARRAY_SIZE(clang_testcase_table); 25 25 } 26 26 27 - const char *test__clang_subtest_get_desc(int i) 27 + static const char *test__clang_subtest_get_desc(int i) 28 28 { 29 29 if (i < 0 || i >= (int)ARRAY_SIZE(clang_testcase_table)) 30 30 return NULL; ··· 32 32 } 33 33 34 34 #ifndef HAVE_LIBCLANGLLVM_SUPPORT 35 - int test__clang(struct test *test __maybe_unused, int i __maybe_unused) 35 + static int test__clang(struct test *test __maybe_unused, int i __maybe_unused) 36 36 { 37 37 return TEST_SKIP; 38 38 } 39 39 #else 40 - int test__clang(struct test *test __maybe_unused, int i) 40 + static int test__clang(struct test *test __maybe_unused, int i) 41 41 { 42 42 if (i < 0 || i >= (int)ARRAY_SIZE(clang_testcase_table)) 43 43 return TEST_FAIL; 44 44 return clang_testcase_table[i].func(); 45 45 } 46 46 #endif 47 + 48 + struct test suite__clang = { 49 + .desc = "builtin clang support", 50 + .func = test__clang, 51 + .subtest = { 52 + .skip_if_fail = true, 53 + .get_nr = test__clang_subtest_get_nr, 54 + .get_desc = test__clang_subtest_get_desc, 55 + } 56 + };
+3 -1
tools/perf/tests/code-reading.c
··· 716 716 return err; 717 717 } 718 718 719 - int test__code_reading(struct test *test __maybe_unused, int subtest __maybe_unused) 719 + static int test__code_reading(struct test *test __maybe_unused, int subtest __maybe_unused) 720 720 { 721 721 int ret; 722 722 ··· 743 743 return -1; 744 744 }; 745 745 } 746 + 747 + DEFINE_SUITE("Object code reading", code_reading);
+7 -3
tools/perf/tests/cpumap.c
··· 75 75 } 76 76 77 77 78 - int test__cpu_map_synthesize(struct test *test __maybe_unused, int subtest __maybe_unused) 78 + static int test__cpu_map_synthesize(struct test *test __maybe_unused, int subtest __maybe_unused) 79 79 { 80 80 struct perf_cpu_map *cpus; 81 81 ··· 111 111 return !strcmp(buf, str); 112 112 } 113 113 114 - int test__cpu_map_print(struct test *test __maybe_unused, int subtest __maybe_unused) 114 + static int test__cpu_map_print(struct test *test __maybe_unused, int subtest __maybe_unused) 115 115 { 116 116 TEST_ASSERT_VAL("failed to convert map", cpu_map_print("1")); 117 117 TEST_ASSERT_VAL("failed to convert map", cpu_map_print("1,5")); ··· 123 123 return 0; 124 124 } 125 125 126 - int test__cpu_map_merge(struct test *test __maybe_unused, int subtest __maybe_unused) 126 + static int test__cpu_map_merge(struct test *test __maybe_unused, int subtest __maybe_unused) 127 127 { 128 128 struct perf_cpu_map *a = perf_cpu_map__new("4,2,1"); 129 129 struct perf_cpu_map *b = perf_cpu_map__new("4,5,7"); ··· 137 137 perf_cpu_map__put(c); 138 138 return 0; 139 139 } 140 + 141 + DEFINE_SUITE("Synthesize cpu map", cpu_map_synthesize); 142 + DEFINE_SUITE("Print cpu map", cpu_map_print); 143 + DEFINE_SUITE("Merge cpu map", cpu_map_merge);
+3 -1
tools/perf/tests/demangle-java-test.c
··· 7 7 #include "debug.h" 8 8 #include "demangle-java.h" 9 9 10 - int test__demangle_java(struct test *test __maybe_unused, int subtest __maybe_unused) 10 + static int test__demangle_java(struct test *test __maybe_unused, int subtest __maybe_unused) 11 11 { 12 12 int ret = TEST_OK; 13 13 char *buf = NULL; ··· 40 40 41 41 return ret; 42 42 } 43 + 44 + DEFINE_SUITE("Demangle Java", demangle_java);
+3 -1
tools/perf/tests/demangle-ocaml-test.c
··· 7 7 #include "debug.h" 8 8 #include "demangle-ocaml.h" 9 9 10 - int test__demangle_ocaml(struct test *test __maybe_unused, int subtest __maybe_unused) 10 + static int test__demangle_ocaml(struct test *test __maybe_unused, int subtest __maybe_unused) 11 11 { 12 12 int ret = TEST_OK; 13 13 char *buf = NULL; ··· 41 41 42 42 return ret; 43 43 } 44 + 45 + DEFINE_SUITE("Demangle OCaml", demangle_ocaml);
+3 -1
tools/perf/tests/dlfilter-test.c
··· 398 398 } 399 399 } 400 400 401 - int test__dlfilter(struct test *test __maybe_unused, int subtest __maybe_unused) 401 + static int test__dlfilter(struct test *test __maybe_unused, int subtest __maybe_unused) 402 402 { 403 403 struct test_data td = {.fd = -1}; 404 404 int pid = getpid(); ··· 414 414 test_data__free(&td); 415 415 return err; 416 416 } 417 + 418 + DEFINE_SUITE("dlfilter C API", dlfilter);
+7 -3
tools/perf/tests/dso-data.c
··· 113 113 return fd; 114 114 } 115 115 116 - int test__dso_data(struct test *test __maybe_unused, int subtest __maybe_unused) 116 + static int test__dso_data(struct test *test __maybe_unused, int subtest __maybe_unused) 117 117 { 118 118 struct machine machine; 119 119 struct dso *dso; ··· 248 248 return setrlimit(RLIMIT_NOFILE, &rlim); 249 249 } 250 250 251 - int test__dso_data_cache(struct test *test __maybe_unused, int subtest __maybe_unused) 251 + static int test__dso_data_cache(struct test *test __maybe_unused, int subtest __maybe_unused) 252 252 { 253 253 struct machine machine; 254 254 long nr_end, nr = open_files_cnt(); ··· 318 318 return ret; 319 319 } 320 320 321 - int test__dso_data_reopen(struct test *test __maybe_unused, int subtest __maybe_unused) 321 + static int test__dso_data_reopen(struct test *test __maybe_unused, int subtest __maybe_unused) 322 322 { 323 323 struct machine machine; 324 324 long nr_end, nr = open_files_cnt(), lim = new_limit(3); ··· 393 393 TEST_ASSERT_VAL("failed leaking files", nr == nr_end); 394 394 return 0; 395 395 } 396 + 397 + DEFINE_SUITE("DSO data read", dso_data); 398 + DEFINE_SUITE("DSO data cache", dso_data_cache); 399 + DEFINE_SUITE("DSO data reopen", dso_data_reopen);
+1 -4
tools/perf/tests/dwarf-unwind.c
··· 238 238 return err; 239 239 } 240 240 241 - struct test dwarf_unwind = { 242 - .desc = "Test dwarf unwind", 243 - .func = test__dwarf_unwind, 244 - }; 241 + DEFINE_SUITE("Test dwarf unwind", dwarf_unwind);
+3 -1
tools/perf/tests/event-times.c
··· 216 216 * and checks that enabled and running times 217 217 * match. 218 218 */ 219 - int test__event_times(struct test *test __maybe_unused, int subtest __maybe_unused) 219 + static int test__event_times(struct test *test __maybe_unused, int subtest __maybe_unused) 220 220 { 221 221 int err, ret = 0; 222 222 ··· 239 239 #undef _T 240 240 return ret; 241 241 } 242 + 243 + DEFINE_SUITE("Event times", event_times);
+3 -1
tools/perf/tests/event_update.c
··· 83 83 return 0; 84 84 } 85 85 86 - int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unused) 86 + static int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unused) 87 87 { 88 88 struct evsel *evsel; 89 89 struct event_name tmp; ··· 123 123 evlist__delete(evlist); 124 124 return 0; 125 125 } 126 + 127 + DEFINE_SUITE("Synthesize attr update", event_update);
+4 -1
tools/perf/tests/evsel-roundtrip-name.c
··· 99 99 #define perf_evsel__name_array_test(names, distance) \ 100 100 __perf_evsel__name_array_test(names, ARRAY_SIZE(names), distance) 101 101 102 - int test__perf_evsel__roundtrip_name_test(struct test *test __maybe_unused, int subtest __maybe_unused) 102 + static int test__perf_evsel__roundtrip_name_test(struct test *test __maybe_unused, 103 + int subtest __maybe_unused) 103 104 { 104 105 int err = 0, ret = 0; 105 106 ··· 121 120 122 121 return ret; 123 122 } 123 + 124 + DEFINE_SUITE("Roundtrip evsel->name", perf_evsel__roundtrip_name_test);
+4 -1
tools/perf/tests/evsel-tp-sched.c
··· 32 32 return ret; 33 33 } 34 34 35 - int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtest __maybe_unused) 35 + static int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, 36 + int subtest __maybe_unused) 36 37 { 37 38 struct evsel *evsel = evsel__newtp("sched", "sched_switch"); 38 39 int ret = 0; ··· 88 87 evsel__delete(evsel); 89 88 return ret; 90 89 } 90 + 91 + DEFINE_SUITE("Parse sched tracepoints fields", perf_evsel__tp_sched_test);
+4 -2
tools/perf/tests/expand-cgroup.c
··· 221 221 return ret; 222 222 } 223 223 224 - int test__expand_cgroup_events(struct test *test __maybe_unused, 225 - int subtest __maybe_unused) 224 + static int test__expand_cgroup_events(struct test *test __maybe_unused, 225 + int subtest __maybe_unused) 226 226 { 227 227 int ret; 228 228 ··· 240 240 241 241 return ret; 242 242 } 243 + 244 + DEFINE_SUITE("Event expansion for cgroups", expand_cgroup_events);
+3 -1
tools/perf/tests/expr.c
··· 62 62 return 0; 63 63 } 64 64 65 - int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused) 65 + static int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused) 66 66 { 67 67 struct expr_id_data *val_ptr; 68 68 const char *p; ··· 155 155 156 156 return 0; 157 157 } 158 + 159 + DEFINE_SUITE("Simple expression parser", expr);
+5 -2
tools/perf/tests/fdarray.c
··· 28 28 return printed + fdarray__fprintf(fda, fp); 29 29 } 30 30 31 - int test__fdarray__filter(struct test *test __maybe_unused, int subtest __maybe_unused) 31 + static int test__fdarray__filter(struct test *test __maybe_unused, int subtest __maybe_unused) 32 32 { 33 33 int nr_fds, err = TEST_FAIL; 34 34 struct fdarray *fda = fdarray__new(5, 5); ··· 89 89 return err; 90 90 } 91 91 92 - int test__fdarray__add(struct test *test __maybe_unused, int subtest __maybe_unused) 92 + static int test__fdarray__add(struct test *test __maybe_unused, int subtest __maybe_unused) 93 93 { 94 94 int err = TEST_FAIL; 95 95 struct fdarray *fda = fdarray__new(2, 2); ··· 158 158 out: 159 159 return err; 160 160 } 161 + 162 + DEFINE_SUITE("Filter fds with revents mask in a fdarray", fdarray__filter); 163 + DEFINE_SUITE("Add fd to a fdarray, making it autogrow", fdarray__add);
+4 -2
tools/perf/tests/genelf.c
··· 16 16 17 17 #define TEMPL "/tmp/perf-test-XXXXXX" 18 18 19 - int test__jit_write_elf(struct test *test __maybe_unused, 20 - int subtest __maybe_unused) 19 + static int test__jit_write_elf(struct test *test __maybe_unused, 20 + int subtest __maybe_unused) 21 21 { 22 22 #ifdef HAVE_JITDUMP 23 23 static unsigned char x86_code[] = { ··· 49 49 return TEST_SKIP; 50 50 #endif 51 51 } 52 + 53 + DEFINE_SUITE("Test jit_write_elf", jit_write_elf);
+3 -1
tools/perf/tests/hists_cumulate.c
··· 689 689 return err; 690 690 } 691 691 692 - int test__hists_cumulate(struct test *test __maybe_unused, int subtest __maybe_unused) 692 + static int test__hists_cumulate(struct test *test __maybe_unused, int subtest __maybe_unused) 693 693 { 694 694 int err = TEST_FAIL; 695 695 struct machines machines; ··· 736 736 737 737 return err; 738 738 } 739 + 740 + DEFINE_SUITE("Cumulate child hist entries", hists_cumulate);
+3 -1
tools/perf/tests/hists_filter.c
··· 101 101 return TEST_FAIL; 102 102 } 103 103 104 - int test__hists_filter(struct test *test __maybe_unused, int subtest __maybe_unused) 104 + static int test__hists_filter(struct test *test __maybe_unused, int subtest __maybe_unused) 105 105 { 106 106 int err = TEST_FAIL; 107 107 struct machines machines; ··· 325 325 326 326 return err; 327 327 } 328 + 329 + DEFINE_SUITE("Filter hist entries", hists_filter);
+3 -1
tools/perf/tests/hists_link.c
··· 264 264 return __validate_link(leader, 0) || __validate_link(other, 1); 265 265 } 266 266 267 - int test__hists_link(struct test *test __maybe_unused, int subtest __maybe_unused) 267 + static int test__hists_link(struct test *test __maybe_unused, int subtest __maybe_unused) 268 268 { 269 269 int err = -1; 270 270 struct hists *hists, *first_hists; ··· 339 339 340 340 return err; 341 341 } 342 + 343 + DEFINE_SUITE("Match and link multiple hists", hists_link);
+3 -1
tools/perf/tests/hists_output.c
··· 575 575 return err; 576 576 } 577 577 578 - int test__hists_output(struct test *test __maybe_unused, int subtest __maybe_unused) 578 + static int test__hists_output(struct test *test __maybe_unused, int subtest __maybe_unused) 579 579 { 580 580 int err = TEST_FAIL; 581 581 struct machines machines; ··· 623 623 624 624 return err; 625 625 } 626 + 627 + DEFINE_SUITE("Sort output of hist entries", hists_output);
+3 -1
tools/perf/tests/is_printable_array.c
··· 5 5 #include "debug.h" 6 6 #include "print_binary.h" 7 7 8 - int test__is_printable_array(struct test *test __maybe_unused, int subtest __maybe_unused) 8 + static int test__is_printable_array(struct test *test __maybe_unused, int subtest __maybe_unused) 9 9 { 10 10 char buf1[] = { 'k', 'r', 4, 'v', 'a', 0 }; 11 11 char buf2[] = { 'k', 'r', 'a', 'v', 4, 0 }; ··· 36 36 37 37 return TEST_OK; 38 38 } 39 + 40 + DEFINE_SUITE("is_printable_array", is_printable_array);
+3 -1
tools/perf/tests/keep-tracking.c
··· 61 61 * when an event is disabled but a dummy software event is not disabled. If the 62 62 * test passes %0 is returned, otherwise %-1 is returned. 63 63 */ 64 - int test__keep_tracking(struct test *test __maybe_unused, int subtest __maybe_unused) 64 + static int test__keep_tracking(struct test *test __maybe_unused, int subtest __maybe_unused) 65 65 { 66 66 struct record_opts opts = { 67 67 .mmap_pages = UINT_MAX, ··· 160 160 161 161 return err; 162 162 } 163 + 164 + DEFINE_SUITE("Use a dummy software event to keep tracking", keep_tracking);
+3 -1
tools/perf/tests/kmod-path.c
··· 47 47 #define M(path, c, e) \ 48 48 TEST_ASSERT_VAL("failed", !test_is_kernel_module(path, c, e)) 49 49 50 - int test__kmod_path__parse(struct test *t __maybe_unused, int subtest __maybe_unused) 50 + static int test__kmod_path__parse(struct test *t __maybe_unused, int subtest __maybe_unused) 51 51 { 52 52 /* path alloc_name kmod comp name */ 53 53 T("/xxxx/xxxx/x-x.ko", true , true, 0 , "[x_x]"); ··· 159 159 160 160 return 0; 161 161 } 162 + 163 + DEFINE_SUITE("kmod_path__parse", kmod_path__parse);
+16 -6
tools/perf/tests/llvm.c
··· 124 124 return ret; 125 125 } 126 126 127 - int test__llvm(struct test *test __maybe_unused, int subtest) 127 + static int test__llvm(struct test *test __maybe_unused, int subtest) 128 128 { 129 129 int ret; 130 130 void *obj_buf = NULL; ··· 149 149 return ret; 150 150 } 151 151 152 - int test__llvm_subtest_get_nr(void) 152 + static int test__llvm_subtest_get_nr(void) 153 153 { 154 154 return __LLVM_TESTCASE_MAX; 155 155 } 156 156 157 - const char *test__llvm_subtest_get_desc(int subtest) 157 + static const char *test__llvm_subtest_get_desc(int subtest) 158 158 { 159 159 if ((subtest < 0) || (subtest >= __LLVM_TESTCASE_MAX)) 160 160 return NULL; ··· 162 162 return bpf_source_table[subtest].desc; 163 163 } 164 164 #else //HAVE_LIBBPF_SUPPORT 165 - int test__llvm(struct test *test __maybe_unused, int subtest __maybe_unused) 165 + static int test__llvm(struct test *test __maybe_unused, int subtest __maybe_unused) 166 166 { 167 167 return TEST_SKIP; 168 168 } 169 169 170 - int test__llvm_subtest_get_nr(void) 170 + static int test__llvm_subtest_get_nr(void) 171 171 { 172 172 return 0; 173 173 } 174 174 175 - const char *test__llvm_subtest_get_desc(int subtest __maybe_unused) 175 + static const char *test__llvm_subtest_get_desc(int subtest __maybe_unused) 176 176 { 177 177 return NULL; 178 178 } 179 179 #endif // HAVE_LIBBPF_SUPPORT 180 + 181 + struct test suite__llvm = { 182 + .desc = "LLVM search and compile", 183 + .func = test__llvm, 184 + .subtest = { 185 + .skip_if_fail = true, 186 + .get_nr = test__llvm_subtest_get_nr, 187 + .get_desc = test__llvm_subtest_get_desc, 188 + }, 189 + };
+3 -1
tools/perf/tests/maps.c
··· 33 33 return TEST_OK; 34 34 } 35 35 36 - int test__maps__merge_in(struct test *t __maybe_unused, int subtest __maybe_unused) 36 + static int test__maps__merge_in(struct test *t __maybe_unused, int subtest __maybe_unused) 37 37 { 38 38 struct maps maps; 39 39 unsigned int i; ··· 120 120 maps__exit(&maps); 121 121 return TEST_OK; 122 122 } 123 + 124 + DEFINE_SUITE("maps__merge_in", maps__merge_in);
+3 -1
tools/perf/tests/mem.c
··· 23 23 return 0; 24 24 } 25 25 26 - int test__mem(struct test *text __maybe_unused, int subtest __maybe_unused) 26 + static int test__mem(struct test *text __maybe_unused, int subtest __maybe_unused) 27 27 { 28 28 int ret = 0; 29 29 union perf_mem_data_src src; ··· 56 56 57 57 return ret; 58 58 } 59 + 60 + DEFINE_SUITE("Test data source output", mem);
+3 -1
tools/perf/tests/mem2node.c
··· 43 43 return bm && map ? bm : NULL; 44 44 } 45 45 46 - int test__mem2node(struct test *t __maybe_unused, int subtest __maybe_unused) 46 + static int test__mem2node(struct test *t __maybe_unused, int subtest __maybe_unused) 47 47 { 48 48 struct mem2node map; 49 49 struct memory_node nodes[3]; ··· 77 77 mem2node__exit(&map); 78 78 return 0; 79 79 } 80 + 81 + DEFINE_SUITE("mem2node", mem2node);
+3 -1
tools/perf/tests/mmap-basic.c
··· 29 29 * Then it checks if the number of syscalls reported as perf events by 30 30 * the kernel corresponds to the number of syscalls made. 31 31 */ 32 - int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unused) 32 + static int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unused) 33 33 { 34 34 int err = -1; 35 35 union perf_event *event; ··· 164 164 perf_thread_map__put(threads); 165 165 return err; 166 166 } 167 + 168 + DEFINE_SUITE("Read samples using the mmap interface", basic_mmap);
+3 -1
tools/perf/tests/mmap-thread-lookup.c
··· 224 224 * 225 225 * by using all thread objects. 226 226 */ 227 - int test__mmap_thread_lookup(struct test *test __maybe_unused, int subtest __maybe_unused) 227 + static int test__mmap_thread_lookup(struct test *test __maybe_unused, int subtest __maybe_unused) 228 228 { 229 229 /* perf_event__synthesize_threads synthesize */ 230 230 TEST_ASSERT_VAL("failed with sythesizing all", ··· 236 236 237 237 return 0; 238 238 } 239 + 240 + DEFINE_SUITE("Lookup mmap thread", mmap_thread_lookup);
+4 -1
tools/perf/tests/openat-syscall-all-cpus.c
··· 19 19 #include "stat.h" 20 20 #include "util/counts.h" 21 21 22 - int test__openat_syscall_event_on_all_cpus(struct test *test __maybe_unused, int subtest __maybe_unused) 22 + static int test__openat_syscall_event_on_all_cpus(struct test *test __maybe_unused, 23 + int subtest __maybe_unused) 23 24 { 24 25 int err = -1, fd, cpu; 25 26 struct perf_cpu_map *cpus; ··· 128 127 perf_thread_map__put(threads); 129 128 return err; 130 129 } 130 + 131 + DEFINE_SUITE("Detect openat syscall event on all cpus", openat_syscall_event_on_all_cpus);
+4 -1
tools/perf/tests/openat-syscall-tp-fields.c
··· 22 22 #define AT_FDCWD -100 23 23 #endif 24 24 25 - int test__syscall_openat_tp_fields(struct test *test __maybe_unused, int subtest __maybe_unused) 25 + static int test__syscall_openat_tp_fields(struct test *test __maybe_unused, 26 + int subtest __maybe_unused) 26 27 { 27 28 struct record_opts opts = { 28 29 .target = { ··· 143 142 out: 144 143 return err; 145 144 } 145 + 146 + DEFINE_SUITE("syscalls:sys_enter_openat event fields", syscall_openat_tp_fields);
+4 -1
tools/perf/tests/openat-syscall.c
··· 13 13 #include "tests.h" 14 14 #include "util/counts.h" 15 15 16 - int test__openat_syscall_event(struct test *test __maybe_unused, int subtest __maybe_unused) 16 + static int test__openat_syscall_event(struct test *test __maybe_unused, 17 + int subtest __maybe_unused) 17 18 { 18 19 int err = -1, fd; 19 20 struct evsel *evsel; ··· 67 66 perf_thread_map__put(threads); 68 67 return err; 69 68 } 69 + 70 + DEFINE_SUITE("Detect openat syscall event", openat_syscall_event);
+3 -1
tools/perf/tests/parse-events.c
··· 2276 2276 return test_event(&e); 2277 2277 } 2278 2278 2279 - int test__parse_events(struct test *test __maybe_unused, int subtest __maybe_unused) 2279 + static int test__parse_events(struct test *test __maybe_unused, int subtest __maybe_unused) 2280 2280 { 2281 2281 int ret1, ret2 = 0; 2282 2282 char *event, *alias; ··· 2319 2319 2320 2320 return ret2; 2321 2321 } 2322 + 2323 + DEFINE_SUITE("Parse event definition strings", parse_events);
+3 -1
tools/perf/tests/parse-metric.c
··· 369 369 return 0; 370 370 } 371 371 372 - int test__parse_metric(struct test *test __maybe_unused, int subtest __maybe_unused) 372 + static int test__parse_metric(struct test *test __maybe_unused, int subtest __maybe_unused) 373 373 { 374 374 TEST_ASSERT_VAL("IPC failed", test_ipc() == 0); 375 375 TEST_ASSERT_VAL("frontend failed", test_frontend() == 0); ··· 383 383 } 384 384 return 0; 385 385 } 386 + 387 + DEFINE_SUITE("Parse and process metrics", parse_metric);
+4 -1
tools/perf/tests/parse-no-sample-id-all.c
··· 67 67 * 68 68 * Return: %0 on success, %-1 if the test fails. 69 69 */ 70 - int test__parse_no_sample_id_all(struct test *test __maybe_unused, int subtest __maybe_unused) 70 + static int test__parse_no_sample_id_all(struct test *test __maybe_unused, 71 + int subtest __maybe_unused) 71 72 { 72 73 int err; 73 74 ··· 104 103 105 104 return 0; 106 105 } 106 + 107 + DEFINE_SUITE("Parse with no sample_id_all bit set", parse_no_sample_id_all);
+4 -2
tools/perf/tests/pe-file-parsing.c
··· 68 68 return TEST_OK; 69 69 } 70 70 71 - int test__pe_file_parsing(struct test *test __maybe_unused, 71 + static int test__pe_file_parsing(struct test *test __maybe_unused, 72 72 int subtest __maybe_unused) 73 73 { 74 74 struct stat st; ··· 89 89 90 90 #else 91 91 92 - int test__pe_file_parsing(struct test *test __maybe_unused, 92 + static int test__pe_file_parsing(struct test *test __maybe_unused, 93 93 int subtest __maybe_unused) 94 94 { 95 95 return TEST_SKIP; 96 96 } 97 97 98 98 #endif 99 + 100 + DEFINE_SUITE("PE file support", pe_file_parsing);
+3 -1
tools/perf/tests/perf-hooks.c
··· 26 26 raise(SIGSEGV); 27 27 } 28 28 29 - int test__perf_hooks(struct test *test __maybe_unused, int subtest __maybe_unused) 29 + static int test__perf_hooks(struct test *test __maybe_unused, int subtest __maybe_unused) 30 30 { 31 31 int hook_flags = 0; 32 32 ··· 45 45 return TEST_FAIL; 46 46 return TEST_OK; 47 47 } 48 + 49 + DEFINE_SUITE("perf hooks", perf_hooks);
+3 -1
tools/perf/tests/perf-record.c
··· 41 41 return cpu; 42 42 } 43 43 44 - int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unused) 44 + static int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unused) 45 45 { 46 46 struct record_opts opts = { 47 47 .target = { ··· 332 332 out: 333 333 return (err < 0 || errs > 0) ? -1 : 0; 334 334 } 335 + 336 + DEFINE_SUITE("PERF_RECORD_* events & perf_sample fields", PERF_RECORD);
+8 -2
tools/perf/tests/perf-time-to-tsc.c
··· 45 45 * %0 is returned, otherwise %-1 is returned. If TSC conversion is not 46 46 * supported then then the test passes but " (not supported)" is printed. 47 47 */ 48 - int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe_unused) 48 + static int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe_unused) 49 49 { 50 50 struct record_opts opts = { 51 51 .mmap_pages = UINT_MAX, ··· 185 185 return err; 186 186 } 187 187 188 - bool test__tsc_is_supported(void) 188 + static bool test__tsc_is_supported(void) 189 189 { 190 190 /* 191 191 * Except x86_64/i386 and Arm64, other archs don't support TSC in perf. ··· 197 197 return false; 198 198 #endif 199 199 } 200 + 201 + struct test suite__perf_time_to_tsc = { 202 + .desc = "Convert perf time to TSC", 203 + .func = test__perf_time_to_tsc, 204 + .is_supported = test__tsc_is_supported, 205 + };
+13 -3
tools/perf/tests/pfm.c
··· 189 189 } 190 190 #endif 191 191 192 - const char *test__pfm_subtest_get_desc(int i) 192 + static const char *test__pfm_subtest_get_desc(int i) 193 193 { 194 194 if (i < 0 || i >= (int)ARRAY_SIZE(pfm_testcase_table)) 195 195 return NULL; 196 196 return pfm_testcase_table[i].desc; 197 197 } 198 198 199 - int test__pfm_subtest_get_nr(void) 199 + static int test__pfm_subtest_get_nr(void) 200 200 { 201 201 return (int)ARRAY_SIZE(pfm_testcase_table); 202 202 } 203 203 204 - int test__pfm(struct test *test __maybe_unused, int i __maybe_unused) 204 + static int test__pfm(struct test *test __maybe_unused, int i __maybe_unused) 205 205 { 206 206 #ifdef HAVE_LIBPFM 207 207 if (i < 0 || i >= (int)ARRAY_SIZE(pfm_testcase_table)) ··· 211 211 return TEST_SKIP; 212 212 #endif 213 213 } 214 + 215 + struct test suite__pfm = { 216 + .desc = "Test libpfm4 support", 217 + .func = test__pfm, 218 + .subtest = { 219 + .skip_if_fail = true, 220 + .get_nr = test__pfm_subtest_get_nr, 221 + .get_desc = test__pfm_subtest_get_desc, 222 + } 223 + };
+15 -4
tools/perf/tests/pmu-events.c
··· 1090 1090 }, 1091 1091 }; 1092 1092 1093 - const char *test__pmu_events_subtest_get_desc(int subtest) 1093 + static const char *test__pmu_events_subtest_get_desc(int subtest) 1094 1094 { 1095 1095 if (subtest < 0 || 1096 1096 subtest >= (int)ARRAY_SIZE(pmu_events_testcase_table)) ··· 1098 1098 return pmu_events_testcase_table[subtest].desc; 1099 1099 } 1100 1100 1101 - const char *test__pmu_events_subtest_skip_reason(int subtest) 1101 + static const char *test__pmu_events_subtest_skip_reason(int subtest) 1102 1102 { 1103 1103 if (subtest < 0 || 1104 1104 subtest >= (int)ARRAY_SIZE(pmu_events_testcase_table)) ··· 1108 1108 return "some metrics failed"; 1109 1109 } 1110 1110 1111 - int test__pmu_events_subtest_get_nr(void) 1111 + static int test__pmu_events_subtest_get_nr(void) 1112 1112 { 1113 1113 return (int)ARRAY_SIZE(pmu_events_testcase_table); 1114 1114 } 1115 1115 1116 - int test__pmu_events(struct test *test __maybe_unused, int subtest) 1116 + static int test__pmu_events(struct test *test __maybe_unused, int subtest) 1117 1117 { 1118 1118 if (subtest < 0 || 1119 1119 subtest >= (int)ARRAY_SIZE(pmu_events_testcase_table)) 1120 1120 return TEST_FAIL; 1121 1121 return pmu_events_testcase_table[subtest].func(); 1122 1122 } 1123 + 1124 + struct test suite__pmu_events = { 1125 + .desc = "PMU events", 1126 + .func = test__pmu_events, 1127 + .subtest = { 1128 + .skip_if_fail = false, 1129 + .get_nr = test__pmu_events_subtest_get_nr, 1130 + .get_desc = test__pmu_events_subtest_get_desc, 1131 + .skip_reason = test__pmu_events_subtest_skip_reason, 1132 + }, 1133 + };
+3 -1
tools/perf/tests/pmu.c
··· 137 137 return &terms; 138 138 } 139 139 140 - int test__pmu(struct test *test __maybe_unused, int subtest __maybe_unused) 140 + static int test__pmu(struct test *test __maybe_unused, int subtest __maybe_unused) 141 141 { 142 142 char *format = test_format_dir_get(); 143 143 LIST_HEAD(formats); ··· 177 177 test_format_dir_put(format); 178 178 return ret; 179 179 } 180 + 181 + DEFINE_SUITE("Parse perf pmu format", pmu);
+3 -1
tools/perf/tests/python-use.c
··· 9 9 #include "tests.h" 10 10 #include "util/debug.h" 11 11 12 - int test__python_use(struct test *test __maybe_unused, int subtest __maybe_unused) 12 + static int test__python_use(struct test *test __maybe_unused, int subtest __maybe_unused) 13 13 { 14 14 char *cmd; 15 15 int ret; ··· 23 23 free(cmd); 24 24 return ret; 25 25 } 26 + 27 + DEFINE_SUITE("'import perf' in python", python_use);
+3 -1
tools/perf/tests/sample-parsing.c
··· 368 368 * checks sample format bits separately and together. If the test passes %0 is 369 369 * returned, otherwise %-1 is returned. 370 370 */ 371 - int test__sample_parsing(struct test *test __maybe_unused, int subtest __maybe_unused) 371 + static int test__sample_parsing(struct test *test __maybe_unused, int subtest __maybe_unused) 372 372 { 373 373 const u64 rf[] = {4, 5, 6, 7, 12, 13, 14, 15}; 374 374 u64 sample_type; ··· 426 426 427 427 return 0; 428 428 } 429 + 430 + DEFINE_SUITE("Sample parsing", sample_parsing);
+4 -2
tools/perf/tests/sdt.c
··· 76 76 return ret; 77 77 } 78 78 79 - int test__sdt_event(struct test *test __maybe_unused, int subtests __maybe_unused) 79 + static int test__sdt_event(struct test *test __maybe_unused, int subtests __maybe_unused) 80 80 { 81 81 int ret = TEST_FAIL; 82 82 char __tempdir[] = "./test-buildid-XXXXXX"; ··· 114 114 return ret; 115 115 } 116 116 #else 117 - int test__sdt_event(struct test *test __maybe_unused, int subtests __maybe_unused) 117 + static int test__sdt_event(struct test *test __maybe_unused, int subtests __maybe_unused) 118 118 { 119 119 pr_debug("Skip SDT event test because SDT support is not compiled\n"); 120 120 return TEST_SKIP; 121 121 } 122 122 #endif 123 + 124 + DEFINE_SUITE("Probe SDT events", sdt_event);
+8 -3
tools/perf/tests/stat.c
··· 47 47 return 0; 48 48 } 49 49 50 - int test__synthesize_stat_config(struct test *test __maybe_unused, int subtest __maybe_unused) 50 + static int test__synthesize_stat_config(struct test *test __maybe_unused, 51 + int subtest __maybe_unused) 51 52 { 52 53 struct perf_stat_config stat_config = { 53 54 .aggr_mode = AGGR_CORE, ··· 78 77 return 0; 79 78 } 80 79 81 - int test__synthesize_stat(struct test *test __maybe_unused, int subtest __maybe_unused) 80 + static int test__synthesize_stat(struct test *test __maybe_unused, int subtest __maybe_unused) 82 81 { 83 82 struct perf_counts_values count; 84 83 ··· 104 103 return 0; 105 104 } 106 105 107 - int test__synthesize_stat_round(struct test *test __maybe_unused, int subtest __maybe_unused) 106 + static int test__synthesize_stat_round(struct test *test __maybe_unused, int subtest __maybe_unused) 108 107 { 109 108 TEST_ASSERT_VAL("failed to synthesize stat_config", 110 109 !perf_event__synthesize_stat_round(NULL, 0xdeadbeef, PERF_STAT_ROUND_TYPE__INTERVAL, ··· 112 111 113 112 return 0; 114 113 } 114 + 115 + DEFINE_SUITE("Synthesize stat config", synthesize_stat_config); 116 + DEFINE_SUITE("Synthesize stat", synthesize_stat); 117 + DEFINE_SUITE("Synthesize stat round", synthesize_stat_round);
+3 -1
tools/perf/tests/sw-clock.c
··· 133 133 return err; 134 134 } 135 135 136 - int test__sw_clock_freq(struct test *test __maybe_unused, int subtest __maybe_unused) 136 + static int test__sw_clock_freq(struct test *test __maybe_unused, int subtest __maybe_unused) 137 137 { 138 138 int ret; 139 139 ··· 143 143 144 144 return ret; 145 145 } 146 + 147 + DEFINE_SUITE("Software clock events period values", sw_clock_freq);
+3 -1
tools/perf/tests/switch-tracking.c
··· 321 321 * evsel->core.system_wide and evsel->tracking flags (respectively) with other events 322 322 * sometimes enabled or disabled. 323 323 */ 324 - int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_unused) 324 + static int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_unused) 325 325 { 326 326 const char *sched_switch = "sched:sched_switch"; 327 327 struct switch_tracking switch_tracking = { .tids = NULL, }; ··· 588 588 err = -1; 589 589 goto out; 590 590 } 591 + 592 + DEFINE_SUITE("Track with sched_switch", switch_tracking);
+3 -1
tools/perf/tests/task-exit.c
··· 39 39 * if the number of exit event reported by the kernel is 1 or not 40 40 * in order to check the kernel returns correct number of event. 41 41 */ 42 - int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused) 42 + static int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused) 43 43 { 44 44 int err = -1; 45 45 union perf_event *event; ··· 151 151 evlist__delete(evlist); 152 152 return err; 153 153 } 154 + 155 + DEFINE_SUITE("Number of exit events of a simple workload", task_exit);
+3 -20
tools/perf/tests/tests.h
··· 41 41 }; 42 42 43 43 #define DECLARE_SUITE(name) \ 44 - int test__##name(struct test *test, int subtest) 44 + extern struct test suite__##name; 45 45 46 46 #define DEFINE_SUITE(description, name) \ 47 - static struct test name = { \ 47 + struct test suite__##name = { \ 48 48 .desc = description, \ 49 49 .func = test__##name, \ 50 50 } ··· 60 60 DECLARE_SUITE(syscall_openat_tp_fields); 61 61 DECLARE_SUITE(pmu); 62 62 DECLARE_SUITE(pmu_events); 63 - const char *test__pmu_events_subtest_get_desc(int subtest); 64 - const char *test__pmu_events_subtest_skip_reason(int subtest); 65 - int test__pmu_events_subtest_get_nr(void); 66 63 DECLARE_SUITE(attr); 67 64 DECLARE_SUITE(dso_data); 68 65 DECLARE_SUITE(dso_data_cache); ··· 71 74 DECLARE_SUITE(bp_signal_overflow); 72 75 DECLARE_SUITE(bp_accounting); 73 76 DECLARE_SUITE(wp); 74 - const char *test__wp_subtest_get_desc(int subtest); 75 - const char *test__wp_subtest_skip_reason(int subtest); 76 - int test__wp_subtest_get_nr(void); 77 77 DECLARE_SUITE(task_exit); 78 78 DECLARE_SUITE(mem); 79 79 DECLARE_SUITE(sw_clock_freq); ··· 78 84 DECLARE_SUITE(sample_parsing); 79 85 DECLARE_SUITE(keep_tracking); 80 86 DECLARE_SUITE(parse_no_sample_id_all); 81 - extern struct test dwarf_unwind; 87 + DECLARE_SUITE(dwarf_unwind); 82 88 DECLARE_SUITE(expr); 83 89 DECLARE_SUITE(hists_filter); 84 90 DECLARE_SUITE(mmap_thread_lookup); ··· 91 97 DECLARE_SUITE(kmod_path__parse); 92 98 DECLARE_SUITE(thread_map); 93 99 DECLARE_SUITE(llvm); 94 - const char *test__llvm_subtest_get_desc(int subtest); 95 - int test__llvm_subtest_get_nr(void); 96 100 DECLARE_SUITE(bpf); 97 - const char *test__bpf_subtest_get_desc(int subtest); 98 - int test__bpf_subtest_get_nr(void); 99 101 DECLARE_SUITE(session_topology); 100 102 DECLARE_SUITE(thread_map_synthesize); 101 103 DECLARE_SUITE(thread_map_remove); ··· 109 119 DECLARE_SUITE(bitmap_print); 110 120 DECLARE_SUITE(perf_hooks); 111 121 DECLARE_SUITE(clang); 112 - const char *test__clang_subtest_get_desc(int subtest); 113 - int test__clang_subtest_get_nr(void); 114 122 DECLARE_SUITE(unit_number__scnprint); 115 123 DECLARE_SUITE(mem2node); 116 124 DECLARE_SUITE(maps__merge_in); ··· 118 130 DECLARE_SUITE(demangle_java); 119 131 DECLARE_SUITE(demangle_ocaml); 120 132 DECLARE_SUITE(pfm); 121 - const char *test__pfm_subtest_get_desc(int subtest); 122 - int test__pfm_subtest_get_nr(void); 123 133 DECLARE_SUITE(parse_metric); 124 134 DECLARE_SUITE(pe_file_parsing); 125 135 DECLARE_SUITE(expand_cgroup_events); ··· 125 139 DECLARE_SUITE(dlfilter); 126 140 127 141 bool test__bp_signal_is_supported(void); 128 - bool test__bp_account_is_supported(void); 129 - bool test__wp_is_supported(void); 130 - bool test__tsc_is_supported(void); 131 142 132 143 #ifdef HAVE_DWARF_UNWIND_SUPPORT 133 144 struct thread;
+7 -3
tools/perf/tests/thread-map.c
··· 19 19 #define NAME (const char *) "perf" 20 20 #define NAMEUL (unsigned long) NAME 21 21 22 - int test__thread_map(struct test *test __maybe_unused, int subtest __maybe_unused) 22 + static int test__thread_map(struct test *test __maybe_unused, int subtest __maybe_unused) 23 23 { 24 24 struct perf_thread_map *map; 25 25 ··· 86 86 return 0; 87 87 } 88 88 89 - int test__thread_map_synthesize(struct test *test __maybe_unused, int subtest __maybe_unused) 89 + static int test__thread_map_synthesize(struct test *test __maybe_unused, int subtest __maybe_unused) 90 90 { 91 91 struct perf_thread_map *threads; 92 92 ··· 106 106 return 0; 107 107 } 108 108 109 - int test__thread_map_remove(struct test *test __maybe_unused, int subtest __maybe_unused) 109 + static int test__thread_map_remove(struct test *test __maybe_unused, int subtest __maybe_unused) 110 110 { 111 111 struct perf_thread_map *threads; 112 112 char *str; ··· 145 145 perf_thread_map__put(threads); 146 146 return 0; 147 147 } 148 + 149 + DEFINE_SUITE("Thread map", thread_map); 150 + DEFINE_SUITE("Synthesize thread map", thread_map_synthesize); 151 + DEFINE_SUITE("Remove thread map", thread_map_remove);
+3 -1
tools/perf/tests/thread-maps-share.c
··· 4 4 #include "thread.h" 5 5 #include "debug.h" 6 6 7 - int test__thread_maps_share(struct test *test __maybe_unused, int subtest __maybe_unused) 7 + static int test__thread_maps_share(struct test *test __maybe_unused, int subtest __maybe_unused) 8 8 { 9 9 struct machines machines; 10 10 struct machine *machine; ··· 96 96 machines__exit(&machines); 97 97 return 0; 98 98 } 99 + 100 + DEFINE_SUITE("Share thread maps", thread_maps_share);
+3 -1
tools/perf/tests/time-utils-test.c
··· 131 131 return pass; 132 132 } 133 133 134 - int test__time_utils(struct test *t __maybe_unused, int subtest __maybe_unused) 134 + static int test__time_utils(struct test *t __maybe_unused, int subtest __maybe_unused) 135 135 { 136 136 bool pass = true; 137 137 ··· 249 249 250 250 return pass ? 0 : TEST_FAIL; 251 251 } 252 + 253 + DEFINE_SUITE("time utils", time_utils);
+3 -1
tools/perf/tests/topology.c
··· 175 175 return 0; 176 176 } 177 177 178 - int test__session_topology(struct test *test __maybe_unused, int subtest __maybe_unused) 178 + static int test__session_topology(struct test *test __maybe_unused, int subtest __maybe_unused) 179 179 { 180 180 char path[PATH_MAX]; 181 181 struct perf_cpu_map *map; ··· 201 201 unlink(path); 202 202 return ret; 203 203 } 204 + 205 + DEFINE_SUITE("Session topology", session_topology);
+3 -1
tools/perf/tests/unit_number__scnprintf.c
··· 7 7 #include "units.h" 8 8 #include "debug.h" 9 9 10 - int test__unit_number__scnprint(struct test *t __maybe_unused, int subtest __maybe_unused) 10 + static int test__unit_number__scnprint(struct test *t __maybe_unused, int subtest __maybe_unused) 11 11 { 12 12 struct { 13 13 u64 n; ··· 38 38 39 39 return TEST_OK; 40 40 } 41 + 42 + DEFINE_SUITE("unit_number__scnprintf", unit_number__scnprint);
+4 -1
tools/perf/tests/vmlinux-kallsyms.c
··· 111 111 return false; 112 112 } 113 113 114 - int test__vmlinux_matches_kallsyms(struct test *test __maybe_unused, int subtest __maybe_unused) 114 + static int test__vmlinux_matches_kallsyms(struct test *test __maybe_unused, 115 + int subtest __maybe_unused) 115 116 { 116 117 int err = -1; 117 118 struct rb_node *nd; ··· 353 352 machine__exit(&vmlinux); 354 353 return err; 355 354 } 355 + 356 + DEFINE_SUITE("vmlinux symtab matches kallsyms", vmlinux_matches_kallsyms);
+17 -5
tools/perf/tests/wp.c
··· 209 209 }, 210 210 }; 211 211 212 - int test__wp_subtest_get_nr(void) 212 + static int test__wp_subtest_get_nr(void) 213 213 { 214 214 return (int)ARRAY_SIZE(wp_testcase_table); 215 215 } 216 216 217 - const char *test__wp_subtest_get_desc(int i) 217 + static const char *test__wp_subtest_get_desc(int i) 218 218 { 219 219 if (i < 0 || i >= (int)ARRAY_SIZE(wp_testcase_table)) 220 220 return NULL; 221 221 return wp_testcase_table[i].desc; 222 222 } 223 223 224 - const char *test__wp_subtest_skip_reason(int i) 224 + static const char *test__wp_subtest_skip_reason(int i) 225 225 { 226 226 if (i < 0 || i >= (int)ARRAY_SIZE(wp_testcase_table)) 227 227 return NULL; ··· 230 230 return wp_testcase_table[i].skip_msg(); 231 231 } 232 232 233 - int test__wp(struct test *test __maybe_unused, int i) 233 + static int test__wp(struct test *test __maybe_unused, int i) 234 234 { 235 235 if (i < 0 || i >= (int)ARRAY_SIZE(wp_testcase_table)) 236 236 return TEST_FAIL; ··· 245 245 /* The s390 so far does not have support for 246 246 * instruction breakpoint using the perf_event_open() system call. 247 247 */ 248 - bool test__wp_is_supported(void) 248 + static bool test__wp_is_supported(void) 249 249 { 250 250 #if defined(__s390x__) 251 251 return false; ··· 253 253 return true; 254 254 #endif 255 255 } 256 + 257 + struct test suite__wp = { 258 + .desc = "Watchpoint", 259 + .func = test__wp, 260 + .is_supported = test__wp_is_supported, 261 + .subtest = { 262 + .skip_if_fail = false, 263 + .get_nr = test__wp_subtest_get_nr, 264 + .get_desc = test__wp_subtest_get_desc, 265 + .skip_reason = test__wp_subtest_skip_reason, 266 + }, 267 + };