perf test: Add 'struct test *' to the test functions

This way we'll be able to pass more test specific parameters without
having to change this function signature.

Will be used by the upcoming 'shell tests', shell scripts that will
call perf tools and check if they work as expected, comparing its
effects on the system (think 'perf probe foo') the output produced, etc.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-wq250w7j1opbzyiynozuajbl@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 28765bf2
#ifndef ARCH_TESTS_H #ifndef ARCH_TESTS_H
#define ARCH_TESTS_H #define ARCH_TESTS_H
#include <linux/compiler.h>
struct test;
/* Tests */ /* Tests */
int test__rdpmc(int subtest); int test__rdpmc(struct test *test __maybe_unused, int subtest);
int test__perf_time_to_tsc(int subtest); int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest);
int test__insn_x86(int subtest); int test__insn_x86(struct test *test __maybe_unused, int subtest);
int test__intel_cqm_count_nmi_context(int subtest); int test__intel_cqm_count_nmi_context(struct test *test __maybe_unused, int subtest);
#ifdef HAVE_DWARF_UNWIND_SUPPORT #ifdef HAVE_DWARF_UNWIND_SUPPORT
struct thread; struct thread;
......
...@@ -171,7 +171,7 @@ static int test_data_set(struct test_data *dat_set, int x86_64) ...@@ -171,7 +171,7 @@ static int test_data_set(struct test_data *dat_set, int x86_64)
* verbose (-v) option to see all the instructions and whether or not they * verbose (-v) option to see all the instructions and whether or not they
* decoded successfuly. * decoded successfuly.
*/ */
int test__insn_x86(int subtest __maybe_unused) int test__insn_x86(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int ret = 0; int ret = 0;
......
...@@ -36,7 +36,7 @@ static pid_t spawn(void) ...@@ -36,7 +36,7 @@ static pid_t spawn(void)
* the last read counter value to avoid triggering a WARN_ON_ONCE() in * the last read counter value to avoid triggering a WARN_ON_ONCE() in
* smp_call_function_many() caused by sending IPIs from NMI context. * smp_call_function_many() caused by sending IPIs from NMI context.
*/ */
int test__intel_cqm_count_nmi_context(int subtest __maybe_unused) int test__intel_cqm_count_nmi_context(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct perf_evlist *evlist = NULL; struct perf_evlist *evlist = NULL;
struct perf_evsel *evsel = NULL; struct perf_evsel *evsel = NULL;
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* %0 is returned, otherwise %-1 is returned. If TSC conversion is not * %0 is returned, otherwise %-1 is returned. If TSC conversion is not
* supported then then the test passes but " (not supported)" is printed. * supported then then the test passes but " (not supported)" is printed.
*/ */
int test__perf_time_to_tsc(int subtest __maybe_unused) int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct record_opts opts = { struct record_opts opts = {
.mmap_pages = UINT_MAX, .mmap_pages = UINT_MAX,
......
...@@ -154,7 +154,7 @@ static int __test__rdpmc(void) ...@@ -154,7 +154,7 @@ static int __test__rdpmc(void)
return 0; return 0;
} }
int test__rdpmc(int subtest __maybe_unused) int test__rdpmc(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int status = 0; int status = 0;
int wret = 0; int wret = 0;
......
...@@ -169,7 +169,7 @@ static int run_dir(const char *d, const char *perf) ...@@ -169,7 +169,7 @@ static int run_dir(const char *d, const char *perf)
return system(cmd); return system(cmd);
} }
int test__attr(int subtest __maybe_unused) int test__attr(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct stat st; struct stat st;
char path_perf[PATH_MAX]; char path_perf[PATH_MAX];
......
...@@ -75,7 +75,7 @@ static int do_test(struct perf_evlist *evlist, int mmap_pages, ...@@ -75,7 +75,7 @@ static int do_test(struct perf_evlist *evlist, int mmap_pages,
} }
int test__backward_ring_buffer(int subtest __maybe_unused) 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; int ret = TEST_SKIP, err, sample_count = 0, comm_count = 0;
char pid[16], sbuf[STRERR_BUFSIZE]; char pid[16], sbuf[STRERR_BUFSIZE];
......
...@@ -40,7 +40,7 @@ static int test_bitmap(const char *str) ...@@ -40,7 +40,7 @@ static int test_bitmap(const char *str)
return ret; return ret;
} }
int test__bitmap_print(int subtest __maybe_unused) 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"));
TEST_ASSERT_VAL("failed to convert map", test_bitmap("1,5")); TEST_ASSERT_VAL("failed to convert map", test_bitmap("1,5"));
......
...@@ -164,7 +164,7 @@ static long long bp_count(int fd) ...@@ -164,7 +164,7 @@ static long long bp_count(int fd)
return count; return count;
} }
int test__bp_signal(int subtest __maybe_unused) int test__bp_signal(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct sigaction sa; struct sigaction sa;
long long count1, count2, count3; long long count1, count2, count3;
......
...@@ -57,7 +57,7 @@ static long long bp_count(int fd) ...@@ -57,7 +57,7 @@ static long long bp_count(int fd)
#define EXECUTIONS 10000 #define EXECUTIONS 10000
#define THRESHOLD 100 #define THRESHOLD 100
int test__bp_signal_overflow(int subtest __maybe_unused) int test__bp_signal_overflow(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct perf_event_attr pe; struct perf_event_attr pe;
struct sigaction sa; struct sigaction sa;
......
...@@ -321,7 +321,7 @@ static int check_env(void) ...@@ -321,7 +321,7 @@ static int check_env(void)
return 0; return 0;
} }
int test__bpf(int i) int test__bpf(struct test *test __maybe_unused, int i)
{ {
int err; int err;
...@@ -351,7 +351,7 @@ const char *test__bpf_subtest_get_desc(int i __maybe_unused) ...@@ -351,7 +351,7 @@ const char *test__bpf_subtest_get_desc(int i __maybe_unused)
return NULL; return NULL;
} }
int test__bpf(int i __maybe_unused) int test__bpf(struct test *test __maybe_unused, int i __maybe_unused)
{ {
pr_debug("Skip BPF test because BPF support is not compiled\n"); pr_debug("Skip BPF test because BPF support is not compiled\n");
return TEST_SKIP; return TEST_SKIP;
......
...@@ -179,7 +179,7 @@ static struct test generic_tests[] = { ...@@ -179,7 +179,7 @@ static struct test generic_tests[] = {
}, },
{ {
.desc = "Session topology", .desc = "Session topology",
.func = test_session_topology, .func = test__session_topology,
}, },
{ {
.desc = "BPF filter", .desc = "BPF filter",
...@@ -325,7 +325,7 @@ static int run_test(struct test *test, int subtest) ...@@ -325,7 +325,7 @@ static int run_test(struct test *test, int subtest)
} }
} }
err = test->func(subtest); err = test->func(test, subtest);
if (!dont_fork) if (!dont_fork)
exit(err); exit(err);
} }
......
...@@ -33,12 +33,12 @@ const char *test__clang_subtest_get_desc(int i) ...@@ -33,12 +33,12 @@ const char *test__clang_subtest_get_desc(int i)
} }
#ifndef HAVE_LIBCLANGLLVM_SUPPORT #ifndef HAVE_LIBCLANGLLVM_SUPPORT
int test__clang(int i __maybe_unused) int test__clang(struct test *test __maybe_unused, int i __maybe_unused)
{ {
return TEST_SKIP; return TEST_SKIP;
} }
#else #else
int test__clang(int i) int test__clang(struct test *test __maybe_unused, int i)
{ {
if (i < 0 || i >= (int)ARRAY_SIZE(clang_testcase_table)) if (i < 0 || i >= (int)ARRAY_SIZE(clang_testcase_table))
return TEST_FAIL; return TEST_FAIL;
......
...@@ -673,7 +673,7 @@ static int do_test_code_reading(bool try_kcore) ...@@ -673,7 +673,7 @@ static int do_test_code_reading(bool try_kcore)
return err; return err;
} }
int test__code_reading(int subtest __maybe_unused) int test__code_reading(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int ret; int ret;
......
...@@ -72,7 +72,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused, ...@@ -72,7 +72,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused,
} }
int test__cpu_map_synthesize(int subtest __maybe_unused) int test__cpu_map_synthesize(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct cpu_map *cpus; struct cpu_map *cpus;
...@@ -106,7 +106,7 @@ static int cpu_map_print(const char *str) ...@@ -106,7 +106,7 @@ static int cpu_map_print(const char *str)
return !strcmp(buf, str); return !strcmp(buf, str);
} }
int test__cpu_map_print(int subtest __maybe_unused) 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"));
TEST_ASSERT_VAL("failed to convert map", cpu_map_print("1,5")); TEST_ASSERT_VAL("failed to convert map", cpu_map_print("1,5"));
......
...@@ -112,7 +112,7 @@ static int dso__data_fd(struct dso *dso, struct machine *machine) ...@@ -112,7 +112,7 @@ static int dso__data_fd(struct dso *dso, struct machine *machine)
return fd; return fd;
} }
int test__dso_data(int subtest __maybe_unused) int test__dso_data(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct machine machine; struct machine machine;
struct dso *dso; struct dso *dso;
...@@ -247,7 +247,7 @@ static int set_fd_limit(int n) ...@@ -247,7 +247,7 @@ static int set_fd_limit(int n)
return setrlimit(RLIMIT_NOFILE, &rlim); return setrlimit(RLIMIT_NOFILE, &rlim);
} }
int test__dso_data_cache(int subtest __maybe_unused) int test__dso_data_cache(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct machine machine; struct machine machine;
long nr_end, nr = open_files_cnt(); long nr_end, nr = open_files_cnt();
...@@ -307,7 +307,7 @@ int test__dso_data_cache(int subtest __maybe_unused) ...@@ -307,7 +307,7 @@ int test__dso_data_cache(int subtest __maybe_unused)
return 0; return 0;
} }
int test__dso_data_reopen(int subtest __maybe_unused) int test__dso_data_reopen(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct machine machine; struct machine machine;
long nr_end, nr = open_files_cnt(); long nr_end, nr = open_files_cnt();
......
...@@ -154,7 +154,7 @@ static noinline int krava_1(struct thread *thread) ...@@ -154,7 +154,7 @@ static noinline int krava_1(struct thread *thread)
return krava_2(thread); return krava_2(thread);
} }
int test__dwarf_unwind(int subtest __maybe_unused) int test__dwarf_unwind(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct machine *machine; struct machine *machine;
struct thread *thread; struct thread *thread;
......
...@@ -213,7 +213,7 @@ static int test_times(int (attach)(struct perf_evlist *), ...@@ -213,7 +213,7 @@ static int test_times(int (attach)(struct perf_evlist *),
* and checks that enabled and running times * and checks that enabled and running times
* match. * match.
*/ */
int test__event_times(int subtest __maybe_unused) int test__event_times(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int err, ret = 0; int err, ret = 0;
......
...@@ -76,7 +76,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused, ...@@ -76,7 +76,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused,
return 0; return 0;
} }
int test__event_update(int subtest __maybe_unused) int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct perf_evlist *evlist; struct perf_evlist *evlist;
struct perf_evsel *evsel; struct perf_evsel *evsel;
......
...@@ -97,7 +97,7 @@ static int __perf_evsel__name_array_test(const char *names[], int nr_names) ...@@ -97,7 +97,7 @@ static int __perf_evsel__name_array_test(const char *names[], int nr_names)
#define perf_evsel__name_array_test(names) \ #define perf_evsel__name_array_test(names) \
__perf_evsel__name_array_test(names, ARRAY_SIZE(names)) __perf_evsel__name_array_test(names, ARRAY_SIZE(names))
int test__perf_evsel__roundtrip_name_test(int subtest __maybe_unused) int test__perf_evsel__roundtrip_name_test(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int err = 0, ret = 0; int err = 0, ret = 0;
......
...@@ -32,7 +32,7 @@ static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name, ...@@ -32,7 +32,7 @@ static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name,
return ret; return ret;
} }
int test__perf_evsel__tp_sched_test(int subtest __maybe_unused) int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct perf_evsel *evsel = perf_evsel__newtp("sched", "sched_switch"); struct perf_evsel *evsel = perf_evsel__newtp("sched", "sched_switch");
int ret = 0; int ret = 0;
......
...@@ -13,7 +13,7 @@ static int test(struct parse_ctx *ctx, const char *e, double val2) ...@@ -13,7 +13,7 @@ static int test(struct parse_ctx *ctx, const char *e, double val2)
return 0; return 0;
} }
int test__expr(int subtest __maybe_unused) int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused)
{ {
const char *p; const char *p;
const char **other; const char **other;
......
...@@ -26,7 +26,7 @@ static int fdarray__fprintf_prefix(struct fdarray *fda, const char *prefix, FILE ...@@ -26,7 +26,7 @@ static int fdarray__fprintf_prefix(struct fdarray *fda, const char *prefix, FILE
return printed + fdarray__fprintf(fda, fp); return printed + fdarray__fprintf(fda, fp);
} }
int test__fdarray__filter(int subtest __maybe_unused) int test__fdarray__filter(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int nr_fds, expected_fd[2], fd, err = TEST_FAIL; int nr_fds, expected_fd[2], fd, err = TEST_FAIL;
struct fdarray *fda = fdarray__new(5, 5); struct fdarray *fda = fdarray__new(5, 5);
...@@ -104,7 +104,7 @@ int test__fdarray__filter(int subtest __maybe_unused) ...@@ -104,7 +104,7 @@ int test__fdarray__filter(int subtest __maybe_unused)
return err; return err;
} }
int test__fdarray__add(int subtest __maybe_unused) int test__fdarray__add(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int err = TEST_FAIL; int err = TEST_FAIL;
struct fdarray *fda = fdarray__new(2, 2); struct fdarray *fda = fdarray__new(2, 2);
......
...@@ -687,7 +687,7 @@ static int test4(struct perf_evsel *evsel, struct machine *machine) ...@@ -687,7 +687,7 @@ static int test4(struct perf_evsel *evsel, struct machine *machine)
return err; return err;
} }
int test__hists_cumulate(int subtest __maybe_unused) int test__hists_cumulate(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int err = TEST_FAIL; int err = TEST_FAIL;
struct machines machines; struct machines machines;
......
...@@ -101,7 +101,7 @@ static int add_hist_entries(struct perf_evlist *evlist, ...@@ -101,7 +101,7 @@ static int add_hist_entries(struct perf_evlist *evlist,
return TEST_FAIL; return TEST_FAIL;
} }
int test__hists_filter(int subtest __maybe_unused) int test__hists_filter(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int err = TEST_FAIL; int err = TEST_FAIL;
struct machines machines; struct machines machines;
......
...@@ -264,7 +264,7 @@ static int validate_link(struct hists *leader, struct hists *other) ...@@ -264,7 +264,7 @@ static int validate_link(struct hists *leader, struct hists *other)
return __validate_link(leader, 0) || __validate_link(other, 1); return __validate_link(leader, 0) || __validate_link(other, 1);
} }
int test__hists_link(int subtest __maybe_unused) int test__hists_link(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int err = -1; int err = -1;
struct hists *hists, *first_hists; struct hists *hists, *first_hists;
......
...@@ -573,7 +573,7 @@ static int test5(struct perf_evsel *evsel, struct machine *machine) ...@@ -573,7 +573,7 @@ static int test5(struct perf_evsel *evsel, struct machine *machine)
return err; return err;
} }
int test__hists_output(int subtest __maybe_unused) int test__hists_output(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int err = TEST_FAIL; int err = TEST_FAIL;
struct machines machines; struct machines machines;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "debug.h" #include "debug.h"
#include "print_binary.h" #include "print_binary.h"
int test__is_printable_array(int subtest __maybe_unused) int test__is_printable_array(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
char buf1[] = { 'k', 'r', 4, 'v', 'a', 0 }; char buf1[] = { 'k', 'r', 4, 'v', 'a', 0 };
char buf2[] = { 'k', 'r', 'a', 'v', 4, 0 }; char buf2[] = { 'k', 'r', 'a', 'v', 4, 0 };
......
...@@ -49,7 +49,7 @@ static int find_comm(struct perf_evlist *evlist, const char *comm) ...@@ -49,7 +49,7 @@ static int find_comm(struct perf_evlist *evlist, const char *comm)
* when an event is disabled but a dummy software event is not disabled. If the * when an event is disabled but a dummy software event is not disabled. If the
* test passes %0 is returned, otherwise %-1 is returned. * test passes %0 is returned, otherwise %-1 is returned.
*/ */
int test__keep_tracking(int subtest __maybe_unused) int test__keep_tracking(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct record_opts opts = { struct record_opts opts = {
.mmap_pages = UINT_MAX, .mmap_pages = UINT_MAX,
......
...@@ -50,7 +50,7 @@ static int test_is_kernel_module(const char *path, int cpumode, bool expect) ...@@ -50,7 +50,7 @@ static int test_is_kernel_module(const char *path, int cpumode, bool expect)
#define M(path, c, e) \ #define M(path, c, e) \
TEST_ASSERT_VAL("failed", !test_is_kernel_module(path, c, e)) TEST_ASSERT_VAL("failed", !test_is_kernel_module(path, c, e))
int test__kmod_path__parse(int subtest __maybe_unused) int test__kmod_path__parse(struct test *t __maybe_unused, int subtest __maybe_unused)
{ {
/* path alloc_name alloc_ext kmod comp name ext */ /* path alloc_name alloc_ext kmod comp name ext */
T("/xxxx/xxxx/x-x.ko", true , true , true, false, "[x_x]", NULL); T("/xxxx/xxxx/x-x.ko", true , true , true, false, "[x_x]", NULL);
......
...@@ -132,7 +132,7 @@ test_llvm__fetch_bpf_obj(void **p_obj_buf, ...@@ -132,7 +132,7 @@ test_llvm__fetch_bpf_obj(void **p_obj_buf,
return ret; return ret;
} }
int test__llvm(int subtest) int test__llvm(struct test *test __maybe_unused, int subtest)
{ {
int ret; int ret;
void *obj_buf = NULL; void *obj_buf = NULL;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* Then it checks if the number of syscalls reported as perf events by * Then it checks if the number of syscalls reported as perf events by
* the kernel corresponds to the number of syscalls made. * the kernel corresponds to the number of syscalls made.
*/ */
int test__basic_mmap(int subtest __maybe_unused) int test__basic_mmap(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int err = -1; int err = -1;
union perf_event *event; union perf_event *event;
......
...@@ -221,7 +221,7 @@ static int mmap_events(synth_cb synth) ...@@ -221,7 +221,7 @@ static int mmap_events(synth_cb synth)
* *
* by using all thread objects. * by using all thread objects.
*/ */
int test__mmap_thread_lookup(int subtest __maybe_unused) int test__mmap_thread_lookup(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
/* perf_event__synthesize_threads synthesize */ /* perf_event__synthesize_threads synthesize */
TEST_ASSERT_VAL("failed with sythesizing all", TEST_ASSERT_VAL("failed with sythesizing all",
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "debug.h" #include "debug.h"
#include "stat.h" #include "stat.h"
int test__openat_syscall_event_on_all_cpus(int subtest __maybe_unused) int test__openat_syscall_event_on_all_cpus(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int err = -1, fd, cpu; int err = -1, fd, cpu;
struct cpu_map *cpus; struct cpu_map *cpus;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#define AT_FDCWD -100 #define AT_FDCWD -100
#endif #endif
int test__syscall_openat_tp_fields(int subtest __maybe_unused) int test__syscall_openat_tp_fields(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct record_opts opts = { struct record_opts opts = {
.target = { .target = {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "debug.h" #include "debug.h"
#include "tests.h" #include "tests.h"
int test__openat_syscall_event(int subtest __maybe_unused) int test__openat_syscall_event(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int err = -1, fd; int err = -1, fd;
struct perf_evsel *evsel; struct perf_evsel *evsel;
......
...@@ -1810,7 +1810,7 @@ static int test_pmu_events(void) ...@@ -1810,7 +1810,7 @@ static int test_pmu_events(void)
return ret; return ret;
} }
int test__parse_events(int subtest __maybe_unused) int test__parse_events(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int ret1, ret2 = 0; int ret1, ret2 = 0;
......
...@@ -68,7 +68,7 @@ struct test_attr_event { ...@@ -68,7 +68,7 @@ struct test_attr_event {
* *
* Return: %0 on success, %-1 if the test fails. * Return: %0 on success, %-1 if the test fails.
*/ */
int test__parse_no_sample_id_all(int subtest __maybe_unused) int test__parse_no_sample_id_all(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int err; int err;
......
...@@ -27,7 +27,7 @@ static void the_hook(void *_hook_flags) ...@@ -27,7 +27,7 @@ static void the_hook(void *_hook_flags)
*p = 0; *p = 0;
} }
int test__perf_hooks(int subtest __maybe_unused) int test__perf_hooks(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int hook_flags = 0; int hook_flags = 0;
......
...@@ -37,7 +37,7 @@ static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp) ...@@ -37,7 +37,7 @@ static int sched__get_first_possible_cpu(pid_t pid, cpu_set_t *maskp)
return cpu; return cpu;
} }
int test__PERF_RECORD(int subtest __maybe_unused) int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct record_opts opts = { struct record_opts opts = {
.target = { .target = {
......
...@@ -135,7 +135,7 @@ static struct list_head *test_terms_list(void) ...@@ -135,7 +135,7 @@ static struct list_head *test_terms_list(void)
return &terms; return &terms;
} }
int test__pmu(int subtest __maybe_unused) int test__pmu(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
char *format = test_format_dir_get(); char *format = test_format_dir_get();
LIST_HEAD(formats); LIST_HEAD(formats);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
extern int verbose; extern int verbose;
int test__python_use(int subtest __maybe_unused) int test__python_use(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
char *cmd; char *cmd;
int ret; int ret;
......
...@@ -292,7 +292,7 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format) ...@@ -292,7 +292,7 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)
* checks sample format bits separately and together. If the test passes %0 is * checks sample format bits separately and together. If the test passes %0 is
* returned, otherwise %-1 is returned. * returned, otherwise %-1 is returned.
*/ */
int test__sample_parsing(int subtest __maybe_unused) int test__sample_parsing(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
const u64 rf[] = {4, 5, 6, 7, 12, 13, 14, 15}; const u64 rf[] = {4, 5, 6, 7, 12, 13, 14, 15};
u64 sample_type; u64 sample_type;
......
...@@ -71,7 +71,7 @@ static int search_cached_probe(const char *target, ...@@ -71,7 +71,7 @@ static int search_cached_probe(const char *target,
return ret; return ret;
} }
int test__sdt_event(int subtests __maybe_unused) int test__sdt_event(struct test *test __maybe_unused, int subtests __maybe_unused)
{ {
int ret = TEST_FAIL; int ret = TEST_FAIL;
char __tempdir[] = "./test-buildid-XXXXXX"; char __tempdir[] = "./test-buildid-XXXXXX";
...@@ -109,7 +109,7 @@ int test__sdt_event(int subtests __maybe_unused) ...@@ -109,7 +109,7 @@ int test__sdt_event(int subtests __maybe_unused)
return ret; return ret;
} }
#else #else
int test__sdt_event(int subtests __maybe_unused) 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"); pr_debug("Skip SDT event test because SDT support is not compiled\n");
return TEST_SKIP; return TEST_SKIP;
......
...@@ -45,7 +45,7 @@ static int process_stat_config_event(struct perf_tool *tool __maybe_unused, ...@@ -45,7 +45,7 @@ static int process_stat_config_event(struct perf_tool *tool __maybe_unused,
return 0; return 0;
} }
int test__synthesize_stat_config(int subtest __maybe_unused) int test__synthesize_stat_config(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct perf_stat_config stat_config = { struct perf_stat_config stat_config = {
.aggr_mode = AGGR_CORE, .aggr_mode = AGGR_CORE,
...@@ -75,7 +75,7 @@ static int process_stat_event(struct perf_tool *tool __maybe_unused, ...@@ -75,7 +75,7 @@ static int process_stat_event(struct perf_tool *tool __maybe_unused,
return 0; return 0;
} }
int test__synthesize_stat(int subtest __maybe_unused) int test__synthesize_stat(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct perf_counts_values count; struct perf_counts_values count;
...@@ -101,7 +101,7 @@ static int process_stat_round_event(struct perf_tool *tool __maybe_unused, ...@@ -101,7 +101,7 @@ static int process_stat_round_event(struct perf_tool *tool __maybe_unused,
return 0; return 0;
} }
int test__synthesize_stat_round(int subtest __maybe_unused) int test__synthesize_stat_round(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
TEST_ASSERT_VAL("failed to synthesize stat_config", TEST_ASSERT_VAL("failed to synthesize stat_config",
!perf_event__synthesize_stat_round(NULL, 0xdeadbeef, PERF_STAT_ROUND_TYPE__INTERVAL, !perf_event__synthesize_stat_round(NULL, 0xdeadbeef, PERF_STAT_ROUND_TYPE__INTERVAL,
......
...@@ -124,7 +124,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id) ...@@ -124,7 +124,7 @@ static int __test__sw_clock_freq(enum perf_sw_ids clock_id)
return err; return err;
} }
int test__sw_clock_freq(int subtest __maybe_unused) int test__sw_clock_freq(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int ret; int ret;
......
...@@ -306,7 +306,7 @@ static int process_events(struct perf_evlist *evlist, ...@@ -306,7 +306,7 @@ static int process_events(struct perf_evlist *evlist,
* evsel->system_wide and evsel->tracking flags (respectively) with other events * evsel->system_wide and evsel->tracking flags (respectively) with other events
* sometimes enabled or disabled. * sometimes enabled or disabled.
*/ */
int test__switch_tracking(int subtest __maybe_unused) int test__switch_tracking(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
const char *sched_switch = "sched:sched_switch"; const char *sched_switch = "sched:sched_switch";
struct switch_tracking switch_tracking = { .tids = NULL, }; struct switch_tracking switch_tracking = { .tids = NULL, };
......
...@@ -32,7 +32,7 @@ static void workload_exec_failed_signal(int signo __maybe_unused, ...@@ -32,7 +32,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 * 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. * in order to check the kernel returns correct number of event.
*/ */
int test__task_exit(int subtest __maybe_unused) int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int err = -1; int err = -1;
union perf_event *event; union perf_event *event;
......
...@@ -28,7 +28,7 @@ enum { ...@@ -28,7 +28,7 @@ enum {
struct test { struct test {
const char *desc; const char *desc;
int (*func)(int subtest); int (*func)(struct test *test, int subtest);
struct { struct {
bool skip_if_fail; bool skip_if_fail;
int (*get_nr)(void); int (*get_nr)(void);
...@@ -38,67 +38,67 @@ struct test { ...@@ -38,67 +38,67 @@ struct test {
}; };
/* Tests */ /* Tests */
int test__vmlinux_matches_kallsyms(int subtest); int test__vmlinux_matches_kallsyms(struct test *test, int subtest);
int test__openat_syscall_event(int subtest); int test__openat_syscall_event(struct test *test, int subtest);
int test__openat_syscall_event_on_all_cpus(int subtest); int test__openat_syscall_event_on_all_cpus(struct test *test, int subtest);
int test__basic_mmap(int subtest); int test__basic_mmap(struct test *test, int subtest);
int test__PERF_RECORD(int subtest); int test__PERF_RECORD(struct test *test, int subtest);
int test__perf_evsel__roundtrip_name_test(int subtest); int test__perf_evsel__roundtrip_name_test(struct test *test, int subtest);
int test__perf_evsel__tp_sched_test(int subtest); int test__perf_evsel__tp_sched_test(struct test *test, int subtest);
int test__syscall_openat_tp_fields(int subtest); int test__syscall_openat_tp_fields(struct test *test, int subtest);
int test__pmu(int subtest); int test__pmu(struct test *test, int subtest);
int test__attr(int subtest); int test__attr(struct test *test, int subtest);
int test__dso_data(int subtest); int test__dso_data(struct test *test, int subtest);
int test__dso_data_cache(int subtest); int test__dso_data_cache(struct test *test, int subtest);
int test__dso_data_reopen(int subtest); int test__dso_data_reopen(struct test *test, int subtest);
int test__parse_events(int subtest); int test__parse_events(struct test *test, int subtest);
int test__hists_link(int subtest); int test__hists_link(struct test *test, int subtest);
int test__python_use(int subtest); int test__python_use(struct test *test, int subtest);
int test__bp_signal(int subtest); int test__bp_signal(struct test *test, int subtest);
int test__bp_signal_overflow(int subtest); int test__bp_signal_overflow(struct test *test, int subtest);
int test__task_exit(int subtest); int test__task_exit(struct test *test, int subtest);
int test__sw_clock_freq(int subtest); int test__sw_clock_freq(struct test *test, int subtest);
int test__code_reading(int subtest); int test__code_reading(struct test *test, int subtest);
int test__sample_parsing(int subtest); int test__sample_parsing(struct test *test, int subtest);
int test__keep_tracking(int subtest); int test__keep_tracking(struct test *test, int subtest);
int test__parse_no_sample_id_all(int subtest); int test__parse_no_sample_id_all(struct test *test, int subtest);
int test__dwarf_unwind(int subtest); int test__dwarf_unwind(struct test *test, int subtest);
int test__expr(int subtest); int test__expr(struct test *test, int subtest);
int test__hists_filter(int subtest); int test__hists_filter(struct test *test, int subtest);
int test__mmap_thread_lookup(int subtest); int test__mmap_thread_lookup(struct test *test, int subtest);
int test__thread_mg_share(int subtest); int test__thread_mg_share(struct test *test, int subtest);
int test__hists_output(int subtest); int test__hists_output(struct test *test, int subtest);
int test__hists_cumulate(int subtest); int test__hists_cumulate(struct test *test, int subtest);
int test__switch_tracking(int subtest); int test__switch_tracking(struct test *test, int subtest);
int test__fdarray__filter(int subtest); int test__fdarray__filter(struct test *test, int subtest);
int test__fdarray__add(int subtest); int test__fdarray__add(struct test *test, int subtest);
int test__kmod_path__parse(int subtest); int test__kmod_path__parse(struct test *test, int subtest);
int test__thread_map(int subtest); int test__thread_map(struct test *test, int subtest);
int test__llvm(int subtest); int test__llvm(struct test *test, int subtest);
const char *test__llvm_subtest_get_desc(int subtest); const char *test__llvm_subtest_get_desc(int subtest);
int test__llvm_subtest_get_nr(void); int test__llvm_subtest_get_nr(void);
int test__bpf(int subtest); int test__bpf(struct test *test, int subtest);
const char *test__bpf_subtest_get_desc(int subtest); const char *test__bpf_subtest_get_desc(int subtest);
int test__bpf_subtest_get_nr(void); int test__bpf_subtest_get_nr(void);
int test_session_topology(int subtest); int test__session_topology(struct test *test, int subtest);
int test__thread_map_synthesize(int subtest); int test__thread_map_synthesize(struct test *test, int subtest);
int test__thread_map_remove(int subtest); int test__thread_map_remove(struct test *test, int subtest);
int test__cpu_map_synthesize(int subtest); int test__cpu_map_synthesize(struct test *test, int subtest);
int test__synthesize_stat_config(int subtest); int test__synthesize_stat_config(struct test *test, int subtest);
int test__synthesize_stat(int subtest); int test__synthesize_stat(struct test *test, int subtest);
int test__synthesize_stat_round(int subtest); int test__synthesize_stat_round(struct test *test, int subtest);
int test__event_update(int subtest); int test__event_update(struct test *test, int subtest);
int test__event_times(int subtest); int test__event_times(struct test *test, int subtest);
int test__backward_ring_buffer(int subtest); int test__backward_ring_buffer(struct test *test, int subtest);
int test__cpu_map_print(int subtest); int test__cpu_map_print(struct test *test, int subtest);
int test__sdt_event(int subtest); int test__sdt_event(struct test *test, int subtest);
int test__is_printable_array(int subtest); int test__is_printable_array(struct test *test, int subtest);
int test__bitmap_print(int subtest); int test__bitmap_print(struct test *test, int subtest);
int test__perf_hooks(int subtest); int test__perf_hooks(struct test *test, int subtest);
int test__clang(int subtest); int test__clang(struct test *test, int subtest);
const char *test__clang_subtest_get_desc(int subtest); const char *test__clang_subtest_get_desc(int subtest);
int test__clang_subtest_get_nr(void); int test__clang_subtest_get_nr(void);
int test__unit_number__scnprint(int subtest); int test__unit_number__scnprint(struct test *test, int subtest);
bool test__bp_signal_is_supported(void); bool test__bp_signal_is_supported(void);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#define NAME (const char *) "perf" #define NAME (const char *) "perf"
#define NAMEUL (unsigned long) NAME #define NAMEUL (unsigned long) NAME
int test__thread_map(int subtest __maybe_unused) int test__thread_map(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct thread_map *map; struct thread_map *map;
...@@ -76,7 +76,7 @@ static int process_event(struct perf_tool *tool __maybe_unused, ...@@ -76,7 +76,7 @@ static int process_event(struct perf_tool *tool __maybe_unused,
return 0; return 0;
} }
int test__thread_map_synthesize(int subtest __maybe_unused) int test__thread_map_synthesize(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct thread_map *threads; struct thread_map *threads;
...@@ -95,7 +95,7 @@ int test__thread_map_synthesize(int subtest __maybe_unused) ...@@ -95,7 +95,7 @@ int test__thread_map_synthesize(int subtest __maybe_unused)
return 0; return 0;
} }
int test__thread_map_remove(int subtest __maybe_unused) int test__thread_map_remove(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct thread_map *threads; struct thread_map *threads;
char *str; char *str;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "map.h" #include "map.h"
#include "debug.h" #include "debug.h"
int test__thread_mg_share(int subtest __maybe_unused) int test__thread_mg_share(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
struct machines machines; struct machines machines;
struct machine *machine; struct machine *machine;
......
...@@ -86,7 +86,7 @@ static int check_cpu_topology(char *path, struct cpu_map *map) ...@@ -86,7 +86,7 @@ static int check_cpu_topology(char *path, struct cpu_map *map)
return 0; return 0;
} }
int test_session_topology(int subtest __maybe_unused) int test__session_topology(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
char path[PATH_MAX]; char path[PATH_MAX];
struct cpu_map *map; struct cpu_map *map;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "units.h" #include "units.h"
#include "debug.h" #include "debug.h"
int test__unit_number__scnprint(int subtest __maybe_unused) int test__unit_number__scnprint(struct test *t __maybe_unused, int subtest __maybe_unused)
{ {
struct { struct {
u64 n; u64 n;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#define UM(x) kallsyms_map->unmap_ip(kallsyms_map, (x)) #define UM(x) kallsyms_map->unmap_ip(kallsyms_map, (x))
int test__vmlinux_matches_kallsyms(int subtest __maybe_unused) int test__vmlinux_matches_kallsyms(struct test *test __maybe_unused, int subtest __maybe_unused)
{ {
int err = -1; int err = -1;
struct rb_node *nd; struct rb_node *nd;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment