]> git.dujemihanovic.xyz Git - linux.git/commitdiff
perf test: Move each test suite struct to its test
authorIan Rogers <irogers@google.com>
Thu, 4 Nov 2021 06:41:50 +0000 (23:41 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sat, 13 Nov 2021 13:30:58 +0000 (10:30 -0300)
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>
70 files changed:
tools/perf/arch/arm/tests/arch-tests.c
tools/perf/arch/arm64/tests/arch-tests.c
tools/perf/arch/powerpc/tests/arch-tests.c
tools/perf/arch/x86/tests/arch-tests.c
tools/perf/tests/api-io.c
tools/perf/tests/attr.c
tools/perf/tests/backward-ring-buffer.c
tools/perf/tests/bitmap.c
tools/perf/tests/bp_account.c
tools/perf/tests/bp_signal.c
tools/perf/tests/bp_signal_overflow.c
tools/perf/tests/bpf.c
tools/perf/tests/builtin-test.c
tools/perf/tests/clang.c
tools/perf/tests/code-reading.c
tools/perf/tests/cpumap.c
tools/perf/tests/demangle-java-test.c
tools/perf/tests/demangle-ocaml-test.c
tools/perf/tests/dlfilter-test.c
tools/perf/tests/dso-data.c
tools/perf/tests/dwarf-unwind.c
tools/perf/tests/event-times.c
tools/perf/tests/event_update.c
tools/perf/tests/evsel-roundtrip-name.c
tools/perf/tests/evsel-tp-sched.c
tools/perf/tests/expand-cgroup.c
tools/perf/tests/expr.c
tools/perf/tests/fdarray.c
tools/perf/tests/genelf.c
tools/perf/tests/hists_cumulate.c
tools/perf/tests/hists_filter.c
tools/perf/tests/hists_link.c
tools/perf/tests/hists_output.c
tools/perf/tests/is_printable_array.c
tools/perf/tests/keep-tracking.c
tools/perf/tests/kmod-path.c
tools/perf/tests/llvm.c
tools/perf/tests/maps.c
tools/perf/tests/mem.c
tools/perf/tests/mem2node.c
tools/perf/tests/mmap-basic.c
tools/perf/tests/mmap-thread-lookup.c
tools/perf/tests/openat-syscall-all-cpus.c
tools/perf/tests/openat-syscall-tp-fields.c
tools/perf/tests/openat-syscall.c
tools/perf/tests/parse-events.c
tools/perf/tests/parse-metric.c
tools/perf/tests/parse-no-sample-id-all.c
tools/perf/tests/pe-file-parsing.c
tools/perf/tests/perf-hooks.c
tools/perf/tests/perf-record.c
tools/perf/tests/perf-time-to-tsc.c
tools/perf/tests/pfm.c
tools/perf/tests/pmu-events.c
tools/perf/tests/pmu.c
tools/perf/tests/python-use.c
tools/perf/tests/sample-parsing.c
tools/perf/tests/sdt.c
tools/perf/tests/stat.c
tools/perf/tests/sw-clock.c
tools/perf/tests/switch-tracking.c
tools/perf/tests/task-exit.c
tools/perf/tests/tests.h
tools/perf/tests/thread-map.c
tools/perf/tests/thread-maps-share.c
tools/perf/tests/time-utils-test.c
tools/perf/tests/topology.c
tools/perf/tests/unit_number__scnprintf.c
tools/perf/tests/vmlinux-kallsyms.c
tools/perf/tests/wp.c

index 8276740f7ff86db424f245ab50f581c2ecfe287c..2495b57706371d71c4382265eb8905a12696e3fa 100644 (file)
@@ -5,8 +5,8 @@
 
 struct test *arch_tests[] = {
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
-       &dwarf_unwind,
+       &suite__dwarf_unwind,
 #endif
-       &vectors_page,
+       &suite__vectors_page,
        NULL,
 };
index bc327048b807fc2dd50eab558f1c5701e169d8bd..6d137138a2deea971e3e6b51126fc47c46226fd1 100644 (file)
@@ -5,7 +5,7 @@
 
 struct test *arch_tests[] = {
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
-       &dwarf_unwind,
+       &suite__dwarf_unwind,
 #endif
        NULL,
 };
index bc327048b807fc2dd50eab558f1c5701e169d8bd..6d137138a2deea971e3e6b51126fc47c46226fd1 100644 (file)
@@ -5,7 +5,7 @@
 
 struct test *arch_tests[] = {
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
-       &dwarf_unwind,
+       &suite__dwarf_unwind,
 #endif
        NULL,
 };
index f5e3195768a4243612bdb3bd960ef6473f06c660..20b1c0d8ca66b4cbf76bbde9fea2b1dbf4469c4e 100644 (file)
@@ -14,17 +14,17 @@ 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,
        NULL,
 };
index 2ada86ad6084094c822962264ca361ab2b88d5ab..af49139675149146a430c393ec448243b4ed8872 100644 (file)
@@ -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);
index 9b40a25376ae5d52d50edc25ff513cfd036b34aa..f1461051f579b4da91e4e6a227ee4e3f7fac5965 100644 (file)
@@ -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);
index 7447a44789919f3d8f9bd77f252b62cf904ea518..131903a2054d0a93792f76b2668b4002b99f5f17 100644 (file)
@@ -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];
@@ -167,3 +167,5 @@ out_delete_evlist:
        evlist__delete(evlist);
        return ret;
 }
+
+DEFINE_SUITE("Read backward ring buffer", backward_ring_buffer);
index 12b805efdca0d9616ef6c8db5477be2916ac13f4..13d1d1d6774f4d308977c24bbf34686a64c6729e 100644 (file)
@@ -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_unu
        TEST_ASSERT_VAL("failed to convert map", test_bitmap("1-10,12-20,22-30,32-40"));
        return 0;
 }
+
+DEFINE_SUITE("Print bitmap", bitmap_print);
index 489b50604cf274046b879c54eb0e2a9037236ff8..76cf356ba13f29e04c9c092d43069bed6dca762c 100644 (file)
@@ -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_un
        return 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,
+};
index ef37353636d87829dbdb8f3d5af7926caccd4930..c19b05488cfb1d6df848b746d9fb077543a121e1 100644 (file)
@@ -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,
+};
index eb4dbbddf4ffcfcbe42ee513d0dac6520dad00e7..99c30d028f5ea0b71464892367cfa201ce15ec80 100644 (file)
@@ -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 __may
 
        return 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,
+};
index 2bf146e49ce886dfc9c23f58eb5360f0a5f81fb2..3f936864d0eeaa09d840bd9768122775c36bfcf4 100644 (file)
@@ -283,12 +283,12 @@ out:
        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;
@@ -325,7 +325,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;
 
@@ -345,19 +345,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,
+       },
+};
index b2cbc12a70a204ea391908814ba11c4e5cbbac52..07467ec43100db28c3d10b3f01366e33aa79d9b2 100644 (file)
@@ -34,220 +34,79 @@ struct test *__weak arch_tests[] = {
        NULL,
 };
 
