[PATCH i-g-t] runner/executor.c: Detect tests killed by a signal

Peter Senna Tschudin peter.senna at linux.intel.com
Wed Aug 28 06:40:44 UTC 2024


Make igt-runner aware about tests being killed by signals. Before this
patch, manually killing a test process would result in igt-runner silently
marking the test as incomplete.

Now igt-runner aborts the run verbosely. As an example the following is 
from results.json:
 This test caused an abort condition: Test terminated by a signal -9

Cc: Petri Latvala <adrinael at adrinael.net>
Cc: kamil Konieczny <kamil.konieczny at linux.intel.com>
Signed-off-by: Peter Senna Tschudin <peter.senna at intel.com>
---
 runner/executor.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/runner/executor.c b/runner/executor.c
index ac73e1dde..208c2f7a6 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -960,6 +960,21 @@ static int monitor_output(pid_t child,
 
 		igt_gettime(&time_now);
 
+		if (waitpid(child, &status, WNOHANG) == child) {
+			if(WIFSIGNALED(status)) {
+				/* The test terminated by a signal */
+
+				aborting = true;
+				killed = -WTERMSIG(status);
+
+				sprintf(buf, "Test terminated by a signal %d\n", killed);
+				errf("%s", buf);
+				*abortreason = strdup(buf);
+
+				break;
+			}
+		}
+
 		/* TODO: Refactor these handlers to their own functions */
 		if (outfd >= 0 && FD_ISSET(outfd, &set)) {
 			char *newline;
-- 
2.34.1



More information about the igt-dev mailing list