2012-11-10 04:46:41 +04:00
|
|
|
#ifndef TESTS_H
|
|
|
|
#define TESTS_H
|
|
|
|
|
2015-11-17 11:32:48 +03:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2013-06-07 17:37:03 +04:00
|
|
|
#define TEST_ASSERT_VAL(text, cond) \
|
|
|
|
do { \
|
|
|
|
if (!(cond)) { \
|
|
|
|
pr_debug("FAILED %s:%d %s\n", __FILE__, __LINE__, text); \
|
|
|
|
return -1; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2015-05-11 22:30:20 +03:00
|
|
|
#define TEST_ASSERT_EQUAL(text, val, expected) \
|
|
|
|
do { \
|
|
|
|
if (val != expected) { \
|
|
|
|
pr_debug("FAILED %s:%d %s (%d != %d)\n", \
|
|
|
|
__FILE__, __LINE__, text, val, expected); \
|
|
|
|
return -1; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2012-12-19 18:33:39 +04:00
|
|
|
enum {
|
|
|
|
TEST_OK = 0,
|
|
|
|
TEST_FAIL = -1,
|
|
|
|
TEST_SKIP = -2,
|
|
|
|
};
|
|
|
|
|
2015-10-05 17:40:19 +03:00
|
|
|
struct test {
|
|
|
|
const char *desc;
|
perf tests: Pass the subtest index to each test routine
Some tests have sub-tests we want to run, so allow passing this.
Wang tried to avoid having to touch all tests, but then, having the
test.func in an anonymous union makes the build fail on older compilers,
like the one in RHEL6, where:
test a = {
.func = foo,
};
fails.
To fix it leave the func pointer in the main structure and pass the subtest
index to all tests, end result function is the same, but we have just one
function pointer, not two, with and without the subtest index as an argument.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-5genj0ficwdmelpoqlds0u4y@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-11-19 18:01:48 +03:00
|
|
|
int (*func)(int subtest);
|
2015-11-17 11:32:48 +03:00
|
|
|
struct {
|
|
|
|
bool skip_if_fail;
|
|
|
|
int (*get_nr)(void);
|
|
|
|
const char *(*get_desc)(int subtest);
|
|
|
|
} subtest;
|
2015-10-05 17:40:19 +03:00
|
|
|
};
|
|
|
|
|
2012-11-10 04:46:42 +04:00
|
|
|
/* Tests */
|
perf tests: Pass the subtest index to each test routine
Some tests have sub-tests we want to run, so allow passing this.
Wang tried to avoid having to touch all tests, but then, having the
test.func in an anonymous union makes the build fail on older compilers,
like the one in RHEL6, where:
test a = {
.func = foo,
};
fails.
To fix it leave the func pointer in the main structure and pass the subtest
index to all tests, end result function is the same, but we have just one
function pointer, not two, with and without the subtest index as an argument.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-5genj0ficwdmelpoqlds0u4y@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-11-19 18:01:48 +03:00
|
|
|
int test__vmlinux_matches_kallsyms(int subtest);
|
|
|
|
int test__openat_syscall_event(int subtest);
|
|
|
|
int test__openat_syscall_event_on_all_cpus(int subtest);
|
|
|
|
int test__basic_mmap(int subtest);
|
|
|
|
int test__PERF_RECORD(int subtest);
|
|
|
|
int test__perf_evsel__roundtrip_name_test(int subtest);
|
|
|
|
int test__perf_evsel__tp_sched_test(int subtest);
|
|
|
|
int test__syscall_openat_tp_fields(int subtest);
|
|
|
|
int test__pmu(int subtest);
|
|
|
|
int test__attr(int subtest);
|
|
|
|
int test__dso_data(int subtest);
|
|
|
|
int test__dso_data_cache(int subtest);
|
|
|
|
int test__dso_data_reopen(int subtest);
|
|
|
|
int test__parse_events(int subtest);
|
|
|
|
int test__hists_link(int subtest);
|
|
|
|
int test__python_use(int subtest);
|
|
|
|
int test__bp_signal(int subtest);
|
|
|
|
int test__bp_signal_overflow(int subtest);
|
|
|
|
int test__task_exit(int subtest);
|
|
|
|
int test__sw_clock_freq(int subtest);
|
|
|
|
int test__code_reading(int subtest);
|
|
|
|
int test__sample_parsing(int subtest);
|
|
|
|
int test__keep_tracking(int subtest);
|
|
|
|
int test__parse_no_sample_id_all(int subtest);
|
|
|
|
int test__dwarf_unwind(int subtest);
|
|
|
|
int test__hists_filter(int subtest);
|
|
|
|
int test__mmap_thread_lookup(int subtest);
|
|
|
|
int test__thread_mg_share(int subtest);
|
|
|
|
int test__hists_output(int subtest);
|
|
|
|
int test__hists_cumulate(int subtest);
|
|
|
|
int test__switch_tracking(int subtest);
|
|
|
|
int test__fdarray__filter(int subtest);
|
|
|
|
int test__fdarray__add(int subtest);
|
|
|
|
int test__kmod_path__parse(int subtest);
|
|
|
|
int test__thread_map(int subtest);
|
|
|
|
int test__llvm(int subtest);
|
2015-11-17 11:32:48 +03:00
|
|
|
const char *test__llvm_subtest_get_desc(int subtest);
|
|
|
|
int test__llvm_subtest_get_nr(void);
|
perf tests: Pass the subtest index to each test routine
Some tests have sub-tests we want to run, so allow passing this.
Wang tried to avoid having to touch all tests, but then, having the
test.func in an anonymous union makes the build fail on older compilers,
like the one in RHEL6, where:
test a = {
.func = foo,
};
fails.
To fix it leave the func pointer in the main structure and pass the subtest
index to all tests, end result function is the same, but we have just one
function pointer, not two, with and without the subtest index as an argument.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-5genj0ficwdmelpoqlds0u4y@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-11-19 18:01:48 +03:00
|
|
|
int test__bpf(int subtest);
|
2015-11-17 11:32:49 +03:00
|
|
|
const char *test__bpf_subtest_get_desc(int subtest);
|
|
|
|
int test__bpf_subtest_get_nr(void);
|
perf tests: Pass the subtest index to each test routine
Some tests have sub-tests we want to run, so allow passing this.
Wang tried to avoid having to touch all tests, but then, having the
test.func in an anonymous union makes the build fail on older compilers,
like the one in RHEL6, where:
test a = {
.func = foo,
};
fails.
To fix it leave the func pointer in the main structure and pass the subtest
index to all tests, end result function is the same, but we have just one
function pointer, not two, with and without the subtest index as an argument.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-5genj0ficwdmelpoqlds0u4y@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-11-19 18:01:48 +03:00
|
|
|
int test_session_topology(int subtest);
|
2015-10-25 17:51:20 +03:00
|
|
|
int test__thread_map_synthesize(int subtest);
|
2015-10-25 17:51:24 +03:00
|
|
|
int test__cpu_map_synthesize(int subtest);
|
2015-10-25 17:51:28 +03:00
|
|
|
int test__synthesize_stat_config(int subtest);
|
2015-10-25 17:51:31 +03:00
|
|
|
int test__synthesize_stat(int subtest);
|
2015-10-25 17:51:34 +03:00
|
|
|
int test__synthesize_stat_round(int subtest);
|
2015-10-25 17:51:37 +03:00
|
|
|
int test__event_update(int subtest);
|
perf tests: Add test to check for event times
This test creates software event 'cpu-clock' attaches it in several ways
and checks that enabled and running times match.
Committer notes:
Testing it:
[acme@jouet linux]$ perf test -v times
44: Test events times :
--- start ---
test child forked, pid 27170
attaching to spawned child, enable on exec
OK : ena 307328, run 307328
attaching to current thread as enabled
OK : ena 7826, run 7826
attaching to current thread as disabled
OK : ena 738, run 738
attaching to CPU 0 as enabled
SKIP : not enough rights
attaching to CPU 0 as enabled
SKIP : not enough rights
test child finished with -2
---- end ----
Test events times: Skip
[acme@jouet linux]$
[root@jouet ~]# perf test times
44: Test events times : Ok
[root@jouet ~]# perf test -v times
44: Test events times :
--- start ---
test child forked, pid 27306
attaching to spawned child, enable on exec
OK : ena 479290, run 479290
attaching to current thread as enabled
OK : ena 11356, run 11356
attaching to current thread as disabled
OK : ena 987, run 987
attaching to CPU 0 as enabled
OK : ena 3717, run 3717
attaching to CPU 0 as enabled
OK : ena 2323, run 2323
test child finished with 0
---- end ----
Test events times: Ok
[root@jouet ~]#
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1458823940-24583-7-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-03-24 15:52:20 +03:00
|
|
|
int test__event_times(int subtest);
|
2016-05-09 04:47:51 +03:00
|
|
|
int test__backward_ring_buffer(int subtest);
|
2016-06-28 14:29:04 +03:00
|
|
|
int test__cpu_map_print(int subtest);
|
2016-07-12 13:06:05 +03:00
|
|
|
int test__sdt_event(int subtest);
|
2016-07-16 19:11:20 +03:00
|
|
|
int test__is_printable_array(int subtest);
|
2016-08-01 21:02:32 +03:00
|
|
|
int test__bitmap_print(int subtest);
|
2016-11-26 10:03:28 +03:00
|
|
|
int test__perf_hooks(int subtest);
|
2012-11-10 04:46:42 +04:00
|
|
|
|
2015-10-05 17:40:20 +03:00
|
|
|
#if defined(__arm__) || defined(__aarch64__)
|
2014-01-07 16:47:28 +04:00
|
|
|
#ifdef HAVE_DWARF_UNWIND_SUPPORT
|
2014-01-07 16:47:22 +04:00
|
|
|
struct thread;
|
|
|
|
struct perf_sample;
|
|
|
|
int test__arch_unwind_sample(struct perf_sample *sample,
|
|
|
|
struct thread *thread);
|
|
|
|
#endif
|
|
|
|
#endif
|
2012-11-10 04:46:41 +04:00
|
|
|
#endif /* TESTS_H */
|