summaryrefslogtreecommitdiff
path: root/lib/drmtest.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2013-09-19 19:56:03 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-09-19 19:56:03 +0200
commit64cfe4eefe9b91ad648df216ba385d9a1e67dd78 (patch)
tree8dafd62004f240c4e0e88cad746b5b1d61b0da6c /lib/drmtest.c
parente5cdd62624342180a16630b4f6b1d604f6e6e581 (diff)
lib/drmtest: Improve printf-like igt_skip_on/require
Ben Widawsky suggested to use vasprintf, which perfectly fits the bill. Also fix the logic conversion bug in tests/gem_storedw_batches_loop that crept in again :( Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib/drmtest.c')
-rw-r--r--lib/drmtest.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c
index 7c3c0af7..0bc1e869 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -882,18 +882,14 @@ void __igt_skip_check(const char *file, const int line,
va_list args;
if (f) {
- char buf[4096];
- int length;
-
- /*
- * Important: va_list argument lists can't be used twice, so we
- * can't first do an vsnprintf call to size the temporary
- * storage correctly. Pick the easy solution with a static
- * buffer and an asssert.
- */
+ static char *buf;
+
+ /* igt_skip never returns, so try to not leak too badly. */
+ if (buf)
+ free(buf);
+
va_start(args, f);
- length = vsnprintf(buf, sizeof(buf), f, args);
- assert(length < sizeof(buf) - 1);
+ vasprintf(&buf, f, args);
va_end(args);
igt_skip("Test requirement not met in function %s, file %s:%i:\n"