All of lore.kernel.org
 help / color / mirror / Atom feed
From: “Samir <samir@linux.ibm.com>
To: ltp@lists.linux.it
Cc: “Samir <samir@linux.ibm.com>
Subject: [LTP] [PATCH] madvise09: Make memory map output conditional and more informative
Date: Wed,  1 Apr 2026 11:11:46 +0530	[thread overview]
Message-ID: <20260401054146.99060-1-samir@linux.ibm.com> (raw)

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

             reply	other threads:[~2026-04-01  5:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-01  5:41 “Samir [this message]
2026-04-03  3:25 ` [LTP] [PATCH] madvise09: Make memory map output conditional and more informative Li Wang via ltp

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=20260401054146.99060-1-samir@linux.ibm.com \
    --to=samir@linux.ibm.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.