[LTP] [PATCH 2/3] umount02: Simplify test using TST_ macros
Petr Vorel
pvorel@suse.cz
Thu Oct 26 02:12:17 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);
I'd prefer just:
TST_EXP_FAIL(umount(tc->mntpoint), tc->exp_errno);
> if (tc->exp_errno != TST_ERR) {
> tst_res(TFAIL | TTERRNO, "umount() should fail with %s",
> tst_strerrno(tc->exp_errno));
> return;
> }
Also this is redundant and should be removed.
With it removed you may add:
Reviewed-by: Petr Vorel <pvorel@suse.cz>
nit: #include <string.h> could be removed.
Also doc could be converted to docparse.
Kind regards,
Petr
More information about the ltp
mailing list