Commit 83440953 authored by Daniel Vetter's avatar Daniel Vetter

tests: s/assert/igt_assert

Just a wholesale rollout for now, we can refine later on.
Signed-off-by: Daniel Vetter's avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 2371c79b
......@@ -37,7 +37,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
# include <sys/syscall.h>
#include "drm.h"
......@@ -79,7 +78,7 @@ int main(int argc, char **argv)
/* root (which we run igt as) should always be authenticated */
auth = check_auth(fd);
assert(auth);
igt_assert(auth);
return 0;
}
......@@ -27,7 +27,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......@@ -72,17 +71,17 @@ int main(int argc, char **argv)
for (i = 0; i < BO_ARRAY_SIZE; i++) {
bos[i] = drm_intel_bo_alloc(bufmgr, "mmap bo", 4096, 4096);
assert(bos[i]);
igt_assert(bos[i]);
drm_intel_bo_map(bos[i], 1);
ptr = bos[i]->virtual;
assert(ptr);
igt_assert(ptr);
*ptr = 'c';
drm_intel_bo_unmap(bos[i]);
drm_intel_gem_bo_map_gtt(bos[i]);
ptr = bos[i]->virtual;
assert(ptr);
igt_assert(ptr);
*ptr = 'c';
drm_intel_gem_bo_unmap_gtt(bos[i]);
}
......@@ -90,16 +89,16 @@ int main(int argc, char **argv)
/* and recheck whether a second map of the same still works */
for (i = 0; i < BO_ARRAY_SIZE; i++) {
bos[i] = drm_intel_bo_alloc(bufmgr, "mmap bo", 4096, 4096);
assert(bos[i]);
igt_assert(bos[i]);
drm_intel_bo_map(bos[i], 1);
ptr = bos[i]->virtual;
assert(*ptr = 'c');
igt_assert(*ptr = 'c');
drm_intel_bo_unmap(bos[i]);
drm_intel_gem_bo_map_gtt(bos[i]);
ptr = bos[i]->virtual;
assert(*ptr = 'c');
igt_assert(*ptr = 'c');
drm_intel_gem_bo_unmap_gtt(bos[i]);
}
......
......@@ -27,7 +27,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......@@ -70,7 +69,7 @@ int main(int argc, char **argv)
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
load_bo = drm_intel_bo_alloc(bufmgr, "target bo", 1024*4096, 4096);
assert(load_bo);
igt_assert(load_bo);
drm_intel_bufmgr_gem_set_vma_cache_size(bufmgr, 500);
......@@ -104,11 +103,11 @@ int main(int argc, char **argv)
for (j = 0; j < GROUP_SZ; j++, i++) {
bo[j] = drm_intel_bo_alloc(bufmgr, "mmap bo", 4096, 4096);
assert(bo[j]);
igt_assert(bo[j]);
drm_intel_gem_bo_map_gtt(bo[j]);
ptr = bo[j]->virtual;
assert(ptr);
igt_assert(ptr);
*ptr = 'c';
drm_intel_gem_bo_unmap_gtt(bo[j]);
......
......@@ -27,7 +27,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......@@ -73,11 +72,11 @@ int main(int argc, char **argv)
for (i = 0; i < BO_ARRAY_SIZE; i++) {
bos[i] = drm_intel_bo_alloc(bufmgr, "mmap bo", 4096, 4096);
assert(bos[i]);
igt_assert(bos[i]);
drm_intel_bo_map(bos[i], 1);
ptr = bos[i]->virtual;
assert(ptr);
igt_assert(ptr);
*ptr = 'c';
drm_intel_bo_unmap(bos[i]);
}
......@@ -85,11 +84,11 @@ int main(int argc, char **argv)
/* and recheck whether a second map of the same still works */
for (i = 0; i < BO_ARRAY_SIZE; i++) {
bos[i] = drm_intel_bo_alloc(bufmgr, "mmap bo", 4096, 4096);
assert(bos[i]);
igt_assert(bos[i]);
drm_intel_bo_map(bos[i], 1);
ptr = bos[i]->virtual;
assert(*ptr = 'c');
igt_assert(*ptr = 'c');
drm_intel_bo_unmap(bos[i]);
}
......
......@@ -27,7 +27,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......@@ -74,11 +73,11 @@ int main(int argc, char **argv)
for (i = 0; i < BO_ARRAY_SIZE; i++) {
bos[i] = drm_intel_bo_alloc(bufmgr, "mmap bo", 4096, 4096);
assert(bos[i]);
igt_assert(bos[i]);
drm_intel_gem_bo_map_gtt(bos[i]);
ptr = bos[i]->virtual;
assert(ptr);
igt_assert(ptr);
*ptr = 'c';
drm_intel_gem_bo_unmap_gtt(bos[i]);
}
......@@ -86,11 +85,11 @@ int main(int argc, char **argv)
/* and recheck whether a second map of the same still works */
for (i = 0; i < BO_ARRAY_SIZE; i++) {
bos[i] = drm_intel_bo_alloc(bufmgr, "mmap bo", 4096, 4096);
assert(bos[i]);
igt_assert(bos[i]);
drm_intel_gem_bo_map_gtt(bos[i]);
ptr = bos[i]->virtual;
assert(*ptr = 'c');
igt_assert(*ptr = 'c');
drm_intel_gem_bo_unmap_gtt(bos[i]);
}
......
......@@ -29,7 +29,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......
......@@ -29,7 +29,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......
......@@ -44,7 +44,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......
......@@ -29,7 +29,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......@@ -55,7 +54,7 @@ static uint32_t do_gem_create(int fd, int size, int *retval)
create.handle = 0;
create.size = (size + 4095) & -4096;
ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
assert(retval || ret == 0);
igt_assert(retval || ret == 0);
if (retval)
*retval = errno;
......@@ -74,7 +73,7 @@ static void create0(int fd)
int retval = 0;
printf("trying to create a zero-length gem object\n");
do_gem_create(fd, 0, &retval);
assert(retval == EINVAL);
igt_assert(retval == EINVAL);
}
#if 0
......
......@@ -29,7 +29,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......@@ -50,7 +49,7 @@ test_bad_close(int fd)
close_bo.handle = 0x10101010;
ret = ioctl(fd, DRM_IOCTL_GEM_CLOSE, &close_bo);
assert(ret == -1 && errno == EINVAL);
igt_assert(ret == -1 && errno == EINVAL);
}
static void
......
......@@ -29,7 +29,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......
......@@ -35,7 +35,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......@@ -70,7 +69,7 @@ cmp_bo(drm_intel_bo *bo, uint32_t val, int width, int height)
do_or_die(drm_intel_bo_map(bo, false));
vaddr = bo->virtual;
while (size--)
assert(*vaddr++ == val);
igt_assert(*vaddr++ == val);
drm_intel_bo_unmap(bo);
}
......@@ -80,7 +79,7 @@ create_bo(drm_intel_bufmgr *bufmgr, uint32_t val, int width, int height)
drm_intel_bo *bo;
bo = drm_intel_bo_alloc(bufmgr, "bo", 4*width*height, 0);
assert(bo);
igt_assert(bo);
return bo;
}
......
......@@ -48,7 +48,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......@@ -157,7 +156,7 @@ int main(int argc, char **argv)
count = 10;
handles = malloc (count * sizeof(uint32_t));
assert(handles);
igt_assert(handles);
noop = gem_create(fd, 4096);
gem_write(fd, noop, 0, end, sizeof(end));
......
......@@ -38,7 +38,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......@@ -85,7 +84,7 @@ static void exec(int fd, uint32_t handle)
DRM_IOCTL_I915_GEM_EXECBUFFER2,
&execbuf);
gem_sync(fd, handle);
assert(ret == 0);
igt_assert(ret == 0);
}
int main(int argc, char **argv)
......@@ -119,20 +118,20 @@ int main(int argc, char **argv)
count = aper_size / 4096;
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
assert(batch);
igt_assert(batch);
sample_batch_bo = drm_intel_bo_alloc(bufmgr, "", 4096, 4096);
assert(sample_batch_bo);
igt_assert(sample_batch_bo);
ret = drm_intel_bo_subdata(sample_batch_bo, 4096-sizeof(batch_end),
sizeof(batch_end), batch_end);
assert(ret == 0);
igt_assert(ret == 0);
/* fill the entire gart with batches and run them */
for (i = 0; i < count; i++) {
drm_intel_bo *batch_bo;
batch_bo = drm_intel_bo_alloc(bufmgr, "", 4096, 4096);
assert(batch_bo);
igt_assert(batch_bo);
/* copy the sample batch with the gpu to the new one, so that we
* also test the unmappable part of the gtt. */
......
......@@ -40,7 +40,6 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......@@ -130,7 +129,7 @@ static void run_on_ring(int fd, unsigned ring_id, const char *ring_name)
if (split > 0) {
/* Check that we've managed to collide in the tlb. */
assert(gtt_offset == gtt_offset_new);
igt_assert(gtt_offset == gtt_offset_new);
/* We hang onto the storage of the old batch by keeping
* the cpu mmap around. */
......
......@@ -89,7 +89,7 @@ int main(int argc, char *argv[])
destroy.ctx_id = ctx_id;
/* Make sure a proper destroy works first */
ret = drmIoctl(fd, CONTEXT_DESTROY_IOCTL, &destroy);
assert(ret == 0);
igt_assert(ret == 0);
/* try double destroy */
ret = drmIoctl(fd, CONTEXT_DESTROY_IOCTL, &destroy);
......
......@@ -35,7 +35,6 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......@@ -119,9 +118,9 @@ int main(int argc, char *argv[])
handle = gem_create(fd, 4096);
gem_write(fd, handle, 0, batch, sizeof(batch));
assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
assert(exec(fd, handle, I915_EXEC_BSD, ctx_id) != 0);
assert(exec(fd, handle, I915_EXEC_BLT, ctx_id) != 0);
igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
igt_assert(exec(fd, handle, I915_EXEC_BSD, ctx_id) != 0);
igt_assert(exec(fd, handle, I915_EXEC_BLT, ctx_id) != 0);
exit(EXIT_SUCCESS);
}
......@@ -50,7 +50,7 @@ static void init_buffer(drm_intel_bufmgr *bufmgr,
{
buf->bo = drm_intel_bo_alloc(bufmgr, "", size, 4096);
buf->size = size;
assert(buf->bo);
igt_assert(buf->bo);
buf->tiling = I915_TILING_NONE;
buf->stride = 4096;
}
......@@ -70,7 +70,7 @@ static void *work(void *arg)
else
td_fd = fd;
assert(td_fd >= 0);
igt_assert(td_fd >= 0);
bufmgr = drm_intel_bufmgr_gem_init(td_fd, 4096);
batch = intel_batchbuffer_alloc(bufmgr, devid);
......@@ -89,12 +89,12 @@ static void *work(void *arg)
if (uncontexted) {
assert(rendercopy);
igt_assert(rendercopy);
rendercopy(batch, &src, 0, 0, 0, 0, &dst, 0, 0);
} else {
int ret;
ret = drm_intel_bo_subdata(batch->bo, 0, 4096, batch->buffer);
assert(ret == 0);
igt_assert(ret == 0);
intel_batchbuffer_flush_with_context(batch, context);
}
}
......
......@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "%s\n", strerror(errno));
exit(EXIT_FAILURE);
}
assert(create.ctx_id != 0);
igt_assert(create.ctx_id != 0);
close(fd);
......
......@@ -34,7 +34,6 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......@@ -130,14 +129,14 @@ int main(int argc, char *argv[])
handle = gem_create(fd, 4096);
gem_write(fd, handle, 0, batch, sizeof(batch));
assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
context_destroy(fd, ctx_id);
ctx_id = context_create(fd);
assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
context_destroy(fd, ctx_id);
assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) < 0);
igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) < 0);
exit(EXIT_SUCCESS);
}
......@@ -28,7 +28,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......
......@@ -28,7 +28,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......
......@@ -28,7 +28,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......@@ -72,7 +71,7 @@ run_batch(void)
used = batch->ptr - batch->buffer;
ret = drm_intel_bo_subdata(batch->bo, 0, used, batch->buffer);
assert(ret == 0);
igt_assert(ret == 0);
batch->ptr = NULL;
......
......@@ -37,7 +37,6 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......@@ -94,7 +93,7 @@ static int exec(int fd, uint32_t handle, uint32_t reloc_ofs)
gem_read(fd, handle, reloc_ofs, &tmp, 4);
assert(tmp == gem_reloc[0].presumed_offset);
igt_assert(tmp == gem_reloc[0].presumed_offset);
return ret;
}
......
......@@ -30,7 +30,6 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......@@ -61,7 +60,7 @@ static int gem_linear_blt(uint32_t *batch,
uint32_t *b = batch;
int height = length / (16 * 1024);
assert(height <= 1<<16);
igt_assert(height <= 1<<16);
if (height) {
b[0] = COPY_BLT_CMD | BLT_WRITE_ALPHA | BLT_WRITE_RGB;
......
......@@ -30,7 +30,6 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......@@ -66,7 +65,7 @@ static int gem_linear_blt(uint32_t *batch,
uint32_t *b = batch;
int height = length / (16 * 1024);
assert(height <= 1<<16);
igt_assert(height <= 1<<16);
if (height) {
b[0] = COPY_BLT_CMD | BLT_WRITE_ALPHA | BLT_WRITE_RGB;
......@@ -138,7 +137,7 @@ static void gem_exec(int fd, struct drm_i915_gem_execbuffer2 *execbuf)
ret = drmIoctl(fd,
DRM_IOCTL_I915_GEM_EXECBUFFER2,
execbuf);
assert(ret == 0);
igt_assert(ret == 0);
}
static void run(int object_size)
......@@ -182,7 +181,7 @@ static void run(int object_size)
gem_write(fd, handle_relocs, 0, reloc, sizeof(reloc));
gtt_relocs = gem_mmap(fd, handle_relocs, 4096,
PROT_READ | PROT_WRITE);
assert(gtt_relocs);
igt_assert(gtt_relocs);
exec[2].handle = handle;
exec[2].relocation_count = len > 40 ? 4 : 2;
......
......@@ -30,7 +30,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......
......@@ -30,7 +30,6 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......
......@@ -34,7 +34,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
......@@ -71,14 +70,14 @@ bo_create (int fd, int tiling)
/* dirty cpu caches a bit ... */
ptr = gem_mmap__cpu(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
assert(ptr);
igt_assert(ptr);
memset(ptr, 0, OBJECT_SIZE);
munmap(ptr, OBJECT_SIZE);
gem_set_tiling(fd, handle, tiling, 1024);
ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE);
assert(ptr);
igt_assert(ptr);
/* XXX: mmap_gtt pulls the bo into the GTT read domain. */
gem_sync(fd, handle);
......@@ -119,7 +118,7 @@ _bo_write_verify(struct test *t)
assert (t->num_surfaces > 0);
s = calloc(sizeof(*s), t->num_surfaces);
assert(s);
igt_assert(s);
for (k = 0; k < t->num_surfaces; k++)
s[k] = bo_create(fd, t->tiling);
......@@ -196,7 +195,7 @@ static int run_test(int threads_per_fence, void *f, int tiling,
pthread_join (threads[n], NULL);
} else {
void *(*func)(void *) = f;
assert(func(&t) == (void *)0);
igt_assert(func(&t) == (void *)0);
}
close(t.fd);
......@@ -237,7 +236,7 @@ main(int argc, char **argv)
}
igt_subtest("bo-copy")
assert(run_test(1, bo_copy, I915_TILING_X, 1) == 0);
igt_assert(run_test(1, bo_copy, I915_TILING_X, 1) == 0);
return 0;
}
......@@ -31,7 +31,6 @@
#include <sys/ioctl.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <drm.h>
......@@ -92,7 +91,7 @@ static int get_num_fences(int fd)
val = gem_available_fences(fd);
printf ("total %d fences\n", val);