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

Submitted by Dylan Baker on Jan. 20, 2018, 12:25 a.m.

Details

Message ID 505ba0cfb6a3e5dd540a676972c2c5648ea04dbd.1516407949.git-series.dylan@pnwbakers.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Dylan Baker Jan. 20, 2018, 12:25 a.m.
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@intel.com>
---
 tests/util/piglit-util.c | 29 +++++++++++++++++++++++++++++
 tests/util/piglit-util.h |  2 ++
 2 files changed, 31 insertions(+)


base-commit: 736496667329bf73a706aebec6f8287078df79ae

Patch hide | download patch | download mbox

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);
 

Comments

I meant to add a cover letter to this, also, there's only 8 patches.

This is an RFC, I'm looking for input into fixing the subtest reporting problem.
This approach is going to be more complete, but it's going to be pretty
involved. If anyone has a better approach I'd be happy to hear it.

Quoting Dylan Baker (2018-01-19 16:25:56)
> 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@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
> _______________________________________________
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit