* [LTP] [PATCH] mlock05: add log details about the success/failure
@ 2024-07-24 13:05 Filippo Storniolo
2024-07-24 15:14 ` Cyril Hrubis
0 siblings, 1 reply; 4+ messages in thread
From: Filippo Storniolo @ 2024-07-24 13:05 UTC (permalink / raw)
To: ltp, f.storniolo95; +Cc: Filippo Storniolo
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
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] mlock05: add log details about the success/failure
2024-07-24 13:05 [LTP] [PATCH] mlock05: add log details about the success/failure Filippo Storniolo
@ 2024-07-24 15:14 ` Cyril Hrubis
2024-07-29 15:43 ` Filippo Storniolo
0 siblings, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2024-07-24 15:14 UTC (permalink / raw)
To: Filippo Storniolo; +Cc: f.storniolo95, ltp
Hi!
> 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
What exactly are the requirements? It would make more sense to improve
the TST_EXP_EQ_LU() macro to print the additional information instead...
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] mlock05: add log details about the success/failure
2024-07-24 15:14 ` Cyril Hrubis
@ 2024-07-29 15:43 ` Filippo Storniolo
2024-07-30 7:36 ` Cyril Hrubis
0 siblings, 1 reply; 4+ messages in thread
From: Filippo Storniolo @ 2024-07-29 15:43 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: ltp
Hi!
Our test logs will be reviewed by people not familiar with the test purpose
or its implementation. These will be people who may not have the background
or time necessary to read and understand the source code.
However, improving the TST_EXP_EQ_LU() macro to print additional
information looks great and I believe it would be the better approach, as
it would also be useful for future contributions.
Do you already have something in mind for a possible implementation?
I was thinking of creating a new one that looks like this:
TST_EXP_EQ_LU_MSG() so that the test writer can add a custom message where
the test passes/fails.
Filippo Storniolo
On Wed, Jul 24, 2024 at 5:14 PM Cyril Hrubis <chrubis@suse.cz> wrote:
> Hi!
> > 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
>
> What exactly are the requirements? It would make more sense to improve
> the TST_EXP_EQ_LU() macro to print the additional information instead...
>
> --
> Cyril Hrubis
> chrubis@suse.cz
>
>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] mlock05: add log details about the success/failure
2024-07-29 15:43 ` Filippo Storniolo
@ 2024-07-30 7:36 ` Cyril Hrubis
0 siblings, 0 replies; 4+ messages in thread
From: Cyril Hrubis @ 2024-07-30 7:36 UTC (permalink / raw)
To: Filippo Storniolo; +Cc: ltp
Hi!
> Our test logs will be reviewed by people not familiar with the test purpose
> or its implementation. These will be people who may not have the background
> or time necessary to read and understand the source code.
You may be interested in the metadata extracted during the test build as
well. LTP produces a big a big html page with descriptions extracted
from the tests in docparse/metadata.html for mlock05 you get:
...
Description
Verify mlock() causes pre-faulting of PTEs and prevent memory to be swapped out.
Find the new mapping in /proc/$pid/smaps and check Rss and Locked fields
after mlock syscall: Rss and Locked size should be equal to the size of
the memory allocation
...
> However, improving the TST_EXP_EQ_LU() macro to print additional
> information looks great and I believe it would be the better approach, as
> it would also be useful for future contributions.
> Do you already have something in mind for a possible implementation?
> I was thinking of creating a new one that looks like this:
> TST_EXP_EQ_LU_MSG() so that the test writer can add a custom message where
> the test passes/fails.
Most of the TST_EXP_*() macros have optional printf-like format string
and parameters, it should be easy to add that functionality the
TST_EXP_EQ_*() macros as well.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-07-30 7:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-24 13:05 [LTP] [PATCH] mlock05: add log details about the success/failure Filippo Storniolo
2024-07-24 15:14 ` Cyril Hrubis
2024-07-29 15:43 ` Filippo Storniolo
2024-07-30 7:36 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox