From 4f31e6303468bf783d3642235567ec2bfc32c950 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Wed, 24 Oct 2012 15:44:41 -0200 Subject: [PATCH] --- yaml --- r: 338891 b: refs/heads/master c: 9a8e85ad0b61ec0720df7d24392163c2a12626d0 h: refs/heads/master i: 338889: 1d71f56114adb4c5c678720097276a81d5b29e3a 338887: 2de9460522f8ed6104f9aad6233d6b201ef9f7de v: v3 --- [refs] | 2 +- trunk/tools/perf/builtin-test.c | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index e44fee1b59d8..0a15e0cd59e6 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2305c82fb35dd2c8c9533303bb1693f1636c66e4 +refs/heads/master: 9a8e85ad0b61ec0720df7d24392163c2a12626d0 diff --git a/trunk/tools/perf/builtin-test.c b/trunk/tools/perf/builtin-test.c index e2d9872de3d7..a04276e81f40 100644 --- a/trunk/tools/perf/builtin-test.c +++ b/trunk/tools/perf/builtin-test.c @@ -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" @@ -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;