mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-12 02:16:17 +00:00
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>
This commit is contained in:
parent
e5cdd62624
commit
64cfe4eefe
@ -882,18 +882,14 @@ void __igt_skip_check(const char *file, const int line,
|
||||
va_list args;
|
||||
|
||||
if (f) {
|
||||
char buf[4096];
|
||||
int length;
|
||||
static char *buf;
|
||||
|
||||
/* igt_skip never returns, so try to not leak too badly. */
|
||||
if (buf)
|
||||
free(buf);
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
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"
|
||||
|
@ -103,7 +103,7 @@ store_dword_loop(int divider, unsigned flags)
|
||||
drm_intel_bo_map(target_bo, 1);
|
||||
|
||||
buf = target_bo->virtual;
|
||||
igt_assert_f(buf[0] != (0x42000000 | val),
|
||||
igt_assert_f(buf[0] == (0x42000000 | val),
|
||||
"value mismatch: cur 0x%08x, stored 0x%08x\n",
|
||||
buf[0], 0x42000000 | val);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user