All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 01/11] runner/resultgen: Extract igt-version field handling to a helper
@ 2019-12-17  9:47 Petri Latvala
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t v2 02/11] runner/resultgen: Extract finding begin/end lines for a subtest " Petri Latvala
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Petri Latvala @ 2019-12-17  9:47 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 runner/resultgen.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/runner/resultgen.c b/runner/resultgen.c
index aa438000..31bc0bb1 100644
--- a/runner/resultgen.c
+++ b/runner/resultgen.c
@@ -365,6 +365,17 @@ static void free_matches(struct matches *matches)
 	free(matches->items);
 }
 
+static void add_igt_version(struct json_object *testobj,
+			    const char *igt_version,
+			    size_t igt_version_len)
+{
+	if (igt_version)
+		json_object_object_add(testobj, "igt-version",
+				       json_object_new_string_len(igt_version,
+								  igt_version_len));
+
+}
+
 static bool fill_from_output(int fd, const char *binary, const char *key,
 			     struct subtest_list *subtests,
 			     struct json_object *tests)
@@ -420,10 +431,7 @@ static bool fill_from_output(int fd, const char *binary, const char *key,
 
 		json_object_object_add(current_test, key,
 				       json_object_new_string_len(buf, statbuf.st_size));
-		if (igt_version)
-			json_object_object_add(current_test, "igt-version",
-					       json_object_new_string_len(igt_version,
-									  igt_version_len));
+		add_igt_version(current_test, igt_version, igt_version_len);
 
 		return true;
 	}
@@ -522,11 +530,7 @@ static bool fill_from_output(int fd, const char *binary, const char *key,
 		json_object_object_add(current_test, key,
 				       json_object_new_string_len(beg, end - beg));
 
-		if (igt_version) {
-			json_object_object_add(current_test, "igt-version",
-					       json_object_new_string_len(igt_version,
-									  igt_version_len));
-		}
+		add_igt_version(current_test, igt_version, igt_version_len);
 
 		if (!json_object_object_get_ex(current_test, "result", NULL)) {
 			parse_subtest_result(subtests->subs[i].name,
@@ -608,10 +612,7 @@ static bool fill_from_output(int fd, const char *binary, const char *key,
 
 				json_object_object_add(current_dynamic_test, key,
 						       json_object_new_string_len(dynbeg, dynend - dynbeg));
-				if (igt_version)
-					json_object_object_add(current_dynamic_test, "igt-version",
-							       json_object_new_string_len(igt_version,
-											  igt_version_len));
+				add_igt_version(current_dynamic_test, igt_version, igt_version_len);
 
 				if (!json_object_object_get_ex(current_dynamic_test, "result", NULL)) {
 					const char *dynresulttext;
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t v2 02/11] runner/resultgen: Extract finding begin/end lines for a subtest to a helper
  2019-12-17  9:47 [igt-dev] [PATCH i-g-t 01/11] runner/resultgen: Extract igt-version field handling to a helper Petri Latvala
@ 2019-12-17  9:47 ` Petri Latvala
  2019-12-27  8:45   ` Arkadiusz Hiler
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t v2 03/11] runner/resultgen: Extract finding begin/end pointers for test output to helpers Petri Latvala
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 12+ messages in thread
From: Petri Latvala @ 2019-12-17  9:47 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

v2: Use an enum to select a pattern string for asprintf (Arek)

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 runner/resultgen.c | 106 +++++++++++++++++++++++++--------------------
 1 file changed, 58 insertions(+), 48 deletions(-)

diff --git a/runner/resultgen.c b/runner/resultgen.c
index 31bc0bb1..e14a31b8 100644
--- a/runner/resultgen.c
+++ b/runner/resultgen.c
@@ -376,6 +376,61 @@ static void add_igt_version(struct json_object *testobj,
 
 }
 
+enum subtest_find_pattern {
+	PATTERN_BEGIN,
+	PATTERN_RESULT,
+};
+
+static int find_subtest_idx_limited(struct matches matches,
+				    const char *bufend,
+				    const char *linekey,
+				    enum subtest_find_pattern pattern,
+				    const char *subtest_name,
+				    int first,
+				    int last)
+{
+	char *full_line;
+	int line_len;
+	int k;
+
+	switch (pattern) {
+	case PATTERN_BEGIN:
+		line_len = asprintf(&full_line, "%s%s\n", linekey, subtest_name);
+		break;
+	case PATTERN_RESULT:
+		line_len = asprintf(&full_line, "%s%s: ", linekey, subtest_name);
+		break;
+	default:
+		assert(!"Unknown pattern");
+	}
+
+	if (line_len < 0)
+		return -1;
+
+	for (k = first; k < last; k++)
+		if (matches.items[k].what == linekey &&
+		    !memcmp(matches.items[k].where,
+			    full_line,
+			    min(line_len, bufend - matches.items[k].where)))
+			break;
+
+	free(full_line);
+
+	if (k == last)
+		k = -1;
+
+	return k;
+}
+
+static int find_subtest_idx(struct matches matches,
+			    const char *bufend,
+			    const char *linekey,
+			    enum subtest_find_pattern pattern,
+			    const char *subtest_name)
+{
+	return find_subtest_idx_limited(matches, bufend, linekey, pattern, subtest_name, 0, matches.size);
+}
+
 static bool fill_from_output(int fd, const char *binary, const char *key,
 			     struct subtest_list *subtests,
 			     struct json_object *tests)
@@ -439,44 +494,16 @@ static bool fill_from_output(int fd, const char *binary, const char *key,
 	matches = find_matches(buf, bufend, needles);
 
 	for (i = 0; i < subtests->size; i++) {
-		char *this_sub_begin, *this_sub_result;
 		int begin_idx = -1, result_idx = -1;
 		const char *resulttext;
 		const char *beg, *end;
 		double time;
-		int begin_len;
-		int result_len;
 
 		generate_piglit_name(binary, subtests->subs[i].name, piglit_name, sizeof(piglit_name));
 		current_test = get_or_create_json_object(tests, piglit_name);
 
-		begin_len = asprintf(&this_sub_begin, "%s%s\n", STARTING_SUBTEST, subtests->subs[i].name);
-		result_len = asprintf(&this_sub_result, "%s%s: ", SUBTEST_RESULT, subtests->subs[i].name);
-
-		if (begin_len < 0 || result_len < 0) {
-			fprintf(stderr, "Failure generating strings\n");
-			return false;
-		}
-
-		for (k = 0; k < matches.size; k++) {
-			if (matches.items[k].what == STARTING_SUBTEST &&
-			    !memcmp(matches.items[k].where,
-				    this_sub_begin,
-				    min(begin_len, bufend - matches.items[k].where))) {
-				beg = matches.items[k].where;
-				begin_idx = k;
-			}
-			if (matches.items[k].what == SUBTEST_RESULT &&
-			    !memcmp(matches.items[k].where,
-				    this_sub_result,
-				    min(result_len, bufend - matches.items[k].where))) {
-				end = matches.items[k].where;
-				result_idx = k;
-			}
-		}
-
-		free(this_sub_begin);
-		free(this_sub_result);
+		begin_idx = find_subtest_idx(matches, bufend, STARTING_SUBTEST, PATTERN_BEGIN, subtests->subs[i].name);
+		result_idx = find_subtest_idx(matches, bufend, SUBTEST_RESULT, PATTERN_RESULT, subtests->subs[i].name);
 
 		if (begin_idx < 0 && result_idx < 0) {
 			/* No output at all */
@@ -562,31 +589,14 @@ static bool fill_from_output(int fd, const char *binary, const char *key,
 				int dyn_result_idx = -1;
 				char dynamic_name[256];
 				char dynamic_piglit_name[256];
-				char *this_dyn_result;
-				int dyn_result_len;
 				const char *dynbeg, *dynend;
-				int n;
 
 				if (sscanf(matches.items[k].where + strlen(STARTING_DYNAMIC_SUBTEST), "%s", dynamic_name) != 1) {
 					/* Cannot parse name, just ignore this one */
 					continue;
 				}
 
-				dyn_result_len = asprintf(&this_dyn_result, "%s%s: ", DYNAMIC_SUBTEST_RESULT, dynamic_name);
-				if (dyn_result_len < 0)
-					continue;
-
-				for (n = k + 1; n < result_idx; n++) {
-					if (matches.items[n].what == DYNAMIC_SUBTEST_RESULT &&
-					    !memcmp(matches.items[n].where,
-						    this_dyn_result,
-						    min(dyn_result_len, bufend - matches.items[n].where))) {
-						dyn_result_idx = n;
-						break;
-					}
-				}
-
-				free(this_dyn_result);
+				dyn_result_idx = find_subtest_idx_limited(matches, end, DYNAMIC_SUBTEST_RESULT, PATTERN_RESULT, dynamic_name, k, result_idx);
 
 				if (k == 0)
 					dynbeg = beg;
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t v2 03/11] runner/resultgen: Extract finding begin/end pointers for test output to helpers
  2019-12-17  9:47 [igt-dev] [PATCH i-g-t 01/11] runner/resultgen: Extract igt-version field handling to a helper Petri Latvala
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t v2 02/11] runner/resultgen: Extract finding begin/end lines for a subtest " Petri Latvala
@ 2019-12-17  9:47 ` Petri Latvala
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t v2 04/11] runner/resultgen: Hoist handling of dynamic subtest output to a helper Petri Latvala
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Petri Latvala @ 2019-12-17  9:47 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

v2: Rebase

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 runner/resultgen.c | 211 +++++++++++++++++++++++----------------------
 1 file changed, 109 insertions(+), 102 deletions(-)

diff --git a/runner/resultgen.c b/runner/resultgen.c
index e14a31b8..f91c6884 100644
--- a/runner/resultgen.c
+++ b/runner/resultgen.c
@@ -431,6 +431,71 @@ static int find_subtest_idx(struct matches matches,
 	return find_subtest_idx_limited(matches, bufend, linekey, pattern, subtest_name, 0, matches.size);
 }
 
+static const char *find_subtest_begin_limit(struct matches matches,
+					    int begin_idx,
+					    int result_idx,
+					    const char *buf,
+					    const char *bufend)
+{
+	/* No matching output at all, include everything */
+	if (begin_idx < 0 && result_idx < 0)
+		return buf;
+
+	if (begin_idx < 0) {
+		/*
+		 * Subtest didn't start, but we have the
+		 * result. Probably because an igt_fixture
+		 * made it fail/skip.
+		 *
+		 * We go backwards one match from the result match,
+		 * and start from the next line.
+		 */
+		if (result_idx > 0)
+			return next_line(matches.items[result_idx - 1].where, bufend);
+		else
+			return buf;
+	}
+
+	/* Include all non-special output before the beginning line. */
+	if (begin_idx == 0)
+		return buf;
+
+	return next_line(matches.items[begin_idx - 1].where, bufend);
+}
+
+static const char *find_subtest_end_limit(struct matches matches,
+					  int begin_idx,
+					  int result_idx,
+					  const char *buf,
+					  const char *bufend)
+{
+	int k;
+
+	/* No matching output at all, include everything */
+	if (begin_idx < 0 && result_idx < 0)
+		return bufend;
+
+	if (result_idx < 0) {
+		/*
+		 * Incomplete result. Include all output up to the
+		 * next starting subtest, or the result of one.
+		 */
+		for (k = begin_idx + 1; k < matches.size; k++) {
+			if (matches.items[k].what == STARTING_SUBTEST ||
+			    matches.items[k].what == SUBTEST_RESULT)
+				return matches.items[k].where;
+		}
+
+		return bufend;
+	}
+
+	/* Include all non-special output to the next match, whatever it is. */
+	if (result_idx < matches.size - 1)
+		return matches.items[result_idx + 1].where;
+
+	return bufend;
+}
+
 static bool fill_from_output(int fd, const char *binary, const char *key,
 			     struct subtest_list *subtests,
 			     struct json_object *tests)
@@ -505,54 +570,8 @@ static bool fill_from_output(int fd, const char *binary, const char *key,
 		begin_idx = find_subtest_idx(matches, bufend, STARTING_SUBTEST, PATTERN_BEGIN, subtests->subs[i].name);
 		result_idx = find_subtest_idx(matches, bufend, SUBTEST_RESULT, PATTERN_RESULT, subtests->subs[i].name);
 
-		if (begin_idx < 0 && result_idx < 0) {
-			/* No output at all */
-			beg = buf;
-			end = bufend;
-		} else if (begin_idx < 0) {
-			/*
-			 * Subtest didn't start, but we have the
-			 * result. Probably because an igt_fixture
-			 * made it fail/skip.
-			 *
-			 * Start the output right after the previous
-			 * subtest result/start.
-			 */
-			if (result_idx > 0)
-				beg = next_line(matches.items[result_idx - 1].where, bufend);
-			else
-				beg = buf;
-		} else {
-			/* Stretch output beginning backwards */
-			if (begin_idx == 0)
-				beg = buf;
-			else
-				beg = next_line(matches.items[begin_idx - 1].where, bufend);
-		}
-
-		if (result_idx < 0 && begin_idx < 0) {
-			/* No output at all: Already handled above */
-		} else if (result_idx < 0) {
-			/*
-			 * Incomplete result. Include output up to the
-			 * next starting subtest or result.
-			 */
-			for (k = begin_idx + 1; k < matches.size; k++) {
-				if (matches.items[k].what == STARTING_SUBTEST ||
-				    matches.items[k].what == SUBTEST_RESULT)
-					break;
-			}
-			if (k < matches.size)
-				end = matches.items[k].where;
-			else
-				end = bufend;
-		} else {
-			/* Stretch output to the next starting subtest or result. */
-			if (result_idx < matches.size - 1)
-				end = matches.items[result_idx + 1].where;
-			else
-				end = bufend;
-		}
+		beg = find_subtest_begin_limit(matches, begin_idx, result_idx, buf, bufend);
+		end = find_subtest_end_limit(matches, begin_idx, result_idx, buf, bufend);
 
 		json_object_object_add(current_test, key,
 				       json_object_new_string_len(beg, end - beg));
@@ -574,68 +593,56 @@ static bool fill_from_output(int fd, const char *binary, const char *key,
 		 * the subtest output.
 		 */
 		if (result_idx < 0) {
-			/* If the subtest itself is incomplete, stop at the next start of a subtest */
+			/* If the subtest itself is incomplete, stop at the next start/end of a subtest */
 			for (result_idx = begin_idx + 1;
 			     result_idx < matches.size;
 			     result_idx++) {
-				if (matches.items[result_idx].what == STARTING_SUBTEST)
+				if (matches.items[result_idx].what == STARTING_SUBTEST ||
+				    matches.items[result_idx].what == SUBTEST_RESULT)
 					break;
 			}
 		}
 
 		for (k = begin_idx + 1; k < result_idx; k++) {
-			if (matches.items[k].what == STARTING_DYNAMIC_SUBTEST) {
-				struct json_object *current_dynamic_test = NULL;
-				int dyn_result_idx = -1;
-				char dynamic_name[256];
-				char dynamic_piglit_name[256];
-				const char *dynbeg, *dynend;
-
-				if (sscanf(matches.items[k].where + strlen(STARTING_DYNAMIC_SUBTEST), "%s", dynamic_name) != 1) {
-					/* Cannot parse name, just ignore this one */
-					continue;
-				}
-
-				dyn_result_idx = find_subtest_idx_limited(matches, end, DYNAMIC_SUBTEST_RESULT, PATTERN_RESULT, dynamic_name, k, result_idx);
-
-				if (k == 0)
-					dynbeg = beg;
-				else
-					dynbeg = next_line(matches.items[k - 1].where, end);
-
-				if (dyn_result_idx < 0) {
-					if (k < matches.size - 1)
-						dynend = matches.items[k + 1].where;
-					else
-						dynend = end;
-				} else {
-					if (dyn_result_idx < matches.size - 1)
-						dynend = matches.items[dyn_result_idx + 1].where;
-					else
-						dynend = end;
-				}
-
-				generate_piglit_name_for_dynamic(piglit_name, dynamic_name, dynamic_piglit_name, sizeof(dynamic_piglit_name));
-
-				add_dynamic_subtest(&subtests->subs[i], strdup(dynamic_name));
-				current_dynamic_test = get_or_create_json_object(tests, dynamic_piglit_name);
-
-				json_object_object_add(current_dynamic_test, key,
-						       json_object_new_string_len(dynbeg, dynend - dynbeg));
-				add_igt_version(current_dynamic_test, igt_version, igt_version_len);
-
-				if (!json_object_object_get_ex(current_dynamic_test, "result", NULL)) {
-					const char *dynresulttext;
-					double dyntime;
-
-					parse_subtest_result(dynamic_name,
-							     DYNAMIC_SUBTEST_RESULT,
-							     &dynresulttext, &dyntime,
-							     dyn_result_idx < 0 ? NULL : matches.items[dyn_result_idx].where,
-							     dynend);
-					set_result(current_dynamic_test, dynresulttext);
-					set_runtime(current_dynamic_test, dyntime);
-				}
+			struct json_object *current_dynamic_test = NULL;
+			int dyn_result_idx = -1;
+			char dynamic_name[256];
+			char dynamic_piglit_name[256];
+			const char *dynbeg, *dynend;
+
+			if (matches.items[k].what != STARTING_DYNAMIC_SUBTEST)
+				continue;
+
+			if (sscanf(matches.items[k].where + strlen(STARTING_DYNAMIC_SUBTEST), "%s", dynamic_name) != 1) {
+				/* Cannot parse name, just ignore this one */
+				continue;
+			}
+
+			dyn_result_idx = find_subtest_idx_limited(matches, end, DYNAMIC_SUBTEST_RESULT, PATTERN_RESULT, dynamic_name, k, result_idx);
+
+			dynbeg = find_subtest_begin_limit(matches, k, dyn_result_idx, beg, end);
+			dynend = find_subtest_end_limit(matches, k, dyn_result_idx, beg, end);
+
+			generate_piglit_name_for_dynamic(piglit_name, dynamic_name, dynamic_piglit_name, sizeof(dynamic_piglit_name));
+
+			add_dynamic_subtest(&subtests->subs[i], strdup(dynamic_name));
+			current_dynamic_test = get_or_create_json_object(tests, dynamic_piglit_name);
+
+			json_object_object_add(current_dynamic_test, key,
+					       json_object_new_string_len(dynbeg, dynend - dynbeg));
+			add_igt_version(current_dynamic_test, igt_version, igt_version_len);
+
+			if (!json_object_object_get_ex(current_dynamic_test, "result", NULL)) {
+				const char *dynresulttext;
+				double dyntime;
+
+				parse_subtest_result(dynamic_name,
+						     DYNAMIC_SUBTEST_RESULT,
+						     &dynresulttext, &dyntime,
+						     dyn_result_idx < 0 ? NULL : matches.items[dyn_result_idx].where,
+						     dynend);
+				set_result(current_dynamic_test, dynresulttext);
+				set_runtime(current_dynamic_test, dyntime);
 			}
 		}
 	}
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t v2 04/11] runner/resultgen: Hoist handling of dynamic subtest output to a helper
  2019-12-17  9:47 [igt-dev] [PATCH i-g-t 01/11] runner/resultgen: Extract igt-version field handling to a helper Petri Latvala
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t v2 02/11] runner/resultgen: Extract finding begin/end lines for a subtest " Petri Latvala
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t v2 03/11] runner/resultgen: Extract finding begin/end pointers for test output to helpers Petri Latvala
@ 2019-12-17  9:47 ` Petri Latvala
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t v2 05/11] runner/resultgen: Extrude dynamic subtest result texts Petri Latvala
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Petri Latvala @ 2019-12-17  9:47 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

v2: Rebase

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 runner/resultgen.c | 136 ++++++++++++++++++++++++++-------------------
 1 file changed, 78 insertions(+), 58 deletions(-)

diff --git a/runner/resultgen.c b/runner/resultgen.c
index f91c6884..4a5d329c 100644
--- a/runner/resultgen.c
+++ b/runner/resultgen.c
@@ -496,6 +496,75 @@ static const char *find_subtest_end_limit(struct matches matches,
 	return bufend;
 }
 
+static void process_dynamic_subtest_output(const char *piglit_name,
+					   const char *igt_version,
+					   size_t igt_version_len,
+					   struct matches matches,
+					   int begin_idx,
+					   int result_idx,
+					   const char *beg,
+					   const char *end,
+					   const char *key,
+					   struct json_object *tests,
+					   struct subtest *subtest)
+{
+	size_t k;
+
+	if (result_idx < 0) {
+		/* If the subtest itself is incomplete, stop at the next start/end of a subtest */
+		for (result_idx = begin_idx + 1;
+		     result_idx < matches.size;
+		     result_idx++) {
+			if (matches.items[result_idx].what == STARTING_SUBTEST ||
+			    matches.items[result_idx].what == SUBTEST_RESULT)
+				break;
+		}
+	}
+
+	for (k = begin_idx + 1; k < result_idx; k++) {
+		struct json_object *current_dynamic_test = NULL;
+		int dyn_result_idx = -1;
+		char dynamic_name[256];
+		char dynamic_piglit_name[256];
+		const char *dynbeg, *dynend;
+
+		if (matches.items[k].what != STARTING_DYNAMIC_SUBTEST)
+			continue;
+
+		if (sscanf(matches.items[k].where + strlen(STARTING_DYNAMIC_SUBTEST), "%s", dynamic_name) != 1) {
+			/* Cannot parse name, just ignore this one */
+			continue;
+		}
+
+		dyn_result_idx = find_subtest_idx_limited(matches, end, DYNAMIC_SUBTEST_RESULT, PATTERN_RESULT, dynamic_name, k, result_idx);
+
+		dynbeg = find_subtest_begin_limit(matches, k, dyn_result_idx, beg, end);
+		dynend = find_subtest_end_limit(matches, k, dyn_result_idx, beg, end);
+
+		generate_piglit_name_for_dynamic(piglit_name, dynamic_name, dynamic_piglit_name, sizeof(dynamic_piglit_name));
+
+		add_dynamic_subtest(subtest, strdup(dynamic_name));
+		current_dynamic_test = get_or_create_json_object(tests, dynamic_piglit_name);
+
+		json_object_object_add(current_dynamic_test, key,
+				       json_object_new_string_len(dynbeg, dynend - dynbeg));
+		add_igt_version(current_dynamic_test, igt_version, igt_version_len);
+
+		if (!json_object_object_get_ex(current_dynamic_test, "result", NULL)) {
+			const char *dynresulttext;
+			double dyntime;
+
+			parse_subtest_result(dynamic_name,
+					     DYNAMIC_SUBTEST_RESULT,
+					     &dynresulttext, &dyntime,
+					     dyn_result_idx < 0 ? NULL : matches.items[dyn_result_idx].where,
+					     dynend);
+			set_result(current_dynamic_test, dynresulttext);
+			set_runtime(current_dynamic_test, dyntime);
+		}
+	}
+}
+
 static bool fill_from_output(int fd, const char *binary, const char *key,
 			     struct subtest_list *subtests,
 			     struct json_object *tests)
@@ -514,7 +583,7 @@ static bool fill_from_output(int fd, const char *binary, const char *key,
 		NULL
 	};
 	struct matches matches = {};
-	size_t i, k;
+	size_t i;
 
 	if (fstat(fd, &statbuf))
 		return false;
@@ -588,63 +657,14 @@ static bool fill_from_output(int fd, const char *binary, const char *key,
 			set_runtime(current_test, time);
 		}
 
-		/*
-		 * Look for dynamic subtests: If any, they are within
-		 * the subtest output.
-		 */
-		if (result_idx < 0) {
-			/* If the subtest itself is incomplete, stop at the next start/end of a subtest */
-			for (result_idx = begin_idx + 1;
-			     result_idx < matches.size;
-			     result_idx++) {
-				if (matches.items[result_idx].what == STARTING_SUBTEST ||
-				    matches.items[result_idx].what == SUBTEST_RESULT)
-					break;
-			}
-		}
-
-		for (k = begin_idx + 1; k < result_idx; k++) {
-			struct json_object *current_dynamic_test = NULL;
-			int dyn_result_idx = -1;
-			char dynamic_name[256];
-			char dynamic_piglit_name[256];
-			const char *dynbeg, *dynend;
-
-			if (matches.items[k].what != STARTING_DYNAMIC_SUBTEST)
-				continue;
-
-			if (sscanf(matches.items[k].where + strlen(STARTING_DYNAMIC_SUBTEST), "%s", dynamic_name) != 1) {
-				/* Cannot parse name, just ignore this one */
-				continue;
-			}
-
-			dyn_result_idx = find_subtest_idx_limited(matches, end, DYNAMIC_SUBTEST_RESULT, PATTERN_RESULT, dynamic_name, k, result_idx);
-
-			dynbeg = find_subtest_begin_limit(matches, k, dyn_result_idx, beg, end);
-			dynend = find_subtest_end_limit(matches, k, dyn_result_idx, beg, end);
-
-			generate_piglit_name_for_dynamic(piglit_name, dynamic_name, dynamic_piglit_name, sizeof(dynamic_piglit_name));
-
-			add_dynamic_subtest(&subtests->subs[i], strdup(dynamic_name));
-			current_dynamic_test = get_or_create_json_object(tests, dynamic_piglit_name);
-
-			json_object_object_add(current_dynamic_test, key,
-					       json_object_new_string_len(dynbeg, dynend - dynbeg));
-			add_igt_version(current_dynamic_test, igt_version, igt_version_len);
-
-			if (!json_object_object_get_ex(current_dynamic_test, "result", NULL)) {
-				const char *dynresulttext;
-				double dyntime;
-
-				parse_subtest_result(dynamic_name,
-						     DYNAMIC_SUBTEST_RESULT,
-						     &dynresulttext, &dyntime,
-						     dyn_result_idx < 0 ? NULL : matches.items[dyn_result_idx].where,
-						     dynend);
-				set_result(current_dynamic_test, dynresulttext);
-				set_runtime(current_dynamic_test, dyntime);
-			}
-		}
+		process_dynamic_subtest_output(piglit_name,
+					       igt_version, igt_version_len,
+					       matches,
+					       begin_idx, result_idx,
+					       beg, end,
+					       key,
+					       tests,
+					       &subtests->subs[i]);
 	}
 
 	free_matches(&matches);
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t v2 05/11] runner/resultgen: Extrude dynamic subtest result texts
  2019-12-17  9:47 [igt-dev] [PATCH i-g-t 01/11] runner/resultgen: Extract igt-version field handling to a helper Petri Latvala
                   ` (2 preceding siblings ...)
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t v2 04/11] runner/resultgen: Hoist handling of dynamic subtest output to a helper Petri Latvala
@ 2019-12-17  9:47 ` Petri Latvala
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t 06/11] runner/resultgen: Add support for extra validation hook in find_matches() Petri Latvala
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Petri Latvala @ 2019-12-17  9:47 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

The first dynamic part now starts its reported output at the beginning
of its subtest's output, and the last dynamic part ends its reported
output at the end of its subtest's output.

v2: Rebase

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 runner/resultgen.c | 64 ++++++++++++++++++++++++++++++----------------
 1 file changed, 42 insertions(+), 22 deletions(-)

diff --git a/runner/resultgen.c b/runner/resultgen.c
index 4a5d329c..ed61b922 100644
--- a/runner/resultgen.c
+++ b/runner/resultgen.c
@@ -431,17 +431,18 @@ static int find_subtest_idx(struct matches matches,
 	return find_subtest_idx_limited(matches, bufend, linekey, pattern, subtest_name, 0, matches.size);
 }
 
-static const char *find_subtest_begin_limit(struct matches matches,
-					    int begin_idx,
-					    int result_idx,
-					    const char *buf,
-					    const char *bufend)
+static const char *find_subtest_begin_limit_limited(struct matches matches,
+						    int begin_idx,
+						    int result_idx,
+						    const char *buf,
+						    const char *bufend,
+						    int first_idx)
 {
 	/* No matching output at all, include everything */
-	if (begin_idx < 0 && result_idx < 0)
+	if (begin_idx < first_idx && result_idx < first_idx)
 		return buf;
 
-	if (begin_idx < 0) {
+	if (begin_idx < first_idx) {
 		/*
 		 * Subtest didn't start, but we have the
 		 * result. Probably because an igt_fixture
@@ -450,37 +451,48 @@ static const char *find_subtest_begin_limit(struct matches matches,
 		 * We go backwards one match from the result match,
 		 * and start from the next line.
 		 */
-		if (result_idx > 0)
+		if (result_idx > first_idx)
 			return next_line(matches.items[result_idx - 1].where, bufend);
 		else
 			return buf;
 	}
 
 	/* Include all non-special output before the beginning line. */
-	if (begin_idx == 0)
+	if (begin_idx <= first_idx)
 		return buf;
 
 	return next_line(matches.items[begin_idx - 1].where, bufend);
 }
 
-static const char *find_subtest_end_limit(struct matches matches,
-					  int begin_idx,
-					  int result_idx,
-					  const char *buf,
-					  const char *bufend)
+static const char *find_subtest_begin_limit(struct matches matches,
+					    int begin_idx,
+					    int result_idx,
+					    const char *buf,
+					    const char *bufend)
+{
+	return find_subtest_begin_limit_limited(matches, begin_idx, result_idx, buf, bufend, 0);
+}
+
+static const char *find_subtest_end_limit_limited(struct matches matches,
+						  int begin_idx,
+						  int result_idx,
+						  const char *buf,
+						  const char *bufend,
+						  int first_idx,
+						  int last_idx)
 {
 	int k;
 
 	/* No matching output at all, include everything */
-	if (begin_idx < 0 && result_idx < 0)
+	if (begin_idx < first_idx && result_idx < first_idx)
 		return bufend;
 
-	if (result_idx < 0) {
+	if (result_idx < first_idx) {
 		/*
 		 * Incomplete result. Include all output up to the
 		 * next starting subtest, or the result of one.
 		 */
-		for (k = begin_idx + 1; k < matches.size; k++) {
+		for (k = begin_idx + 1; k < last_idx; k++) {
 			if (matches.items[k].what == STARTING_SUBTEST ||
 			    matches.items[k].what == SUBTEST_RESULT)
 				return matches.items[k].where;
@@ -490,12 +502,21 @@ static const char *find_subtest_end_limit(struct matches matches,
 	}
 
 	/* Include all non-special output to the next match, whatever it is. */
-	if (result_idx < matches.size - 1)
+	if (result_idx < last_idx - 1)
 		return matches.items[result_idx + 1].where;
 
 	return bufend;
 }
 
+static const char *find_subtest_end_limit(struct matches matches,
+					  int begin_idx,
+					  int result_idx,
+					  const char *buf,
+					  const char *bufend)
+{
+	return find_subtest_end_limit_limited(matches, begin_idx, result_idx, buf, bufend, 0, matches.size);
+}
+
 static void process_dynamic_subtest_output(const char *piglit_name,
 					   const char *igt_version,
 					   size_t igt_version_len,
@@ -538,8 +559,8 @@ static void process_dynamic_subtest_output(const char *piglit_name,
 
 		dyn_result_idx = find_subtest_idx_limited(matches, end, DYNAMIC_SUBTEST_RESULT, PATTERN_RESULT, dynamic_name, k, result_idx);
 
-		dynbeg = find_subtest_begin_limit(matches, k, dyn_result_idx, beg, end);
-		dynend = find_subtest_end_limit(matches, k, dyn_result_idx, beg, end);
+		dynbeg = find_subtest_begin_limit_limited(matches, k, dyn_result_idx, beg, end, begin_idx + 1);
+		dynend = find_subtest_end_limit_limited(matches, k, dyn_result_idx, beg, end, begin_idx + 1, result_idx);
 
 		generate_piglit_name_for_dynamic(piglit_name, dynamic_name, dynamic_piglit_name, sizeof(dynamic_piglit_name));
 
@@ -938,8 +959,7 @@ static bool fill_from_dmesg(int fd,
 			}
 		}
 		append_line(&dmesg, &dmesglen, formatted);
-		if (current_test != NULL)
-			append_line(&dynamic_dmesg, &dynamic_dmesg_len, formatted);
+		append_line(&dynamic_dmesg, &dynamic_dmesg_len, formatted);
 		free(formatted);
 	}
 	free(line);
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t 06/11] runner/resultgen: Add support for extra validation hook in find_matches()
  2019-12-17  9:47 [igt-dev] [PATCH i-g-t 01/11] runner/resultgen: Extract igt-version field handling to a helper Petri Latvala
                   ` (3 preceding siblings ...)
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t v2 05/11] runner/resultgen: Extrude dynamic subtest result texts Petri Latvala
@ 2019-12-17  9:47 ` Petri Latvala
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t 07/11] runner/resultgen: Make subtest result line finding more robust Petri Latvala
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Petri Latvala @ 2019-12-17  9:47 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 runner/resultgen.c | 43 +++++++++++++++++++++++++------------------
 1 file changed, 25 insertions(+), 18 deletions(-)

diff --git a/runner/resultgen.c b/runner/resultgen.c
index ed61b922..8cd1aa49 100644
--- a/runner/resultgen.c
+++ b/runner/resultgen.c
@@ -324,6 +324,12 @@ struct matches
 	size_t size;
 };
 
+struct match_needle
+{
+	const char *str;
+	bool (*validate)(const char *needle, const char *line, const char *bufend);
+};
+
 static void match_add(struct matches *matches, const char *where, const char *what)
 {
 	struct match_item newitem = { where, what };
@@ -334,19 +340,20 @@ static void match_add(struct matches *matches, const char *where, const char *wh
 }
 
 static struct matches find_matches(const char *buf, const char *bufend,
-				   const char **needles)
+				   const struct match_needle *needles)
 {
 	struct matches ret = {};
 
 	while (buf < bufend) {
-		const char **needle;
+		const struct match_needle *needle;
 
-		for (needle = needles; *needle; needle++) {
-			if (bufend - buf < strlen(*needle))
+		for (needle = needles; needle->str; needle++) {
+			if (bufend - buf < strlen(needle->str))
 				continue;
 
-			if (!memcmp(buf, *needle, strlen(*needle))) {
-				match_add(&ret, buf, *needle);
+			if (!memcmp(buf, needle->str, strlen(needle->str)) &&
+			    (!needle->validate || needle->validate(needle->str, buf, bufend))) {
+				match_add(&ret, buf, needle->str);
 				goto end_find;
 			}
 		}
@@ -596,12 +603,12 @@ static bool fill_from_output(int fd, const char *binary, const char *key,
 	char *igt_version = NULL;
 	size_t igt_version_len = 0;
 	struct json_object *current_test = NULL;
-	const char *needles[] = {
-		STARTING_SUBTEST,
-		SUBTEST_RESULT,
-		STARTING_DYNAMIC_SUBTEST,
-		DYNAMIC_SUBTEST_RESULT,
-		NULL
+	struct match_needle needles[] = {
+		{ STARTING_SUBTEST, NULL },
+		{ SUBTEST_RESULT, NULL },
+		{ STARTING_DYNAMIC_SUBTEST, NULL },
+		{ DYNAMIC_SUBTEST_RESULT, NULL },
+		{ NULL, NULL },
 	};
 	struct matches matches = {};
 	size_t i;
@@ -1117,12 +1124,12 @@ static void fill_from_journal(int fd,
 
 static bool stderr_contains_warnings(const char *beg, const char *end)
 {
-	const char *needles[] = {
-		STARTING_SUBTEST,
-		SUBTEST_RESULT,
-		STARTING_DYNAMIC_SUBTEST,
-		DYNAMIC_SUBTEST_RESULT,
-		NULL
+	struct match_needle needles[] = {
+		{ STARTING_SUBTEST, NULL },
+		{ SUBTEST_RESULT, NULL },
+		{ STARTING_DYNAMIC_SUBTEST, NULL },
+		{ DYNAMIC_SUBTEST_RESULT, NULL },
+		{ NULL, NULL },
 	};
 	struct matches matches;
 	size_t i = 0;
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t 07/11] runner/resultgen: Make subtest result line finding more robust
  2019-12-17  9:47 [igt-dev] [PATCH i-g-t 01/11] runner/resultgen: Extract igt-version field handling to a helper Petri Latvala
                   ` (4 preceding siblings ...)
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t 06/11] runner/resultgen: Add support for extra validation hook in find_matches() Petri Latvala
@ 2019-12-17  9:47 ` Petri Latvala
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t 08/11] runner/json_tests: Adapt to dynamic subtest result parsing Petri Latvala
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Petri Latvala @ 2019-12-17  9:47 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

On an assertion failure, the string "Subtest xyz failed" is
printed. Make sure we don't match that for SUBTEST_RESULT, or the
equivalent for dynamic subtests.

Parsing the results already explicitly searched for the proper result
line, the difference is when we delimit output up to "the next line of
interest".

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 runner/resultgen.c | 41 +++++++++++++++++++++++++++++++++++++----
 1 file changed, 37 insertions(+), 4 deletions(-)

diff --git a/runner/resultgen.c b/runner/resultgen.c
index 8cd1aa49..f93a673c 100644
--- a/runner/resultgen.c
+++ b/runner/resultgen.c
@@ -367,6 +367,39 @@ static struct matches find_matches(const char *buf, const char *bufend,
 	return ret;
 }
 
+static bool valid_char_for_subtest_name(char x)
+{
+	return x == '-' || x == '_' || isalnum(x);
+}
+
+static bool is_subtest_result_line(const char *needle, const char *line, const char *bufend)
+{
+	line += strlen(needle);
+
+	/*
+	 * At this point of the string we're expecting:
+	 * - The subtest name (one or more of a-z, A-Z, 0-9, '-' and '_')
+	 * - The characters ':' and ' '
+	 *
+	 * If we find all those, allow parsing this line as [dynamic]
+	 * subtest result.
+	 */
+
+	if (!valid_char_for_subtest_name(*line))
+		return false;
+
+	while (line < bufend && valid_char_for_subtest_name(*line))
+		line++;
+
+	if (line >= bufend || *line++ != ':')
+		return false;
+
+	if (line >= bufend || *line++ != ' ')
+		return false;
+
+	return true;
+}
+
 static void free_matches(struct matches *matches)
 {
 	free(matches->items);
@@ -605,9 +638,9 @@ static bool fill_from_output(int fd, const char *binary, const char *key,
 	struct json_object *current_test = NULL;
 	struct match_needle needles[] = {
 		{ STARTING_SUBTEST, NULL },
-		{ SUBTEST_RESULT, NULL },
+		{ SUBTEST_RESULT, is_subtest_result_line },
 		{ STARTING_DYNAMIC_SUBTEST, NULL },
-		{ DYNAMIC_SUBTEST_RESULT, NULL },
+		{ DYNAMIC_SUBTEST_RESULT, is_subtest_result_line },
 		{ NULL, NULL },
 	};
 	struct matches matches = {};
@@ -1126,9 +1159,9 @@ static bool stderr_contains_warnings(const char *beg, const char *end)
 {
 	struct match_needle needles[] = {
 		{ STARTING_SUBTEST, NULL },
-		{ SUBTEST_RESULT, NULL },
+		{ SUBTEST_RESULT, is_subtest_result_line },
 		{ STARTING_DYNAMIC_SUBTEST, NULL },
-		{ DYNAMIC_SUBTEST_RESULT, NULL },
+		{ DYNAMIC_SUBTEST_RESULT, is_subtest_result_line },
 		{ NULL, NULL },
 	};
 	struct matches matches;
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t 08/11] runner/json_tests: Adapt to dynamic subtest result parsing
  2019-12-17  9:47 [igt-dev] [PATCH i-g-t 01/11] runner/resultgen: Extract igt-version field handling to a helper Petri Latvala
                   ` (5 preceding siblings ...)
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t 07/11] runner/resultgen: Make subtest result line finding more robust Petri Latvala
@ 2019-12-17  9:47 ` Petri Latvala
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t 09/11] runner/resultgen: Don't report subtest result if it has dynamic subtests Petri Latvala
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Petri Latvala @ 2019-12-17  9:47 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

Dynamic subtests now include more output, change the dynamic subtest
parsing test accordingly.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 .../dynamic-subtests/reference.json           | 20 +++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/runner/json_tests_data/dynamic-subtests/reference.json b/runner/json_tests_data/dynamic-subtests/reference.json
index 274173f7..24a1fe8c 100644
--- a/runner/json_tests_data/dynamic-subtests/reference.json
+++ b/runner/json_tests_data/dynamic-subtests/reference.json
@@ -22,7 +22,7 @@
       "dmesg":"<6> [23426155.175691] Console: switching to colour dummy device 80x25\n<6> [23426155.175708] [IGT] dynamic: executing\n<6> [23426155.184875] [IGT] dynamic: starting subtest debug-log-checking\n<6> [23426155.184895] [IGT] dynamic: starting dynamic subtest this-is-dynamic-1\n<6> [23426155.240164] [IGT] dynamic: starting dynamic subtest this-is-dynamic-2\n<6> [23426155.293846] [IGT] dynamic: exiting, ret=98\n<6> [23426155.294003] Console: switching to colour frame buffer device 240x75\n"
     },
     "igt@dynamic@debug-log-checking@this-is-dynamic-1":{
-      "out":"Starting dynamic subtest: this-is-dynamic-1\nStack trace:\n  #0 ..\/lib\/igt_core.c:1607 __igt_fail_assert()\n  #1 ..\/runner\/testdata\/dynamic.c:11 __real_main3()\n  #2 ..\/runner\/testdata\/dynamic.c:3 main()\n  #3 ..\/csu\/libc-start.c:342 __libc_start_main()\n  #4 [_start+0x2a]\nDynamic subtest this-is-dynamic-1: FAIL (0.055s)\n",
+      "out":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)\nStarting subtest: debug-log-checking\nStarting dynamic subtest: this-is-dynamic-1\nStack trace:\n  #0 ..\/lib\/igt_core.c:1607 __igt_fail_assert()\n  #1 ..\/runner\/testdata\/dynamic.c:11 __real_main3()\n  #2 ..\/runner\/testdata\/dynamic.c:3 main()\n  #3 ..\/csu\/libc-start.c:342 __libc_start_main()\n  #4 [_start+0x2a]\nDynamic subtest this-is-dynamic-1: FAIL (0.055s)\n",
       "igt-version":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)",
       "result":"fail",
       "time":{
@@ -30,11 +30,11 @@
         "start":0,
         "end":0.055
       },
-      "err":"Starting dynamic subtest: this-is-dynamic-1\n(dynamic:20904) CRITICAL: Test assertion failure function __real_main3, file ..\/runner\/testdata\/dynamic.c:8:\n(dynamic:20904) CRITICAL: Failed assertion: false\nDynamic subtest this-is-dynamic-1 failed.\n**** DEBUG ****\n(dynamic:20904) DEBUG: This print is from 1\n(dynamic:20904) CRITICAL: Test assertion failure function __real_main3, file ..\/runner\/testdata\/dynamic.c:8:\n(dynamic:20904) CRITICAL: Failed assertion: false\n(dynamic:20904) igt_core-INFO: Stack trace:\n(dynamic:20904) igt_core-INFO:   #0 ..\/lib\/igt_core.c:1607 __igt_fail_assert()\n(dynamic:20904) igt_core-INFO:   #1 ..\/runner\/testdata\/dynamic.c:11 __real_main3()\n(dynamic:20904) igt_core-INFO:   #2 ..\/runner\/testdata\/dynamic.c:3 main()\n(dynamic:20904) igt_core-INFO:   #3 ..\/csu\/libc-start.c:342 __libc_start_main()\n(dynamic:20904) igt_core-INFO:   #4 [_start+0x2a]\n****  END  ****\nDynamic subtest this-is-dynamic-1: FAIL (0.055s)\n",
-      "dmesg":"<6> [23426155.184875] [IGT] dynamic: starting subtest debug-log-checking\n<6> [23426155.184895] [IGT] dynamic: starting dynamic subtest this-is-dynamic-1\n"
+      "err":"Starting subtest: debug-log-checking\nStarting dynamic subtest: this-is-dynamic-1\n(dynamic:20904) CRITICAL: Test assertion failure function __real_main3, file ..\/runner\/testdata\/dynamic.c:8:\n(dynamic:20904) CRITICAL: Failed assertion: false\nDynamic subtest this-is-dynamic-1 failed.\n**** DEBUG ****\n(dynamic:20904) DEBUG: This print is from 1\n(dynamic:20904) CRITICAL: Test assertion failure function __real_main3, file ..\/runner\/testdata\/dynamic.c:8:\n(dynamic:20904) CRITICAL: Failed assertion: false\n(dynamic:20904) igt_core-INFO: Stack trace:\n(dynamic:20904) igt_core-INFO:   #0 ..\/lib\/igt_core.c:1607 __igt_fail_assert()\n(dynamic:20904) igt_core-INFO:   #1 ..\/runner\/testdata\/dynamic.c:11 __real_main3()\n(dynamic:20904) igt_core-INFO:   #2 ..\/runner\/testdata\/dynamic.c:3 main()\n(dynamic:20904) igt_core-INFO:   #3 ..\/csu\/libc-start.c:342 __libc_start_main()\n(dynamic:20904) igt_core-INFO:   #4 [_start+0x2a]\n****  END  ****\nDynamic subtest this-is-d
 ynamic-1: FAIL (0.055s)\n",
+      "dmesg":"<6> [23426155.175691] Console: switching to colour dummy device 80x25\n<6> [23426155.175708] [IGT] dynamic: executing\n<6> [23426155.184875] [IGT] dynamic: starting subtest debug-log-checking\n<6> [23426155.184895] [IGT] dynamic: starting dynamic subtest this-is-dynamic-1\n"
     },
     "igt@dynamic@debug-log-checking@this-is-dynamic-2":{
-      "out":"Starting dynamic subtest: this-is-dynamic-2\nStack trace:\n  #0 ..\/lib\/igt_core.c:1607 __igt_fail_assert()\n  #1 ..\/runner\/testdata\/dynamic.c:5 __real_main3()\n  #2 ..\/runner\/testdata\/dynamic.c:3 main()\n  #3 ..\/csu\/libc-start.c:342 __libc_start_main()\n  #4 [_start+0x2a]\nDynamic subtest this-is-dynamic-2: FAIL (0.054s)\n",
+      "out":"Starting dynamic subtest: this-is-dynamic-2\nStack trace:\n  #0 ..\/lib\/igt_core.c:1607 __igt_fail_assert()\n  #1 ..\/runner\/testdata\/dynamic.c:5 __real_main3()\n  #2 ..\/runner\/testdata\/dynamic.c:3 main()\n  #3 ..\/csu\/libc-start.c:342 __libc_start_main()\n  #4 [_start+0x2a]\nDynamic subtest this-is-dynamic-2: FAIL (0.054s)\nSubtest debug-log-checking: FAIL (0.109s)\n",
       "igt-version":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)",
       "result":"fail",
       "time":{
@@ -42,7 +42,7 @@
         "start":0,
         "end":0.054
       },
-      "err":"Starting dynamic subtest: this-is-dynamic-2\n(dynamic:20904) CRITICAL: Test assertion failure function __real_main3, file ..\/runner\/testdata\/dynamic.c:13:\n(dynamic:20904) CRITICAL: Failed assertion: false\nDynamic subtest this-is-dynamic-2 failed.\n**** DEBUG ****\n(dynamic:20904) DEBUG: This print is from 2\n(dynamic:20904) CRITICAL: Test assertion failure function __real_main3, file ..\/runner\/testdata\/dynamic.c:13:\n(dynamic:20904) CRITICAL: Failed assertion: false\n(dynamic:20904) igt_core-INFO: Stack trace:\n(dynamic:20904) igt_core-INFO:   #0 ..\/lib\/igt_core.c:1607 __igt_fail_assert()\n(dynamic:20904) igt_core-INFO:   #1 ..\/runner\/testdata\/dynamic.c:5 __real_main3()\n(dynamic:20904) igt_core-INFO:   #2 ..\/runner\/testdata\/dynamic.c:3 main()\n(dynamic:20904) igt_core-INFO:   #3 ..\/csu\/libc-start.c:342 __libc_start_main()\n(dynamic:20904) igt_core-INFO:   #4 [_start+0x2a]\n****  END  ****\nDynamic subtest this-is-dynamic-2: FAIL (0.054s)\n",
+      "err":"Starting dynamic subtest: this-is-dynamic-2\n(dynamic:20904) CRITICAL: Test assertion failure function __real_main3, file ..\/runner\/testdata\/dynamic.c:13:\n(dynamic:20904) CRITICAL: Failed assertion: false\nDynamic subtest this-is-dynamic-2 failed.\n**** DEBUG ****\n(dynamic:20904) DEBUG: This print is from 2\n(dynamic:20904) CRITICAL: Test assertion failure function __real_main3, file ..\/runner\/testdata\/dynamic.c:13:\n(dynamic:20904) CRITICAL: Failed assertion: false\n(dynamic:20904) igt_core-INFO: Stack trace:\n(dynamic:20904) igt_core-INFO:   #0 ..\/lib\/igt_core.c:1607 __igt_fail_assert()\n(dynamic:20904) igt_core-INFO:   #1 ..\/runner\/testdata\/dynamic.c:5 __real_main3()\n(dynamic:20904) igt_core-INFO:   #2 ..\/runner\/testdata\/dynamic.c:3 main()\n(dynamic:20904) igt_core-INFO:   #3 ..\/csu\/libc-start.c:342 __libc_start_main()\n(dynamic:20904) igt_core-INFO:   #4 [_start+0x2a]\n****  END  ****\nDynamic subtest this-is-dynamic-2: FAIL (0.054s)\nSubtest debu
 g-log-checking failed.\nNo log.\nSubtest debug-log-checking: FAIL (0.109s)\n",
       "dmesg":"<6> [23426155.240164] [IGT] dynamic: starting dynamic subtest this-is-dynamic-2\n<6> [23426155.293846] [IGT] dynamic: exiting, ret=98\n<6> [23426155.294003] Console: switching to colour frame buffer device 240x75\n"
     },
     "igt@dynamic@empty-container":{
@@ -70,7 +70,7 @@
       "dmesg":"<6> [23426155.175691] Console: switching to colour dummy device 80x25\n<6> [23426155.175708] [IGT] dynamic: executing\n<6> [23426155.184875] [IGT] dynamic: starting subtest normal\n<6> [23426155.184895] Dmesg output for normal\n<6> [23426155.184895] [IGT] dynamic: starting dynamic subtest normal-dynamic-subtest\n"
     },
     "igt@dynamic@normal@normal-dynamic-subtest":{
-      "out":"Starting dynamic subtest: normal-dynamic-subtest\nDynamic subtest normal-dynamic-subtest: SUCCESS (0.055s)\n",
+      "out":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)\nStarting subtest: normal\nStarting dynamic subtest: normal-dynamic-subtest\nDynamic subtest normal-dynamic-subtest: SUCCESS (0.055s)\nSubtest normal: SUCCESS (0.100s)\n",
       "igt-version":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)",
       "result":"pass",
       "time":{
@@ -78,8 +78,8 @@
         "start":0,
         "end":0.055
       },
-      "err":"Starting dynamic subtest: normal-dynamic-subtest\nDynamic subtest normal-dynamic-subtest: SUCCESS (0.055s)\n",
-      "dmesg":"<6> [23426155.184875] [IGT] dynamic: starting subtest normal\n<6> [23426155.184895] Dmesg output for normal\n<6> [23426155.184895] [IGT] dynamic: starting dynamic subtest normal-dynamic-subtest\n"
+      "err":"Starting subtest: normal\nStarting dynamic subtest: normal-dynamic-subtest\nDynamic subtest normal-dynamic-subtest: SUCCESS (0.055s)\nSubtest normal: SUCCESS (0.100s)\n",
+      "dmesg":"<6> [23426155.175691] Console: switching to colour dummy device 80x25\n<6> [23426155.175708] [IGT] dynamic: executing\n<6> [23426155.184875] [IGT] dynamic: starting subtest normal\n<6> [23426155.184895] Dmesg output for normal\n<6> [23426155.184895] [IGT] dynamic: starting dynamic subtest normal-dynamic-subtest\n"
     },
     "igt@dynamic@incomplete":{
       "out":"Starting subtest: incomplete\nStarting dynamic subtest: this-is-incomplete\nThis is some output\n",
@@ -94,7 +94,7 @@
       "dmesg":"<6> [23426155.184875] [IGT] dynamic: starting subtest incomplete\n<6> [23426155.184895] [IGT] dynamic: starting dynamic subtest this-is-incomplete\n<6> [23426155.184895] Dmesg output for incomplete\n"
     },
     "igt@dynamic@incomplete@this-is-incomplete":{
-      "out":"Starting dynamic subtest: this-is-incomplete\nThis is some output\n",
+      "out":"Starting subtest: incomplete\nStarting dynamic subtest: this-is-incomplete\nThis is some output\n",
       "igt-version":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)",
       "result":"incomplete",
       "time":{
@@ -102,7 +102,7 @@
         "start":0,
         "end":0
       },
-      "err":"Starting dynamic subtest: this-is-incomplete\n",
+      "err":"Starting subtest: incomplete\nStarting dynamic subtest: this-is-incomplete\n",
       "dmesg":"<6> [23426155.184875] [IGT] dynamic: starting subtest incomplete\n<6> [23426155.184895] [IGT] dynamic: starting dynamic subtest this-is-incomplete\n<6> [23426155.184895] Dmesg output for incomplete\n"
     },
     "igt@dynamic@resume":{
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t 09/11] runner/resultgen: Don't report subtest result if it has dynamic subtests
  2019-12-17  9:47 [igt-dev] [PATCH i-g-t 01/11] runner/resultgen: Extract igt-version field handling to a helper Petri Latvala
                   ` (6 preceding siblings ...)
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t 08/11] runner/json_tests: Adapt to dynamic subtest result parsing Petri Latvala
@ 2019-12-17  9:47 ` Petri Latvala
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t 10/11] runner/json_tests: Adapt to no longer reporting subtests with " Petri Latvala
  2019-12-17  9:48 ` [igt-dev] [PATCH i-g-t 11/11] runner/json_tests: Add test for parsing dynamic subtests with same name Petri Latvala
  9 siblings, 0 replies; 12+ messages in thread
From: Petri Latvala @ 2019-12-17  9:47 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 runner/resultgen.c | 43 +++++++++++++++++++++++++++++++++----------
 1 file changed, 33 insertions(+), 10 deletions(-)

diff --git a/runner/resultgen.c b/runner/resultgen.c
index f93a673c..2c8a55da 100644
--- a/runner/resultgen.c
+++ b/runner/resultgen.c
@@ -1155,6 +1155,22 @@ static void fill_from_journal(int fd,
 	fclose(f);
 }
 
+static void prune_subtests_with_dynamic_subtests(const char *binary,
+						 struct subtest_list *subtests,
+						 struct json_object *tests)
+{
+	char piglit_name[256];
+	size_t i;
+
+	for (i = 0; i < subtests->size; i++) {
+		if (subtests->subs[i].dynamic_size) {
+			generate_piglit_name(binary, subtests->subs[i].name, piglit_name, sizeof(piglit_name));
+			json_object_object_del(tests, piglit_name);
+		}
+
+	}
+}
+
 static bool stderr_contains_warnings(const char *beg, const char *end)
 {
 	struct match_needle needles[] = {
@@ -1225,8 +1241,10 @@ static void override_results(char *binary,
 
 	for (i = 0; i < subtests->size; i++) {
 		generate_piglit_name(binary, subtests->subs[i].name, piglit_name, sizeof(piglit_name));
-		obj = get_or_create_json_object(tests, piglit_name);
-		override_result_single(obj);
+		if (subtests->subs[i].dynamic_size == 0) {
+			obj = get_or_create_json_object(tests, piglit_name);
+			override_result_single(obj);
+		}
 
 		for (k = 0; k < subtests->subs[i].dynamic_size; k++) {
 			generate_piglit_name_for_dynamic(piglit_name, subtests->subs[i].dynamic_names[k],
@@ -1307,15 +1325,18 @@ static void add_to_totals(const char *binary,
 
 	for (i = 0; i < subtests->size; i++) {
 		generate_piglit_name(binary, subtests->subs[i].name, piglit_name, sizeof(piglit_name));
-		test = get_or_create_json_object(results->tests, piglit_name);
-		if (!json_object_object_get_ex(test, "result", &resultobj)) {
-			fprintf(stderr, "Warning: No results set for %s\n", piglit_name);
-			return;
+
+		if (subtests->subs[i].dynamic_size == 0) {
+			test = get_or_create_json_object(results->tests, piglit_name);
+			if (!json_object_object_get_ex(test, "result", &resultobj)) {
+				fprintf(stderr, "Warning: No results set for %s\n", piglit_name);
+				return;
+			}
+			result = json_object_get_string(resultobj);
+			add_result_to_totals(emptystrtotal, result);
+			add_result_to_totals(roottotal, result);
+			add_result_to_totals(binarytotal, result);
 		}
-		result = json_object_get_string(resultobj);
-		add_result_to_totals(emptystrtotal, result);
-		add_result_to_totals(roottotal, result);
-		add_result_to_totals(binarytotal, result);
 
 		for (k = 0; k < subtests->subs[i].dynamic_size; k++) {
 			generate_piglit_name_for_dynamic(piglit_name, subtests->subs[i].dynamic_names[k],
@@ -1362,6 +1383,8 @@ static bool parse_test_directory(int dirfd,
 		goto parse_output_end;
 	}
 
+	prune_subtests_with_dynamic_subtests(entry->binary, &subtests, results->tests);
+
 	override_results(entry->binary, &subtests, results->tests);
 	add_to_totals(entry->binary, &subtests, results);
 
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t 10/11] runner/json_tests: Adapt to no longer reporting subtests with dynamic subtests
  2019-12-17  9:47 [igt-dev] [PATCH i-g-t 01/11] runner/resultgen: Extract igt-version field handling to a helper Petri Latvala
                   ` (7 preceding siblings ...)
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t 09/11] runner/resultgen: Don't report subtest result if it has dynamic subtests Petri Latvala
@ 2019-12-17  9:47 ` Petri Latvala
  2019-12-17  9:48 ` [igt-dev] [PATCH i-g-t 11/11] runner/json_tests: Add test for parsing dynamic subtests with same name Petri Latvala
  9 siblings, 0 replies; 12+ messages in thread
From: Petri Latvala @ 2019-12-17  9:47 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 .../dynamic-subtests/reference.json           | 54 ++++---------------
 1 file changed, 9 insertions(+), 45 deletions(-)

diff --git a/runner/json_tests_data/dynamic-subtests/reference.json b/runner/json_tests_data/dynamic-subtests/reference.json
index 24a1fe8c..ca8f6cd7 100644
--- a/runner/json_tests_data/dynamic-subtests/reference.json
+++ b/runner/json_tests_data/dynamic-subtests/reference.json
@@ -9,18 +9,6 @@
     "end":1560163492.4104891
   },
   "tests":{
-    "igt@dynamic@debug-log-checking":{
-      "out":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)\nStarting subtest: debug-log-checking\nStarting dynamic subtest: this-is-dynamic-1\nStack trace:\n  #0 ..\/lib\/igt_core.c:1607 __igt_fail_assert()\n  #1 ..\/runner\/testdata\/dynamic.c:11 __real_main3()\n  #2 ..\/runner\/testdata\/dynamic.c:3 main()\n  #3 ..\/csu\/libc-start.c:342 __libc_start_main()\n  #4 [_start+0x2a]\nDynamic subtest this-is-dynamic-1: FAIL (0.055s)\nStarting dynamic subtest: this-is-dynamic-2\nStack trace:\n  #0 ..\/lib\/igt_core.c:1607 __igt_fail_assert()\n  #1 ..\/runner\/testdata\/dynamic.c:5 __real_main3()\n  #2 ..\/runner\/testdata\/dynamic.c:3 main()\n  #3 ..\/csu\/libc-start.c:342 __libc_start_main()\n  #4 [_start+0x2a]\nDynamic subtest this-is-dynamic-2: FAIL (0.054s)\nSubtest debug-log-checking: FAIL (0.109s)\n",
-      "igt-version":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)",
-      "result":"fail",
-      "time":{
-        "__type__":"TimeAttribute",
-        "start":0,
-        "end":0.109
-      },
-      "err":"Starting subtest: debug-log-checking\nStarting dynamic subtest: this-is-dynamic-1\n(dynamic:20904) CRITICAL: Test assertion failure function __real_main3, file ..\/runner\/testdata\/dynamic.c:8:\n(dynamic:20904) CRITICAL: Failed assertion: false\nDynamic subtest this-is-dynamic-1 failed.\n**** DEBUG ****\n(dynamic:20904) DEBUG: This print is from 1\n(dynamic:20904) CRITICAL: Test assertion failure function __real_main3, file ..\/runner\/testdata\/dynamic.c:8:\n(dynamic:20904) CRITICAL: Failed assertion: false\n(dynamic:20904) igt_core-INFO: Stack trace:\n(dynamic:20904) igt_core-INFO:   #0 ..\/lib\/igt_core.c:1607 __igt_fail_assert()\n(dynamic:20904) igt_core-INFO:   #1 ..\/runner\/testdata\/dynamic.c:11 __real_main3()\n(dynamic:20904) igt_core-INFO:   #2 ..\/runner\/testdata\/dynamic.c:3 main()\n(dynamic:20904) igt_core-INFO:   #3 ..\/csu\/libc-start.c:342 __libc_start_main()\n(dynamic:20904) igt_core-INFO:   #4 [_start+0x2a]\n****  END  ****\nDynamic subtest this-is-d
 ynamic-1: FAIL (0.055s)\nStarting dynamic subtest: this-is-dynamic-2\n(dynamic:20904) CRITICAL: Test assertion failure function __real_main3, file ..\/runner\/testdata\/dynamic.c:13:\n(dynamic:20904) CRITICAL: Failed assertion: false\nDynamic subtest this-is-dynamic-2 failed.\n**** DEBUG ****\n(dynamic:20904) DEBUG: This print is from 2\n(dynamic:20904) CRITICAL: Test assertion failure function __real_main3, file ..\/runner\/testdata\/dynamic.c:13:\n(dynamic:20904) CRITICAL: Failed assertion: false\n(dynamic:20904) igt_core-INFO: Stack trace:\n(dynamic:20904) igt_core-INFO:   #0 ..\/lib\/igt_core.c:1607 __igt_fail_assert()\n(dynamic:20904) igt_core-INFO:   #1 ..\/runner\/testdata\/dynamic.c:5 __real_main3()\n(dynamic:20904) igt_core-INFO:   #2 ..\/runner\/testdata\/dynamic.c:3 main()\n(dynamic:20904) igt_core-INFO:   #3 ..\/csu\/libc-start.c:342 __libc_start_main()\n(dynamic:20904) igt_core-INFO:   #4 [_start+0x2a]\n****  END  ****\nDynamic subtest this-is-dynamic-2: FAIL (0.054s)\n
 Subtest debug-log-checking failed.\nNo log.\nSubtest debug-log-checking: FAIL (0.109s)\n",
-      "dmesg":"<6> [23426155.175691] Console: switching to colour dummy device 80x25\n<6> [23426155.175708] [IGT] dynamic: executing\n<6> [23426155.184875] [IGT] dynamic: starting subtest debug-log-checking\n<6> [23426155.184895] [IGT] dynamic: starting dynamic subtest this-is-dynamic-1\n<6> [23426155.240164] [IGT] dynamic: starting dynamic subtest this-is-dynamic-2\n<6> [23426155.293846] [IGT] dynamic: exiting, ret=98\n<6> [23426155.294003] Console: switching to colour frame buffer device 240x75\n"
-    },
     "igt@dynamic@debug-log-checking@this-is-dynamic-1":{
       "out":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)\nStarting subtest: debug-log-checking\nStarting dynamic subtest: this-is-dynamic-1\nStack trace:\n  #0 ..\/lib\/igt_core.c:1607 __igt_fail_assert()\n  #1 ..\/runner\/testdata\/dynamic.c:11 __real_main3()\n  #2 ..\/runner\/testdata\/dynamic.c:3 main()\n  #3 ..\/csu\/libc-start.c:342 __libc_start_main()\n  #4 [_start+0x2a]\nDynamic subtest this-is-dynamic-1: FAIL (0.055s)\n",
       "igt-version":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)",
@@ -57,18 +45,6 @@
       "err":"Starting subtest: empty-container\nSubtest empty-container: SKIP (0.000s)\n",
       "dmesg":"<6> [23426155.304955] Console: switching to colour dummy device 80x25\n<6> [23426155.304968] [IGT] dynamic: executing\n<6> [23426155.308644] [IGT] dynamic: starting subtest empty-container\n<6> [23426155.308671] [IGT] dynamic: exiting, ret=77\n<6> [23426155.308822] Console: switching to colour frame buffer device 240x75\n"
     },
-    "igt@dynamic@normal":{
-      "out":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)\nStarting subtest: normal\nStarting dynamic subtest: normal-dynamic-subtest\nDynamic subtest normal-dynamic-subtest: SUCCESS (0.055s)\nSubtest normal: SUCCESS (0.100s)\n",
-      "igt-version":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)",
-      "result":"pass",
-      "time":{
-        "__type__":"TimeAttribute",
-        "start":0,
-        "end":0.100
-      },
-      "err":"Starting subtest: normal\nStarting dynamic subtest: normal-dynamic-subtest\nDynamic subtest normal-dynamic-subtest: SUCCESS (0.055s)\nSubtest normal: SUCCESS (0.100s)\n",
-      "dmesg":"<6> [23426155.175691] Console: switching to colour dummy device 80x25\n<6> [23426155.175708] [IGT] dynamic: executing\n<6> [23426155.184875] [IGT] dynamic: starting subtest normal\n<6> [23426155.184895] Dmesg output for normal\n<6> [23426155.184895] [IGT] dynamic: starting dynamic subtest normal-dynamic-subtest\n"
-    },
     "igt@dynamic@normal@normal-dynamic-subtest":{
       "out":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)\nStarting subtest: normal\nStarting dynamic subtest: normal-dynamic-subtest\nDynamic subtest normal-dynamic-subtest: SUCCESS (0.055s)\nSubtest normal: SUCCESS (0.100s)\n",
       "igt-version":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)",