-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);
-static struct test 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,
-       },
-};
-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);
-static struct test bp_signal = {
-       .desc = "Breakpoint overflow signal handler",
-       .func = test__bp_signal,
-       .is_supported = test__bp_signal_is_supported,
-};
-static struct test bp_signal_overflow = {
-       .desc = "Breakpoint overflow sampling",
-       .func = test__bp_signal_overflow,
-       .is_supported = test__bp_signal_is_supported,
-};
-static struct test bp_accounting = {
-       .desc = "Breakpoint accounting",
-       .func = test__bp_accounting,
-       .is_supported = test__bp_account_is_supported,
-};
-static struct test 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,
-       },
-};
-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);
-static struct test 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,
-       },
-};
-DEFINE_SUITE("Session topology", session_topology);
-static struct test 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,
-       },
-};
-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);
-static struct test 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,
-       }
-};
-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);
-static struct test 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,
-       }
-};
-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);
-static struct test perf_time_to_tsc = {
-       .desc = "Convert perf time to TSC",
-       .func = test__perf_time_to_tsc,
-       .is_supported = test__tsc_is_supported,
-};
-DEFINE_SUITE("dlfilter C API", dlfilter);
-
-
 static struct test *generic_tests[] = {
-       &vmlinux_matches_kallsyms,
-       &openat_syscall_event,
-       &openat_syscall_event_on_all_cpus,
-       &basic_mmap,
-       &mem,
-       &parse_events,
-       &expr,
-       &PERF_RECORD,
-       &pmu,
-       &pmu_events,
-       &dso_data,
-       &dso_data_cache,
-       &dso_data_reopen,
-       &perf_evsel__roundtrip_name_test,
-       &perf_evsel__tp_sched_test,
-       &syscall_openat_tp_fields,
-       &attr,
-       &hists_link,
-       &python_use,
-       &bp_signal,
-       &bp_signal_overflow,
-       &bp_accounting,
-       &wp,
-       &task_exit,
-       &sw_clock_freq,
-       &code_reading,
-       &sample_parsing,
-       &keep_tracking,
-       &parse_no_sample_id_all,
-       &hists_filter,
-       &mmap_thread_lookup,
-       &thread_maps_share,
-       &hists_output,
-       &hists_cumulate,
-       &switch_tracking,
-       &fdarray__filter,
-       &fdarray__add,
-       &kmod_path__parse,
-       &thread_map,
-       &llvm,
-       &session_topology,
-       &bpf,
-       &thread_map_synthesize,
-       &thread_map_remove,
-       &cpu_map_synthesize,
-       &synthesize_stat_config,
-       &synthesize_stat,
-       &synthesize_stat_round,
-       &event_update,
-       &event_times,
-       &backward_ring_buffer,
-       &cpu_map_print,
-       &cpu_map_merge,
-       &sdt_event,
-       &is_printable_array,
-       &bitmap_print,
-       &perf_hooks,
-       &clang,
-       &unit_number__scnprint,
-       &mem2node,
-       &time_utils,
-       &jit_write_elf,
-       &pfm,
-       &api_io,
-       &maps__merge_in,
-       &demangle_java,
-       &demangle_ocaml,
-       &parse_metric,
-       &pe_file_parsing,
-       &expand_cgroup_events,
-       &perf_time_to_tsc,
-       &dlfilter,
+       &suite__vmlinux_matches_kallsyms,
+       &suite__openat_syscall_event,
+       &suite__openat_syscall_event_on_all_cpus,
+       &suite__basic_mmap,
+       &suite__mem,
+       &suite__parse_events,
+       &suite__expr,
+       &suite__PERF_RECORD,
+       &suite__pmu,
+       &suite__pmu_events,
+       &suite__dso_data,
+       &suite__dso_data_cache,
+       &suite__dso_data_reopen,
+       &suite__perf_evsel__roundtrip_name_test,
+       &suite__perf_evsel__tp_sched_test,
+       &suite__syscall_openat_tp_fields,
+       &suite__attr,
+       &suite__hists_link,
+       &suite__python_use,
+       &suite__bp_signal,
+       &suite__bp_signal_overflow,
+       &suite__bp_accounting,
+       &suite__wp,
+       &suite__task_exit,
+       &suite__sw_clock_freq,
+       &suite__code_reading,
+       &suite__sample_parsing,
+       &suite__keep_tracking,
+       &suite__parse_no_sample_id_all,
+       &suite__hists_filter,
+       &suite__mmap_thread_lookup,
+       &suite__thread_maps_share,
+       &suite__hists_output,
+       &suite__hists_cumulate,
+       &suite__switch_tracking,
+       &suite__fdarray__filter,
+       &suite__fdarray__add,
+       &suite__kmod_path__parse,
+       &suite__thread_map,
+       &suite__llvm,
+       &suite__session_topology,
+       &suite__bpf,
+       &suite__thread_map_synthesize,
+       &suite__thread_map_remove,
+       &suite__cpu_map_synthesize,
+       &suite__synthesize_stat_config,
+       &suite__synthesize_stat,
+       &suite__synthesize_stat_round,
+       &suite__event_update,
+       &suite__event_times,
+       &suite__backward_ring_buffer,
+       &suite__cpu_map_print,
+       &suite__cpu_map_merge,
+       &suite__sdt_event,
+       &suite__is_printable_array,
+       &suite__bitmap_print,
+       &suite__perf_hooks,
+       &suite__clang,
+       &suite__unit_number__scnprint,
+       &suite__mem2node,
+       &suite__time_utils,
+       &suite__jit_write_elf,
+       &suite__pfm,
+       &suite__api_io,
+       &suite__maps__merge_in,
+       &suite__demangle_java,
+       &suite__demangle_ocaml,
+       &suite__parse_metric,
+       &suite__pe_file_parsing,
+       &suite__expand_cgroup_events,
+       &suite__perf_time_to_tsc,
+       &suite__dlfilter,
        NULL,
 };
 
index 2577d3ed153152fe1c53494847e7ac2a184cc2c5..5052be1b5b2081a00a855df5b61d939c21b0dca0 100644 (file)
@@ -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,
+       }
+};
index f439bd49da195392bf52865470a31338430baa03..e4199cb4d4bf3d1970da6969409de063f064133a 100644 (file)
@@ -716,7 +716,7 @@ out_err:
        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;
 
@@ -743,3 +743,5 @@ int test__code_reading(struct test *test __maybe_unused, int subtest __maybe_unu
                return -1;
        };
 }
+
+DEFINE_SUITE("Object code reading", code_reading);
index 0472b110fe651ffe1da7c0e7aec71bb6128f0439..6f2525fb9fd7e027e353276ac9e8cd0222dcf533 100644 (file)
@@ -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_un
        return 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_un
        perf_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);
index 8f3b90832fb0f9f9efa6d9ce5db3d42d583de755..37f488e5c36d0a49f5d6c9f272b077544fd03918 100644 (file)
@@ -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_un
 
        return ret;
 }
+
+DEFINE_SUITE("Demangle Java", demangle_java);
index 0043be812355a90e1dfac1a445a3fb2e5d76fd0f..ee982cca7bbfb6516c8b3f0616c5f9d02fb83433 100644 (file)
@@ -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_u
 
        return ret;
 }
+
+DEFINE_SUITE("Demangle OCaml", demangle_ocaml);
index bc03b5df6828d6fa2a0201b54734b325dfce41b0..378f5afc6032ce3e3b41b6a4c85031195a7e4557 100644 (file)
@@ -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);
index 43e1b01e5afcb7acac500a63907cc45c42bdf4ba..d9e060a7c1f66c48f2e9b97fa9797d2ccc40357e 100644 (file)
@@ -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);
index 38f16a53613f714db9a873d7f46e93640fcd9217..6e0429012ed6cd9205aca9ab82cff26c4794075a 100644 (file)
@@ -238,7 +238,4 @@ static int test__dwarf_unwind(struct test *test __maybe_unused, int subtest __ma
        return err;
 }
 
-struct test dwarf_unwind = {
-       .desc = "Test dwarf unwind",
-       .func = test__dwarf_unwind,
-};
+DEFINE_SUITE("Test dwarf unwind", dwarf_unwind);
index 04ce4401f77528375819f618a2002070219438d6..2ce8945931e77804fb6e94739d9549d52088dbd0 100644 (file)
@@ -216,7 +216,7 @@ out_err:
  * 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 _T
        return ret;
 }
+
+DEFINE_SUITE("Event times", event_times);
index 44a50527f9d95170f176d4e5abbe70fdadd53a0a..9dfb665f8ac9617317826ae9cdcd92f7c1195307 100644 (file)
@@ -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_unu
        evlist__delete(evlist);
        return 0;
 }
+
+DEFINE_SUITE("Synthesize attr update", event_update);
index 4e09f0a312afc31a63a4614bb423cd4807369836..82ff3c04d0bdebfce3785fa3240ed6ef8c724dee 100644 (file)
@@ -99,7 +99,8 @@ out_delete_evlist:
 #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 +121,5 @@ int test__perf_evsel__roundtrip_name_test(struct test *test __maybe_unused, int
 
        return ret;
 }
+
+DEFINE_SUITE("Roundtrip evsel->name", perf_evsel__roundtrip_name_test);
index f9e34bd26cf33536388265330400cddce0c87eef..58f17d18e4d51bb295a5e5473f0d0efb71fea6c2 100644 (file)
@@ -32,7 +32,8 @@ static int evsel__test_field(struct evsel *evsel, const char *name, int size, bo
        return 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 +88,5 @@ int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtes
        evsel__delete(evsel);
        return ret;
 }
+
+DEFINE_SUITE("Parse sched tracepoints fields", perf_evsel__tp_sched_test);
index 80cff8a3558cfba6d610e247837425b3793cd5a4..7bea14f0951e42e7be49abf921e195bd1dc11beb 100644 (file)
@@ -221,8 +221,8 @@ out:
        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;
 
@@ -240,3 +240,5 @@ int test__expand_cgroup_events(struct test *test __maybe_unused,
 
        return ret;
 }
+
+DEFINE_SUITE("Event expansion for cgroups", expand_cgroup_events);
index 077783223ce0762882ab2f22dc9fed31c6c0038f..8c6397d0c381e062e628ca3e37c8cf0c83b5b4a4 100644 (file)
@@ -62,7 +62,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;
@@ -155,3 +155,5 @@ int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused)
 
        return 0;
 }
+
+DEFINE_SUITE("Simple expression parser", expr);
index d9eca8e86a6b0b8ef8f201f32dec2454ed4dca7c..7b2f6c2ad70521248d9080a75f6d086c41d92b7a 100644 (file)
@@ -28,7 +28,7 @@ static int fdarray__fprintf_prefix(struct fdarray *fda, const char *prefix, FILE
        return 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 @@ out:
        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 @@ out_delete:
 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);
index f797f9823e8917583491d577092c2af07cbb070d..3c5ced5d958819d4c27dc2fd30b420ef827e17a5 100644 (file)
@@ -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);
index 890cb1f5bf53d3da44871821f8e4837da7d02900..f7a8d3d78389fd8aa70d37fb651848fb0d19fdc9 100644 (file)
@@ -689,7 +689,7 @@ out:
        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 @@ out:
 
        return err;
 }
+
+DEFINE_SUITE("Cumulate child hist entries", hists_cumulate);
index ca6120cd1d90c0f8aa430e4e487f3041f0218bf2..09e140191e5fc20a92fb41928d185f5d3cd098f9 100644 (file)
@@ -101,7 +101,7 @@ out:
        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 @@ out:
 
        return err;
 }
+
+DEFINE_SUITE("Filter hist entries", hists_filter);
index a024d3f3a4123dd0167218f86b2cbe1423e7a931..08571f788884ed2264c4326df29fb7e93a9a9b64 100644 (file)
@@ -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 @@ out:
 
        return err;
 }
+
+DEFINE_SUITE("Match and link multiple hists", hists_link);
index 8973f35df6042b14a7fddd337f806a51bca51e7f..b427df8ee94a9b77d5d55b47f67cbe061d91067d 100644 (file)
@@ -575,7 +575,7 @@ out:
        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 @@ out:
 
        return err;
 }
+
+DEFINE_SUITE("Sort output of hist entries", hists_output);
index 9c7b3baca4fed6b9a2de769dc6c5f40db94d70a1..8891b10fac5c96619b4c8307911456939cac665a 100644 (file)
@@ -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 __may
 
        return TEST_OK;
 }
+
+DEFINE_SUITE("is_printable_array", is_printable_array);
index a0438b0f080526d4b6f4e8713aa14d35b987418d..e723c976dc8178e187bf029dcd411097d76e5c84 100644 (file)
@@ -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 @@ out_err:
 
        return err;
 }
+
+DEFINE_SUITE("Use a dummy software event to keep tracking", keep_tracking);
index e483210b176bf0dbc8a373f2c22465ae89f3fa8d..4935dd3182ed29241707047b14589774013debc3 100644 (file)
@@ -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_un
 
        return 0;
 }
+
+DEFINE_SUITE("kmod_path__parse", kmod_path__parse);
index 33e43cce90640fb30a20fa7da482cd2513b859d1..b605a71ad8d5f9f77537dc27e41b90b885b6be46 100644 (file)
@@ -124,7 +124,7 @@ out:
        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,
+       },
+};
index 1ac72919fa358601df50ce2c17f5efe68a4f1af6..4a2e6f3120152167e5c9716fda5b532410171351 100644 (file)
@@ -33,7 +33,7 @@ static int check_maps(struct map_def *merged, unsigned int size, struct maps *ma
        return 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_unus
        maps__exit(&maps);
        return TEST_OK;
 }
+
+DEFINE_SUITE("maps__merge_in", maps__merge_in);
index 673a11a6cd1b14bb84003c9a05b674fe9c147575..3af082508653b952b42aa7ca2938f09377a69a25 100644 (file)
@@ -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);
index e4d0d58b97f81a023cea86f386e34d611f57bc5c..0a90e6084d8125238df0ac37517e62687af1fe69 100644 (file)
@@ -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);
index d38757db2dc2c04bd8294d90e05a2bce9717b8ff..86f34631312daab9d9ed8cb672831daa1d67ee4e 100644 (file)
@@ -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 @@ out_free_threads:
        perf_thread_map__put(threads);
        return err;
 }
+
+DEFINE_SUITE("Read samples using the mmap interface", basic_mmap);
index 6f2da7a72f67e767132941b95b4725ceb2149173..756a46c796f78ced6c32630ab520572e01601eaf 100644 (file)
@@ -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 __may
 
        return 0;
 }
