public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] madvise09: Make memory map output conditional and more informative
@ 2026-04-01  5:41 “Samir
  2026-04-03  3:25 ` Li Wang via ltp
  0 siblings, 1 reply; 2+ messages in thread
From: “Samir @ 2026-04-01  5:41 UTC (permalink / raw)
  To: ltp; +Cc: “Samir

The memory map was being printed unconditionally for every test run,
creating verbose output even for successful tests. This change makes
the output conditional and adds useful context.

Changes:
- Only display memory map when there are issues (corrupted pages or
  no pages freed), eliminating verbose output for successful runs
- Add legend to memory map output explaining symbols:
  p=present, _=freed, ?=corrupted
- Enhance TPASS message to show freed page count (e.g., "126/128 freed")
- Improve TFAIL message to show count of corrupted pages

Before:
  TINFO: Memory map: p_________p_____________________...
  TPASS: Pages MADV_FREE were freed on low memory

After (successful run):
  TPASS: Pages MADV_FREE were freed on low memory (126/128 freed)

After (failure with issues):
  TINFO: Memory map: p_________p??___ (p=present, _=freed, ?=corrupted)
  TFAIL: Found 2 corrupted page(s)

This improves test output readability while preserving debugging
information when needed.

Signed-off-by: Samir <samir@linux.ibm.com>
---
 testcases/kernel/syscalls/madvise/madvise09.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/madvise/madvise09.c b/testcases/kernel/syscalls/madvise/madvise09.c
index 1fad983fd..87fe096fb 100644
--- a/testcases/kernel/syscalls/madvise/madvise09.c
+++ b/testcases/kernel/syscalls/madvise/madvise09.c
@@ -219,15 +219,17 @@ static void child(void)
 	}
 	map[PAGES] = '\0';
 
-	tst_res(TINFO, "Memory map: %s", map);
+	/* Only show memory map if there are issues or for debugging */
+	if (corrupted || freed == 0)
+		tst_res(TINFO, "Memory map: %s (p=present, _=freed, ?=corrupted)", map);
 
 	if (freed)
-		tst_res(TPASS, "Pages MADV_FREE were freed on low memory");
+		tst_res(TPASS, "Pages MADV_FREE were freed on low memory (%u/%u freed)", freed, PAGES);
 	else
 		tst_res(TFAIL, "No MADV_FREE page was freed on low memory");
 
 	if (corrupted)
-		tst_res(TFAIL, "Found corrupted page");
+		tst_res(TFAIL, "Found %u corrupted page(s)", corrupted);
 	else
 		tst_res(TPASS, "All pages have expected content");
 
-- 
2.52.0


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

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

end of thread, other threads:[~2026-04-03  3:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-01  5:41 [LTP] [PATCH] madvise09: Make memory map output conditional and more informative “Samir
2026-04-03  3:25 ` Li Wang via ltp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox