public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/3] umount01: Simplify test using TST_ macros
@ 2023-10-12  8:40 Yang Xu
  2023-10-12  8:40 ` [LTP] [PATCH 2/3] umount02: " Yang Xu
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Yang Xu @ 2023-10-12  8:40 UTC (permalink / raw)
  To: ltp

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 testcases/kernel/syscalls/umount/umount01.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/testcases/kernel/syscalls/umount/umount01.c b/testcases/kernel/syscalls/umount/umount01.c
index d05296dce..2950300a7 100644
--- a/testcases/kernel/syscalls/umount/umount01.c
+++ b/testcases/kernel/syscalls/umount/umount01.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
+ * Copyright (c) Linux Test Project, 2003-2023
  * Author: Nirmala Devi Dhanasekar <nirmala.devi@wipro.com>
  *
  * Phase I test for the umount(2) system call.
@@ -23,7 +24,7 @@ static void verify_umount(void)
 		mount_flag = 1;
 	}
 
-	TEST(umount(MNTPOINT));
+	TST_EXP_PASS(umount(MNTPOINT), "umount(%s)", MNTPOINT);
 
 	if (TST_RET != 0 && TST_ERR == EBUSY) {
 		tst_res(TINFO, "umount() Failed with EBUSY "
@@ -31,12 +32,6 @@ static void verify_umount(void)
 			"is probing newly mounted dirs");
 	}
 
-	if (TST_RET != 0) {
-		tst_res(TFAIL | TTERRNO, "umount() Failed");
-		return;
-	}
-
-	tst_res(TPASS, "umount() Passed");
 	mount_flag = 0;
 }
 
-- 
2.39.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [LTP] [PATCH 2/3] umount02: Simplify test using TST_ macros
  2023-10-12  8:40 [LTP] [PATCH 1/3] umount01: Simplify test using TST_ macros Yang Xu
@ 2023-10-12  8:40 ` Yang Xu
  2023-10-26  0:12   ` Petr Vorel
  2023-10-12  8:40 ` [LTP] [PATCH 3/3] umount03: " Yang Xu
  2023-10-20  9:49 ` [LTP] [PATCH 1/3] umount01: " Yang Xu (Fujitsu)
  2 siblings, 1 reply; 10+ messages in thread
From: Yang Xu @ 2023-10-12  8:40 UTC (permalink / raw)
  To: ltp

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);
 
 	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);
 }
 
 static void setup(void)
-- 
2.39.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [LTP] [PATCH 3/3] umount03: Simplify test using TST_ macros
  2023-10-12  8:40 [LTP] [PATCH 1/3] umount01: Simplify test using TST_ macros Yang Xu
  2023-10-12  8:40 ` [LTP] [PATCH 2/3] umount02: " Yang Xu
@ 2023-10-12  8:40 ` Yang Xu
  2023-10-26  0:05   ` Petr Vorel
  2023-10-20  9:49 ` [LTP] [PATCH 1/3] umount01: " Yang Xu (Fujitsu)
  2 siblings, 1 reply; 10+ messages in thread
From: Yang Xu @ 2023-10-12  8:40 UTC (permalink / raw)
  To: ltp

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 testcases/kernel/syscalls/umount/umount03.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/testcases/kernel/syscalls/umount/umount03.c b/testcases/kernel/syscalls/umount/umount03.c
index 1cef06fa1..e6bb523b4 100644
--- a/testcases/kernel/syscalls/umount/umount03.c
+++ b/testcases/kernel/syscalls/umount/umount03.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
+ * Copyright (c) Linux Test Project, 2003-2023
  * Author: Nirmala Devi Dhanasekar <nirmala.devi@wipro.com>
  *
  * Verify that umount(2) returns -1 and sets errno to  EPERM if the user
@@ -20,19 +21,12 @@ static int mount_flag;
 
 static void verify_umount(void)
 {
-	TEST(umount(MNTPOINT));
-
-	if (TST_RET != -1) {
-		tst_res(TFAIL, "umount() succeeds unexpectedly");
-		return;
-	}
+	TST_EXP_FAIL(umount(MNTPOINT), EPERM, "umount(%s) Failed", MNTPOINT);
 
 	if (TST_ERR != EPERM) {
 		tst_res(TFAIL | TTERRNO, "umount() should fail with EPERM");
 		return;
 	}
-
-	tst_res(TPASS | TTERRNO, "umount() fails as expected");
 }
 
 static void setup(void)
-- 
2.39.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [LTP] [PATCH 1/3] umount01: Simplify test using TST_ macros
  2023-10-12  8:40 [LTP] [PATCH 1/3] umount01: Simplify test using TST_ macros Yang Xu
  2023-10-12  8:40 ` [LTP] [PATCH 2/3] umount02: " Yang Xu
  2023-10-12  8:40 ` [LTP] [PATCH 3/3] umount03: " Yang Xu
@ 2023-10-20  9:49 ` Yang Xu (Fujitsu)
  2 siblings, 0 replies; 10+ messages in thread
