aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-12-19 09:33:39 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-01-24 14:40:14 -0500
commitf4c1ea5f2a6b9e1c0aaa874ffb25fe4a4f9f1a3f (patch)
tree467616140ae362e158d2a18f09d17eb111c80388
parent20914ce5b9e1ef4a35f1f09a2c9c8fb8eb1c4d86 (diff)
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>
-rw-r--r--tools/perf/tests/builtin-test.c15
-rw-r--r--tools/perf/tests/tests.h6
2 files changed, 18 insertions, 3 deletions
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index a164e4cd5f42..6a5dee2377b0 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -129,10 +129,19 @@ static int __cmd_test(int argc, const char *argv[])
129 pr_debug("\n--- start ---\n"); 129 pr_debug("\n--- start ---\n");
130 err = tests[curr].func(); 130 err = tests[curr].func();
131 pr_debug("---- end ----\n%s:", tests[curr].desc); 131 pr_debug("---- end ----\n%s:", tests[curr].desc);
132 if (err) 132
133 color_fprintf(stderr, PERF_COLOR_RED, " FAILED!\n"); 133 switch (err) {
134 else 134 case TEST_OK:
135 pr_info(" Ok\n"); 135 pr_info(" Ok\n");
136 break;
137 case TEST_SKIP:
138 color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip\n");
139 break;
140 case TEST_FAIL:
141 default:
142 color_fprintf(stderr, PERF_COLOR_RED, " FAILED!\n");
143 break;
144 }
136 } 145 }
137 146
138 return 0; 147 return 0;
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
index 0ded425b17d6..5de0be1ff4b6 100644
--- a/tools/perf/tests/tests.h
+++ b/tools/perf/tests/tests.h
@@ -1,6 +1,12 @@
1#ifndef TESTS_H 1#ifndef TESTS_H
2#define TESTS_H 2#define TESTS_H
3 3
4enum {
5 TEST_OK = 0,
6 TEST_FAIL = -1,
7 TEST_SKIP = -2,
8};
9
4/* Tests */ 10/* Tests */
5int test__vmlinux_matches_kallsyms(void); 11int test__vmlinux_matches_kallsyms(void);
6int test__open_syscall_event(void); 12int test__open_syscall_event(void);