diff mbox series

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

Message ID 20231027093801.51947-3-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/umount03.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/testcases/kernel/syscalls/umount/umount03.c b/testcases/kernel/syscalls/umount/umount03.c
index 1cef06fa1..3dd222d9f 100644
--- a/testcases/kernel/syscalls/umount/umount03.c
+++ b/testcases/kernel/syscalls/umount/umount03.c
@@ -7,11 +7,8 @@ 
  * is not the super-user.
  */
 
-#include <errno.h>
 #include <pwd.h>
 #include <sys/mount.h>
-#include <sys/types.h>
-#include <unistd.h>
 #include "tst_test.h"
 
 #define MNTPOINT	"mntpoint"
@@ -20,19 +17,7 @@  static int mount_flag;
 
 static void verify_umount(void)
 {
-	TEST(umount(MNTPOINT));
-
-	if (TST_RET != -1) {
-		tst_res(TFAIL, "umount() succeeds unexpectedly");
-		return;
-	}
-
-	if (TST_ERR != EPERM) {
-		tst_res(TFAIL | TTERRNO, "umount() should fail with EPERM");
-		return;
-	}
-
-	tst_res(TPASS | TTERRNO, "umount() fails as expected");
+	TST_EXP_FAIL(umount(MNTPOINT), EPERM);
 }
 
 static void setup(void)