[LTP] [PATCH v2 3/3] sbrk02.c: Use TST_EXP_FAIL_PTR_VOID

Wei Gao wegao@suse.com
Thu Apr 25 04:03:08 CEST 2024


Signed-off-by: Wei Gao <wegao@suse.com>
---
 testcases/kernel/syscalls/sbrk/sbrk02.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/testcases/kernel/syscalls/sbrk/sbrk02.c b/testcases/kernel/syscalls/sbrk/sbrk02.c
index dc344577e..08cbdf367 100644
--- a/testcases/kernel/syscalls/sbrk/sbrk02.c
+++ b/testcases/kernel/syscalls/sbrk/sbrk02.c
@@ -19,21 +19,8 @@ static long increment = INC;
 
 static void run(void)
 {
-	TESTPTR(sbrk(increment));
-
-	if (TST_RET_PTR != (void *)-1) {
-		tst_res(TFAIL, "sbrk(%ld) unexpectedly passed and returned %p, "
-						"expected (void *)-1 with errno=%d",
-						increment, TST_RET_PTR, ENOMEM);
-		return;
-	}
-
-	if (TST_ERR == ENOMEM)
-		tst_res(TPASS | TTERRNO, "sbrk(%ld) failed as expected", increment);
-	else
-		tst_res(TFAIL | TTERRNO, "sbrk(%ld) failed but unexpected errno, "
-								"expected errno=%d - %s",
-								increment, ENOMEM, strerror(ENOMEM));
+	TST_EXP_FAIL_PTR_VOID(sbrk(increment), ENOMEM,
+		"sbrk(%ld) returned %p", increment, TST_RET_PTR);
 }
 
 static void setup(void)
-- 
2.35.3



More information about the ltp mailing list