perf tests: Add return states enum for tests
Commit-ID: f4c1ea5f2a6b9e1c0aaa874ffb25fe4a4f9f1a3f Gitweb: http://git.kernel.org/tip/f4c1ea5f2a6b9e1c0aaa874ffb25fe4a4f9f1a3f Author: Jiri Olsa <[email protected]> AuthorDate: Wed, 19 Dec 2012 11:33:39 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Thu, 24 Jan 2013 16:40:14 -0300
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 <[email protected]>
Cc Corey Ashford <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/tests/builtin-test.c | 15 ++++++++++++--- tools/perf/tests/tests.h | 6 ++++++ 2 files changed, 18 insertions(+), 3 deletions(-)
tools/perf/tests/builtin-test.c +12 -3
@@ -129,10 +129,19 @@ static int __cmd_test(int argc, const char *argv[])pr_debug ("\n--- start ---\n" ); err = tests[curr].func ();pr_debug ("---- end ----\n%s:" , tests[curr].desc); -if (err) -color_fprintf (stderr,PERF_COLOR_RED ," FAILED!\n" ); -else + +switch (err) { +case TEST_OK :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 ;
tools/perf/tests/tests.h +6 -0
@@ -1,6 +1,12 @@#ifndef TESTS_H #define TESTS_H +enum { +TEST_OK =0 , +TEST_FAIL =-1 , +TEST_SKIP =-2 , +}; +/* Tests */ int test__vmlinux_matches_kallsyms (void );int test__open_syscall_event (void );