Re: [igt-dev] [PATCH i-g-t] runner: Cope with repeated subtests in journal

Chris Wilson
2019-05-31T11:36:25Z

Quoting Petri Latvala (2019-05-31 10:56:19)
> As seen in fallout with the i915 engine discovery patchset, subtests
> can in very dire cases be entered multiple times, when the for loop
> they're in doesn't progress. That is of course a bug in IGT that needs
> to be fixed, but if (when) that happens again, don't make results take
> a million years to process.
>
> This patch has been tested to produce good results from the
> corresponding bad runs.
>
> Signed-off-by: Petri Latvala <petri.latvala@intel.com>
> Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>
> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> ---
> runner/resultgen.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/runner/resultgen.c b/runner/resultgen.c
> index 2b7d26d5..7b4cd519 100644
> --- a/runner/resultgen.c
> +++ b/runner/resultgen.c
> @@ -742,6 +742,7 @@ static const char *result_from_exitcode(int exitcode)
> static void add_subtest(struct subtests *subtests, char *subtest)
> {
> size_t len = strlen(subtest);
> + size_t i;
>
> if (len == 0)
> return;
> @@ -749,6 +750,11 @@ static void add_subtest(struct subtests *subtests, char *subtest)
> if (subtest[len - 1] == '\n')
> subtest[len - 1] = '\0';
>
> + /* Don't add if we already have this subtest */
> + for (i = 0; i < subtests->size; i++)
> + if (!strcmp(subtest, subtests->names[i]))
> + return;

Looks sane in the short term. I wonder how well it would scale, but
until we want to spend weeks running tests, I'm fairly confident we will
not reach 1M subtests.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris