[yocto] [[PATCH][ptest-runner]] utils.c: Improve user notice of TIMEOUT
Aníbal Limón
anibal.limon at linux.intel.com
Thu Apr 6 14:05:24 PDT 2017
Print exit status before TIMEOUT to give clear information
to the user about exit status before TIMEOUT and END.
[YOCTO #10842]
Signed-off-by: Aníbal Limón <anibal.limon at linux.intel.com>
---
utils.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/utils.c b/utils.c
index 77427e0..e5677ec 100644
--- a/utils.c
+++ b/utils.c
@@ -260,6 +260,7 @@ wait_child(const char *ptest_dir, const char *run_ptest, pid_t pid,
time_t sentinel;
int r;
+ int timeouted = 0;
int status;
int waitflags;
@@ -289,7 +290,7 @@ wait_child(const char *ptest_dir, const char *run_ptest, pid_t pid,
sentinel = time(NULL);
} else if (timeout >= 0 && ((time(NULL) - sentinel) > timeout)) {
- fprintf(fps[0], "TIMEOUT: %s\n", ptest_dir);
+ timeouted = 1;
kill(pid, SIGKILL);
waitflags = 0;
}
@@ -298,6 +299,12 @@ wait_child(const char *ptest_dir, const char *run_ptest, pid_t pid,
break;
}
+ if (status) {
+ fprintf(fps[0], "\nERROR: Exit status is %d\n", status);
+ if (timeouted)
+ fprintf(fps[0], "TIMEOUT: %s\n", ptest_dir);
+ }
+
return status;
}
@@ -351,10 +358,9 @@ run_ptests(struct ptest_list *head, int timeout, const char *progname,
status = wait_child(ptest_dir, p->run_ptest, child,
timeout, fds, fps);
- if (status) {
- fprintf(fp, "ERROR: Exit status is %d\n", status);
+ if (status)
rc += 1;
- }
+
fprintf(fp, "END: %s\n", ptest_dir);
fprintf(fp, "%s\n", get_stime(stime, GET_STIME_BUF_SIZE));
}
--
2.1.4
More information about the yocto
mailing list