summaryrefslogtreecommitdiff
path: root/runner
diff options
context:
space:
mode:
authorPetri Latvala <petri.latvala@intel.com>2020-03-12 11:59:42 +0200
committerPetri Latvala <petri.latvala@intel.com>2020-03-13 11:37:48 +0200
commitbfa5b9eb4798a6ddbb87c0bc0973ef7cd09450d4 (patch)
tree808bbf4d65917a7e0092773387850ac6b0a16324 /runner
parent59fd8a0d01dac58dc6c7d86ef391ed4393ab5aae (diff)
runner: Handle outputs before checking for timeout
Signed-off-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'runner')
-rw-r--r--runner/executor.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/runner/executor.c b/runner/executor.c
index 72e45b65..28b8a443 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -828,42 +828,6 @@ static int monitor_output(pid_t child,
igt_gettime(&time_now);
- timeout_reason = need_to_timeout(settings, killed, tainted(&taints),
- igt_time_elapsed(&time_last_activity, &time_now),
- igt_time_elapsed(&time_last_subtest, &time_now),
- igt_time_elapsed(&time_killed, &time_now));
-
- if (timeout_reason) {
- if (killed == SIGKILL) {
- /* Nothing that can be done, really. Let's tell the caller we want to abort. */
-
- if (settings->log_level >= LOG_LEVEL_NORMAL) {
- errf("Child refuses to die, tainted 0x%lx. Aborting.\n",
- taints);
- if (kill(child, 0) && errno == ESRCH)
- errf("The test process no longer exists, "
- "but we didn't get informed of its demise...\n");
- }
-
- close_watchdogs(settings);
- free(outbuf);
- close(outfd);
- close(errfd);
- close(kmsgfd);
- return -1;
- }
-
- if (settings->log_level >= LOG_LEVEL_NORMAL) {
- outf("%s", timeout_reason);
- fflush(stdout);
- }
-
- killed = next_kill_signal(killed);
- if (!kill_child(killed, child))
- return -1;
- time_killed = time_now;
- }
-
/* TODO: Refactor these handlers to their own functions */
if (outfd >= 0 && FD_ISSET(outfd, &set)) {
char *newline;
@@ -1072,6 +1036,42 @@ static int monitor_output(pid_t child,
child = 0;
sigfd = -1; /* we are dying, no signal handling for now */
}
+
+ timeout_reason = need_to_timeout(settings, killed, tainted(&taints),
+ igt_time_elapsed(&time_last_activity, &time_now),
+ igt_time_elapsed(&time_last_subtest, &time_now),
+ igt_time_elapsed(&time_killed, &time_now));
+
+ if (timeout_reason) {
+ if (killed == SIGKILL) {
+ /* Nothing that can be done, really. Let's tell the caller we want to abort. */
+
+ if (settings->log_level >= LOG_LEVEL_NORMAL) {
+ errf("Child refuses to die, tainted 0x%lx. Aborting.\n",
+ taints);
+ if (kill(child, 0) && errno == ESRCH)
+ errf("The test process no longer exists, "
+ "but we didn't get informed of its demise...\n");
+ }
+
+ close_watchdogs(settings);
+ free(outbuf);
+ close(outfd);
+ close(errfd);
+ close(kmsgfd);
+ return -1;
+ }
+
+ if (settings->log_level >= LOG_LEVEL_NORMAL) {
+ outf("%s", timeout_reason);
+ fflush(stdout);
+ }
+
+ killed = next_kill_signal(killed);
+ if (!kill_child(killed, child))
+ return -1;
+ time_killed = time_now;
+ }
}
dump_dmesg(kmsgfd, outputs[_F_DMESG]);