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 1/2] runner: Create results after each tests end
Date: Mon, 20 Jul 2026 18:15:25 +0200 [thread overview]
Message-ID: <20260720161526.64709-2-kamil.konieczny@linux.intel.com> (raw)
In-Reply-To: <20260720161526.64709-1-kamil.konieczny@linux.intel.com>
Sometimes it is desireable to have results present after an
execution of each test, so if any unexpected reboot happen, there
is at least result with already executed ones. Before creating
new results.json, previous one from test before is saved into
results.old file.
This will have one drawback of not containing any info about last
test which causes sudden machine reboot.
Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
runner/executor.c | 50 ++++++++++++++++++++++++++++++++++++++++++----
runner/resultgen.c | 6 +++++-
2 files changed, 51 insertions(+), 5 deletions(-)
diff --git a/runner/executor.c b/runner/executor.c
index a8907c575..b204fdffc 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -41,6 +41,7 @@
#include "executor.h"
#include "kmemleak.h"
#include "output_strings.h"
+#include "resultgen.h"
#include "runnercomms.h"
#define KMSG_HEADER "[IGT] "
@@ -2466,6 +2467,40 @@ static int open_comms_if_valid(int resdirfd, size_t testidx)
return -1;
}
+static void write_endtime(int resdirfd, double a_time)
+{
+ int timefd = openat(resdirfd, "endtime.txt", O_CREAT | O_WRONLY | O_EXCL, 0666);
+
+ if (timefd >= 0) {
+ dprintf(timefd, "%f\n", a_time);
+ close(timefd);
+ }
+}
+
+static bool generate_results_with_endtime(int resdirfd, struct settings *settings)
+{
+ char *results_path = settings->results_path;
+ double beg_time = timeofday_double();
+ double end_time;
+ bool ret;
+
+ remove_file(resdirfd, "results.bak");
+ renameat(resdirfd, "results.json", resdirfd, "results.bak");
+
+ write_endtime(resdirfd, beg_time);
+ ret = generate_results_path(results_path);
+ if (settings->sync)
+ fsync(resdirfd);
+
+ end_time = timeofday_double();
+ if (settings->log_level >= LOG_LEVEL_NORMAL) {
+ outf("generating results took: %.6ffs\n", end_time - beg_time);
+ fflush(stdout);
+ }
+
+ return ret;
+}
+
bool execute(struct execute_state *state,
struct settings *settings,
struct job_list *job_list)
@@ -2718,8 +2753,18 @@ bool execute(struct execute_state *state,
if (!initialize_execute_state_from_resume(resdirfd, state, settings, job_list))
return false;
state->time_left = time_left;
+ /* it should check option, also measure time taken */
+ if (!generate_results_with_endtime(resdirfd, settings))
+ 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;
+ }
}
/* Collect facts after the last test runs */
@@ -2731,10 +2776,7 @@ bool execute(struct execute_state *state,
settings->kmemleak_each, settings->sync))
errf("Failed to collect kmemleak logs after the last test\n");
- if ((timefd = openat(resdirfd, "endtime.txt", O_CREAT | O_WRONLY | O_EXCL, 0666)) >= 0) {
- dprintf(timefd, "%f\n", timeofday_double());
- close(timefd);
- }
+ write_endtime(resdirfd, timeofday_double());
end:
if (settings->enable_code_coverage && !settings->cov_results_per_test) {
diff --git a/runner/resultgen.c b/runner/resultgen.c
index 1ee167fb0..f5a91f542 100644
--- a/runner/resultgen.c
+++ b/runner/resultgen.c
@@ -2555,9 +2555,13 @@ bool generate_results(int dirfd)
bool generate_results_path(char *resultspath)
{
int dirfd = open(resultspath, O_DIRECTORY | O_RDONLY);
+ bool ret;
if (dirfd < 0)
return false;
- return generate_results(dirfd);
+ ret = generate_results(dirfd);
+ close(dirfd);
+
+ return ret;
}
--
2.54.0
next prev parent reply other threads:[~2026-07-20 16:17 UTC|newest]
Thread overview: 3+ 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 ` Kamil Konieczny [this message]
2026-07-20 16:15 ` [PATCH i-g-t v1 2/2] runner: Create new option for incremental results Kamil Konieczny
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-2-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