@@ -81,18 +57,6 @@
       "err":"Starting subtest: normal\nStarting dynamic subtest: normal-dynamic-subtest\nDynamic subtest normal-dynamic-subtest: SUCCESS (0.055s)\nSubtest normal: SUCCESS (0.100s)\n",
       "dmesg":"<6> [23426155.175691] Console: switching to colour dummy device 80x25\n<6> [23426155.175708] [IGT] dynamic: executing\n<6> [23426155.184875] [IGT] dynamic: starting subtest normal\n<6> [23426155.184895] Dmesg output for normal\n<6> [23426155.184895] [IGT] dynamic: starting dynamic subtest normal-dynamic-subtest\n"
     },
-    "igt@dynamic@incomplete":{
-      "out":"Starting subtest: incomplete\nStarting dynamic subtest: this-is-incomplete\nThis is some output\n",
-      "igt-version":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)",
-      "result":"incomplete",
-      "time":{
-        "__type__":"TimeAttribute",
-        "start":0,
-        "end":0
-      },
-      "err":"Starting subtest: incomplete\nStarting dynamic subtest: this-is-incomplete\n",
-      "dmesg":"<6> [23426155.184875] [IGT] dynamic: starting subtest incomplete\n<6> [23426155.184895] [IGT] dynamic: starting dynamic subtest this-is-incomplete\n<6> [23426155.184895] Dmesg output for incomplete\n"
-    },
     "igt@dynamic@incomplete@this-is-incomplete":{
       "out":"Starting subtest: incomplete\nStarting dynamic subtest: this-is-incomplete\nThis is some output\n",
       "igt-version":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)",
@@ -121,38 +85,38 @@
   "totals":{
     "":{
       "crash":0,
-      "pass":3,
+      "pass":2,
       "dmesg-fail":0,
       "dmesg-warn":0,
       "skip":1,
-      "incomplete":2,
+      "incomplete":1,
       "timeout":0,
       "notrun":0,
-      "fail":3,
+      "fail":2,
       "warn":0
     },
     "root":{
       "crash":0,
-      "pass":3,
+      "pass":2,
       "dmesg-fail":0,
       "dmesg-warn":0,
       "skip":1,
-      "incomplete":2,
+      "incomplete":1,
       "timeout":0,
       "notrun":0,
-      "fail":3,
+      "fail":2,
       "warn":0
     },
     "igt@dynamic":{
       "crash":0,
-      "pass":3,
+      "pass":2,
       "dmesg-fail":0,
       "dmesg-warn":0,
       "skip":1,
-      "incomplete":2,
+      "incomplete":1,
       "timeout":0,
       "notrun":0,
-      "fail":3,
+      "fail":2,
       "warn":0
     }
   },
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t 11/11] runner/json_tests: Add test for parsing dynamic subtests with same name
  2019-12-17  9:47 [igt-dev] [PATCH i-g-t 01/11] runner/resultgen: Extract igt-version field handling to a helper Petri Latvala
                   ` (8 preceding siblings ...)
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t 10/11] runner/json_tests: Adapt to no longer reporting subtests with " Petri Latvala
@ 2019-12-17  9:48 ` Petri Latvala
  9 siblings, 0 replies; 12+ messages in thread
From: Petri Latvala @ 2019-12-17  9:48 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

Multiple different subtests can have a dynamic subtest with the same
name. Add a test to make sure we correctly delimit the output parsing.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 .../0/dmesg.txt                               | 10 +++
 .../0/err.txt                                 | 10 +++
 .../0/journal.txt                             |  3 +
 .../0/out.txt                                 | 11 +++
 .../README.txt                                |  2 +
 .../endtime.txt                               |  1 +
 .../joblist.txt                               |  1 +
 .../metadata.txt                              | 12 +++
 .../reference.json                            | 84 +++++++++++++++++++
 .../starttime.txt                             |  1 +
 .../uname.txt                                 |  1 +
 runner/runner_json_tests.c                    |  1 +
 12 files changed, 137 insertions(+)
 create mode 100644 runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/0/dmesg.txt
 create mode 100644 runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/0/err.txt
 create mode 100644 runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/0/journal.txt
 create mode 100644 runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/0/out.txt
 create mode 100644 runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/README.txt
 create mode 100644 runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/endtime.txt
 create mode 100644 runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/joblist.txt
 create mode 100644 runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/metadata.txt
 create mode 100644 runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/reference.json
 create mode 100644 runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/starttime.txt
 create mode 100644 runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/uname.txt

diff --git a/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/0/dmesg.txt b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/0/dmesg.txt
new file mode 100644
index 00000000..59741e5f
--- /dev/null
+++ b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/0/dmesg.txt
@@ -0,0 +1,10 @@
+6,1157,23426155175691,-;Console: switching to colour dummy device 80x25
+14,1158,23426155175708,-;[IGT] dynamic: executing
+14,1159,23426155184875,-;[IGT] dynamic: starting subtest subtest-one
+14,1160,23426155184895,-;[IGT] dynamic: starting dynamic subtest this-name-is-shared
+14,1160,23426155184895,-;This dmesg output is from subtest-one/this-name-is-shared
+14,1159,23426155184875,-;[IGT] dynamic: starting subtest subtest-two
+14,1160,23426155184895,-;[IGT] dynamic: starting dynamic subtest this-name-is-shared
+14,1160,23426155184895,-;This dmesg output is from subtest-two/this-name-is-shared
+14,1162,23426155293846,-;[IGT] dynamic: exiting, ret=0
+6,1163,23426155294003,-;Console: switching to colour frame buffer device 240x75
diff --git a/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/0/err.txt b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/0/err.txt
new file mode 100644
index 00000000..3d551819
--- /dev/null
+++ b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/0/err.txt
@@ -0,0 +1,10 @@
+Starting subtest: subtest-one
+Starting dynamic subtest: this-name-is-shared
+This stderr output is from subtest-one/this-name-is-shared
+Dynamic subtest this-name-is-shared: SUCCESS (0.050s)
+Subtest subtest-one: SUCCESS (0.050s)
+Starting subtest: subtest-two
+Starting dynamic subtest: this-name-is-shared
+This stderr output is from subtest-two/this-name-is-shared
+Dynamic subtest this-name-is-shared: SUCCESS (0.050s)
+Subtest subtest-two: SUCCESS (0.050s)
diff --git a/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/0/journal.txt b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/0/journal.txt
new file mode 100644
index 00000000..3af2b007
--- /dev/null
+++ b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/0/journal.txt
@@ -0,0 +1,3 @@
+subtest-one
+subtest-two
+exit:0 (0.100s)
diff --git a/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/0/out.txt b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/0/out.txt
new file mode 100644
index 00000000..e025c096
--- /dev/null
+++ b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/0/out.txt
@@ -0,0 +1,11 @@
+IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)
+Starting subtest: subtest-one
+Starting dynamic subtest: this-name-is-shared
+This stdout output is from subtest-one/this-name-is-shared
+Dynamic subtest this-name-is-shared: SUCCESS (0.050s)
+Subtest subtest-one: SUCCESS (0.050s)
+Starting subtest: subtest-two
+Starting dynamic subtest: this-name-is-shared
+This stdout output is from subtest-two/this-name-is-shared
+Dynamic subtest this-name-is-shared: SUCCESS (0.050s)
+Subtest subtest-two: SUCCESS (0.050s)
diff --git a/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/README.txt b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/README.txt
new file mode 100644
index 00000000..e141077d
--- /dev/null
+++ b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/README.txt
@@ -0,0 +1,2 @@
+Parsing of dynamic subtest output is tricky if multiple subtests use
+the same name for a dynamic subtest.
diff --git a/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/endtime.txt b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/endtime.txt
new file mode 100644
index 00000000..5c7608b5
--- /dev/null
+++ b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/endtime.txt
@@ -0,0 +1 @@
+1560163492.410489
diff --git a/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/joblist.txt b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/joblist.txt
new file mode 100644
index 00000000..9296b9ed
--- /dev/null
+++ b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/joblist.txt
@@ -0,0 +1 @@
+dynamic subtest-one,subtest-two
diff --git a/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/metadata.txt b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/metadata.txt
new file mode 100644
index 00000000..8da1aee2
--- /dev/null
+++ b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/metadata.txt
@@ -0,0 +1,12 @@
+abort_mask : 0
+name : dynamic-subtest-name-in-multiple-subtests
+dry_run : 0
+sync : 0
+log_level : 0
+overwrite : 0
+multiple_mode : 1
+inactivity_timeout : 0
+use_watchdog : 0
+piglit_style_dmesg : 0
+test_root : /path/does/not/exist
+results_path : /path/does/not/exist
diff --git a/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/reference.json b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/reference.json
new file mode 100644
index 00000000..370fce4d
--- /dev/null
+++ b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/reference.json
@@ -0,0 +1,84 @@
+{
+  "__type__":"TestrunResult",
+  "results_version":10,
+  "name":"dynamic-subtest-name-in-multiple-subtests",
+  "uname":"Linux hostname 4.18.0-1-amd64 #1 SMP Debian 4.18.6-1 (2018-09-06) x86_64",
+  "time_elapsed":{
+    "__type__":"TimeAttribute",
+    "start":1560163492.266377,
+    "end":1560163492.4104891
+  },
+  "tests":{
+    "igt@dynamic@subtest-one@this-name-is-shared":{
+      "out":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)\nStarting subtest: subtest-one\nStarting dynamic subtest: this-name-is-shared\nThis stdout output is from subtest-one\/this-name-is-shared\nDynamic subtest this-name-is-shared: SUCCESS (0.050s)\nSubtest subtest-one: SUCCESS (0.050s)\n",
+      "igt-version":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)",
+      "result":"warn",
+      "time":{
+        "__type__":"TimeAttribute",
+        "start":0,
+        "end":0.050000000000000003
+      },
+      "err":"Starting subtest: subtest-one\nStarting dynamic subtest: this-name-is-shared\nThis stderr output is from subtest-one\/this-name-is-shared\nDynamic subtest this-name-is-shared: SUCCESS (0.050s)\nSubtest subtest-one: SUCCESS (0.050s)\n",
+      "dmesg":"<6> [23426155.175691] Console: switching to colour dummy device 80x25\n<6> [23426155.175708] [IGT] dynamic: executing\n<6> [23426155.184875] [IGT] dynamic: starting subtest subtest-one\n<6> [23426155.184895] [IGT] dynamic: starting dynamic subtest this-name-is-shared\n<6> [23426155.184895] This dmesg output is from subtest-one\/this-name-is-shared\n"
+    },
+    "igt@dynamic@subtest-two@this-name-is-shared":{
+      "out":"Starting subtest: subtest-two\nStarting dynamic subtest: this-name-is-shared\nThis stdout output is from subtest-two\/this-name-is-shared\nDynamic subtest this-name-is-shared: SUCCESS (0.050s)\nSubtest subtest-two: SUCCESS (0.050s)\n",
+      "igt-version":"IGT-Version: 1.23-g9e957acd (x86_64) (Linux: 4.18.0-1-amd64 x86_64)",
+      "result":"warn",
+      "time":{
+        "__type__":"TimeAttribute",
+        "start":0,
+        "end":0.050000000000000003
+      },
+      "err":"Starting subtest: subtest-two\nStarting dynamic subtest: this-name-is-shared\nThis stderr output is from subtest-two\/this-name-is-shared\nDynamic subtest this-name-is-shared: SUCCESS (0.050s)\nSubtest subtest-two: SUCCESS (0.050s)\n",
+      "dmesg":"<6> [23426155.184875] [IGT] dynamic: starting subtest subtest-two\n<6> [23426155.184895] [IGT] dynamic: starting dynamic subtest this-name-is-shared\n<6> [23426155.184895] This dmesg output is from subtest-two\/this-name-is-shared\n<6> [23426155.293846] [IGT] dynamic: exiting, ret=0\n<6> [23426155.294003] Console: switching to colour frame buffer device 240x75\n"
+    }
+  },
+  "totals":{
+    "":{
+      "crash":0,
+      "pass":0,
+      "dmesg-fail":0,
+      "dmesg-warn":0,
+      "skip":0,
+      "incomplete":0,
+      "timeout":0,
+      "notrun":0,
+      "fail":0,
+      "warn":2
+    },
+    "root":{
+      "crash":0,
+      "pass":0,
+      "dmesg-fail":0,
+      "dmesg-warn":0,
+      "skip":0,
+      "incomplete":0,
+      "timeout":0,
+      "notrun":0,
+      "fail":0,
+      "warn":2
+    },
+    "igt@dynamic":{
+      "crash":0,
+      "pass":0,
+      "dmesg-fail":0,
+      "dmesg-warn":0,
+      "skip":0,
+      "incomplete":0,
+      "timeout":0,
+      "notrun":0,
+      "fail":0,
+      "warn":2
+    }
+  },
+  "runtimes":{
+    "igt@dynamic":{
+      "time":{
+        "__type__":"TimeAttribute",
+        "start":0,
+        "end":0.10000000000000001
+      }
+    }
+  }
+}
diff --git a/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/starttime.txt b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/starttime.txt
new file mode 100644
index 00000000..b30b32ee
--- /dev/null
+++ b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/starttime.txt
@@ -0,0 +1 @@
+1560163492.266377
diff --git a/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/uname.txt b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/uname.txt
new file mode 100644
index 00000000..a7aef6f7
--- /dev/null
+++ b/runner/json_tests_data/dynamic-subtest-name-in-multiple-subtests/uname.txt
@@ -0,0 +1 @@
+Linux hostname 4.18.0-1-amd64 #1 SMP Debian 4.18.6-1 (2018-09-06) x86_64
diff --git a/runner/runner_json_tests.c b/runner/runner_json_tests.c
index 3443bd2b..21e87a02 100644
--- a/runner/runner_json_tests.c
+++ b/runner/runner_json_tests.c
@@ -163,6 +163,7 @@ static const char *dirnames[] = {
 	"dmesg-warn-level-piglit-style",
 	"dmesg-warn-level-one-piglit-style",
 	"dynamic-subtests",
+	"dynamic-subtest-name-in-multiple-subtests",
 };
 
 igt_main
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v2 02/11] runner/resultgen: Extract finding begin/end lines for a subtest to a helper
  2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t v2 02/11] runner/resultgen: Extract finding begin/end lines for a subtest " Petri Latvala
