[LTP] [PATCH 2/3] umount02: Simplify test using TST_ macros

Yang Xu xuyang2018.jy@fujitsu.com
Thu Oct 12 10:40:57 CEST 2023


Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 testcases/kernel/syscalls/umount/umount02.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/testcases/kernel/syscalls/umount/umount02.c b/testcases/kernel/syscalls/umount/umount02.c
index 34a38c998..40fed1fbd 100644
--- a/testcases/kernel/syscalls/umount/umount02.c
+++ b/testcases/kernel/syscalls/umount/umount02.c
@@ -2,6 +2,7 @@
 /*
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
  * Copyright (c) 2014 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) Linux Test Project, 2003-2023
  * Author: Nirmala Devi Dhanasekar <nirmala.devi@wipro.com>
  *
  * Check for basic errors returned by umount(2) system call.
@@ -41,21 +42,14 @@ static void verify_umount(unsigned int n)
 {
 	struct tcase *tc = &tcases[n];
 
-	TEST(umount(tc->mntpoint));
-
-	if (TST_RET != -1) {
-		tst_res(TFAIL, "umount() succeeds unexpectedly");
-		return;
-	}
+	TST_EXP_FAIL(umount(tc->mntpoint), tc->exp_errno,
+		     "umount() fail with %s", tc->err_desc);
 
 	if (tc->exp_errno != TST_ERR) {
 		tst_res(TFAIL | TTERRNO, "umount() should fail with %s",
 			tst_strerrno(tc->exp_errno));
 		return;
 	}
-
-	tst_res(TPASS | TTERRNO, "umount() fails as expected: %s",
-		tc->err_desc);
 }
 
 static void setup(void)
-- 
2.39.1



More information about the ltp mailing list