[LTP] [PATCH 1/3] swapping01: skip test if zram-swap is being used
Yang Xu
xuyang2018.jy@fujitsu.com
Thu Dec 9 08:43:41 CET 2021
For the swapping test we attempt to allocate 130% of the available RAM and
we make sure that the overflow would fit the swap, but as long as swap is
backed by RAM this obviously false. So skip it if zram-swap is being used.
Fixes: #888
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
testcases/kernel/mem/swapping/swapping01.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/testcases/kernel/mem/swapping/swapping01.c b/testcases/kernel/mem/swapping/swapping01.c
index 392b79d65..29c1e0443 100644
--- a/testcases/kernel/mem/swapping/swapping01.c
+++ b/testcases/kernel/mem/swapping/swapping01.c
@@ -67,6 +67,11 @@ static void test_swapping(void)
#ifdef TST_ABI32
tst_brk(TCONF, "test is not designed for 32-bit system.");
#endif
+ int ret;
+
+ ret = tst_system("zramctl | grep SWAP");
+ if (!ret)
+ tst_brk(TCONF, "zram-swap is being used!");
init_meminfo();
@@ -155,4 +160,8 @@ static struct tst_test test = {
.needs_root = 1,
.forks_child = 1,
.test_all = test_swapping,
+ .needs_cmds = (const char *[]) {
+ "zramctl",
+ NULL
+ }
};
--
2.23.0
More information about the ltp
mailing list