diff mbox series

write02: Simplify test using TST_ macros

Message ID 1692262008-9126-1-git-send-email-xuyang2018.jy@fujitsu.com
State Accepted
Headers show
Series write02: Simplify test using TST_ macros | expand

Commit Message

Yang Xu Aug. 17, 2023, 8:46 a.m. UTC
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 testcases/kernel/syscalls/write/write02.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

Comments

Petr Vorel Aug. 18, 2023, 7:01 a.m. UTC | #1
Hi Xu,

thanks, merged!

Kind regards,
Petr
diff mbox series

Patch

diff --git a/testcases/kernel/syscalls/write/write02.c b/testcases/kernel/syscalls/write/write02.c
index 2f630ab65..ab38dce77 100644
--- a/testcases/kernel/syscalls/write/write02.c
+++ b/testcases/kernel/syscalls/write/write02.c
@@ -2,27 +2,24 @@ 
 /*
  * Copyright (c) 2017 Carlo Marcelo Arenas Belon <carlo@gmail.com>
  * Copyright (c) 2018 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) Linux Test Project, 2003-2023
  */
-/*
+
+/*\
+ * [Description]
+ *
  * Tests for a special case NULL buffer with size 0 is expected to return 0.
  */
 
-#include <errno.h>
 #include "tst_test.h"
 
 static int fd;
 
 static void verify_write(void)
 {
-	TEST(write(fd, NULL, 0));
-
-	if (TST_RET != 0) {
-		tst_res(TFAIL | TTERRNO,
-			"write() should have succeeded with ret=0");
-		return;
-	}
+	TST_EXP_POSITIVE(write(fd, NULL, 0));
 
-	tst_res(TPASS, "write(fd, NULL, 0) == 0");
+	TST_EXP_EXPR(TST_RET == 0, "write(fd, NULL, %ld) == %d", TST_RET, 0);
 }
 
 static void setup(void)