BPF List
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii@kernel.org>
To: <bpf@vger.kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>,
	<martin.lau@kernel.org>
Cc: <andrii@kernel.org>, <kernel-team@meta.com>
Subject: [PATCH bpf-next 3/3] selftests/bpf: don't truncate #test/subtest field
Date: Tue, 3 Oct 2023 17:17:50 -0700	[thread overview]
Message-ID: <20231004001750.2939898-3-andrii@kernel.org> (raw)
In-Reply-To: <20231004001750.2939898-1-andrii@kernel.org>

We currently expect up to a three-digit number of tests and subtests, so:

  #999/999: some_test/some_subtest: ...

Is the largest test/subtest we can see. If we happen to cross into
1000s, current logic will just truncate everything after 7th character.
This patch fixes this truncate and allows to go way higher (up to 31
characters in total). We still nicely align test numbers:

  #60/66   core_reloc_btfgen/type_based___incompat:OK
  #60/67   core_reloc_btfgen/type_based___fn_wrong_args:OK
  #60/68   core_reloc_btfgen/type_id:OK
  #60/69   core_reloc_btfgen/type_id___missing_targets:OK
  #60/70   core_reloc_btfgen/enumval:OK

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/testing/selftests/bpf/test_progs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index 4d582cac2c09..1b9387890148 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -255,7 +255,7 @@ static void print_subtest_name(int test_num, int subtest_num,
 			       const char *test_name, char *subtest_name,
 			       char *result)
 {
-	char test_num_str[TEST_NUM_WIDTH + 1];
+	char test_num_str[32];
 
 	snprintf(test_num_str, sizeof(test_num_str), "%d/%d", test_num, subtest_num);
 
-- 
2.34.1


  parent reply	other threads:[~2023-10-04  0:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-04  0:17 [PATCH bpf-next 1/3] selftests/bpf: fix compiler warnings reported in -O2 mode Andrii Nakryiko
2023-10-04  0:17 ` [PATCH bpf-next 2/3] selftests/bpf: support building selftests in optimized " Andrii Nakryiko
2023-10-04  8:27   ` Jiri Olsa
2023-10-04 17:21     ` Andrii Nakryiko
2023-10-05  7:19       ` Jiri Olsa
2023-10-05  9:04         ` Alan Maguire
2023-10-06 17:55           ` Andrii Nakryiko
2023-10-06 17:56             ` Andrii Nakryiko
2023-10-04  0:17 ` Andrii Nakryiko [this message]
2023-10-05  7:21   ` [PATCH bpf-next 3/3] selftests/bpf: don't truncate #test/subtest field Jiri Olsa
2023-10-05  7:21 ` [PATCH bpf-next 1/3] selftests/bpf: fix compiler warnings reported in -O2 mode Jiri Olsa
2023-10-06 18:20 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231004001750.2939898-3-andrii@kernel.org \
    --to=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@meta.com \
    --cc=martin.lau@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox