]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
selftests/nolibc: add some tests for makedev() and friends
authorThomas Weißschuh <linux@weissschuh.net>
Sat, 4 Apr 2026 08:08:18 +0000 (10:08 +0200)
committerThomas Weißschuh <linux@weissschuh.net>
Sat, 4 Apr 2026 08:28:35 +0000 (10:28 +0200)
These functions/macros are about to be changed.

Add some tests to make sure they continue working.
As they only handle small dev_t values, only test those for now.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260404-nolibc-makedev-v2-1-456a429bf60c@weissschuh.net
tools/testing/selftests/nolibc/nolibc-test.c

index e6fef6eb1db1ce14a4792d36dd53ee2f6ccc66b0..4a9b6eb9e47718a617b8d6f51a07e03db090a5a3 100644 (file)
@@ -1680,6 +1680,9 @@ int run_stdlib(int min, int max)
                CASE_TEST(memchr_foobar6_o);        EXPECT_STREQ(1, memchr("foobar", 'o', 6), "oobar"); break;
                CASE_TEST(memchr_foobar3_b);        EXPECT_STRZR(1, memchr("foobar", 'b', 3)); break;
                CASE_TEST(time_types);              EXPECT_ZR(is_nolibc, test_time_types()); break;
+               CASE_TEST(makedev);                 EXPECT_EQ(1, makedev(0x12, 0x34), 0x1234); break;
+               CASE_TEST(major);                   EXPECT_EQ(1, major(0x1234), 0x12); break;
+               CASE_TEST(minor);                   EXPECT_EQ(1, minor(0x1234), 0x34); break;
 
                case __LINE__:
                        return ret; /* must be last */