aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/selftests/nolibc/nolibc-test.c
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>2025-04-28 14:40:02 +0200
committerThomas Weißschuh <linux@weissschuh.net>2025-05-21 15:32:00 +0200
commit05b6b2a9efa4b40b7bc1668f887b7d98f719efb1 (patch)
tree42ce2e03f1db4c81401c4151053c2398b15cda6b /tools/testing/selftests/nolibc/nolibc-test.c
parenttools/nolibc: use poll-related definitions from UAPI headers (diff)
downloadwireguard-linux-05b6b2a9efa4b40b7bc1668f887b7d98f719efb1.tar.xz
wireguard-linux-05b6b2a9efa4b40b7bc1668f887b7d98f719efb1.zip
tools/nolibc: add strstr()
This is used in various selftests and will be handy when integrating those with nolibc. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/r/20250428-nolibc-misc-v2-1-3c043eeab06c@linutronix.de Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Diffstat (limited to '')
-rw-r--r--tools/testing/selftests/nolibc/nolibc-test.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index 1ad0db92f0ed..3e15a25ccddf 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -1211,6 +1211,9 @@ int run_stdlib(int min, int max)
CASE_TEST(strlcpy_2); EXPECT_STRBUFEQ(is_nolibc, strlcpy(buf, "bar", 2), buf, 3, "b"); break;
CASE_TEST(strlcpy_3); EXPECT_STRBUFEQ(is_nolibc, strlcpy(buf, "bar", 3), buf, 3, "ba"); break;
CASE_TEST(strlcpy_4); EXPECT_STRBUFEQ(is_nolibc, strlcpy(buf, "bar", 4), buf, 3, "bar"); break;
+ CASE_TEST(strstr_foobar_foo); EXPECT_STREQ(1, strstr("foobar", "foo"), "foobar"); break;
+ CASE_TEST(strstr_foobar_bar); EXPECT_STREQ(1, strstr("foobar", "bar"), "bar"); break;
+ CASE_TEST(strstr_foobar_baz); EXPECT_PTREQ(1, strstr("foobar", "baz"), NULL); break;
CASE_TEST(memcmp_20_20); EXPECT_EQ(1, memcmp("aaa\x20", "aaa\x20", 4), 0); break;
CASE_TEST(memcmp_20_60); EXPECT_LT(1, memcmp("aaa\x20", "aaa\x60", 4), 0); break;
CASE_TEST(memcmp_60_20); EXPECT_GT(1, memcmp("aaa\x60", "aaa\x20", 4), 0); break;