diff mbox series

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

Message ID 20231027093801.51947-2-xuyang2018.jy@fujitsu.com
State Accepted
Headers show
Series [v2,1/3] umount01: Simplify test using TST_ macros | expand

Commit Message

Yang Xu \(Fujitsu\) Oct. 27, 2023, 9:38 a.m. UTC
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(-)

Comments

Petr Vorel Oct. 27, 2023, 5:01 p.m. UTC | #1
Hi Xu,

I rebased this patchset (it failed to apply) and merged it with the third one.
Thanks!

Kind regards,
Petr
diff mbox series

Patch

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)