Tests that only make sense for some architectures currently live in
the same place as the generic tests. Move out the x86-specific tests
into tools/perf/arch/x86/tests and define an 'arch_tests' array, which
is the list of tests that only apply to the build architecture.
The main idea is to encourage developers to add arch tests to build
out perf's test coverage, without dumping everything in
tools/perf/tests.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kanaka Juvva <kanaka.d.juvva@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Vikas Shivappa <vikas.shivappa@intel.com>
Cc: Vince Weaver <vince@deater.net>
Link: http://lkml.kernel.org/n/tip-p4uc1c15ssbj8xj7ku5slpa6@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-libperf-$(CONFIG_DWARF_UNWIND) += tests/
--- /dev/null
+#ifndef ARCH_TESTS_H
+#define ARCH_TESTS_H
+
+extern struct test arch_tests[];
+
+#endif
-libperf-y += regs_load.o
-libperf-y += dwarf-unwind.o
+libperf-$(CONFIG_DWARF_UNWIND) += regs_load.o
+libperf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
+
+libperf-y += arch-tests.o
--- /dev/null
+#include <string.h>
+#include "tests/tests.h"
+#include "arch-tests.h"
+
+struct test arch_tests[] = {
+ {
+ .func = NULL,
+ },
+
+};
#include "parse-options.h"
#include "symbol.h"
#include "parse-options.h"
#include "symbol.h"
-static struct test {
- const char *desc;
- int (*func)(void);
-} tests[] = {
+struct test __weak arch_tests[] = {
+ {
+ .func = NULL,
+ },
+};
+
+static struct test generic_tests[] = {
{
.desc = "vmlinux symtab matches kallsyms",
.func = test__vmlinux_matches_kallsyms,
{
.desc = "vmlinux symtab matches kallsyms",
.func = test__vmlinux_matches_kallsyms,
+static struct test *tests[] = {
+ generic_tests,
+ arch_tests,
+};
+
static bool perf_test__matches(struct test *test, int curr, int argc, const char *argv[])
{
int i;
static bool perf_test__matches(struct test *test, int curr, int argc, const char *argv[])
{
int i;
-#define for_each_test(t) for (t = &tests[0]; t->func; t++)
+#define for_each_test(j, t) \
+ for (j = 0; j < ARRAY_SIZE(tests); j++) \
+ for (t = &tests[j][0]; t->func; t++)
static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
{
struct test *t;
static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
{
struct test *t;
int i = 0;
int width = 0;
int i = 0;
int width = 0;
int len = strlen(t->desc);
if (width < len)
width = len;
}
int len = strlen(t->desc);
if (width < len)
width = len;
}
int curr = i++, err;
if (!perf_test__matches(t, curr, argc, argv))
int curr = i++, err;
if (!perf_test__matches(t, curr, argc, argv))
static int perf_test__list(int argc, const char **argv)
{
static int perf_test__list(int argc, const char **argv)
{
struct test *t;
int i = 0;
struct test *t;
int i = 0;
if (argc > 1 && !strstr(t->desc, argv[1]))
continue;
if (argc > 1 && !strstr(t->desc, argv[1]))
continue;
+struct test {
+ const char *desc;
+ int (*func)(void);
+};
+
/* Tests */
int test__vmlinux_matches_kallsyms(void);
int test__openat_syscall_event(void);
/* Tests */
int test__vmlinux_matches_kallsyms(void);
int test__openat_syscall_event(void);