* [LTP] [PATCH] syscalls/mmap06: use macro TST_EXP_FAIL_PTR_VOID()
@ 2024-04-29 19:40 Avinesh Kumar
2024-05-07 16:53 ` Petr Vorel
0 siblings, 1 reply; 3+ messages in thread
From: Avinesh Kumar @ 2024-04-29 19:40 UTC (permalink / raw)
To: ltp
Signed-off-by: Avinesh Kumar <akumar@suse.de>
---
testcases/kernel/syscalls/mmap/mmap06.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/testcases/kernel/syscalls/mmap/mmap06.c b/testcases/kernel/syscalls/mmap/mmap06.c
index 615743fa7..02c186a3a 100644
--- a/testcases/kernel/syscalls/mmap/mmap06.c
+++ b/testcases/kernel/syscalls/mmap/mmap06.c
@@ -56,16 +56,7 @@ static void run(unsigned int i)
{
struct tcase *tc = &tcases[i];
- TESTPTR(mmap(NULL, tc->length, tc->prot, tc->flags, fd, 0));
-
- if (TST_RET_PTR != MAP_FAILED) {
- tst_res(TFAIL, "mmap() was successful unexpectedly");
- SAFE_MUNMAP(TST_RET_PTR, MMAPSIZE);
- } else if (TST_ERR == tc->exp_errno) {
- tst_res(TPASS | TERRNO, "mmap() failed with");
- } else {
- tst_res(TFAIL | TERRNO, "mmap() failed unexpectedly");
- }
+ TST_EXP_FAIL_PTR_VOID(mmap(NULL, tc->length, tc->prot, tc->flags, fd, 0), tc->exp_errno);
}
static void cleanup(void)
--
2.44.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] syscalls/mmap06: use macro TST_EXP_FAIL_PTR_VOID()
2024-04-29 19:40 [LTP] [PATCH] syscalls/mmap06: use macro TST_EXP_FAIL_PTR_VOID() Avinesh Kumar
@ 2024-05-07 16:53 ` Petr Vorel
2024-05-13 13:07 ` [LTP] [PATCH v2] " Avinesh Kumar
0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2024-05-07 16:53 UTC (permalink / raw)
To: Avinesh Kumar; +Cc: ltp
Hi Avinesh,
...
> - TESTPTR(mmap(NULL, tc->length, tc->prot, tc->flags, fd, 0));
> -
> - if (TST_RET_PTR != MAP_FAILED) {
> - tst_res(TFAIL, "mmap() was successful unexpectedly");
> - SAFE_MUNMAP(TST_RET_PTR, MMAPSIZE);
> - } else if (TST_ERR == tc->exp_errno) {
> - tst_res(TPASS | TERRNO, "mmap() failed with");
> - } else {
> - tst_res(TFAIL | TERRNO, "mmap() failed unexpectedly");
> - }
> + TST_EXP_FAIL_PTR_VOID(mmap(NULL, tc->length, tc->prot, tc->flags, fd, 0), tc->exp_errno);
Also here should IMHO be:
if (TST_RET_PTR != MAP_FAILED) {
SAFE_MUNMAP(TST_RET_PTR, page_sz);
Kind regards,
Petr
> }
> static void cleanup(void)
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
* [LTP] [PATCH v2] syscalls/mmap06: use macro TST_EXP_FAIL_PTR_VOID()
2024-05-07 16:53 ` Petr Vorel
@ 2024-05-13 13:07 ` Avinesh Kumar
0 siblings, 0 replies; 3+ messages in thread
From: Avinesh Kumar @ 2024-05-13 13:07 UTC (permalink / raw)
To: ltp
Signed-off-by: Avinesh Kumar <akumar@suse.de>
---
testcases/kernel/syscalls/mmap/mmap06.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/testcases/kernel/syscalls/mmap/mmap06.c b/testcases/kernel/syscalls/mmap/mmap06.c
index 615743fa7..c825abf9e 100644
--- a/testcases/kernel/syscalls/mmap/mmap06.c
+++ b/testcases/kernel/syscalls/mmap/mmap06.c
@@ -56,15 +56,10 @@ static void run(unsigned int i)
{
struct tcase *tc = &tcases[i];
- TESTPTR(mmap(NULL, tc->length, tc->prot, tc->flags, fd, 0));
+ TST_EXP_FAIL_PTR_VOID(mmap(NULL, tc->length, tc->prot, tc->flags, fd, 0), tc->exp_errno);
if (TST_RET_PTR != MAP_FAILED) {
- tst_res(TFAIL, "mmap() was successful unexpectedly");
- SAFE_MUNMAP(TST_RET_PTR, MMAPSIZE);
- } else if (TST_ERR == tc->exp_errno) {
- tst_res(TPASS | TERRNO, "mmap() failed with");
- } else {
- tst_res(TFAIL | TERRNO, "mmap() failed unexpectedly");
+ SAFE_MUNMAP(TST_RET_PTR, page_sz);
}
}
--
2.44.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-13 13:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-29 19:40 [LTP] [PATCH] syscalls/mmap06: use macro TST_EXP_FAIL_PTR_VOID() Avinesh Kumar
2024-05-07 16:53 ` Petr Vorel
2024-05-13 13:07 ` [LTP] [PATCH v2] " Avinesh Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox