Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kamil Konieczny <kamil.konieczny@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Subject: [PATCH i-g-t v1 2/2] runner: Create new option for incremental results
Date: Mon, 20 Jul 2026 18:15:26 +0200	[thread overview]
Message-ID: <20260720161526.64709-3-kamil.konieczny@linux.intel.com> (raw)
In-Reply-To: <20260720161526.64709-1-kamil.konieczny@linux.intel.com>

Create new option --inc-results which will make results.json
after each test was run, not only after last one.

Please note that this could be somewhat misleading when a kernel
panic happens during an execution, as a real test causing this
will not be there. In such cases one still needs to run
igt_results to add that last one to results.

Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 runner/executor.c | 19 +++++++++++++------
 runner/settings.c |  8 ++++++++
 runner/settings.h |  1 +
 3 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/runner/executor.c b/runner/executor.c
index b204fdffc..7c923bed3 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -2045,6 +2045,11 @@ static bool clear_old_results(char *path)
 		return false;
 	}
 
+	if (remove_file(dirfd, "results.old")) {
+		errf("Error clearing results.old : %m\n");
+		return false;
+	}
+
 	for (i = 0; true; i++) {
 		struct stat st;
 
@@ -2484,6 +2489,9 @@ static bool generate_results_with_endtime(int resdirfd, struct settings *setting
 	double end_time;
 	bool ret;
 
+	if (!settings->inc_results)
+		return true;
+
 	remove_file(resdirfd, "results.bak");
 	renameat(resdirfd, "results.json", resdirfd, "results.bak");
 
@@ -2758,12 +2766,11 @@ bool execute(struct execute_state *state,
 				return false;
 
 			return execute(state, settings, job_list);
-		}
-
-		/* it should check option, also measure time taken */
-		if (!generate_results_with_endtime(resdirfd, settings)) {
-			status = false;
-			break;
+		} else {
+			if (!generate_results_with_endtime(resdirfd, settings)) {
+				status = false;
+				break;
+			}
 		}
 	}
 
diff --git a/runner/settings.c b/runner/settings.c
index 3ccf71870..c52fed92b 100644
--- a/runner/settings.c
+++ b/runner/settings.c
@@ -23,6 +23,7 @@ enum {
 	OPT_DISK_USAGE_LIMIT,
 	OPT_TEST_LIST,
 	OPT_IGNORE_MISSING,
+	OPT_INC_RESULTS,
 	OPT_PIGLIT_DMESG,
 	OPT_DMESG_WARN_LEVEL,
 	OPT_OVERALL_TIMEOUT,
@@ -309,6 +310,7 @@ static const char *usage_str =
 	"                        Set an environment variable for the test process.\n"
 	"                        If only the key is provided, the current value is read\n"
 	"                        from the runner's environment (and saved for resumes).\n"
+	"  --inc-results         Save results incrementally after each test was run\n"
 	"  -L, --list-all        List all matching subtests instead of running\n"
 	"  --collect-code-cov    Enables gcov-based collect of code coverage for tests.\n"
 	"                        Requires --collect-script FILENAME\n"
@@ -693,6 +695,7 @@ bool parse_options(int argc, char **argv,
 		{"abort-on-monitored-error", optional_argument, NULL, OPT_ABORT_ON_ERROR},
 		{"disk-usage-limit", required_argument, NULL, OPT_DISK_USAGE_LIMIT},
 		{"facts", no_argument, NULL, OPT_FACTS},
+		{"inc-results", no_argument, NULL, OPT_INC_RESULTS},
 		{"kmemleak", optional_argument, NULL, OPT_KMEMLEAK},
 		{"sync", no_argument, NULL, OPT_SYNC},
 		{"log-level", required_argument, NULL, OPT_LOG_LEVEL},
@@ -768,6 +771,9 @@ bool parse_options(int argc, char **argv,
 		case OPT_FACTS:
 			settings->facts = true;
 			break;
+		case OPT_INC_RESULTS:
+			settings->inc_results = true;
+			break;
 		case OPT_KMEMLEAK:
 			/* The default is once */
 			settings->kmemleak = true;
@@ -1235,6 +1241,7 @@ bool serialize_settings(struct settings *settings)
 	SERIALIZE_INT(f, settings, dry_run);
 	SERIALIZE_INT(f, settings, allow_non_root);
 	SERIALIZE_INT(f, settings, facts);
+	SERIALIZE_INT(f, settings, inc_results);
 	SERIALIZE_INT(f, settings, kmemleak);
 	SERIALIZE_INT(f, settings, kmemleak_each);
 	SERIALIZE_INT(f, settings, sync);
@@ -1353,6 +1360,7 @@ bool read_settings_from_file(struct settings *settings, FILE *f)
 		PARSE_INT(settings, name, val, dry_run);
 		PARSE_INT(settings, name, val, allow_non_root);
 		PARSE_INT(settings, name, val, facts);
+		PARSE_INT(settings, name, val, inc_results);
 		PARSE_INT(settings, name, val, kmemleak);
 		PARSE_INT(settings, name, val, kmemleak_each);
 		PARSE_INT(settings, name, val, sync);
diff --git a/runner/settings.h b/runner/settings.h
index 6c58c3282..10f95f286 100644
--- a/runner/settings.h
+++ b/runner/settings.h
@@ -62,6 +62,7 @@ struct settings {
 	struct igt_list_head env_vars;
 	struct igt_vec hook_strs;
 	bool facts;
+	bool inc_results;
 	bool kmemleak;
 	bool kmemleak_each;
 	bool sync;
-- 
2.54.0


  parent reply	other threads:[~2026-07-20 16:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 16:15 [PATCH i-g-t RFC v1 0/2] runner: create results incrementally Kamil Konieczny
2026-07-20 16:15 ` [PATCH i-g-t v1 1/2] runner: Create results after each tests end Kamil Konieczny
2026-07-21 13:17   ` [i-g-t,v1,1/2] " Knop, Ryszard
2026-07-20 16:15 ` Kamil Konieczny [this message]
2026-07-21 13:20   ` [i-g-t,v1,2/2] runner: Create new option for incremental results Knop, Ryszard
2026-07-21 22:20 ` [PATCH i-g-t RFC v1 0/2] runner: create results incrementally Gustavo Sousa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260720161526.64709-3-kamil.konieczny@linux.intel.com \
    --to=kamil.konieczny@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox