[PATCH i-g-t 5/5] runner/resultgen: Add cmdline to results.json

Lucas De Marchi lucas.demarchi at intel.com
Fri Jan 17 23:17:51 UTC 2025


For easier repro scenarios, add the cmdline to the json: one can see the
exact command executed to try to reproduce a CI failure without needing
extra files.

Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
 runner/resultgen.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/runner/resultgen.c b/runner/resultgen.c
index 87847bf5b..0d3a569cf 100644
--- a/runner/resultgen.c
+++ b/runner/resultgen.c
@@ -2281,7 +2281,7 @@ struct json_object *generate_results_json(int dirfd)
 {
 	struct settings settings;
 	struct job_list job_list;
-	struct json_object *obj, *elapsed;
+	struct json_object *obj, *elapsed, *arr;
 	struct results results;
 	int testdirfd, fd;
 	size_t i;
@@ -2319,6 +2319,11 @@ struct json_object *generate_results_json(int dirfd)
 		close(fd);
 	}
 
+	arr = json_object_new_array();
+	for (i = 0; i < settings.cmdline.argc; i++)
+		json_object_array_add(arr, json_object_new_string(settings.cmdline.argv[i]));
+	json_object_object_add(obj, "cmdline", arr);
+
 	elapsed = json_object_new_object();
 	json_object_object_add(elapsed, "__type__", json_object_new_string("TimeAttribute"));
 	if ((fd = openat(dirfd, "starttime.txt", O_RDONLY)) >= 0) {
-- 
2.48.0



More information about the igt-dev mailing list