summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetri Latvala <petri.latvala@intel.com>2020-07-29 14:34:25 +0300
committerPetri Latvala <petri.latvala@intel.com>2020-07-30 11:39:17 +0300
commit3ecf9d88803a686354394ea60164551646235273 (patch)
tree0caa76397713b59efadcc4fb6760a34f6ea6caa8
parent64f3a4c4351120a3807ad58e038934d07c8c4c46 (diff)
runner: Also generate igt@runner@aborted when aborting internally
If we can't kill the (main) test process, or when the test process exits with IGT_EXIT_ABORT, we abort the execution. Pass that information along to the other machinery that tracks whether we aborted, thus also getting that information to the end user in the form of the pseudo-result igt@runner@aborted. Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Cc: Lukasz Fiedorowicz <lukasz.fiedorowicz@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--runner/executor.c47
1 files changed, 26 insertions, 21 deletions
diff --git a/runner/executor.c b/runner/executor.c
index 77818987..0377195d 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -795,10 +795,11 @@ static int next_kill_signal(int killed)
* >0 - Timeout happened, need to recreate from journal
*/
static int monitor_output(pid_t child,
- int outfd, int errfd, int kmsgfd, int sigfd,
- int *outputs,
- double *time_spent,
- struct settings *settings)
+ int outfd, int errfd, int kmsgfd, int sigfd,
+ int *outputs,
+ double *time_spent,
+ struct settings *settings,
+ char **abortreason)
{
fd_set set;
char buf[2048];
@@ -1116,6 +1117,7 @@ static int monitor_output(pid_t child,
if (status == IGT_EXIT_ABORT) {
errf("Test exited with IGT_EXIT_ABORT, aborting.\n");
aborting = true;
+ *abortreason = strdup("Test exited with IGT_EXIT_ABORT");
}
if (time_spent)
@@ -1142,6 +1144,7 @@ static int monitor_output(pid_t child,
if (kill(child, 0) && errno == ESRCH)
errf("The test process no longer exists, "
"but we didn't get informed of its demise...\n");
+ asprintf(abortreason, "Child refuses to die, tainted 0x%lx.", taints);
}
dump_dmesg(kmsgfd, outputs[_F_DMESG]);
@@ -1309,7 +1312,8 @@ static int execute_next_entry(struct execute_state *state,
struct settings *settings,
struct job_list_entry *entry,
int testdirfd, int resdirfd,
- int sigfd, sigset_t *sigmask)
+ int sigfd, sigset_t *sigmask,
+ char **abortreason)
{
int dirfd;
int outputs[_F_LAST];
@@ -1406,7 +1410,7 @@ static int execute_next_entry(struct execute_state *state,
outpipe[1] = errpipe[1] = -1;
result = monitor_output(child, outfd, errfd, kmsgfd, sigfd,
- outputs, time_spent, settings);
+ outputs, time_spent, settings, abortreason);
out_kmsgfd:
close(kmsgfd);
@@ -1783,7 +1787,7 @@ bool execute(struct execute_state *state,
for (; state->next < job_list->size;
state->next++) {
- char *reason;
+ char *reason = NULL;
int result;
if (should_die_because_signal(sigfd)) {
@@ -1797,7 +1801,21 @@ bool execute(struct execute_state *state,
settings,
&job_list->entries[state->next],
testdirfd, resdirfd,
- sigfd, &sigmask);
+ sigfd, &sigmask,
+ &reason);
+
+ if (reason != NULL || (reason = need_to_abort(settings)) != NULL) {
+ char *prev = entry_display_name(&job_list->entries[state->next]);
+ char *next = (state->next + 1 < job_list->size ?
+ entry_display_name(&job_list->entries[state->next + 1]) :
+ strdup("nothing"));
+ write_abort_file(resdirfd, reason, prev, next);
+ free(prev);
+ free(next);
+ free(reason);
+ status = false;
+ break;
+ }
if (result < 0) {
status = false;
@@ -1814,19 +1832,6 @@ bool execute(struct execute_state *state,
break;
}
- if ((reason = need_to_abort(settings)) != NULL) {
- char *prev = entry_display_name(&job_list->entries[state->next]);
- char *next = (state->next + 1 < job_list->size ?
- entry_display_name(&job_list->entries[state->next + 1]) :
- strdup("nothing"));
- write_abort_file(resdirfd, reason, prev, next);
- free(prev);
- free(next);
- free(reason);
- status = false;
- break;
- }
-
if (result > 0) {
double time_left = state->time_left;