[LTP] [PATCH v2 3/3] umount03: Simplify test using TST_ macros
Yang Xu
xuyang2018.jy@fujitsu.com
Fri Oct 27 11:38:01 CEST 2023
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 --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)
--
2.39.1
More information about the ltp
mailing list