Re: [i-g-t,v1,2/2] runner: Create new option for incremental results
"Knop, Ryszard" <[email protected]>
| Newsgroups | org.freedesktop.lists.igt-dev |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 2026-07-20 at 18:15 +0200, Kamil Konieczny wrote: > 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 <[email protected]> > --- > 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" Can this be named something like "--save-results-after-each-test" or something like that? It's not really "incremental", the entire results.json is getting generated from scratch on each run, and a longer name is a bit more descriptive. > " -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; Thanks, Ryszard