mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
perf test: Fix subtest status alignment for multi-digit indexes
When running perf test, the status column (: Ok) became misaligned when subtest indexes reached 2 or 3 digits (e.g. 9.100 vs 9.9 vs 10.1). This occurred because the subtest description field width (subw) was statically fixed to width - 2, assuming all subtest index prefixes were exactly 7 characters wide. Dynamically calculate subw based on the exact character length of the test suite and subtest index prefix. This ensures the status column is perfectly aligned vertically across all test outputs regardless of subtest index digit count. Assisted-by: Gemini-CLI:Google Gemini 3 Signed-off-by: Ian Rogers <irogers@google.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@linaro.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
33f20342ba
commit
94ac3ce427
|
|
@ -376,10 +376,12 @@ static int print_test_result(struct test_suite *t, int curr_suite, int curr_test
|
|||
int result, int width, int running)
|
||||
{
|
||||
if (test_suite__num_test_cases(t) > 1) {
|
||||
int subw = width > 2 ? width - 2 : width;
|
||||
char prefix[32];
|
||||
int len = snprintf(prefix, sizeof(prefix), "%3d.%1d:",
|
||||
curr_suite + 1, curr_test_case + 1);
|
||||
int subw = len >= 4 ? width + 4 - len : width;
|
||||
|
||||
pr_info("%3d.%1d: %-*s:", curr_suite + 1, curr_test_case + 1, subw,
|
||||
test_description(t, curr_test_case));
|
||||
pr_info("%s %-*s:", prefix, subw, test_description(t, curr_test_case));
|
||||
} else
|
||||
pr_info("%3d: %-*s:", curr_suite + 1, width, test_description(t, curr_test_case));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user