mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH bpf-next v2] selftests/bpf: Use snake_case for subtest descriptions in jit_insns_arena.c
@ 2026-10-19  4:01 Tiezhu Yang
  2026-10-19  6:47 ` Daniel Borkmann
  0 siblings, 1 reply; 6+ messages in thread
From: Tiezhu Yang @ 2026-10-19  4:01 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi
  Cc: bpf, linux-kernel

Normalize two inline assembly test descriptions in jit_insns_arena.c
from space-separated strings to snake_case.

It is done for consistency with other neighboring subtests registered
in test_jit_insns() (such as alu_imm, alu_reg, etc.). This also makes
it convenient to execute these subtests directly from the command line
without being forced to use shell quoting.

Otherwise, unquoted shell word-splitting causes test_progs to reject
the extra arguments before the filter code runs:

$ sudo ./test_progs -t jit_insns/arena access with zero offset
Usage: test_progs [OPTION...]
Try `test_progs --help' or `test_progs --usage' for more information.

$ sudo ./test_progs -t jit_insns/cast to a user address
Usage: test_progs [OPTION...]
Try `test_progs --help' or `test_progs --usage' for more information.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
v2: update the commit message to make it accurate.

 tools/testing/selftests/bpf/progs/jit_insns_arena.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/bpf/progs/jit_insns_arena.c b/tools/testing/selftests/bpf/progs/jit_insns_arena.c
index b396d5aefb5a..16276ec192ac 100644
--- a/tools/testing/selftests/bpf/progs/jit_insns_arena.c
+++ b/tools/testing/selftests/bpf/progs/jit_insns_arena.c
@@ -34,7 +34,7 @@ struct {
 
 #if defined(__BPF_FEATURE_ADDR_SPACE_CAST)
 SEC("syscall")
-__description("arena access with zero offset")
+__description("arena_access_with_zero_offset")
 __success __retval(0)
 int arena_zero_off(void *ctx)
 {
@@ -82,7 +82,7 @@ int arena_zero_off(void *ctx)
 }
 
 SEC("syscall")
-__description("cast to a user address")
+__description("cast_to_a_user_address")
 __success __retval(0)
 int cast_to_user(void *ctx)
 {
-- 
2.42.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next v2] selftests/bpf: Use snake_case for subtest descriptions in jit_insns_arena.c
  2026-10-19  4:01 [PATCH bpf-next v2] selftests/bpf: Use snake_case for subtest descriptions in jit_insns_arena.c Tiezhu Yang
@ 2026-10-19  6:47 ` Daniel Borkmann
  2026-10-19  7:18   ` Tiezhu Yang
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Borkmann @ 2026-10-19  6:47 UTC (permalink / raw)
  To: Tiezhu Yang, Alexei Starovoitov, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi
  Cc: bpf, linux-kernel

On 10/19/26 6:01 AM, Tiezhu Yang wrote:
> Normalize two inline assembly test descriptions in jit_insns_arena.c
> from space-separated strings to snake_case.
> 
> It is done for consistency with other neighboring subtests registered
> in test_jit_insns() (such as alu_imm, alu_reg, etc.). This also makes
> it convenient to execute these subtests directly from the command line
> without being forced to use shell quoting.
> 
> Otherwise, unquoted shell word-splitting causes test_progs to reject
> the extra arguments before the filter code runs:
> 
> $ sudo ./test_progs -t jit_insns/arena access with zero offset
> Usage: test_progs [OPTION...]
> Try `test_progs --help' or `test_progs --usage' for more information.
> 
> $ sudo ./test_progs -t jit_insns/cast to a user address
> Usage: test_progs [OPTION...]
> Try `test_progs --help' or `test_progs --usage' for more information.
> 
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Do these not work already?

   ./test_progs -t jit_insns/arena_zero_off
   ./test_progs -t jit_insns/cast_to_user

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next v2] selftests/bpf: Use snake_case for subtest descriptions in jit_insns_arena.c
  2026-10-19  6:47 ` Daniel Borkmann
@ 2026-10-19  7:18   ` Tiezhu Yang
  2026-10-19  7:43     ` Daniel Borkmann
  2026-10-19  7:49     ` Tiezhu Yang
  0 siblings, 2 replies; 6+ messages in thread
From: Tiezhu Yang @ 2026-10-19  7:18 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi
  Cc: bpf, linux-kernel

On 2026/10/19 下午2:47, Daniel Borkmann wrote:
> On 10/19/26 6:01 AM, Tiezhu Yang wrote:
>> Normalize two inline assembly test descriptions in jit_insns_arena.c
>> from space-separated strings to snake_case.
>>
>> It is done for consistency with other neighboring subtests registered
>> in test_jit_insns() (such as alu_imm, alu_reg, etc.). This also makes
>> it convenient to execute these subtests directly from the command line
>> without being forced to use shell quoting.
>>
>> Otherwise, unquoted shell word-splitting causes test_progs to reject
>> the extra arguments before the filter code runs:
>>
>> $ sudo ./test_progs -t jit_insns/arena access with zero offset
>> Usage: test_progs [OPTION...]
>> Try `test_progs --help' or `test_progs --usage' for more information.
>>
>> $ sudo ./test_progs -t jit_insns/cast to a user address
>> Usage: test_progs [OPTION...]
>> Try `test_progs --help' or `test_progs --usage' for more information.
>>
>> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> Do these not work already?
> 
>    ./test_progs -t jit_insns/arena_zero_off
>    ./test_progs -t jit_insns/cast_to_user

Yes, they work.

I misunderstood that the name is "cast to a user address" in the output
rather than "cast_to_user" before, there is difference between the
description and the name.

Something like this:

$ sudo ./test_progs -t jit_insns/cast_to_user
#191/2   jit_insns/cast to a user address:OK
#191     jit_insns:OK
#192     jit_insns_blinded:OK
Summary: 2/1 PASSED, 0 SKIPPED, 0/0 FAILED

Anyway, if this patch is not necessary, please ignore it.

Thanks,
Tiezhu



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next v2] selftests/bpf: Use snake_case for subtest descriptions in jit_insns_arena.c
  2026-10-19  7:18   ` Tiezhu Yang
@ 2026-10-19  7:43     ` Daniel Borkmann
  2026-10-19  7:49     ` Tiezhu Yang
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Borkmann @ 2026-10-19  7:43 UTC (permalink / raw)
  To: Tiezhu Yang, Alexei Starovoitov, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi
  Cc: bpf, linux-kernel

On 10/19/26 9:18 AM, Tiezhu Yang wrote:
> On 2026/10/19 下午2:47, Daniel Borkmann wrote:
>> On 10/19/26 6:01 AM, Tiezhu Yang wrote:
>>> Normalize two inline assembly test descriptions in jit_insns_arena.c
>>> from space-separated strings to snake_case.
>>>
>>> It is done for consistency with other neighboring subtests registered
>>> in test_jit_insns() (such as alu_imm, alu_reg, etc.). This also makes
>>> it convenient to execute these subtests directly from the command line
>>> without being forced to use shell quoting.
>>>
>>> Otherwise, unquoted shell word-splitting causes test_progs to reject
>>> the extra arguments before the filter code runs:
>>>
>>> $ sudo ./test_progs -t jit_insns/arena access with zero offset
>>> Usage: test_progs [OPTION...]
>>> Try `test_progs --help' or `test_progs --usage' for more information.
>>>
>>> $ sudo ./test_progs -t jit_insns/cast to a user address
>>> Usage: test_progs [OPTION...]
>>> Try `test_progs --help' or `test_progs --usage' for more information.
>>>
>>> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
>> Do these not work already?
>>
>>    ./test_progs -t jit_insns/arena_zero_off
>>    ./test_progs -t jit_insns/cast_to_user
> 
> Yes, they work.
> 
> I misunderstood that the name is "cast to a user address" in the output
> rather than "cast_to_user" before, there is difference between the
> description and the name.
> 
> Something like this:
> 
> $ sudo ./test_progs -t jit_insns/cast_to_user
> #191/2   jit_insns/cast to a user address:OK
> #191     jit_insns:OK
> #192     jit_insns_blinded:OK
> Summary: 2/1 PASSED, 0 SKIPPED, 0/0 FAILED

That makes a lot more sense as reasoning. I've applied the patch to bpf-next
and also adapted the commit message accordingly. Thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next v2] selftests/bpf: Use snake_case for subtest descriptions in jit_insns_arena.c
  2026-10-19  7:18   ` Tiezhu Yang
  2026-10-19  7:43     ` Daniel Borkmann
@ 2026-10-19  7:49     ` Tiezhu Yang
  2026-10-19  8:13       ` Daniel Borkmann
  1 sibling, 1 reply; 6+ messages in thread
From: Tiezhu Yang @ 2026-10-19  7:49 UTC (permalink / raw)
  To: Daniel Borkmann, Alexei Starovoitov, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi
  Cc: bpf, linux-kernel

On 2026/10/19 下午3:18, Tiezhu Yang wrote:
> On 2026/10/19 下午2:47, Daniel Borkmann wrote:
>> On 10/19/26 6:01 AM, Tiezhu Yang wrote:
>>> Normalize two inline assembly test descriptions in jit_insns_arena.c
>>> from space-separated strings to snake_case.
>>>
>>> It is done for consistency with other neighboring subtests registered
>>> in test_jit_insns() (such as alu_imm, alu_reg, etc.). This also makes
>>> it convenient to execute these subtests directly from the command line
>>> without being forced to use shell quoting.
>>>
>>> Otherwise, unquoted shell word-splitting causes test_progs to reject
>>> the extra arguments before the filter code runs:
>>>
>>> $ sudo ./test_progs -t jit_insns/arena access with zero offset
>>> Usage: test_progs [OPTION...]
>>> Try `test_progs --help' or `test_progs --usage' for more information.
>>>
>>> $ sudo ./test_progs -t jit_insns/cast to a user address
>>> Usage: test_progs [OPTION...]
>>> Try `test_progs --help' or `test_progs --usage' for more information.
>>>
>>> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
>> Do these not work already?
>>
>>    ./test_progs -t jit_insns/arena_zero_off
>>    ./test_progs -t jit_insns/cast_to_user
> 
> Yes, they work.
> 
> I misunderstood that the name is "cast to a user address" in the output
> rather than "cast_to_user" before, there is difference between the
> description and the name.
> 
> Something like this:
> 
> $ sudo ./test_progs -t jit_insns/cast_to_user
> #191/2   jit_insns/cast to a user address:OK
> #191     jit_insns:OK
> #192     jit_insns_blinded:OK
> Summary: 2/1 PASSED, 0 SKIPPED, 0/0 FAILED
> 
> Anyway, if this patch is not necessary, please ignore it.

By the way, IMO, it is better to remove the __description strings,
so that the test output style matches the actual program names like
other neighboring subtests. This prevents developers from being
misled into copying space-separated strings from the standard output.

What do you think about something like this?