@ 2019-12-27  8:45   ` Arkadiusz Hiler
  0 siblings, 0 replies; 12+ messages in thread
From: Arkadiusz Hiler @ 2019-12-27  8:45 UTC (permalink / raw)
  To: Petri Latvala; +Cc: igt-dev

On Tue, Dec 17, 2019 at 11:47:51AM +0200, Petri Latvala wrote:
> v2: Use an enum to select a pattern string for asprintf (Arek)
> 
> Signed-off-by: Petri Latvala <petri.latvala@intel.com>
> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-12-27  8:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-17  9:47 [igt-dev] [PATCH i-g-t 01/11] runner/resultgen: Extract igt-version field handling to a helper Petri Latvala
2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t v2 02/11] runner/resultgen: Extract finding begin/end lines for a subtest " Petri Latvala
2019-12-27  8:45   ` Arkadiusz Hiler
2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t v2 03/11] runner/resultgen: Extract finding begin/end pointers for test output to helpers Petri Latvala
2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t v2 04/11] runner/resultgen: Hoist handling of dynamic subtest output to a helper Petri Latvala
2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t v2 05/11] runner/resultgen: Extrude dynamic subtest result texts Petri Latvala
2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t 06/11] runner/resultgen: Add support for extra validation hook in find_matches() Petri Latvala
2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t 07/11] runner/resultgen: Make subtest result line finding more robust Petri Latvala
2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t 08/11] runner/json_tests: Adapt to dynamic subtest result parsing Petri Latvala
2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t 09/11] runner/resultgen: Don't report subtest result if it has dynamic subtests Petri Latvala
2019-12-17  9:47 ` [igt-dev] [PATCH i-g-t 10/11] runner/json_tests: Adapt to no longer reporting subtests with " Petri Latvala
2019-12-17  9:48 ` [igt-dev] [PATCH i-g-t 11/11] runner/json_tests: Add test for parsing dynamic subtests with same name Petri Latvala

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.