All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/process_madvise01: fix smaps scan and min_swap_avail
@ 2023-10-19  8:51 Jan Stancek
  2023-10-19  8:58 ` Andrea Cervesato via ltp
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Stancek @ 2023-10-19  8:51 UTC (permalink / raw)
  To: ltp

smaps matching can prematurely end, because the comparison to "VmFlags"
string is not exact. So depending on address on line, it can break
before it finds Swap line. This makes the test fail on recent aarch64
kernels.

min_swap_avail per documentation is in MB not KB.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/syscalls/process_madvise/process_madvise.h   | 2 +-
 testcases/kernel/syscalls/process_madvise/process_madvise01.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/process_madvise/process_madvise.h b/testcases/kernel/syscalls/process_madvise/process_madvise.h
index c4570e5309de..5b227ada099e 100644
--- a/testcases/kernel/syscalls/process_madvise/process_madvise.h
+++ b/testcases/kernel/syscalls/process_madvise/process_madvise.h
@@ -54,7 +54,7 @@ static inline void read_address_mapping(unsigned long address, struct addr_mappi
 		if (!found)
 			continue;
 
-		if (found && strcmp(line, "VmFlags") >= 0)
+		if (found && strncmp(line, "VmFlags", 7) == 0)
 			break;
 
 		if (sscanf(line, "%31[^:]: %d", label, &value) > 0) {
diff --git a/testcases/kernel/syscalls/process_madvise/process_madvise01.c b/testcases/kernel/syscalls/process_madvise/process_madvise01.c
index 322b4cf60353..0fd3c1ef4f80 100644
--- a/testcases/kernel/syscalls/process_madvise/process_madvise01.c
+++ b/testcases/kernel/syscalls/process_madvise/process_madvise01.c
@@ -123,7 +123,7 @@ static struct tst_test test = {
 	.min_kver = "5.10",
 	.needs_checkpoints = 1,
 	.needs_root = 1,
-	.min_swap_avail = MEM_CHILD / TST_KB,
+	.min_swap_avail = MEM_CHILD / TST_MB,
 	.needs_kconfigs = (const char *[]) {
 		"CONFIG_SWAP=y",
 		NULL
-- 
2.31.1


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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-10-27  9:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-19  8:51 [LTP] [PATCH] syscalls/process_madvise01: fix smaps scan and min_swap_avail Jan Stancek
2023-10-19  8:58 ` Andrea Cervesato via ltp
2023-10-27  8:50   ` Jan Stancek
2023-10-27  8:55     ` Andrea Cervesato via ltp
2023-10-27  9:49       ` Jan Stancek

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.