[PATCH 1/6] selftests/nolibc: add some tests for makedev() and friends

Thomas Weißschuh posted 6 patches 14 hours ago
[PATCH 1/6] selftests/nolibc: add some tests for makedev() and friends
Posted by Thomas Weißschuh 14 hours ago
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>
---
 tools/testing/selftests/nolibc/nolibc-test.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index 1efd10152e83..fec098ed71e5 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -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 */

-- 
2.53.0