diff mbox series

epoll_creat01: Replace TST_PASS with TST_RET

Message ID OSZP286MB087168E8DE5E0E49C9F90E27CCC89@OSZP286MB0871.JPNP286.PROD.OUTLOOK.COM
State Superseded
Headers show
Series epoll_creat01: Replace TST_PASS with TST_RET | expand

Commit Message

Xie Ziyao Aug. 27, 2021, 11:57 a.m. UTC
In TST_EXP_FD(), the value of TST_RET is the returned fd, not TST_PASS.

Fixes: 081f940b2df00 ("epoll_create: Add test for epoll_create01")
Signed-off-by: Xie Ziyao <ziyaoxie@outlook.com>
---
 testcases/kernel/syscalls/epoll_create/epoll_create01.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--
2.25.1

Comments

Xie Ziyao Aug. 27, 2021, 12:03 p.m. UTC | #1
Hi,

> In TST_EXP_FD(), the value of TST_RET is the returned fd, not TST_PASS.
>
> Fixes: 081f940b2df00 ("epoll_create: Add test for epoll_create01")
> Signed-off-by: Xie Ziyao <ziyaoxie@outlook.com>
> ---
>   testcases/kernel/syscalls/epoll_create/epoll_create01.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/epoll_create/epoll_create01.c b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
> index 54fd0810d..29ac3763e 100644
> --- a/testcases/kernel/syscalls/epoll_create/epoll_create01.c
> +++ b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
> @@ -26,9 +26,8 @@ static void run(unsigned int n)
>   {
>   	TST_EXP_FD(tst_syscall(__NR_epoll_create, tc[n]), "epoll_create(%d)", tc[n]);
>
> -	if (!TST_PASS)
> -		return;
> -	SAFE_CLOSE(TST_PASS);
> +	if (TST_RET)
> +		SAFE_CLOSE(TST_RET);

This patch fixes the incorrect use of TST_PASS in commit 081f940 
("epoll_create: Add test for epoll_create01"), which I noticed when 
reviewing the merged commit.

Sorry for this minor mistake.


>   }
>
>   static struct tst_test test = {
> --
> 2.25.1
>
>
Cyril Hrubis Aug. 30, 2021, 2:50 p.m. UTC | #2
Hi!
> diff --git a/testcases/kernel/syscalls/epoll_create/epoll_create01.c b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
> index 54fd0810d..29ac3763e 100644
> --- a/testcases/kernel/syscalls/epoll_create/epoll_create01.c
> +++ b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
> @@ -26,9 +26,8 @@ static void run(unsigned int n)
>  {
>  	TST_EXP_FD(tst_syscall(__NR_epoll_create, tc[n]), "epoll_create(%d)", tc[n]);
> 
> -	if (!TST_PASS)
> -		return;
> -	SAFE_CLOSE(TST_PASS);
> +	if (TST_RET)
> +		SAFE_CLOSE(TST_RET);
>  }

Isn't this broken as well?

As far as I can tell the if (!TST_PASS) part in the test is correct and
we only have to change the TST_PASS to TST_RET in the SAFE_CLOSE().

So we should apply:

diff --git a/testcases/kernel/syscalls/epoll_create/epoll_create01.c b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
index 54fd0810d..3ef5b5cac 100644
--- a/testcases/kernel/syscalls/epoll_create/epoll_create01.c
+++ b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
@@ -28,7 +28,7 @@ static void run(unsigned int n)

        if (!TST_PASS)
                return;
-       SAFE_CLOSE(TST_PASS);
+       SAFE_CLOSE(TST_RET);
 }

 static struct tst_test test = {
Xie Ziyao Aug. 30, 2021, 3:34 p.m. UTC | #3
Hi, Cyril,

> Hi!
>> diff --git a/testcases/kernel/syscalls/epoll_create/epoll_create01.c b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
>> index 54fd0810d..29ac3763e 100644
>> --- a/testcases/kernel/syscalls/epoll_create/epoll_create01.c
>> +++ b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
>> @@ -26,9 +26,8 @@ static void run(unsigned int n)
>>   {
>>   	TST_EXP_FD(tst_syscall(__NR_epoll_create, tc[n]), "epoll_create(%d)", tc[n]);
>>
>> -	if (!TST_PASS)
>> -		return;
>> -	SAFE_CLOSE(TST_PASS);
>> +	if (TST_RET)
>> +		SAFE_CLOSE(TST_RET);
>>   }
> Isn't this broken as well?
>
> As far as I can tell the if (!TST_PASS) part in the test is correct and
> we only have to change the TST_PASS to TST_RET in the SAFE_CLOSE().

Agree with you. By the way, would you mind helping to modify it?

Thanks a lot.

>
> So we should apply:
>
> diff --git a/testcases/kernel/syscalls/epoll_create/epoll_create01.c b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
> index 54fd0810d..3ef5b5cac 100644
> --- a/testcases/kernel/syscalls/epoll_create/epoll_create01.c
> +++ b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
> @@ -28,7 +28,7 @@ static void run(unsigned int n)
>
>          if (!TST_PASS)
>                  return;
> -       SAFE_CLOSE(TST_PASS);
> +       SAFE_CLOSE(TST_RET);
>   }
>
>   static struct tst_test test = {
>
>
Xie Ziyao Aug. 31, 2021, 3:55 a.m. UTC | #4
Hi,

> Hi, Cyril,
>
>> Hi!
>>> diff --git a/testcases/kernel/syscalls/epoll_create/epoll_create01.c 
>>> b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
>>> index 54fd0810d..29ac3763e 100644
>>> --- a/testcases/kernel/syscalls/epoll_create/epoll_create01.c
>>> +++ b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
>>> @@ -26,9 +26,8 @@ static void run(unsigned int n)
>>>   {
>>>       TST_EXP_FD(tst_syscall(__NR_epoll_create, tc[n]), 
>>> "epoll_create(%d)", tc[n]);
>>>
>>> -    if (!TST_PASS)
>>> -        return;
>>> -    SAFE_CLOSE(TST_PASS);
>>> +    if (TST_RET)
>>> +        SAFE_CLOSE(TST_RET);
>>>   }
>> Isn't this broken as well?
>>
>> As far as I can tell the if (!TST_PASS) part in the test is correct and
>> we only have to change the TST_PASS to TST_RET in the SAFE_CLOSE().
>
> Agree with you. By the way, would you mind helping to modify it?

I helped modify it, and thanks for your review.

Please see: 
https://patchwork.ozlabs.org/project/ltp/patch/OSZP286MB0871620CFE5F9AB0D6F33BD9CCCC9@OSZP286MB0871.JPNP286.PROD.OUTLOOK.COM/

>
> Thanks a lot.
>
>>
>> So we should apply:
>>
>> diff --git a/testcases/kernel/syscalls/epoll_create/epoll_create01.c 
>> b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
>> index 54fd0810d..3ef5b5cac 100644
>> --- a/testcases/kernel/syscalls/epoll_create/epoll_create01.c
>> +++ b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
>> @@ -28,7 +28,7 @@ static void run(unsigned int n)
>>
>>          if (!TST_PASS)
>>                  return;
>> -       SAFE_CLOSE(TST_PASS);
>> +       SAFE_CLOSE(TST_RET);
>>   }
>>
>>   static struct tst_test test = {
>>
>>
diff mbox series

Patch

diff --git a/testcases/kernel/syscalls/epoll_create/epoll_create01.c b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
index 54fd0810d..29ac3763e 100644
--- a/testcases/kernel/syscalls/epoll_create/epoll_create01.c
+++ b/testcases/kernel/syscalls/epoll_create/epoll_create01.c
@@ -26,9 +26,8 @@  static void run(unsigned int n)
 {
 	TST_EXP_FD(tst_syscall(__NR_epoll_create, tc[n]), "epoll_create(%d)", tc[n]);

-	if (!TST_PASS)
-		return;
-	SAFE_CLOSE(TST_PASS);
+	if (TST_RET)
+		SAFE_CLOSE(TST_RET);
 }

 static struct tst_test test = {