[igt-dev] [PATCH i-g-t] runner: Exit with 2 when overall timeout exceeded

Petri Latvala petri.latvala at intel.com
Mon Feb 18 13:10:14 UTC 2019


That leaves exitcode 1 for aborts and initialization failures. Should
maybe differentiate those as well. Not to mention document the exit
codes.

Also fix igt_resume to follow suit to igt_runner: Generate
results.json even when aborting or exceeding overall-timeout.

Signed-off-by: Petri Latvala <petri.latvala at intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
Cc: Tomi Sarvela <tomi.p.sarvela at intel.com>
---
 runner/resume.c | 15 ++++++++++++---
 runner/runner.c |  8 ++++++++
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/runner/resume.c b/runner/resume.c
index b3a2a71e..d5a20e80 100644
--- a/runner/resume.c
+++ b/runner/resume.c
@@ -15,6 +15,7 @@ int main(int argc, char **argv)
 	struct settings settings;
 	struct job_list job_list;
 	struct execute_state state;
+	int exitcode = 0;
 	int dirfd;
 
 	init_settings(&settings);
@@ -35,13 +36,21 @@ int main(int argc, char **argv)
 	}
 
 	if (!execute(&state, &settings, &job_list)) {
-		return 1;
+		exitcode = 1;
+	}
+
+	if (state.time_left == 0.0) {
+		/*
+		 * Overall timeout happened. Results generation can
+		 * override this
+		 */
+		exitcode = 2;
 	}
 
 	if (!generate_results_path(settings.results_path)) {
-		return 1;
+		exitcode = 1;
 	}
 
 	printf("Done.\n");
-	return 0;
+	return exitcode;
 }
diff --git a/runner/runner.c b/runner/runner.c
index 013af551..e1a6ccba 100644
--- a/runner/runner.c
+++ b/runner/runner.c
@@ -32,6 +32,14 @@ int main(int argc, char **argv)
 		exitcode = 1;
 	}
 
+	if (state.time_left == 0.0) {
+		/*
+		 * Overall timeout happened. Results generation can
+		 * override this
+		 */
+		exitcode = 2;
+	}
+
 	if (!generate_results_path(settings.results_path)) {
 		exitcode = 1;
 	}
-- 
2.19.1



More information about the igt-dev mailing list