[LTP] [PATCH] mlock05: add log details about the success/failure
Filippo Storniolo
fstornio@redhat.com
Wed Jul 24 15:05:53 CEST 2024
In some testing environments, such as those related to safety
critical requirements, more detailed logs are needed when
the executed test passes or fails.
This format already exists in other LTP tests, such as
kernel/security/kallsyms/kallsyms.c
Signed-off-by: Filippo Storniolo <fstornio@redhat.com>
---
testcases/kernel/syscalls/mlock/mlock05.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/syscalls/mlock/mlock05.c b/testcases/kernel/syscalls/mlock/mlock05.c
index 8e805736d..8b217beb5 100644
--- a/testcases/kernel/syscalls/mlock/mlock05.c
+++ b/testcases/kernel/syscalls/mlock/mlock05.c
@@ -102,8 +102,15 @@ static void verify_mlock(void)
Rss *= 1024;
Locked *= 1024;
- TST_EXP_EQ_LU(Rss, MMAPLEN);
- TST_EXP_EQ_LU(Locked, MMAPLEN);
+ if (Rss == MMAPLEN)
+ tst_res(TPASS, "Pre-faulted %lu bytes and expected %lu", Rss, MMAPLEN);
+ else
+ tst_res(TFAIL, "Pre-faulted %lu bytes but expected %lu", Rss, MMAPLEN);
+
+ if (Locked == MMAPLEN)
+ tst_res(TPASS, "Locked %lu bytes and expected %lu", Locked, MMAPLEN);
+ else
+ tst_res(TFAIL, "Locked %lu bytes but expected %lu", Locked, MMAPLEN);
SAFE_MUNLOCK(buf, MMAPLEN);
SAFE_MUNMAP(buf, MMAPLEN);
--
2.44.0
More information about the ltp
mailing list