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

Petri Latvala petri.latvala at intel.com
Fri May 31 09:56:19 UTC 2019


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 at intel.com>
Cc: Tomi Sarvela <tomi.p.sarvela at intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler at 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;
+
 	subtests->size++;
 	subtests->names = realloc(subtests->names, sizeof(*subtests->names) * subtests->size);
 	subtests->names[subtests->size - 1] = subtest;
-- 
2.19.1



More information about the igt-dev mailing list