diff --git a/tools/testing/selftests/bpf/progs/jit_insns_arena.c 
b/tools/testing/selftests/bpf/progs/jit_insns_arena.c
index b396d5aefb5a..95736eae2a58 100644
--- a/tools/testing/selftests/bpf/progs/jit_insns_arena.c
+++ b/tools/testing/selftests/bpf/progs/jit_insns_arena.c
@@ -34,7 +34,6 @@ struct {

  #if defined(__BPF_FEATURE_ADDR_SPACE_CAST)
  SEC("syscall")
-__description("arena access with zero offset")
  __success __retval(0)
  int arena_zero_off(void *ctx)
  {
@@ -82,7 +81,6 @@ int arena_zero_off(void *ctx)
  }

  SEC("syscall")
-__description("cast to a user address")
  __success __retval(0)
  int cast_to_user(void *ctx)
  {

The output is something like this:

$ sudo ./test_progs -t jit_insns/arena_zero_off | tail -3
#191/1   jit_insns/arena_zero_off:FAIL
#191     jit_insns:FAIL
Summary: 1/0 PASSED, 0 SKIPPED, 1/1 FAILED

$ sudo ./test_progs -t jit_insns/cast_to_user
#191/2   jit_insns/cast_to_user:OK
#191     jit_insns:OK
#192     jit_insns_blinded:OK
Summary: 2/1 PASSED, 0 SKIPPED, 0/0 FAILED

The main goal here is that if a test fails, developers can immediately
recognize the exact, actionable test name from the standard output and
rerun it without any confusion.

Thanks,
Tiezhu


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next v2] selftests/bpf: Use snake_case for subtest descriptions in jit_insns_arena.c
  2026-10-19  7:49     ` Tiezhu Yang
@ 2026-10-19  8:13       ` Daniel Borkmann
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Borkmann @ 2026-10-19  8:13 UTC (permalink / raw)
  To: Tiezhu Yang, Alexei Starovoitov, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi
  Cc: bpf, linux-kernel

On 10/19/26 9:49 AM, Tiezhu Yang wrote:
> On 2026/10/19 下午3:18, Tiezhu Yang wrote:
>> On 2026/10/19 下午2:47, Daniel Borkmann wrote:
>>> On 10/19/26 6:01 AM, Tiezhu Yang wrote:
>>>> Normalize two inline assembly test descriptions in jit_insns_arena.c
>>>> from space-separated strings to snake_case.
>>>>
>>>> It is done for consistency with other neighboring subtests registered
>>>> in test_jit_insns() (such as alu_imm, alu_reg, etc.). This also makes
>>>> it convenient to execute these subtests directly from the command line
>>>> without being forced to use shell quoting.
>>>>
>>>> Otherwise, unquoted shell word-splitting causes test_progs to reject
>>>> the extra arguments before the filter code runs:
>>>>
>>>> $ sudo ./test_progs -t jit_insns/arena access with zero offset
>>>> Usage: test_progs [OPTION...]
>>>> Try `test_progs --help' or `test_progs --usage' for more information.
>>>>
>>>> $ sudo ./test_progs -t jit_insns/cast to a user address
>>>> Usage: test_progs [OPTION...]
>>>> Try `test_progs --help' or `test_progs --usage' for more information.
>>>>
>>>> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
>>> Do these not work already?
>>>
>>>    ./test_progs -t jit_insns/arena_zero_off
>>>    ./test_progs -t jit_insns/cast_to_user
>>
>> Yes, they work.
>>
>> I misunderstood that the name is "cast to a user address" in the output
>> rather than "cast_to_user" before, there is difference between the
>> description and the name.
>>
>> Something like this:
>>
>> $ sudo ./test_progs -t jit_insns/cast_to_user
>> #191/2   jit_insns/cast to a user address:OK
>> #191     jit_insns:OK
>> #192     jit_insns_blinded:OK
>> Summary: 2/1 PASSED, 0 SKIPPED, 0/0 FAILED
>>
>> Anyway, if this patch is not necessary, please ignore it.
> 
> By the way, IMO, it is better to remove the __description strings,
> so that the test output style matches the actual program names like
> other neighboring subtests. This prevents developers from being
> misled into copying space-separated strings from the standard output.
> 
> What do you think about something like this?
That's cleaner to just remove, lets go with that. In the meantime I've
tossed the old commit from bpf-next, so please send a v3.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-10-19  8:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-19  4:01 [PATCH bpf-next v2] selftests/bpf: Use snake_case for subtest descriptions in jit_insns_arena.c Tiezhu Yang
2026-10-19  6:47 ` Daniel Borkmann
2026-10-19  7:18   ` Tiezhu Yang
2026-10-19  7:43     ` Daniel Borkmann
2026-10-19  7:49     ` Tiezhu Yang
2026-10-19  8:13       ` Daniel Borkmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®