From: "rtoax@foxmail.com" <rtoax@foxmail.com>
To: Eduard Zingerman <eddyz87@gmail.com>, vmalik@redhat.com, ast@kernel.org
Cc: Rong Tao <rongtao@cestc.cn>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>, Shuah Khan <shuah@kernel.org>,
"open list:BPF [GENERAL] (Safe Dynamic Programs and Tools)"
<bpf@vger.kernel.org>, open list <linux-kernel@vger.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH bpf-next v2 2/2] selftests/bpf: Test bpf_strcasestr,bpf_strncasestr kfuncs
Date: Tue, 7 Oct 2025 11:02:33 +0800 [thread overview]
Message-ID: <tencent_F14B16E125884ADA6BE0E81BA295C181D006@qq.com> (raw)
In-Reply-To: <405da03e33853622da3a70ad88df3396c85926e4.camel@gmail.com>
On 10/7/25 8:29 AM, Eduard Zingerman wrote:
> On Sat, 2025-10-04 at 22:47 +0800, Rong Tao wrote:
>> From: Rong Tao <rongtao@cestc.cn>
>>
>> Add tests for new kfuncs bpf_strcasestr() and bpf_strncasestr().
>>
>> Signed-off-by: Rong Tao <rongtao@cestc.cn>
>> ---
> Acked-by: Eduard Zingerman <eddyz87@gmail.com>
>
> [...]
>
>> diff --git a/tools/testing/selftests/bpf/progs/string_kfuncs_success.c b/tools/testing/selftests/bpf/progs/string_kfuncs_success.c
>> index 2e3498e37b9c..d21330b4cc3b 100644
>> --- a/tools/testing/selftests/bpf/progs/string_kfuncs_success.c
>> +++ b/tools/testing/selftests/bpf/progs/string_kfuncs_success.c
>> @@ -33,8 +33,12 @@ __test(11) int test_strnlen(void *ctx) { return bpf_strnlen(str, 12); }
>> __test(5) int test_strspn(void *ctx) { return bpf_strspn(str, "ehlo"); }
>> __test(2) int test_strcspn(void *ctx) { return bpf_strcspn(str, "lo"); }
>> __test(6) int test_strstr_found(void *ctx) { return bpf_strstr(str, "world"); }
>> +__test(6) int test_strcasestr_found1(void *ctx) { return bpf_strcasestr(str, "world"); }
>> +__test(6) int test_strcasestr_found2(void *ctx) { return bpf_strcasestr(str, "WORLD"); }
> Nit: I'd compress these two tests into one:
> __test(6) int test_strcasestr_found1(void *ctx) { return bpf_strcasestr(str, "woRLD"); }
> (and did the same for (str, "hello") variants below).
I just submit v3, please review, thanks.
Rong Tao
>
>> __test(-ENOENT) int test_strstr_notfound(void *ctx) { return bpf_strstr(str, "hi"); }
>> +__test(-ENOENT) int test_strcasestr_notfound(void *ctx) { return bpf_strcasestr(str, "hi"); }
>> __test(0) int test_strstr_empty(void *ctx) { return bpf_strstr(str, ""); }
>> +__test(0) int test_strcasestr_empty(void *ctx) { return bpf_strcasestr(str, ""); }
>> __test(0) int test_strnstr_found1(void *ctx) { return bpf_strnstr("", "", 0); }
>> __test(0) int test_strnstr_found2(void *ctx) { return bpf_strnstr(str, "hello", 5); }
>> __test(0) int test_strnstr_found3(void *ctx) { return bpf_strnstr(str, "hello", 6); }
>> @@ -42,5 +46,14 @@ __test(-ENOENT) int test_strnstr_notfound1(void *ctx) { return bpf_strnstr(str,
>> __test(-ENOENT) int test_strnstr_notfound2(void *ctx) { return bpf_strnstr(str, "hello", 4); }
>> __test(-ENOENT) int test_strnstr_notfound3(void *ctx) { return bpf_strnstr("", "a", 0); }
>> __test(0) int test_strnstr_empty(void *ctx) { return bpf_strnstr(str, "", 1); }
>> +__test(0) int test_strncasestr_found1(void *ctx) { return bpf_strncasestr("", "", 0); }
>> +__test(0) int test_strncasestr_found2(void *ctx) { return bpf_strncasestr(str, "hello", 5); }
>> +__test(0) int test_strncasestr_found3(void *ctx) { return bpf_strncasestr(str, "hello", 6); }
>> +__test(0) int test_strncasestr_found4(void *ctx) { return bpf_strncasestr(str, "HELLO", 5); }
>> +__test(0) int test_strncasestr_found5(void *ctx) { return bpf_strncasestr(str, "HELLO", 6); }
>> +__test(-ENOENT) int test_strncasestr_notfound1(void *ctx) { return bpf_strncasestr(str, "hi", 10); }
>> +__test(-ENOENT) int test_strncasestr_notfound2(void *ctx) { return bpf_strncasestr(str, "hello", 4); }
>> +__test(-ENOENT) int test_strncasestr_notfound3(void *ctx) { return bpf_strncasestr("", "a", 0); }
>> +__test(0) int test_strncasestr_empty(void *ctx) { return bpf_strncasestr(str, "", 1); }
>>
>> char _license[] SEC("license") = "GPL";
prev parent reply other threads:[~2025-10-07 3:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1759588929.git.rongtao@cestc.cn>
2025-10-04 14:47 ` [PATCH bpf-next v2 1/2] bpf: add " Rong Tao
2025-10-06 23:23 ` Andrii Nakryiko
2025-10-07 3:01 ` rtoax
2025-10-04 14:47 ` [PATCH bpf-next v2 2/2] selftests/bpf: Test " Rong Tao
2025-10-07 0:29 ` Eduard Zingerman
2025-10-07 3:02 ` rtoax [this message]
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=tencent_F14B16E125884ADA6BE0E81BA295C181D006@qq.com \
--to=rtoax@foxmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=rongtao@cestc.cn \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=vmalik@redhat.com \
--cc=yonghong.song@linux.dev \
/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
all inboxes | Powered by JetHome®