Skip to content

Commit

Permalink
selftests/bpf: Fix subtest number formatting in test_progs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mykola-lysenko authored and anakryiko committed May 20, 2022
1 parent b23316a commit fa37686
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tools/testing/selftests/bpf/test_progs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
Expand Down

0 comments on commit fa37686

Please sign in to comment.