syscalls/mmap06: use macro TST_EXP_FAIL_PTR_VOID()
PATCH 1/1 syscalls/mmap06: use macro TST_EXP_FAIL_PTR_VOID()
Signed-off-by Avinesh Kumar <[email protected]>
--- testcases/kernel/syscalls/mmap/mmap06.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
testcases/kernel/syscalls/mmap/mmap06.c +1 -10
@@ -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 )
Signature · 5 lines
2.44.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Avinesh,
...
testcases/kernel/syscalls/mmap/mmap06.c static void run(unsigned int i) · line 59
Quoted 11 lines
testcases/kernel/syscalls/mmap/mmap06.c +1
-10-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
Quoted 3 lines
}
static void cleanup(void)
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 1/1 syscalls/mmap06: use macro TST_EXP_FAIL_PTR_VOID()
Signed-off-by Avinesh Kumar <[email protected]>
--- testcases/kernel/syscalls/mmap/mmap06.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
testcases/kernel/syscalls/mmap/mmap06.c +2 -7
@@ -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); } }
Signature · 5 lines
2.44.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp