diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-10-24 13:44:41 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-10-24 13:44:41 -0400 |
commit | 9a8e85ad0b61ec0720df7d24392163c2a12626d0 (patch) | |
tree | d9903fedb02987be82b6a1a7c984c7e842b49e73 /tools/perf | |
parent | 2305c82fb35dd2c8c9533303bb1693f1636c66e4 (diff) |
perf test: Align the 'Ok'/'FAILED!' test results
And also print 'FAILED!' in red.
Suggested-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-rkisq85w24il3e2yl3nzumhu@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-test.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c index e2d9872de3d7..a04276e81f40 100644 --- a/tools/perf/builtin-test.c +++ b/tools/perf/builtin-test.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include "builtin.h" | 6 | #include "builtin.h" |
7 | 7 | ||
8 | #include "util/cache.h" | 8 | #include "util/cache.h" |
9 | #include "util/color.h" | ||
9 | #include "util/debug.h" | 10 | #include "util/debug.h" |
10 | #include "util/debugfs.h" | 11 | #include "util/debugfs.h" |
11 | #include "util/evlist.h" | 12 | #include "util/evlist.h" |
@@ -1485,18 +1486,31 @@ static bool perf_test__matches(int curr, int argc, const char *argv[]) | |||
1485 | static int __cmd_test(int argc, const char *argv[]) | 1486 | static int __cmd_test(int argc, const char *argv[]) |
1486 | { | 1487 | { |
1487 | int i = 0; | 1488 | int i = 0; |
1489 | int width = 0; | ||
1488 | 1490 | ||
1489 | while (tests[i].func) { | 1491 | while (tests[i].func) { |
1492 | int len = strlen(tests[i].desc); | ||
1493 | |||
1494 | if (width < len) | ||
1495 | width = len; | ||
1496 | ++i; | ||
1497 | } | ||
1498 | |||
1499 | i = 0; | ||
1500 | while (tests[i].func) { | ||
1490 | int curr = i++, err; | 1501 | int curr = i++, err; |
1491 | 1502 | ||
1492 | if (!perf_test__matches(curr, argc, argv)) | 1503 | if (!perf_test__matches(curr, argc, argv)) |
1493 | continue; | 1504 | continue; |
1494 | 1505 | ||
1495 | pr_info("%2d: %s:", i, tests[curr].desc); | 1506 | pr_info("%2d: %-*s:", i, width, tests[curr].desc); |
1496 | pr_debug("\n--- start ---\n"); | 1507 | pr_debug("\n--- start ---\n"); |
1497 | err = tests[curr].func(); | 1508 | err = tests[curr].func(); |
1498 | pr_debug("---- end ----\n%s:", tests[curr].desc); | 1509 | pr_debug("---- end ----\n%s:", tests[curr].desc); |
1499 | pr_info(" %s\n", err ? "FAILED!\n" : "Ok"); | 1510 | if (err) |
1511 | color_fprintf(stderr, PERF_COLOR_RED, " FAILED!\n"); | ||
1512 | else | ||
1513 | pr_info(" Ok\n"); | ||
1500 | } | 1514 | } |
1501 | 1515 | ||
1502 | return 0; | 1516 | return 0; |