perf tests: Add return states enum for tests

Test can currently return one of 3 states: ok, fail, skip.

The ok and fail states are self-explanatory. The skip state means that
some of the conditions for running the test was not met, making it
impossible to even run the test. For instance, if the hardware doesn't
support the 'precise' level required by a test, it will be skipped.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: http://lkml.kernel.org/n/tip-04vnsdndarctfb1eii5c9hcy@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Jiri Olsa 2012-12-19 11:33:39 -03:00 committed by Arnaldo Carvalho de Melo
parent 20914ce5b9
commit f4c1ea5f2a
2 changed files with 18 additions and 3 deletions

View file

@ -129,10 +129,19 @@ static int __cmd_test(int argc, const char *argv[])
pr_debug("\n--- start ---\n"); pr_debug("\n--- start ---\n");
err = tests[curr].func(); err = tests[curr].func();
pr_debug("---- end ----\n%s:", tests[curr].desc); pr_debug("---- end ----\n%s:", tests[curr].desc);
if (err)
color_fprintf(stderr, PERF_COLOR_RED, " FAILED!\n"); switch (err) {
else case TEST_OK:
pr_info(" Ok\n"); pr_info(" Ok\n");
break;
case TEST_SKIP:
color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip\n");
break;
case TEST_FAIL:
default:
color_fprintf(stderr, PERF_COLOR_RED, " FAILED!\n");
break;
}
} }
return 0; return 0;

View file

@ -1,6 +1,12 @@
#ifndef TESTS_H #ifndef TESTS_H
#define TESTS_H #define TESTS_H
enum {
TEST_OK = 0,
TEST_FAIL = -1,
TEST_SKIP = -2,
};
/* Tests */ /* Tests */
int test__vmlinux_matches_kallsyms(void); int test__vmlinux_matches_kallsyms(void);
int test__open_syscall_event(void); int test__open_syscall_event(void);