aboutsummaryrefslogtreecommitdiff
path: root/tests/util
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-01-14 09:06:02 -0800
committerEric Anholt <eric@anholt.net>2013-01-21 12:45:35 -0800
commitb85f89db9a837a731d09fe34e4fc3f6441deda97 (patch)
tree00d658bc85e7f5ced10c4cf0181dc35e84cfb8ea /tests/util
parent7f90d9bb2710a6c9e117561287b17a2a83036a38 (diff)
util: Allow varargs in reporting subtest results.
We'll want this in GL tests where a subtest name will often be composed of a couple of strings. Reviewed-by: Carl Worth <cworth@cworth.org> Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'tests/util')
-rw-r--r--tests/util/piglit-util.c12
-rw-r--r--tests/util/piglit-util.h3
2 files changed, 12 insertions, 3 deletions
diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index 4fd3a144..98fffa28 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 e04e161b..f89eb6e3 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);