[Piglit] [PATCH 02/15] util: Allow varargs in reporting subtest results.
Eric Anholt
eric at anholt.net
Mon Jan 14 10:55:29 PST 2013
We'll want this in GL tests where a subtest name will often be
composed of a couple of strings.
---
tests/cl/program/program-tester.c | 2 +-
tests/util/piglit-util.c | 12 ++++++++++--
tests/util/piglit-util.h | 3 ++-
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/tests/cl/program/program-tester.c b/tests/cl/program/program-tester.c
index 27a20ed..096cd2a 100644
--- a/tests/cl/program/program-tester.c
+++ b/tests/cl/program/program-tester.c
@@ -1942,7 +1942,7 @@ piglit_cl_test(const int argc,
test_result = test_kernel(config, env, tests[i]);
piglit_merge_result(&result, test_result);
- piglit_report_subtest_result(tests[i].name, test_result);
+ piglit_report_subtest_result(test_result, tests[i].name);
}
/* Print result */
diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index 4fd3a14..98fffa2 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -191,11 +191,19 @@ piglit_report_result(enum piglit_result result)
}
void
-piglit_report_subtest_result(const char *name, enum piglit_result result)
+piglit_report_subtest_result(enum piglit_result result, const char *format, ...)
{
const char *result_str = piglit_result_to_string(result);
- printf("PIGLIT:subtest {'%s' : '%s'}\n", name, result_str);
+ va_list ap;
+
+ va_start(ap, format);
+
+ printf("PIGLIT:subtest {'");
+ vprintf(format, ap);
+ printf("' : '%s'}\n", result_str);
fflush(stdout);
+
+ va_end(ap);
}
#ifndef HAVE_STRCHRNUL
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index e04e161..f89eb6e 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -137,7 +137,8 @@ int piglit_find_line(const char *program, int position);
void piglit_merge_result(enum piglit_result *all, enum piglit_result subtest);
const char * piglit_result_to_string(enum piglit_result result);
void piglit_report_result(enum piglit_result result);
-void piglit_report_subtest_result(const char *name, enum piglit_result result);
+void piglit_report_subtest_result(enum piglit_result result,
+ const char *format, ...) PRINTFLIKE(2, 3);
#ifndef HAVE_STRCHRNUL
char *strchrnul(const char *s, int c);
--
1.7.10.4
More information about the Piglit
mailing list