[LTP] [PATCH v2] syscalls/mmap06: use macro TST_EXP_FAIL_PTR_VOID()

Avinesh Kumar akumar@suse.de
Mon May 13 15:07:35 CEST 2024


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



More information about the ltp mailing list