diff mbox series

[v4,3/6] syscalls/readahead02: fail test if readahead did not use any cache

Message ID 20181128164645.783-4-amir73il@gmail.com
State Superseded
Headers show
Series Tests for readahead() and fadvise() on overlayfs | expand

Commit Message

Amir Goldstein Nov. 28, 2018, 4:46 p.m. UTC
The heuristic of failing the test only if not saving any io has false
negatives with overlayfs readahead() bug, but readahead() with overlayfs
always warns on "using less cache then expected", when actually, it is
using no cache at all.

Add another condition to fail the test if readahead did not use any
cache at all, which always detected the overlayfs bug.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Acked-by: Jan Stancek <jstancek@redhat.com>
 testcases/kernel/syscalls/readahead/readahead02.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series


diff --git a/testcases/kernel/syscalls/readahead/readahead02.c b/testcases/kernel/syscalls/readahead/readahead02.c
index 88eb5fbff..0acdad482 100644
--- a/testcases/kernel/syscalls/readahead/readahead02.c
+++ b/testcases/kernel/syscalls/readahead/readahead02.c
@@ -280,6 +280,8 @@  static void test_readahead(void)
 		if (cached_ra * 1024 > testfile_size / 2)
 			tst_res(TPASS, "using cache as expected");
+		else if (!cached_ra)
+			tst_res(TFAIL, "readahead failed to use any cache");
 			tst_res(TWARN, "using less cache than expected");
 	} else {