[LTP] [PATCH] syscalls/umount2_02: use umount2 directly instead of TEST macro

xuyang2018.jy@fujitsu.com xuyang2018.jy@fujitsu.com
Mon Mar 28 11:26:08 CEST 2022


Hi Dai

Looks good to me,
Reviewed-by: Yang Xu <xuyang2018.jy@fujitsu.com>

Best Regards
Yang Xu
> There is no need to use TEST macro in umount2_retry(),
> because we have used it in TST_EXP_FAIL and TST_EXP_PASS macro.
> 
> Signed-off-by: Dai Shili<daisl.fnst@fujitsu.com>
> ---
>   testcases/kernel/syscalls/umount2/umount2_02.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/umount2/umount2_02.c b/testcases/kernel/syscalls/umount2/umount2_02.c
> index 4c3b30e..b23f37b 100644
> --- a/testcases/kernel/syscalls/umount2/umount2_02.c
> +++ b/testcases/kernel/syscalls/umount2/umount2_02.c
> @@ -53,12 +53,12 @@ static struct tcase {
> 
>   static int umount2_retry(const char *target, int flags)
>   {
> -	int i;
> +	int i, ret;
> 
>   	for (i = 0; i<  50; i++) {
> -		TEST(umount2(target, flags));
> -		if (TST_RET == 0 || TST_ERR != EBUSY)
> -			return TST_RET;
> +		ret = umount2(target, flags);
> +		if (ret == 0 || errno != EBUSY)
> +			return ret;
> 
>   		tst_res(TINFO, "umount('%s', %i) failed with EBUSY, try %2i...",
>   			target, flags, i);
> @@ -69,7 +69,7 @@ static int umount2_retry(const char *target, int flags)
>   	tst_res(TWARN, "Failed to umount('%s', %i) after 50 retries",
>   		target, flags);
> 
> -	TST_ERR = EBUSY;
> +	errno = EBUSY;
>   	return -1;
>   }
> 


More information about the ltp mailing list