From: Yang Xu (Fujitsu) @ 2023-10-20  9:49 UTC (permalink / raw)
  To: ltp@lists.linux.it

Hi

Ping!


Best Regards,

Yang Xu

> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
>   testcases/kernel/syscalls/umount/umount01.c | 9 ++-------
>   1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/umount/umount01.c b/testcases/kernel/syscalls/umount/umount01.c
> index d05296dce..2950300a7 100644
> --- a/testcases/kernel/syscalls/umount/umount01.c
> +++ b/testcases/kernel/syscalls/umount/umount01.c
> @@ -1,6 +1,7 @@
>   // SPDX-License-Identifier: GPL-2.0-or-later
>   /*
>    * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
> + * Copyright (c) Linux Test Project, 2003-2023
>    * Author: Nirmala Devi Dhanasekar <nirmala.devi@wipro.com>
>    *
>    * Phase I test for the umount(2) system call.
> @@ -23,7 +24,7 @@ static void verify_umount(void)
>   		mount_flag = 1;
>   	}
>   
> -	TEST(umount(MNTPOINT));
> +	TST_EXP_PASS(umount(MNTPOINT), "umount(%s)", MNTPOINT);
>   
>   	if (TST_RET != 0 && TST_ERR == EBUSY) {
>   		tst_res(TINFO, "umount() Failed with EBUSY "
> @@ -31,12 +32,6 @@ static void verify_umount(void)
>   			"is probing newly mounted dirs");
>   	}
>   
> -	if (TST_RET != 0) {
> -		tst_res(TFAIL | TTERRNO, "umount() Failed");
> -		return;
> -	}
> -
> -	tst_res(TPASS, "umount() Passed");
>   	mount_flag = 0;
>   }
>   

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] [PATCH 3/3] umount03: Simplify test using TST_ macros
  2023-10-12  8:40 ` [LTP] [PATCH 3/3] umount03: " Yang Xu
@ 2023-10-26  0:05   ` Petr Vorel
  2023-10-26  0:06     ` Petr Vorel
  2023-10-26  6:05     ` Yang Xu (Fujitsu)
  0 siblings, 2 replies; 10+ messages in thread
From: Petr Vorel @ 2023-10-26  0:05 UTC (permalink / raw)
  To: Yang Xu; +Cc: ltp

Hi Xu,

> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
>  testcases/kernel/syscalls/umount/umount03.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)

this is not needed:
#include <errno.h>

This is for all 3 patches.

> diff --git a/testcases/kernel/syscalls/umount/umount03.c b/testcases/kernel/syscalls/umount/umount03.c
> index 1cef06fa1..e6bb523b4 100644
> --- a/testcases/kernel/syscalls/umount/umount03.c
> +++ b/testcases/kernel/syscalls/umount/umount03.c
> @@ -1,6 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later
>  /*
>   * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
> + * Copyright (c) Linux Test Project, 2003-2023
>   * Author: Nirmala Devi Dhanasekar <nirmala.devi@wipro.com>
>   *
>   * Verify that umount(2) returns -1 and sets errno to  EPERM if the user
> @@ -20,19 +21,12 @@ static int mount_flag;

>  static void verify_umount(void)
>  {
> -	TEST(umount(MNTPOINT));
> -
> -	if (TST_RET != -1) {
> -		tst_res(TFAIL, "umount() succeeds unexpectedly");
> -		return;
> -	}
> +	TST_EXP_FAIL(umount(MNTPOINT), EPERM, "umount(%s) Failed", MNTPOINT);
nit: I would prefer just:

	TST_EXP_FAIL(umount(MNTPOINT), EPERM);


>  	if (TST_ERR != EPERM) {
>  		tst_res(TFAIL | TTERRNO, "umount() should fail with EPERM");
>  		return;
>  	}
This should have been removed, it's redundant when TST_EXP_FAIL() is done.
> -
> -	tst_res(TPASS | TTERRNO, "umount() fails as expected");
>  }

>  static void setup(void)

With <errno.h> and if (TST_ERR != EPERM) removed you can add:
Reviewed-by: Petr Vorel <pvorel@suse.cz>

It would be good (as a separate commit) to reword the documentation and convert
it to docparse. Feel free to do it, or please let me know if I should do it.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] [PATCH 3/3] umount03: Simplify test using TST_ macros
  2023-10-26  0:05   ` Petr Vorel
@ 2023-10-26  0:06     ` Petr Vorel
  2023-10-26  6:07       ` [LTP] 回复: " Yang Xu (Fujitsu)
  2023-10-26  6:05     ` Yang Xu (Fujitsu)
  1 sibling, 1 reply; 10+ messages in thread
From: Petr Vorel @ 2023-10-26  0:06 UTC (permalink / raw)
  To: Yang Xu, ltp

Hi Xu,


> this is not needed:
> #include <errno.h>

Also these aren't needed:
#include <sys/types.h>
#include <unistd.h>

> This is for all 3 patches.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [LTP] [PATCH 2/3] umount02: Simplify test using TST_ macros
  2023-10-12  8:40 ` [LTP] [PATCH 2/3] umount02: " Yang Xu
@ 2023-10-26  0:12   ` Petr Vorel
  2023-10-26  5:40     ` [LTP] 回复: " Yang Xu (Fujitsu)
  0 siblings, 1 reply; 10+ messages in thread
From: Petr Vorel @ 2023-10-26  0:12 UTC (permalink / raw)
  To: Yang Xu; +Cc: ltp

> 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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [LTP] 回复:  [PATCH 2/3] umount02: Simplify test using TST_ macros
  2023-10-26  0:12   ` Petr Vorel
@ 2023-10-26  5:40     ` Yang Xu (Fujitsu)
  0 siblings, 0 replies; 10+ messages in thread
From: Yang Xu (Fujitsu) @ 2023-10-26  5:40 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp@lists.linux.it

>> 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);

OK. Thanks for your suggestion.

>>        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.

OK.

>Kind regards,
>Petr

Best Regards
Yang Xu
________________________________
发件人: Petr Vorel <pvorel@suse.cz>
发送时间: 2023年10月26日 8:12
收件人: Xu, Yang/徐 杨 <xuyang2018.jy@fujitsu.com>
抄送: ltp@lists.linux.it <ltp@lists.linux.it>
主题: Re: [LTP] [PATCH 2/3] umount02: Simplify test using TST_ macros

> 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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [LTP] 回复:  [PATCH 3/3] umount03: Simplify test using TST_ macros
  2023-10-26  0:05   ` Petr Vorel
  2023-10-26  0:06     ` Petr Vorel
@ 2023-10-26  6:05     ` Yang Xu (Fujitsu)
  1 sibling, 0 replies; 10+ messages in thread
From: Yang Xu (Fujitsu) @ 2023-10-26  6:05 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp@lists.linux.it

Hi Petr,

>Hi Xu,

>> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
>> ---
>>  testcases/kernel/syscalls/umount/umount03.c | 10 ++--------
>>  1 file changed, 2 insertions(+), 8 deletions(-)

>this is not needed:
>#include <errno.h>

>This is for all 3 patches.

Yes.

>> diff --git a/testcases/kernel/syscalls/umount/umount03.c b/testcases/kernel/syscalls/umount/umount03.c
>> index 1cef06fa1..e6bb523b4 100644
>> --- a/testcases/kernel/syscalls/umount/umount03.c
>> +++ b/testcases/kernel/syscalls/umount/umount03.c
>> @@ -1,6 +1,7 @@
>>  // SPDX-License-Identifier: GPL-2.0-or-later
>>  /*
>>   * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
>> + * Copyright (c) Linux Test Project, 2003-2023
>>   * Author: Nirmala Devi Dhanasekar <nirmala.devi@wipro.com>
>>   *
>>   * Verify that umount(2) returns -1 and sets errno to  EPERM if the user
>> @@ -20,19 +21,12 @@ static int mount_flag;

>>  static void verify_umount(void)
>>  {
>> -     TEST(umount(MNTPOINT));
>> -
>> -     if (TST_RET != -1) {
>> -             tst_res(TFAIL, "umount() succeeds unexpectedly");
>> -             return;
>> -     }
>> +     TST_EXP_FAIL(umount(MNTPOINT), EPERM, "umount(%s) Failed", MNTPOINT);
>nit: I would prefer just:

>        TST_EXP_FAIL(umount(MNTPOINT), EPERM);

OK.

>>        if (TST_ERR != EPERM) {
>>                tst_res(TFAIL | TTERRNO, "umount() should fail with EPERM");
>>                return;
>>        }
>This should have been removed, it's redundant when TST_EXP_FAIL() is done.

Yes.

>> -
>> -     tst_res(TPASS | TTERRNO, "umount() fails as expected");
>>  }

>>  static void setup(void)

>With <errno.h> and if (TST_ERR != EPERM) removed you can add:
>Reviewed-by: Petr Vorel <pvorel@suse.cz>

>It would be good (as a separate commit) to reword the documentation and convert
>it to docparse. Feel free to do it, or please let me know if I should do it.

Thanks for all your suggestions, I will correct it in v2 version.

I see you have already merge this 584b87a<https://github.com/linux-test-project/ltp/commit/584b87ae94d61d5a3cfc47c9146af7b778e2c9ba>. I will also rewrite the documentation for umount01/03
as a separate commit.

Best Regards
Yang Xu

>Kind regards,
>Petr
________________________________
发件人: Petr Vorel <pvorel@suse.cz>
发送时间: 2023年10月26日 8:05
收件人: Xu, Yang/徐 杨 <xuyang2018.jy@fujitsu.com>
抄送: ltp@lists.linux.it <ltp@lists.linux.it>
主题: Re: [LTP] [PATCH 3/3] umount03: Simplify test using TST_ macros

Hi Xu,

> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
>  testcases/kernel/syscalls/umount/umount03.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)

this is not needed:
#include <errno.h>

This is for all 3 patches.

> diff --git a/testcases/kernel/syscalls/umount/umount03.c b/testcases/kernel/syscalls/umount/umount03.c
> index 1cef06fa1..e6bb523b4 100644
> --- a/testcases/kernel/syscalls/umount/umount03.c
> +++ b/testcases/kernel/syscalls/umount/umount03.c
> @@ -1,6 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later
>  /*
>   * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
> + * Copyright (c) Linux Test Project, 2003-2023
>   * Author: Nirmala Devi Dhanasekar <nirmala.devi@wipro.com>
>   *
>   * Verify that umount(2) returns -1 and sets errno to  EPERM if the user
> @@ -20,19 +21,12 @@ static int mount_flag;

>  static void verify_umount(void)
>  {
> -     TEST(umount(MNTPOINT));
> -
> -     if (TST_RET != -1) {
> -             tst_res(TFAIL, "umount() succeeds unexpectedly");
> -             return;
> -     }
> +     TST_EXP_FAIL(umount(MNTPOINT), EPERM, "umount(%s) Failed", MNTPOINT);
nit: I would prefer just:

        TST_EXP_FAIL(umount(MNTPOINT), EPERM);


>        if (TST_ERR != EPERM) {
>                tst_res(TFAIL | TTERRNO, "umount() should fail with EPERM");
>                return;
>        }
This should have been removed, it's redundant when TST_EXP_FAIL() is done.
> -
> -     tst_res(TPASS | TTERRNO, "umount() fails as expected");
>  }

>  static void setup(void)

With <errno.h> and if (TST_ERR != EPERM) removed you can add:
Reviewed-by: Petr Vorel <pvorel@suse.cz>

It would be good (as a separate commit) to reword the documentation and convert
it to docparse. Feel free to do it, or please let me know if I should do it.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [LTP] 回复:  [PATCH 3/3] umount03: Simplify test using TST_ macros
  2023-10-26  0:06     ` Petr Vorel
@ 2023-10-26  6:07       ` Yang Xu (Fujitsu)
  0 siblings, 0 replies; 10+ messages in thread
From: Yang Xu (Fujitsu) @ 2023-10-26  6:07 UTC (permalink / raw)
  To: ltp@lists.linux.it, Petr Vorel

Hi Petr,

>Hi Xu,


>> this is not needed:
>> #include <errno.h>

>Also these aren't needed:
>#include <sys/types.h>
>#include <unistd.h>

Yes.

>> This is for all 3 patches.

>Kind regards,
>Petr

Best Regards
Yang Xu
________________________________
发件人: Petr Vorel <pvorel@suse.cz>
发送时间: 2023年10月26日 8:06
收件人: Xu, Yang/徐 杨 <xuyang2018.jy@fujitsu.com>; ltp@lists.linux.it <ltp@lists.linux.it>
主题: Re: [LTP] [PATCH 3/3] umount03: Simplify test using TST_ macros

Hi Xu,


> this is not needed:
> #include <errno.h>

Also these aren't needed:
#include <sys/types.h>
#include <unistd.h>

> This is for all 3 patches.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-10-26  6:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-12  8:40 [LTP] [PATCH 1/3] umount01: Simplify test using TST_ macros Yang Xu
2023-10-12  8:40 ` [LTP] [PATCH 2/3] umount02: " Yang Xu
2023-10-26  0:12   ` Petr Vorel
2023-10-26  5:40     ` [LTP] 回复: " Yang Xu (Fujitsu)
2023-10-12  8:40 ` [LTP] [PATCH 3/3] umount03: " Yang Xu
2023-10-26  0:05   ` Petr Vorel
2023-10-26  0:06     ` Petr Vorel
2023-10-26  6:07       ` [LTP] 回复: " Yang Xu (Fujitsu)
2023-10-26  6:05     ` Yang Xu (Fujitsu)
2023-10-20  9:49 ` [LTP] [PATCH 1/3] umount01: " Yang Xu (Fujitsu)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox