* [LTP] [PATCH] syscalls/mmap08: Use macro TST_EXP_FAIL_PTR_VOID()
@ 2024-04-29 19:48 Avinesh Kumar
2024-05-07 16:53 ` Petr Vorel
0 siblings, 1 reply; 4+ messages in thread
From: Avinesh Kumar @ 2024-04-29 19:48 UTC (permalink / raw)
To: ltp
Signed-off-by: Avinesh Kumar <akumar@suse.de>
---
testcases/kernel/syscalls/mmap/mmap08.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/testcases/kernel/syscalls/mmap/mmap08.c b/testcases/kernel/syscalls/mmap/mmap08.c
index 5c9fd782c..befd73e14 100644
--- a/testcases/kernel/syscalls/mmap/mmap08.c
+++ b/testcases/kernel/syscalls/mmap/mmap08.c
@@ -27,16 +27,7 @@ static void setup(void)
static void run(void)
{
- TESTPTR(mmap(NULL, page_sz, PROT_WRITE, MAP_FILE | MAP_SHARED, fd, 0));
-
- if (TST_RET_PTR != MAP_FAILED) {
- tst_res(TFAIL, "mmap() passed unexpectedly");
- SAFE_MUNMAP(TST_RET_PTR, page_sz);
- } else if (TST_ERR == EBADF) {
- tst_res(TPASS, "mmap() failed with EBADF");
- } else {
- tst_res(TFAIL | TERRNO, "mmap() failed with an invalid errno");
- }
+ TST_EXP_FAIL_PTR_VOID(mmap(NULL, page_sz, PROT_WRITE, MAP_FILE | MAP_SHARED, fd, 0), EBADF);
}
static void cleanup(void)
--
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] syscalls/mmap08: Use macro TST_EXP_FAIL_PTR_VOID()
2024-04-29 19:48 [LTP] [PATCH] syscalls/mmap08: Use macro TST_EXP_FAIL_PTR_VOID() Avinesh Kumar
@ 2024-05-07 16:53 ` Petr Vorel
2024-05-13 13:08 ` [LTP] [PATCH v2] " Avinesh Kumar
0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2024-05-07 16:53 UTC (permalink / raw)
To: Avinesh Kumar; +Cc: ltp
Hi Avinesh,
> Signed-off-by: Avinesh Kumar <akumar@suse.de>
> ---
> testcases/kernel/syscalls/mmap/mmap08.c | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
> diff --git a/testcases/kernel/syscalls/mmap/mmap08.c b/testcases/kernel/syscalls/mmap/mmap08.c
> index 5c9fd782c..befd73e14 100644
> --- a/testcases/kernel/syscalls/mmap/mmap08.c
> +++ b/testcases/kernel/syscalls/mmap/mmap08.c
> @@ -27,16 +27,7 @@ static void setup(void)
> static void run(void)
> {
> - TESTPTR(mmap(NULL, page_sz, PROT_WRITE, MAP_FILE | MAP_SHARED, fd, 0));
> -
> - if (TST_RET_PTR != MAP_FAILED) {
> - tst_res(TFAIL, "mmap() passed unexpectedly");
> - SAFE_MUNMAP(TST_RET_PTR, page_sz);
> - } else if (TST_ERR == EBADF) {
> - tst_res(TPASS, "mmap() failed with EBADF");
> - } else {
> - tst_res(TFAIL | TERRNO, "mmap() failed with an invalid errno");
> - }
> + TST_EXP_FAIL_PTR_VOID(mmap(NULL, page_sz, PROT_WRITE, MAP_FILE | MAP_SHARED, fd, 0), EBADF);
Don't we need to add:
if (TST_RET_PTR != MAP_FAILED) {
SAFE_MUNMAP(TST_RET_PTR, page_sz);
Also, while at it, could you please change docs: "verify that" => "Verify that" ?
Kind regards,
Petr
> }
> static void cleanup(void)
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread* [LTP] [PATCH v2] syscalls/mmap08: Use macro TST_EXP_FAIL_PTR_VOID()
2024-05-07 16:53 ` Petr Vorel
@ 2024-05-13 13:08 ` Avinesh Kumar
2024-05-13 13:18 ` Petr Vorel
0 siblings, 1 reply; 4+ messages in thread
From: Avinesh Kumar @ 2024-05-13 13:08 UTC (permalink / raw)
To: ltp
Signed-off-by: Avinesh Kumar <akumar@suse.de>
---
testcases/kernel/syscalls/mmap/mmap08.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/testcases/kernel/syscalls/mmap/mmap08.c b/testcases/kernel/syscalls/mmap/mmap08.c
index 5c9fd782c..f023446f5 100644
--- a/testcases/kernel/syscalls/mmap/mmap08.c
+++ b/testcases/kernel/syscalls/mmap/mmap08.c
@@ -8,7 +8,7 @@
/*\
* [Description]
*
- * verify that, mmap() calls fails with errno EBADF when a file mapping
+ * Verify that, mmap() calls fails with errno EBADF when a file mapping
* is requested but the fd is not a valid file descriptor.
*/
@@ -27,15 +27,10 @@ static void setup(void)
static void run(void)
{
- TESTPTR(mmap(NULL, page_sz, PROT_WRITE, MAP_FILE | MAP_SHARED, fd, 0));
+ TST_EXP_FAIL_PTR_VOID(mmap(NULL, page_sz, PROT_WRITE, MAP_FILE | MAP_SHARED, fd, 0), EBADF);
- if (TST_RET_PTR != MAP_FAILED) {
- tst_res(TFAIL, "mmap() passed unexpectedly");
+ if(TST_RET_PTR != MAP_FAILED) {
SAFE_MUNMAP(TST_RET_PTR, page_sz);
- } else if (TST_ERR == EBADF) {
- tst_res(TPASS, "mmap() failed with EBADF");
- } else {
- tst_res(TFAIL | TERRNO, "mmap() failed with an invalid errno");
}
}
--
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 v2] syscalls/mmap08: Use macro TST_EXP_FAIL_PTR_VOID()
2024-05-13 13:08 ` [LTP] [PATCH v2] " Avinesh Kumar
@ 2024-05-13 13:18 ` Petr Vorel
0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2024-05-13 13:18 UTC (permalink / raw)
To: Avinesh Kumar; +Cc: ltp
Hi Avinesh,
...
> static void run(void)
> {
> - TESTPTR(mmap(NULL, page_sz, PROT_WRITE, MAP_FILE | MAP_SHARED, fd, 0));
> + TST_EXP_FAIL_PTR_VOID(mmap(NULL, page_sz, PROT_WRITE, MAP_FILE | MAP_SHARED, fd, 0), EBADF);
> - if (TST_RET_PTR != MAP_FAILED) {
> - tst_res(TFAIL, "mmap() passed unexpectedly");
> + if(TST_RET_PTR != MAP_FAILED) {
Whitespace was broken (missing space after "if") + brackets were not needed any
more. I fixed it and merged together with mmap06 patch.
Thank you!
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-05-13 13:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-29 19:48 [LTP] [PATCH] syscalls/mmap08: Use macro TST_EXP_FAIL_PTR_VOID() Avinesh Kumar
2024-05-07 16:53 ` Petr Vorel
2024-05-13 13:08 ` [LTP] [PATCH v2] " Avinesh Kumar
2024-05-13 13:18 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox