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

Yang Xu xuyang2018.jy@fujitsu.com
Fri Oct 27 11:38:00 CEST 2023


Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 testcases/kernel/syscalls/umount/umount02.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/testcases/kernel/syscalls/umount/umount02.c b/testcases/kernel/syscalls/umount/umount02.c
index 34a38c998..4aa999014 100644
--- a/testcases/kernel/syscalls/umount/umount02.c
+++ b/testcases/kernel/syscalls/umount/umount02.c
@@ -14,8 +14,6 @@
  * 5) ENAMETOOLONG if pathname was longer than MAXPATHLEN.
  */
 
-#include <errno.h>
-#include <string.h>
 #include <sys/mount.h>
 #include "tst_test.h"
 
@@ -41,21 +39,7 @@ 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;
-	}
-
-	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);
+	TST_EXP_FAIL(umount(tc->mntpoint), tc->exp_errno);
 }
 
 static void setup(void)
-- 
2.39.1



More information about the ltp mailing list