[Piglit] [PATCH 02/16] util: Add a function to register subtests

Fabian Bieler fabianbieler at fastmail.fm
Mon Jan 29 00:22:12 UTC 2018


This function takes one or more subtests as strings and prints a JSON
structure that the python framework can consume.
---
 tests/util/piglit-util.c | 11 +++++++++++
 tests/util/piglit-util.h |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index 7f33afb90..ed7d21c95 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -808,6 +808,17 @@ piglit_run_selected_subtests(const struct piglit_subtest *all_subtests,
 	return result;
 }
 
+void
+piglit_register_subtests(const char *names[])
+{
+	printf("PIGLIT: {\"enumerate subtests\": [\"%s\"", names[0]);
+	for (int i = 1; names[i]; i++) {
+		printf(", \"%s\"", names[i]);
+	}
+	printf("]}\n");
+	fflush(stdout);
+}
+
 uint64_t
 piglit_gettid(void)
 {
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 3757f8677..0a5eab810 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -151,6 +151,9 @@ piglit_run_selected_subtests(const struct piglit_subtest *all_subtests,
 			     size_t num_selected_subtests,
 			     enum piglit_result previous_result);
 
+void
+piglit_register_subtests(const char *names[]);
+
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
 
 #define CLAMP( X, MIN, MAX )  ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) )
-- 
2.15.1



More information about the Piglit mailing list