diff mbox series

[ptest-runner] Do not reset error counter before each test

Message ID ZVzTDrwC3WEn4xCu@hohnstaedt.de
State New
Headers show
Series [ptest-runner] Do not reset error counter before each test | expand

Commit Message

Christian Hohnstaedt Nov. 21, 2023, 3:55 p.m. UTC
Hi,

Commit 56ed1082c4914c0ef3c72bfd609d68cc850557f1 moved
the pipe-creation into the loop and resetted rc before each test,
such that only the result code of the last test was taken into
account for the final verdict.

Only set rc = -1 if pipe() fails to keep collected test-errors.

Comments

Joshua Watt Feb. 7, 2024, 4:33 p.m. UTC | #1
LGTM

Reviewed-by: Joshua Watt <JPEWhacker@gmail.com>

On Tue, Nov 21, 2023 at 8:56 AM Christian Hohnstaedt
<christian@hohnstaedt.de> wrote:
>
> Hi,
>
> Commit 56ed1082c4914c0ef3c72bfd609d68cc850557f1 moved
> the pipe-creation into the loop and resetted rc before each test,
> such that only the result code of the last test was taken into
> account for the final verdict.
>
> Only set rc = -1 if pipe() fails to keep collected test-errors.
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#61726): https://lists.yoctoproject.org/g/yocto/message/61726
> Mute This Topic: https://lists.yoctoproject.org/mt/102730915/3616693
> Group Owner: yocto+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [JPEWhacker@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Anibal Limon Feb. 11, 2024, 7:31 p.m. UTC | #2
Hi all,

Joshua: I'm doing an integration branch
Christian: adding this patch.

Regards!,
Anibal

On Wed, Feb 7, 2024 at 10:33 AM Joshua Watt <JPEWhacker@gmail.com> wrote:

> LGTM
>
> Reviewed-by: Joshua Watt <JPEWhacker@gmail.com>
>
> On Tue, Nov 21, 2023 at 8:56 AM Christian Hohnstaedt
> <christian@hohnstaedt.de> wrote:
> >
> > Hi,
> >
> > Commit 56ed1082c4914c0ef3c72bfd609d68cc850557f1 moved
> > the pipe-creation into the loop and resetted rc before each test,
> > such that only the result code of the last test was taken into
> > account for the final verdict.
> >
> > Only set rc = -1 if pipe() fails to keep collected test-errors.
> >
> >
> >
> >
> >
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#62419):
> https://lists.yoctoproject.org/g/yocto/message/62419
> Mute This Topic: https://lists.yoctoproject.org/mt/102730915/8181911
> Group Owner: yocto+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [
> anibal@limonsoftware.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
diff mbox series

Patch

From 1de2f110c94c27a903e3576ae5dc87992de92560 Mon Sep 17 00:00:00 2001
From: Christian Hohnstaedt <christian@hohnstaedt.de>
Date: Tue, 21 Nov 2023 16:07:22 +0100
Subject: [PATCH] Do not reset error counter before each test

Commit 56ed1082c4914c0ef3c72bfd609d68cc850557f1 moved
the pipe-creation into the loop and resetted rc before each test,
such that only the result code of the last test was taken into
account for the final verdict.

Only set rc = -1 if pipe() fails to keep collected test-errors.

Signed-off-by: Christian Hohnstaedt <christian@hohnstaedt.de>
---
 utils.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/utils.c b/utils.c
index 59b8b77..616e9db 100644
--- a/utils.c
+++ b/utils.c
@@ -415,12 +415,14 @@  run_ptests(struct ptest_list *head, const struct ptest_options opts,
 			int pipefd_stderr[2] = {-1, -1};
 			int pgid = -1;
 
-			if ((rc = pipe2(pipefd_stdout, 0)) == -1)
+			if (pipe2(pipefd_stdout, 0) == -1) {
+				rc = -1;
 				break;
-
-			if ((rc = pipe2(pipefd_stderr, 0)) == -1) {
+			}
+			if (pipe2(pipefd_stderr, 0) == -1) {
 				close(pipefd_stdout[PIPE_READ]);
 				close(pipefd_stdout[PIPE_WRITE]);
+				rc = -1;
 				break;
 			}
 
-- 
2.39.2