Yocto Project Discussions
 help / color / mirror / Atom feed
From: Joshua Watt <jpewhacker@gmail.com>
To: yocto@lists.yoctoproject.org
Cc: Joshua Watt <JPEWhacker@gmail.com>
Subject: [ptest-runner][PATCH 2/5] Only collect system state on timeout
Date: Tue, 18 Jul 2023 11:26:11 -0600	[thread overview]
Message-ID: <20230718172614.469304-3-JPEWhacker@gmail.com> (raw)
In-Reply-To: <20230718172614.469304-1-JPEWhacker@gmail.com>

To match the behavior of the previous ptest-runner, only collect system
state when a test has timed out

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 utils.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/utils.c b/utils.c
index 34ca2f0..d0e6a99 100644
--- a/utils.c
+++ b/utils.c
@@ -556,21 +556,18 @@ run_ptests(struct ptest_list *head, const struct ptest_options opts,
 						}
 					}
 				}
-				collect_system_state(_child_reader.fps[0]);
 
-				for (int i = 0; i < 2; i++) {
-					fflush(_child_reader.fps[i]);
-				}
-
-				/*
-				 * This kill is just in case the child did
-				 * something really silly like close its
-				 * stdout and stderr but then go into an
-				 * infinite loop and never exit. Normally, it
-				 * will just fail because the child is already
-				 * dead
-				 */
-				if (!_child_reader.timeouted) {
+				if (_child_reader.timeouted) {
+					collect_system_state(fp);
+				} else {
+					/*
+					 * This kill is just in case the child did
+					 * something really silly like close its
+					 * stdout and stderr but then go into an
+					 * infinite loop and never exit. Normally, it
+					 * will just fail because the child is already
+					 * dead
+					 */
 					kill(-child, SIGKILL);
 				}
 				waitpid(child, &status, 0);
-- 
2.33.0



  parent reply	other threads:[~2023-07-18 17:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-18 17:26 [ptest-runner][PATCH 0/5] Fix ptest timeout errors Joshua Watt
2023-07-18 17:26 ` [ptest-runner][PATCH 1/5] Revert "Change test timeout to be total elapsed time" Joshua Watt
2023-07-18 17:26 ` Joshua Watt [this message]
2023-07-18 17:26 ` [ptest-runner][PATCH 3/5] Report test failure on timeout Joshua Watt
2023-07-18 17:26 ` [ptest-runner][PATCH 4/5] Remove _child_reader singleton Joshua Watt
2023-07-18 17:26 ` [ptest-runner][PATCH 5/5] Flush stdout and stderr after test Joshua Watt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230718172614.469304-3-JPEWhacker@gmail.com \
    --to=jpewhacker@gmail.com \
    --cc=yocto@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox