aboutsummaryrefslogtreecommitdiff
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
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>
-rw-r--r--tests/cl/program/program-tester.c2
-rw-r--r--tests/util/piglit-util.c12
-rw-r--r--tests/util/piglit-util.h3
3 files changed, 13 insertions, 4 deletions
diff --git a/tests/cl/program/program-tester.c b/tests/cl/program/program-tester.c
index 27a20ede..096cd2ae 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 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);