[PATCH 4/6] selftests/filesystems: check listmount() with a U64_MAX cursor
From: Christian Brauner
Date: Wed Oct 21 2026 - 07:50:28 EST
Pass the largest possible mount id as the cursor and check that
listmount() returns no entries instead of starting over at the first
mount.
Signed-off-by: Christian Brauner (Amutable) <brauner@xxxxxxxxxx>
---
.../testing/selftests/filesystems/statmount/listmount_test.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tools/testing/selftests/filesystems/statmount/listmount_test.c b/tools/testing/selftests/filesystems/statmount/listmount_test.c
index 8bc82f38c42f..e603525ce17b 100644
--- a/tools/testing/selftests/filesystems/statmount/listmount_test.c
+++ b/tools/testing/selftests/filesystems/statmount/listmount_test.c
@@ -63,4 +63,15 @@ TEST(listmount_backward)
}
}
+/* A cursor at the largest possible mount id must not wrap around. */
+TEST(listmount_cursor_max)
+{
+ uint64_t list[LISTMNT_BUFFER];
+ ssize_t nr_mounts;
+
+ nr_mounts = listmount(LSMT_ROOT, 0, UINT64_MAX, list,
+ LISTMNT_BUFFER, 0);
+ ASSERT_EQ(nr_mounts, 0);
+}
+
TEST_HARNESS_MAIN
--
2.53.0