[igt-dev] [PATCH i-g-t 09/11] runner/resultgen: Don't report subtest result if it has dynamic subtests

Petri Latvala petri.latvala at intel.com
Mon Dec 2 13:01:07 UTC 2019


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

diff --git a/runner/resultgen.c b/runner/resultgen.c
index 64b899ca..2e15331e 100644
--- a/runner/resultgen.c
+++ b/runner/resultgen.c
@@ -1148,6 +1148,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[] = {
@@ -1218,8 +1234,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],
@@ -1300,15 +1318,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],
@@ -1355,6 +1376,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



More information about the igt-dev mailing list