[igt-dev] [PATCH i-g-t 1/2] runner: Use exitcode 127 when resume is impossible

Petri Latvala petri.latvala at intel.com
Tue Jul 21 09:12:53 UTC 2020


igt_resume is typically used in a scripted loop, with automatic
reboots and retries. It already uses separate exit codes for being
done (0), requiring a reboot and a retry (1) and requiring a retry due
to exceeding its overall time quota (2). Introduce another exit code,
127, for circumstances where execution in the given directory is
impossible and retrying would never terminate. One example case is
a kernel bug causing the filesystem to go enough bonkers to make the
runner settings files disappear.

As a drive-by improvement, also print something when that happens.

Signed-off-by: Petri Latvala <petri.latvala at intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
---
 runner/resume.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/runner/resume.c b/runner/resume.c
index d5a20e80..f5d69e21 100644
--- a/runner/resume.c
+++ b/runner/resume.c
@@ -28,11 +28,12 @@ int main(int argc, char **argv)
 
 	if ((dirfd = open(argv[1], O_RDONLY | O_DIRECTORY)) < 0) {
 		fprintf(stderr, "Failure opening %s: %s\n", argv[1], strerror(errno));
-		return 1;
+		return 127;
 	}
 
 	if (!initialize_execute_state_from_resume(dirfd, &state, &settings, &job_list)) {
-		return 1;
+		fprintf(stderr, "Failure reading metadata in %s\n", argv[1]);
+		return 127;
 	}
 
 	if (!execute(&state, &settings, &job_list)) {
-- 
2.20.1



More information about the igt-dev mailing list