[Piglit] [PATCH 1/9] util: Add a function for enumerating subtests

Dylan Baker dylan at pnwbakers.com
Sat Jan 20 00:25:56 UTC 2018


This function takes one or more subtests as strings and returns a JSON
structure that the python framework can consume.

Signed-off-by: Dylan Baker <dylan.c.baker at intel.com>
---
 tests/util/piglit-util.c | 29 +++++++++++++++++++++++++++++
 tests/util/piglit-util.h |  2 ++
 2 files changed, 31 insertions(+)

diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index e33d055..46b4b75 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -290,6 +290,35 @@ piglit_report_subtest_result(enum piglit_result result, const char *format, ...)
 	va_end(ap);
 }
 
+void
+piglit_enumerate_subtests(int num_args, const char *name, ...)
+{
+	va_list ap;
+
+	va_start(ap, name);
+
+	printf("PIGLIT: {\"enumerate subtests\": [\"%s\"", name);
+	for (int i = 1; i < num_args; i++) {
+		vprintf(", \"%s\"", ap);
+	}
+	printf("]}\n");
+	fflush(stdout);
+
+	va_end(ap);
+}
+
+void
+piglit_enumerate_subtest_list(int length, const char *names[])
+{
+	assert(length > 0);
+	printf("PIGLIT: {\"enumerate subtests\": [\"%s\"", names[0]);
+	for (int i = 1; i < length; i++) {
+		printf(", \"%s\"", names[i]);
+	}
+	printf("]}\n");
+	fflush(stdout);
+}
+
 
 static void
 piglit_disable_error_message_boxes(void)
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 3757f86..c5adb11 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -360,6 +360,8 @@ NORETURN void piglit_report_result(enum piglit_result result);
 void piglit_set_timeout(double seconds, enum piglit_result timeout_result);
 void piglit_report_subtest_result(enum piglit_result result,
 				  const char *format, ...) PRINTFLIKE(2, 3);
+void piglit_enumerate_subtests(int num_args, const char *name, ...);
+void piglit_enumerate_subtest_list(int length, const char *names[]);
 
 void piglit_general_init(void);
 

base-commit: 736496667329bf73a706aebec6f8287078df79ae
-- 
git-series 0.9.1


More information about the Piglit mailing list