Skip to content

Commit

Permalink
perf test: Align the 'Ok'/'FAILED!' test results
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Arnaldo Carvalho de Melo committed Oct 24, 2012
1 parent 2305c82 commit 9a8e85a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tools/perf/builtin-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "builtin.h"

#include "util/cache.h"
#include "util/color.h"
#include "util/debug.h"
#include "util/debugfs.h"
#include "util/evlist.h"
Expand Down Expand Up @@ -1485,18 +1486,31 @@ static bool perf_test__matches(int curr, int argc, const char *argv[])
static int __cmd_test(int argc, const char *argv[])
{
int i = 0;
int width = 0;

while (tests[i].func) {
int len = strlen(tests[i].desc);

if (width < len)
width = len;
++i;
}

i = 0;
while (tests[i].func) {
int curr = i++, err;

if (!perf_test__matches(curr, argc, argv))
continue;

pr_info("%2d: %s:", i, tests[curr].desc);
pr_info("%2d: %-*s:", i, width, tests[curr].desc);
pr_debug("\n--- start ---\n");
err = tests[curr].func();
pr_debug("---- end ----\n%s:", tests[curr].desc);
pr_info(" %s\n", err ? "FAILED!\n" : "Ok");
if (err)
color_fprintf(stderr, PERF_COLOR_RED, " FAILED!\n");
else
pr_info(" Ok\n");
}

return 0;
Expand Down

0 comments on commit 9a8e85a

Please sign in to comment.