From: Joshua Watt <jpewhacker@gmail.com>
To: yocto@lists.yoctoproject.org
Cc: Joshua Watt <JPEWhacker@gmail.com>
Subject: [ptest-runner][PATCH 3/5] Report test failure on timeout
Date: Tue, 18 Jul 2023 11:26:12 -0600 [thread overview]
Message-ID: <20230718172614.469304-4-JPEWhacker@gmail.com> (raw)
In-Reply-To: <20230718172614.469304-1-JPEWhacker@gmail.com>
Even when a test times out, an "ERROR:" message should be printed so
that the OE selftest parser knows the test has failed.
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
utils.c | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/utils.c b/utils.c
index d0e6a99..aacf123 100644
--- a/utils.c
+++ b/utils.c
@@ -575,23 +575,20 @@ run_ptests(struct ptest_list *head, const struct ptest_options opts,
entime = time(NULL);
duration = entime - sttime;
- int exit_code = 0;
-
- if (!_child_reader.timeouted) {
- if (WIFEXITED(status)) {
- exit_code = WEXITSTATUS(status);
- if (exit_code) {
- fprintf(fp, "\nERROR: Exit status is %d\n", exit_code);
- rc += 1;
- }
- } else if (WIFSIGNALED(status)) {
- int signal = WTERMSIG(status);
- fprintf(fp, "\nERROR: Exited from signal %s (%d)\n", strsignal(signal), signal);
- rc += 1;
- } else {
- fprintf(fp, "\nERROR: Exited for unknown reason (%d)\n", status);
+ int exit_code = -1;
+ if (WIFEXITED(status)) {
+ exit_code = WEXITSTATUS(status);
+ if (exit_code) {
+ fprintf(fp, "\nERROR: Exit status is %d\n", exit_code);
rc += 1;
}
+ } else if (WIFSIGNALED(status)) {
+ int signal = WTERMSIG(status);
+ fprintf(fp, "\nERROR: Exited from signal %s (%d)\n", strsignal(signal), signal);
+ rc += 1;
+ } else {
+ fprintf(fp, "\nERROR: Exited for unknown reason (%d)\n", status);
+ rc += 1;
}
fprintf(fp, "DURATION: %d\n", (int) duration);
if (_child_reader.timeouted) {
--
2.33.0
next prev 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 ` [ptest-runner][PATCH 2/5] Only collect system state on timeout Joshua Watt
2023-07-18 17:26 ` Joshua Watt [this message]
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-4-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