madvise09: Make memory map output conditional and more informative
PATCH 1/1 madvise09: Make memory map output conditional and more informative
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.
--- testcases/kernel/syscalls/madvise/madvise09.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/madvise/madvise09.c +5 -3
@@ -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" );
Signature · 5 lines
2.52.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Nice improvement, patch merged, thanks!
Signature · 6 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp