[LTP] [PATCH] catchestat01: skip some tests loop with large pagesize

Li Wang liwang@redhat.com
Fri Aug 2 10:11:36 CEST 2024


To avoid errors with ENOSPC on systems with large page sizes (e.g., ppc64le
with 64kB page size), this patch updates the test_cached_pages function to
check the total memory requirement against the available device size before
running the test. If the required memory exceeds the available device size,
the test is skipped with a message indicating that the device size is not
sufficient for testing.

Also, loosen 45MB for XFS filesystem because it needs a bit of space
for inodes or others.

This prevents errors like the following:

  83  cachestat01.c:39: TINFO: Number of pages: 8192
  84  cachestat01.c:46: TBROK: write(3,0x10037180be0,65536) failed: ENOSPC (28)

Reported-by: Bruno Goncalves <bgoncalv@redhat.com>
Signed-off-by: Li Wang <liwang@redhat.com>
---
 testcases/kernel/syscalls/cachestat/cachestat01.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/cachestat/cachestat01.c b/testcases/kernel/syscalls/cachestat/cachestat01.c
index f7f6275cb..44cbc1f23 100644
--- a/testcases/kernel/syscalls/cachestat/cachestat01.c
+++ b/testcases/kernel/syscalls/cachestat/cachestat01.c
@@ -36,7 +36,10 @@ static void test_cached_pages(const unsigned int use_sync, const int num_pages)
 	int fd;
 
 	tst_res(TINFO, "%s file synchronization", use_sync ? "Enable" : "Disable");
-	tst_res(TINFO, "Number of pages: %d", num_pages);
+	tst_res(TINFO, "Number of pages: %d, Page_size: %d", num_pages, page_size);
+
+	if ((uint64_t)page_size * num_pages >= (tst_device->size - 64) * 1024 * 1024)
+		tst_brk(TCONF, "Device size (%luMB) is not enough for testing", tst_device->size);
 
 	memset(cs, 0, sizeof(struct cachestat));
 
-- 
2.45.2



More information about the ltp mailing list