summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/string_kfuncs_success.c
diff options
context:
space:
mode:
authorRong Tao <rongtao@cestc.cn>2025-09-03 07:48:36 +0800
committerAlexei Starovoitov <ast@kernel.org>2025-09-04 09:00:57 -0700
commitabc8a952d4aa1cdb72e90df280d1fe6fc50ed631 (patch)
tree1005ef5f5ed3978b98cabcfaf41545d9e391ee48 /tools/testing/selftests/bpf/progs/string_kfuncs_success.c
parent19559e8441843bb36ecc78bb8d5cf82d500352fd (diff)
selftests/bpf: Test kfunc bpf_strcasecmp
Add testsuites for kfunc bpf_strcasecmp. Signed-off-by: Rong Tao <rongtao@cestc.cn> Link: https://lore.kernel.org/r/tencent_81A1A0ACC04B68158C57C4D151C46A832B07@qq.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/string_kfuncs_success.c')
-rw-r--r--tools/testing/selftests/bpf/progs/string_kfuncs_success.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/string_kfuncs_success.c b/tools/testing/selftests/bpf/progs/string_kfuncs_success.c
index 46697f381878..67830456637b 100644
--- a/tools/testing/selftests/bpf/progs/string_kfuncs_success.c
+++ b/tools/testing/selftests/bpf/progs/string_kfuncs_success.c
@@ -12,6 +12,11 @@ char str[] = "hello world";
/* Functional tests */
__test(0) int test_strcmp_eq(void *ctx) { return bpf_strcmp(str, "hello world"); }
__test(1) int test_strcmp_neq(void *ctx) { return bpf_strcmp(str, "hello"); }
+__test(0) int test_strcasecmp_eq1(void *ctx) { return bpf_strcasecmp(str, "hello world"); }
+__test(0) int test_strcasecmp_eq2(void *ctx) { return bpf_strcasecmp(str, "HELLO WORLD"); }
+__test(0) int test_strcasecmp_eq3(void *ctx) { return bpf_strcasecmp(str, "HELLO world"); }
+__test(1) int test_strcasecmp_neq1(void *ctx) { return bpf_strcasecmp(str, "hello"); }
+__test(1) int test_strcasecmp_neq2(void *ctx) { return bpf_strcasecmp(str, "HELLO"); }
__test(1) int test_strchr_found(void *ctx) { return bpf_strchr(str, 'e'); }
__test(11) int test_strchr_null(void *ctx) { return bpf_strchr(str, '\0'); }
__test(-ENOENT) int test_strchr_notfound(void *ctx) { return bpf_strchr(str, 'x'); }