+
+DEFINE_SUITE("Lookup mmap thread", mmap_thread_lookup);
index f7dd6c463f04feb413d6bf82d03f735477e3e6f8..28f3597ba531303438f7c0817b67397510da2cb7 100644 (file)
@@ -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 @@ out_thread_map_delete:
        perf_thread_map__put(threads);
        return err;
 }
+
+DEFINE_SUITE("Detect openat syscall event on all cpus", openat_syscall_event_on_all_cpus);
index 5e4af2f0f14ae98a1c056293476510493a4d2d3e..cbb5c0fa40fe599ef37cb34a88f89657b9051032 100644 (file)
@@ -22,7 +22,8 @@
 #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 +143,5 @@ out_delete_evlist:
 out:
        return err;
 }
+
+DEFINE_SUITE("syscalls:sys_enter_openat event fields", syscall_openat_tp_fields);
index 85a8f0fe7aea00da1dcf1484fc1458e1786d0d0a..8f904fcebe6f52cdb6c865a44ddd393ac6b3a8a4 100644 (file)
@@ -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 @@ out_thread_map_delete:
        perf_thread_map__put(threads);
        return err;
 }
+
+DEFINE_SUITE("Detect openat syscall event", openat_syscall_event);
index 6af94639b14a8f29d4caa375d4da8eda370d3cc7..1522dd39dd0ab2c5547edd818059477d31bdecd1 100644 (file)
@@ -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);
index dfc797ecc75095c6ec8c8b238909f27737eca8ea..999d37fc58f2cbc111ac03024659b1a7d060f548 100644 (file)
@@ -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);
index 471273676701bab792d15d28da9fff99048a5535..2a5eec424a432a364cb1d412939d4503a175d3f1 100644 (file)
@@ -67,7 +67,8 @@ 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 +104,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);
index 58b90c42eb38c1b972e604ab7491f6f3d747a075..8d4fec99459a04ebb789ce4c7c3ff35aa90293d2 100644 (file)
@@ -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);
index dd865e0bea12d4e5e6dbd86b60883dca7318de35..61cb1d0a6eb96a3dc58d0aac20a6a9fee1246487 100644 (file)
@@ -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_unuse
                return TEST_FAIL;
        return TEST_OK;
 }
+
+DEFINE_SUITE("perf hooks", perf_hooks);
index 0df471bf1590ee22a1706a9c0720d135db163f5e..24faa8487d8cf0b9943165cd94083afd40cfa072 100644 (file)
@@ -41,7 +41,7 @@ realloc:
        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 @@ out_delete_evlist:
 out:
        return (err < 0 || errs > 0) ? -1 : 0;
 }
+
+DEFINE_SUITE("PERF_RECORD_* events & perf_sample fields", PERF_RECORD);
index 7c56bc1f4cff0d1b99abba14011e3b3977c45cc8..dc2dcad7371f7374ba38838791f98b9f73d95891 100644 (file)
@@ -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 @@ out_err:
        return 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,
+};
index e8fd0da0762b8105a3bac775f80979f97edd1993..83dc9742813a008e2432301053fefe2d7f6de970 100644 (file)
@@ -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,
+       }
+};
index 9ae894c406d823136c1d4dbfc3e0daef5e442105..c3f32ddd821027a49ee74dd2045fcfd5790b5da1 100644 (file)
@@ -1090,7 +1090,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))
@@ -1098,7 +1098,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))
@@ -1108,15 +1108,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,
+       },
+};
index 714e6830a758fac01c1193baf034f897505ce5b2..9a58dad67b276707387659ac9b8075490982cf4e 100644 (file)
@@ -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);
index 98c6d474aa6f20db6408585cbe0b4e1845024164..b667140688be029013712323694e84cb6497f8ca 100644 (file)
@@ -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_unuse
        free(cmd);
        return ret;
 }
+
+DEFINE_SUITE("'import perf' in python", python_use);
index c83a11514129147b14e569dec433f9f8e33aca16..08453238c777a21eab4394bd7b55069a8a21f45d 100644 (file)
@@ -368,7 +368,7 @@ out_free:
  * 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;
@@ -426,3 +426,5 @@ int test__sample_parsing(struct test *test __maybe_unused, int subtest __maybe_u
 
        return 0;
 }
+
+DEFINE_SUITE("Sample parsing", sample_parsing);
index ed76c693f65ecff5f8ff656828a03ab484cf96c2..307615f1b6a723b2f5696dc114d19d1002352d41 100644 (file)
@@ -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 @@ error:
        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);
index c1911501c39c303091dad21bcc9f8f03c308b4f8..2589f2f529ba594b736f88ffc1cfd0141ee6d15a 100644 (file)
@@ -47,7 +47,8 @@ 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 +78,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 +104,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 +112,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);
index 74988846be1da9ae2dae55873ae977376417c57f..db1e339a0fbe960d2a538ff3284757520efb11fe 100644 (file)
@@ -133,7 +133,7 @@ out_delete_evlist:
        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_un
 
        return ret;
 }
+
+DEFINE_SUITE("Software clock events period values", sw_clock_freq);
index 62c0ec21aaa86ef6cb13aaf727bd20e968fabd67..9b379aaddce410e202bee7db94b5ae82de356bd6 100644 (file)
@@ -321,7 +321,7 @@ out_free_nodes:
  * 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 @@ out_err:
        err = -1;
        goto out;
 }
+
+DEFINE_SUITE("Track with sched_switch", switch_tracking);
index 4c2969db59b0777a7117d2e29647082e2d9c0bec..197574230493c319073dbb99a144686fd99cde0d 100644 (file)
@@ -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 @@ out_delete_evlist:
        evlist__delete(evlist);
        return err;
 }
+
+DEFINE_SUITE("Number of exit events of a simple workload", task_exit);
index 8323a3c88284a68dbab2e1aebfe519a0e40dd301..f2efa331b32f0ff4446837040d904571eac69170 100644 (file)
@@ -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);
@@ -84,7 +78,7 @@ DECLARE_SUITE(code_reading);
 DECLARE_SUITE(sample_parsing);
 DECLARE_SUITE(keep_tracking);
 DECLARE_SUITE(parse_no_sample_id_all);
-extern struct test dwarf_unwind;
+DECLARE_SUITE(dwarf_unwind);
 DECLARE_SUITE(expr);
 DECLARE_SUITE(hists_filter);
 DECLARE_SUITE(mmap_thread_lookup);
@@ -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,8 +118,6 @@ 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);
@@ -139,9 +125,6 @@ DECLARE_SUITE(perf_time_to_tsc);
 DECLARE_SUITE(dlfilter);
 
 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;
index d1e208b4a571c939a0cf241b41dfa15eefddfcf0..7e2e8a72fa78e8862733b12618a2a663bbd14d5f 100644 (file)
@@ -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 __mayb
        perf_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);
index 9371484973f24dd38da674c97992550804507d1c..2821be0a9a05ef4b3c1d60e8c344563e0ddb8c05 100644 (file)
@@ -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 __mayb
        machines__exit(&machines);
        return 0;
 }
+
+DEFINE_SUITE("Share thread maps", thread_maps_share);
index fe57ca3b6e543c93e40d42f5019f97bfa9a489a4..538100cb7541c7c71a773ea8c23b51a0874d0963 100644 (file)
@@ -131,7 +131,7 @@ out:
        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);
index 4574c46260d9a7da7e5d84d1eeaf2cb71dbb3cbc..09e5fcdb646d93a40a603af6a29c08e4299b0648 100644 (file)
@@ -175,7 +175,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;
@@ -201,3 +201,5 @@ free_path:
        unlink(path);
        return ret;
 }
+
+DEFINE_SUITE("Session topology", session_topology);
index 3721757435da5e59961ae1142f5ed56ffb04e5b5..2ad78a9473d45e8b3569eb41ec358af48d7aac76 100644 (file)
@@ -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 __may
 
        return TEST_OK;
 }
+
+DEFINE_SUITE("unit_number__scnprintf", unit_number__scnprint);
index 4f884aabc7f4ba055d01c3dd9b23e338e34a3153..7f1b74bf4f132005a548296415f8e930d4cea56f 100644 (file)
@@ -111,7 +111,8 @@ static bool is_ignored_symbol(const char *name, char type)
        return false;
 }
 
-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;
@@ -352,3 +353,5 @@ out:
        machine__exit(&vmlinux);
        return err;
 }
+
+DEFINE_SUITE("vmlinux symtab matches kallsyms", vmlinux_matches_kallsyms);
index 9387fa76faa50342d4e494f19e17db2c195e8c72..16ab733cabce135be07d9e075d44c4401d117895 100644 (file)
@@ -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,
+       },
+};