diff mbox series

[ptest-runner,3/5] Report test failure on timeout

Message ID 20230718172614.469304-4-JPEWhacker@gmail.com
State New
Headers show
Series Fix ptest timeout errors | expand

Commit Message

Joshua Watt July 18, 2023, 5:26 p.m. UTC
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 mbox series

Patch

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) {