* [LTP] [PATCH 1/1] network/echoes: fix endless loop on error
@ 2016-11-29 16:02 Petr Vorel
2016-12-06 10:53 ` Alexey Kodanev
0 siblings, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2016-11-29 16:02 UTC (permalink / raw)
To: ltp
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
testcases/network/tcp_cmds/echo/echoes.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/testcases/network/tcp_cmds/echo/echoes.c b/testcases/network/tcp_cmds/echo/echoes.c
index 8138d28..d753d98 100644
--- a/testcases/network/tcp_cmds/echo/echoes.c
+++ b/testcases/network/tcp_cmds/echo/echoes.c
@@ -97,6 +97,7 @@ int main(int argc, char *argv[], char *env[])
if ((pid = wait(&wait_stat)) == -1)
tst_resm(TFAIL | TERRNO, "wait failed");
+
if (wait_stat == 0) {
for (j = 0; j < i; j++) {
if (echo_struc[j].pid == pid) {
@@ -105,7 +106,6 @@ int main(int argc, char *argv[], char *env[])
}
}
} else {
-
tst_resm(TFAIL, "wait(2) status was non-zero");
if (WIFEXITED(wait_stat)) {
@@ -120,6 +120,9 @@ int main(int argc, char *argv[], char *env[])
if (kill(echo_struc[k].pid, 0) == 0) {
kill(echo_struc[k].pid, 9);
}
+ if (echo_struc[k].pid == pid) {
+ finish--;
+ }
}
}
--
2.10.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH 1/1] network/echoes: fix endless loop on error
2016-11-29 16:02 [LTP] [PATCH 1/1] network/echoes: fix endless loop on error Petr Vorel
@ 2016-12-06 10:53 ` Alexey Kodanev
2016-12-06 13:58 ` Petr Vorel
2016-12-14 17:06 ` Petr Vorel
0 siblings, 2 replies; 6+ messages in thread
From: Alexey Kodanev @ 2016-12-06 10:53 UTC (permalink / raw)
To: ltp
Hi,
On 11/29/2016 07:02 PM, Petr Vorel wrote:
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> testcases/network/tcp_cmds/echo/echoes.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/testcases/network/tcp_cmds/echo/echoes.c b/testcases/network/tcp_cmds/echo/echoes.c
> index 8138d28..d753d98 100644
> --- a/testcases/network/tcp_cmds/echo/echoes.c
> +++ b/testcases/network/tcp_cmds/echo/echoes.c
> @@ -97,6 +97,7 @@ int main(int argc, char *argv[], char *env[])
>
> if ((pid = wait(&wait_stat)) == -1)
> tst_resm(TFAIL | TERRNO, "wait failed");
> +
> if (wait_stat == 0) {
> for (j = 0; j < i; j++) {
> if (echo_struc[j].pid == pid) {
> @@ -105,7 +106,6 @@ int main(int argc, char *argv[], char *env[])
> }
> }
> } else {
> -
> tst_resm(TFAIL, "wait(2) status was non-zero");
>
> if (WIFEXITED(wait_stat)) {
> @@ -120,6 +120,9 @@ int main(int argc, char *argv[], char *env[])
> if (kill(echo_struc[k].pid, 0) == 0) {
> kill(echo_struc[k].pid, 9);
> }
> + if (echo_struc[k].pid == pid) {
> + finish--;
> + }
Good catch, looks like we could substitute the while loop here with
tst_reap_children() library function and remove "echo_struc" as well?
Thanks,
Alexey
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH 1/1] network/echoes: fix endless loop on error
2016-12-06 10:53 ` Alexey Kodanev
@ 2016-12-06 13:58 ` Petr Vorel
2016-12-14 17:06 ` Petr Vorel
1 sibling, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2016-12-06 13:58 UTC (permalink / raw)
To: ltp
Hi,
thanks for your review Alexey!
> Good catch, looks like we could substitute the while loop here with
> tst_reap_children() library function and remove "echo_struc" as well?
OK :-). Needs to be rewritten into new API, then.
Kind regards,
Petr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.linux.it/pipermail/ltp/attachments/20161206/08cecc29/attachment.sig>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH 1/1] network/echoes: fix endless loop on error
2016-12-06 10:53 ` Alexey Kodanev
2016-12-06 13:58 ` Petr Vorel
@ 2016-12-14 17:06 ` Petr Vorel
2016-12-15 11:48 ` Alexey Kodanev
1 sibling, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2016-12-14 17:06 UTC (permalink / raw)
To: ltp
Hi Alexey,
> Good catch, looks like we could substitute the while loop here with
> tst_reap_children() library function and remove "echo_struc" as well?
Could you please push this quick fix? I plan to rewrite test into new API, but probably
will not manage it until the release.
Kind regards,
Petr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.linux.it/pipermail/ltp/attachments/20161214/fc9d9bdd/attachment.sig>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH 1/1] network/echoes: fix endless loop on error
2016-12-14 17:06 ` Petr Vorel
@ 2016-12-15 11:48 ` Alexey Kodanev
[not found] ` <20161215115111.srk5fmrehsllbhuw@x230>
0 siblings, 1 reply; 6+ messages in thread
From: Alexey Kodanev @ 2016-12-15 11:48 UTC (permalink / raw)
To: ltp
Hi Petr,
On 14.12.2016 20:06, Petr Vorel wrote:
> Hi Alexey,
>
>> Good catch, looks like we could substitute the while loop here with
>> tst_reap_children() library function and remove "echo_struc" as well?
> Could you please push this quick fix? I plan to rewrite test into new API, but probably
> will not manage it until the release.
OK, but if we want a quick fix here we can just add a single "break"
after the loop where
it is killing all the left child processes. No need to proceed anyway.
If you agree I'll push
the patch with the break version:
--- a/testcases/network/tcp_cmds/echo/echoes.c
+++ b/testcases/network/tcp_cmds/echo/echoes.c
@@ -121,7 +121,7 @@ int main(int argc, char *argv[], char *env[])
kill(echo_struc[k].pid, 9);
}
}
-
+ break;
}
}
Thanks,
Alexey
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH 1/1] network/echoes: fix endless loop on error
[not found] ` <20161215115111.srk5fmrehsllbhuw@x230>
@ 2016-12-15 12:12 ` Alexey Kodanev
0 siblings, 0 replies; 6+ messages in thread
From: Alexey Kodanev @ 2016-12-15 12:12 UTC (permalink / raw)
To: ltp
On 15.12.2016 14:51, Petr Vorel wrote:
> Hi Alexey,
>
>> OK, but if we want a quick fix here we can just add a single "break" after
>> the loop where
>> it is killing all the left child processes. No need to proceed anyway. If
>> you agree I'll push
>> the patch with the break version:
> Sure, push this version. Thanks!
Applied the patch, thank you.
Best regards,
Alexey
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-12-15 12:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-29 16:02 [LTP] [PATCH 1/1] network/echoes: fix endless loop on error Petr Vorel
2016-12-06 10:53 ` Alexey Kodanev
2016-12-06 13:58 ` Petr Vorel
2016-12-14 17:06 ` Petr Vorel
2016-12-15 11:48 ` Alexey Kodanev
[not found] ` <20161215115111.srk5fmrehsllbhuw@x230>
2016-12-15 12:12 ` Alexey Kodanev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.