* [LTP] [PATCH] syscalls/pidfd_open: Continue with rest of the tests on failure
@ 2020-02-25 6:26 Viresh Kumar
2020-02-25 12:19 ` Cyril Hrubis
2020-02-25 23:33 ` [LTP] [PATCH V2] " Viresh Kumar
0 siblings, 2 replies; 6+ messages in thread
From: Viresh Kumar @ 2020-02-25 6:26 UTC (permalink / raw)
To: ltp
With tst_brk(), the tests end immediately while what we want to do here
is to test rest of the failure tests. Use tst_res() to report result and
continue with rest of the failure tests.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
.../kernel/syscalls/pidfd_open/pidfd_open02.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c b/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c
index d73b5326b3b1..533270da3dbd 100644
--- a/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c
+++ b/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c
@@ -35,17 +35,15 @@ static void run(unsigned int n)
if (TST_RET != -1) {
SAFE_CLOSE(TST_RET);
- tst_brk(TFAIL, "%s: pidfd_open succeeded unexpectedly (index: %d)",
+ tst_res(TFAIL, "%s: pidfd_open succeeded unexpectedly (index: %d)",
tc->name, n);
- }
-
- if (tc->exp_errno != TST_ERR) {
- tst_brk(TFAIL | TTERRNO, "%s: pidfd_open() should fail with %s",
+ } else if (tc->exp_errno != TST_ERR) {
+ tst_res(TFAIL | TTERRNO, "%s: pidfd_open() should fail with %s",
tc->name, tst_strerrno(tc->exp_errno));
- }
-
- tst_res(TPASS | TTERRNO, "%s: pidfd_open() failed as expected",
- tc->name);
+ } else {
+ tst_res(TPASS | TTERRNO, "%s: pidfd_open() failed as expected",
+ tc->name);
+ }
}
static struct tst_test test = {
--
2.21.0.rc0.269.g1a574e7a288b
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH] syscalls/pidfd_open: Continue with rest of the tests on failure
2020-02-25 6:26 [LTP] [PATCH] syscalls/pidfd_open: Continue with rest of the tests on failure Viresh Kumar
@ 2020-02-25 12:19 ` Cyril Hrubis
2020-02-25 23:33 ` [LTP] [PATCH V2] " Viresh Kumar
1 sibling, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2020-02-25 12:19 UTC (permalink / raw)
To: ltp
Hi!
Agree here, also tst_brk(TFAIL, ...) is not working well at this point, see:
https://github.com/linux-test-project/ltp/issues/462
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> .../kernel/syscalls/pidfd_open/pidfd_open02.c | 16 +++++++---------
> 1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c b/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c
> index d73b5326b3b1..533270da3dbd 100644
> --- a/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c
> +++ b/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c
> @@ -35,17 +35,15 @@ static void run(unsigned int n)
>
> if (TST_RET != -1) {
> SAFE_CLOSE(TST_RET);
> - tst_brk(TFAIL, "%s: pidfd_open succeeded unexpectedly (index: %d)",
> + tst_res(TFAIL, "%s: pidfd_open succeeded unexpectedly (index: %d)",
> tc->name, n);
> - }
> -
> - if (tc->exp_errno != TST_ERR) {
> - tst_brk(TFAIL | TTERRNO, "%s: pidfd_open() should fail with %s",
> + } else if (tc->exp_errno != TST_ERR) {
> + tst_res(TFAIL | TTERRNO, "%s: pidfd_open() should fail with %s",
> tc->name, tst_strerrno(tc->exp_errno));
> - }
Can we please use return instead of the else if branches?
i.e.
if (...) {
tst_res(TFAIL, ...);
return;
}
> - tst_res(TPASS | TTERRNO, "%s: pidfd_open() failed as expected",
> - tc->name);
> + } else {
> + tst_res(TPASS | TTERRNO, "%s: pidfd_open() failed as expected",
> + tc->name);
> + }
> }
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH V2] syscalls/pidfd_open: Continue with rest of the tests on failure
2020-02-25 6:26 [LTP] [PATCH] syscalls/pidfd_open: Continue with rest of the tests on failure Viresh Kumar
2020-02-25 12:19 ` Cyril Hrubis
@ 2020-02-25 23:33 ` Viresh Kumar
2020-02-26 14:08 ` Xiao Yang
2020-02-26 16:21 ` Cyril Hrubis
1 sibling, 2 replies; 6+ messages in thread
From: Viresh Kumar @ 2020-02-25 23:33 UTC (permalink / raw)
To: ltp
With tst_brk(), the tests end immediately while what we want to do here
is to test rest of the failure tests. Use tst_res() to report result and
continue with rest of the failure tests.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
V2: Use return, instead of if/else blocks.
testcases/kernel/syscalls/pidfd_open/pidfd_open02.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c b/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c
index d73b5326b3b1..9cdded13525a 100644
--- a/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c
+++ b/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c
@@ -35,14 +35,16 @@ static void run(unsigned int n)
if (TST_RET != -1) {
SAFE_CLOSE(TST_RET);
- tst_brk(TFAIL, "%s: pidfd_open succeeded unexpectedly (index: %d)",
+ tst_res(TFAIL, "%s: pidfd_open succeeded unexpectedly (index: %d)",
tc->name, n);
+ return;
}
if (tc->exp_errno != TST_ERR) {
- tst_brk(TFAIL | TTERRNO, "%s: pidfd_open() should fail with %s",
+ tst_res(TFAIL | TTERRNO, "%s: pidfd_open() should fail with %s",
tc->name, tst_strerrno(tc->exp_errno));
- }
+ return;
+ }
tst_res(TPASS | TTERRNO, "%s: pidfd_open() failed as expected",
tc->name);
--
2.21.0.rc0.269.g1a574e7a288b
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH V2] syscalls/pidfd_open: Continue with rest of the tests on failure
2020-02-25 23:33 ` [LTP] [PATCH V2] " Viresh Kumar
@ 2020-02-26 14:08 ` Xiao Yang
2020-02-26 16:23 ` Cyril Hrubis
2020-02-26 16:21 ` Cyril Hrubis
1 sibling, 1 reply; 6+ messages in thread
From: Xiao Yang @ 2020-02-26 14:08 UTC (permalink / raw)
To: ltp
On 2020/2/26 7:33, Viresh Kumar wrote:
> With tst_brk(), the tests end immediately while what we want to do here
> is to test rest of the failure tests. Use tst_res() to report result and
> continue with rest of the failure tests.
>
> Signed-off-by: Viresh Kumar<viresh.kumar@linaro.org>
> ---
> V2: Use return, instead of if/else blocks.
>
> testcases/kernel/syscalls/pidfd_open/pidfd_open02.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c b/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c
> index d73b5326b3b1..9cdded13525a 100644
> --- a/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c
> +++ b/testcases/kernel/syscalls/pidfd_open/pidfd_open02.c
> @@ -35,14 +35,16 @@ static void run(unsigned int n)
>
> if (TST_RET != -1) {
> SAFE_CLOSE(TST_RET);
> - tst_brk(TFAIL, "%s: pidfd_open succeeded unexpectedly (index: %d)",
> + tst_res(TFAIL, "%s: pidfd_open succeeded unexpectedly (index: %d)",
> tc->name, n);
> + return;
> }
>
> if (tc->exp_errno != TST_ERR) {
> - tst_brk(TFAIL | TTERRNO, "%s: pidfd_open() should fail with %s",
> + tst_res(TFAIL | TTERRNO, "%s: pidfd_open() should fail with %s",
> tc->name, tst_strerrno(tc->exp_errno));
> - }
> + return;
> + }
>
> tst_res(TPASS | TTERRNO, "%s: pidfd_open() failed as expected",
> tc->name);
Acked-by: Xiao Yang <ice_yangxiao@163.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH V2] syscalls/pidfd_open: Continue with rest of the tests on failure
2020-02-25 23:33 ` [LTP] [PATCH V2] " Viresh Kumar
2020-02-26 14:08 ` Xiao Yang
@ 2020-02-26 16:21 ` Cyril Hrubis
1 sibling, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2020-02-26 16:21 UTC (permalink / raw)
To: ltp
Hi!
> + return;
> + }
^
I've removed this space that I suppose was added accidentally and
pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH V2] syscalls/pidfd_open: Continue with rest of the tests on failure
2020-02-26 14:08 ` Xiao Yang
@ 2020-02-26 16:23 ` Cyril Hrubis
0 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2020-02-26 16:23 UTC (permalink / raw)
To: ltp
Hi!
> > tst_res(TPASS | TTERRNO, "%s: pidfd_open() failed as expected",
> > tc->name);
> Acked-by: Xiao Yang <ice_yangxiao@163.com>
Sorry, missed that one.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-02-26 16:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-25 6:26 [LTP] [PATCH] syscalls/pidfd_open: Continue with rest of the tests on failure Viresh Kumar
2020-02-25 12:19 ` Cyril Hrubis
2020-02-25 23:33 ` [LTP] [PATCH V2] " Viresh Kumar
2020-02-26 14:08 ` Xiao Yang
2020-02-26 16:23 ` Cyril Hrubis
2020-02-26 16:21 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox