All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Xu <xuyang2018.jy@fujitsu.com>
To: <ltp@lists.linux.it>
Subject: [LTP] [PATCH v4 1/4] swapping01: skip test if zram-swap is being used
Date: Wed, 15 Dec 2021 15:20:46 +0800	[thread overview]
Message-ID: <1639552849-2251-1-git-send-email-xuyang2018.jy@fujitsu.com> (raw)

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
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 testcases/kernel/mem/swapping/swapping01.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/mem/swapping/swapping01.c b/testcases/kernel/mem/swapping/swapping01.c
index 392b79d65..925790186 100644
--- a/testcases/kernel/mem/swapping/swapping01.c
+++ b/testcases/kernel/mem/swapping/swapping01.c
@@ -40,10 +40,10 @@
 
 #include <sys/types.h>
 #include <sys/wait.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include "tst_safe_stdio.h"
 #include "lapi/abisize.h"
 #include "mem.h"
 
@@ -67,6 +67,17 @@ static void test_swapping(void)
 #ifdef TST_ABI32
 	tst_brk(TCONF, "test is not designed for 32-bit system.");
 #endif
+	FILE *file;
+	char line[PATH_MAX];
+
+	file = SAFE_FOPEN("/proc/swaps", "r");
+	while (fgets(line, sizeof(line), file)) {
+		if (strstr(line, "/dev/zram")) {
+			SAFE_FCLOSE(file);
+			tst_brk(TCONF, "zram-swap is being used!");
+		}
+	}
+	SAFE_FCLOSE(file);
 
 	init_meminfo();
 
-- 
2.23.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2021-12-15  7:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-15  7:20 Yang Xu [this message]
2021-12-15  7:20 ` [LTP] [PATCH v4 2/4] zram/zram_lib.sh: adapt the situation that zram device is being used Yang Xu
2021-12-17  7:48   ` Petr Vorel
2021-12-17  9:34     ` xuyang2018.jy
2021-12-17 10:34       ` Petr Vorel
2021-12-20  2:58         ` xuyang2018.jy
2021-12-20  8:52           ` Petr Vorel
2021-12-17  7:49   ` Petr Vorel
2021-12-15  7:20 ` [LTP] [PATCH v4 3/4] zram/zram03: Convert into new api Yang Xu
2021-12-17  8:22   ` Petr Vorel
2021-12-17  9:42     ` xuyang2018.jy
2021-12-17  8:24   ` Petr Vorel
2021-12-15  7:20 ` [LTP] [PATCH v4 4/4] zram/zram01.sh: Use mem_used_total field instead of compr_data_size field Yang Xu
2021-12-17  8:47   ` Petr Vorel
2021-12-17  9:45     ` xuyang2018.jy
2021-12-17 10:36       ` Petr Vorel
2021-12-17  7:01 ` [LTP] [PATCH v4 1/4] swapping01: skip test if zram-swap is being used Petr Vorel
2021-12-17  7:04   ` xuyang2018.jy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1639552849-2251-1-git-send-email-xuyang2018.jy@fujitsu.com \
    --to=xuyang2018.jy@fujitsu.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.