diff options
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; |
