diff options
author | Mykola Lysenko <mykolal@fb.com> | 2022-05-20 09:01:44 +0200 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2022-05-21 01:23:14 +0200 |
commit | fa376860658252a4559026496528c5d3a36b52e3 (patch) | |
tree | 9ed0a1a657bb397a68f85c57ad77932bed0c0868 /tools/testing/selftests/bpf/test_progs.c | |
parent | selftests/bpf: Add missing trampoline program type to trampoline_count test (diff) | |
download | linux-fa376860658252a4559026496528c5d3a36b52e3.tar.xz linux-fa376860658252a4559026496528c5d3a36b52e3.zip |
selftests/bpf: Fix subtest number formatting in test_progs
Remove weird spaces around / while preserving proper
indentation
Signed-off-by: Mykola Lysenko <mykolal@fb.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Daniel Müller <deso@posteo.net>
Link: https://lore.kernel.org/bpf/20220520070144.10312-1-mykolal@fb.com
Diffstat (limited to 'tools/testing/selftests/bpf/test_progs.c')
-rw-r--r-- | tools/testing/selftests/bpf/test_progs.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c index a07da648af3b..307f8f41437d 100644 --- a/tools/testing/selftests/bpf/test_progs.c +++ b/tools/testing/selftests/bpf/test_progs.c @@ -230,9 +230,11 @@ static void print_test_log(char *log_buf, size_t log_cnt) fprintf(env.stdout, "\n"); } +#define TEST_NUM_WIDTH 7 + static void print_test_name(int test_num, const char *test_name, char *result) { - fprintf(env.stdout, "#%-9d %s", test_num, test_name); + fprintf(env.stdout, "#%-*d %s", TEST_NUM_WIDTH, test_num, test_name); if (result) fprintf(env.stdout, ":%s", result); @@ -244,8 +246,12 @@ static void print_subtest_name(int test_num, int subtest_num, const char *test_name, char *subtest_name, char *result) { - fprintf(env.stdout, "#%-3d/%-5d %s/%s", - test_num, subtest_num, + char test_num_str[TEST_NUM_WIDTH + 1]; + + snprintf(test_num_str, sizeof(test_num_str), "%d/%d", test_num, subtest_num); + + fprintf(env.stdout, "#%-*s %s/%s", + TEST_NUM_WIDTH, test_num_str, test_name, subtest_name); if (result) |