diff options
98 files changed, 342 insertions, 427 deletions
diff --git a/tests/drm_get_client_auth.c b/tests/drm_get_client_auth.c index 7bb23389..28e1b3db 100644 --- a/tests/drm_get_client_auth.c +++ b/tests/drm_get_client_auth.c @@ -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; } diff --git a/tests/drm_vma_limiter.c b/tests/drm_vma_limiter.c index 119156ed..9c95b77b 100644 --- a/tests/drm_vma_limiter.c +++ b/tests/drm_vma_limiter.c @@ -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]); } diff --git a/tests/drm_vma_limiter_cached.c b/tests/drm_vma_limiter_cached.c index 96d7875f..02f08af4 100644 --- a/tests/drm_vma_limiter_cached.c +++ b/tests/drm_vma_limiter_cached.c @@ -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]); diff --git a/tests/drm_vma_limiter_cpu.c b/tests/drm_vma_limiter_cpu.c index b64e1449..792a9f87 100644 --- a/tests/drm_vma_limiter_cpu.c +++ b/tests/drm_vma_limiter_cpu.c @@ -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]); } diff --git a/tests/drm_vma_limiter_gtt.c b/tests/drm_vma_limiter_gtt.c index 65c849e8..68ba25cb 100644 --- a/tests/drm_vma_limiter_gtt.c +++ b/tests/drm_vma_limiter_gtt.c @@ -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]); } diff --git a/tests/gem_bad_address.c b/tests/gem_bad_address.c index fbb96497..6e5f0254 100644 --- a/tests/gem_bad_address.c +++ b/tests/gem_bad_address.c @@ -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> diff --git a/tests/gem_bad_batch.c b/tests/gem_bad_batch.c index db6636ae..abeda881 100644 --- a/tests/gem_bad_batch.c +++ b/tests/gem_bad_batch.c @@ -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> diff --git a/tests/gem_bad_blit.c b/tests/gem_bad_blit.c index 22165270..96c8dddc 100644 --- a/tests/gem_bad_blit.c +++ b/tests/gem_bad_blit.c @@ -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> diff --git a/tests/gem_bad_length.c b/tests/gem_bad_length.c index 3c81dd6b..940dffdb 100644 --- a/tests/gem_bad_length.c +++ b/tests/gem_bad_length.c @@ -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 diff --git a/tests/gem_basic.c b/tests/gem_basic.c index 77707f66..40efe01e 100644 --- a/tests/gem_basic.c +++ b/tests/gem_basic.c @@ -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 diff --git a/tests/gem_caching.c b/tests/gem_caching.c index 510042d9..d3fc131d 100644 --- a/tests/gem_caching.c +++ b/tests/gem_caching.c @@ -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> diff --git a/tests/gem_cpu_concurrent_blit.c b/tests/gem_cpu_concurrent_blit.c index ed759dd3..9422c619 100644 --- a/tests/gem_cpu_concurrent_blit.c +++ b/tests/gem_cpu_concurrent_blit.c @@ -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; } diff --git a/tests/gem_cpu_reloc.c b/tests/gem_cpu_reloc.c index 5de13815..1284c0d4 100644 --- a/tests/gem_cpu_reloc.c +++ b/tests/gem_cpu_reloc.c @@ -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)); diff --git a/tests/gem_cs_prefetch.c b/tests/gem_cs_prefetch.c index d5df43bb..2d70517f 100644 --- a/tests/gem_cs_prefetch.c +++ b/tests/gem_cs_prefetch.c @@ -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. */ diff --git a/tests/gem_cs_tlb.c b/tests/gem_cs_tlb.c index cff66809..b6eb4503 100644 --- a/tests/gem_cs_tlb.c +++ b/tests/gem_cs_tlb.c @@ -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. */ diff --git a/tests/gem_ctx_bad_destroy.c b/tests/gem_ctx_bad_destroy.c index 02db55f3..8ac78874 100644 --- a/tests/gem_ctx_bad_destroy.c +++ b/tests/gem_ctx_bad_destroy.c @@ -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); diff --git a/tests/gem_ctx_bad_exec.c b/tests/gem_ctx_bad_exec.c index cfd35a0e..adb49814 100644 --- a/tests/gem_ctx_bad_exec.c +++ b/tests/gem_ctx_bad_exec.c @@ -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); } diff --git a/tests/gem_ctx_basic.c b/tests/gem_ctx_basic.c index 592a50cc..0926e973 100644 --- a/tests/gem_ctx_basic.c +++ b/tests/gem_ctx_basic.c @@ -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); } } diff --git a/tests/gem_ctx_create.c b/tests/gem_ctx_create.c index 1f4ac51d..9e00e0f8 100644 --- a/tests/gem_ctx_create.c +++ b/tests/gem_ctx_create.c @@ -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); diff --git a/tests/gem_ctx_exec.c b/tests/gem_ctx_exec.c index 301a640a..15c87b03 100644 --- a/tests/gem_ctx_exec.c +++ b/tests/gem_ctx_exec.c @@ -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); } diff --git a/tests/gem_double_irq_loop.c b/tests/gem_double_irq_loop.c index 49110789..31bf0193 100644 --- a/tests/gem_double_irq_loop.c +++ b/tests/gem_double_irq_loop.c @@ -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> diff --git a/tests/gem_dummy_reloc_loop.c b/tests/gem_dummy_reloc_loop.c index bbece79e..87cc4613 100644 --- a/tests/gem_dummy_reloc_loop.c +++ b/tests/gem_dummy_reloc_loop.c @@ -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> diff --git a/tests/gem_exec_bad_domains.c b/tests/gem_exec_bad_domains.c index e40f9079..4499994d 100644 --- a/tests/gem_exec_bad_domains.c +++ b/tests/gem_exec_bad_domains.c @@ -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; diff --git a/tests/gem_exec_big.c b/tests/gem_exec_big.c index 8b2de0d0..e29cfc96 100644 --- a/tests/gem_exec_big.c +++ b/tests/gem_exec_big.c @@ -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; } diff --git a/tests/gem_exec_blt.c b/tests/gem_exec_blt.c index fe86978f..73bb15b1 100644 --- a/tests/gem_exec_blt.c +++ b/tests/gem_exec_blt.c @@ -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; diff --git a/tests/gem_exec_faulting_reloc.c b/tests/gem_exec_faulting_reloc.c index c4ad9361..3d981133 100644 --- a/tests/gem_exec_faulting_reloc.c +++ b/tests/gem_exec_faulting_reloc.c @@ -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; diff --git a/tests/gem_exec_lut_handle.c b/tests/gem_exec_lut_handle.c index 448ee0cf..fd20ab1d 100644 --- a/tests/gem_exec_lut_handle.c +++ b/tests/gem_exec_lut_handle.c @@ -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> diff --git a/tests/gem_exec_nop.c b/tests/gem_exec_nop.c index 7314b68b..7165ca66 100644 --- a/tests/gem_exec_nop.c +++ b/tests/gem_exec_nop.c @@ -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> diff --git a/tests/gem_fence_thrash.c b/tests/gem_fence_thrash.c index ea1c8c31..c7855638 100644 --- a/tests/gem_fence_thrash.c +++ b/tests/gem_fence_thrash.c @@ -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; } diff --git a/tests/gem_fenced_exec_thrash.c b/tests/gem_fenced_exec_thrash.c index cffc2053..58b2545b 100644 --- a/tests/gem_fenced_exec_thrash.c +++ b/tests/gem_fenced_exec_thrash.c @@ -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); - assert(val > 4); + igt_assert(val > 4); return val; } @@ -143,14 +142,14 @@ static void run_test(int fd, int num_fences, int expected_errno) ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf[0]); - assert(expected_errno ? + igt_assert(expected_errno ? ret < 0 && errno == expected_errno : ret == 0); ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf[1]); - assert(expected_errno ? + igt_assert(expected_errno ? ret < 0 && errno == expected_errno : ret == 0); } while (--loop); @@ -169,7 +168,7 @@ main(int argc, char **argv) num_fences = get_num_fences(fd); devid = intel_get_drm_devid(fd); - assert(num_fences <= MAX_FENCES); + igt_assert(num_fences <= MAX_FENCES); run_test(fd, num_fences - 2, 0); run_test(fd, num_fences + 1, intel_gen(devid) >= 4 ? 0 : EDEADLK); diff --git a/tests/gem_flink.c b/tests/gem_flink.c index 161c25ee..946860d7 100644 --- a/tests/gem_flink.c +++ b/tests/gem_flink.c @@ -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> @@ -51,16 +50,16 @@ test_flink(int fd) memset(&create, 0, sizeof(create)); create.size = 16 * 1024; ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create); - assert(ret == 0); + igt_assert(ret == 0); flink.handle = create.handle; ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink); - assert(ret == 0); + igt_assert(ret == 0); open_struct.name = flink.name; ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open_struct); - assert(ret == 0); - assert(open_struct.handle != 0); + igt_assert(ret == 0); + igt_assert(open_struct.handle != 0); } static void @@ -76,16 +75,16 @@ test_double_flink(int fd) memset(&create, 0, sizeof(create)); create.size = 16 * 1024; ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create); - assert(ret == 0); + igt_assert(ret == 0); flink.handle = create.handle; ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink); - assert(ret == 0); + igt_assert(ret == 0); flink2.handle = create.handle; ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink2); - assert(ret == 0); - assert(flink2.name == flink.name); + igt_assert(ret == 0); + igt_assert(flink2.name == flink.name); } static void @@ -98,7 +97,7 @@ test_bad_flink(int fd) flink.handle = 0x10101010; ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink); - assert(ret == -1 && errno == ENOENT); + igt_assert(ret == -1 && errno == ENOENT); } static void @@ -112,7 +111,7 @@ test_bad_open(int fd) open_struct.name = 0x10101010; ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open_struct); - assert(ret == -1 && errno == ENOENT); + igt_assert(ret == -1 && errno == ENOENT); } static void @@ -130,24 +129,24 @@ test_flink_lifetime(int fd) memset(&create, 0, sizeof(create)); create.size = 16 * 1024; ret = ioctl(fd2, DRM_IOCTL_I915_GEM_CREATE, &create); - assert(ret == 0); + igt_assert(ret == 0); flink.handle = create.handle; ret = ioctl(fd2, DRM_IOCTL_GEM_FLINK, &flink); - assert(ret == 0); + igt_assert(ret == 0); open_struct.name = flink.name; ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open_struct); - assert(ret == 0); - assert(open_struct.handle != 0); + igt_assert(ret == 0); + igt_assert(open_struct.handle != 0); close(fd2); fd2 = drm_open_any(); open_struct.name = flink.name; ret = ioctl(fd2, DRM_IOCTL_GEM_OPEN, &open_struct); - assert(ret == 0); - assert(open_struct.handle != 0); + igt_assert(ret == 0); + igt_assert(open_struct.handle != 0); } int main(int argc, char **argv) diff --git a/tests/gem_flink_race.c b/tests/gem_flink_race.c index e8d421dc..ddf9b83c 100644 --- a/tests/gem_flink_race.c +++ b/tests/gem_flink_race.c @@ -28,7 +28,6 @@ #include <sys/ioctl.h> #include <stdlib.h> #include <string.h> -#include <assert.h> #include <fcntl.h> #include <unistd.h> #include <pthread.h> @@ -56,12 +55,12 @@ static int get_object_count(void) char *path; ret = asprintf(&path, "/sys/kernel/debug/dri/%d/i915_gem_objects", device); - assert(ret != -1); + igt_assert(ret != -1); file = fopen(path, "r"); scanned = fscanf(file, "%i objects", &ret); - assert(scanned == 1); + igt_assert(scanned == 1); return ret; } @@ -80,11 +79,11 @@ static void *thread_fn_flink_name(void *p) if (ret == 0) { uint32_t name = gem_flink(fd, open_struct.handle); - assert(name == 1); + igt_assert(name == 1); gem_close(fd, open_struct.handle); } else - assert(errno == ENOENT); + igt_assert(errno == ENOENT); } return (void *)0; @@ -103,12 +102,12 @@ static void test_flink_name(void) threads = calloc(num_threads, sizeof(pthread_t)); fd = drm_open_any(); - assert(fd >= 0); + igt_assert(fd >= 0); for (i = 0; i < num_threads; i++) { r = pthread_create(&threads[i], NULL, thread_fn_flink_name, NULL); - assert(r == 0); + igt_assert(r == 0); } for (i = 0; i < 1000000; i++) { @@ -125,7 +124,7 @@ static void test_flink_name(void) for (i = 0; i < num_threads; i++) { pthread_join(threads[i], &status); - assert(status == 0); + igt_assert(status == 0); } close(fd); @@ -166,12 +165,12 @@ static void test_flink_close(void) threads = calloc(num_threads, sizeof(pthread_t)); fd = drm_open_any(); - assert(fd >= 0); + igt_assert(fd >= 0); for (i = 0; i < num_threads; i++) { r = pthread_create(&threads[i], NULL, thread_fn_flink_close, NULL); - assert(r == 0); + igt_assert(r == 0); } sleep(5); @@ -180,7 +179,7 @@ static void test_flink_close(void) for (i = 0; i < num_threads; i++) { pthread_join(threads[i], &status); - assert(status == 0); + igt_assert(status == 0); } close(fd); @@ -188,7 +187,7 @@ static void test_flink_close(void) obj_count = get_object_count() - obj_count; printf("leaked %i objects\n", obj_count); - assert(obj_count == 0); + igt_assert(obj_count == 0); } int main(int argc, char **argv) diff --git a/tests/gem_gtt_concurrent_blit.c b/tests/gem_gtt_concurrent_blit.c index 15a23362..ebaa96cb 100644 --- a/tests/gem_gtt_concurrent_blit.c +++ b/tests/gem_gtt_concurrent_blit.c @@ -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> @@ -69,7 +68,7 @@ cmp_bo(drm_intel_bo *bo, uint32_t val, int width, int height) drm_intel_gem_bo_start_gtt_access(bo, false); vaddr = bo->virtual; while (size--) - assert(*vaddr++ == val); + igt_assert(*vaddr++ == val); } static drm_intel_bo * @@ -78,7 +77,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); /* gtt map doesn't have a write parameter, so just keep the mapping * around (to avoid the set_domain with the gtt write domain set) and diff --git a/tests/gem_gtt_cpu_tlb.c b/tests/gem_gtt_cpu_tlb.c index 2d532c04..4c62ea34 100644 --- a/tests/gem_gtt_cpu_tlb.c +++ b/tests/gem_gtt_cpu_tlb.c @@ -33,7 +33,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <assert.h> #include <fcntl.h> #include <inttypes.h> #include <errno.h> @@ -92,7 +91,7 @@ main(int argc, char **argv) /* stirr up the page allocator a bit. */ ptr = malloc(OBJ_SIZE); - assert(ptr); + igt_assert(ptr); memset(ptr, 0x1, OBJ_SIZE); handle = create_bo(fd); @@ -102,7 +101,7 @@ main(int argc, char **argv) */ gem_read(fd, handle, 0, ptr, OBJ_SIZE); for (i = 0; i < OBJ_SIZE/4; i++) - assert(ptr[i] == i); + igt_assert(ptr[i] == i); close(fd); diff --git a/tests/gem_gtt_speed.c b/tests/gem_gtt_speed.c index e567b1f4..d685838f 100644 --- a/tests/gem_gtt_speed.c +++ b/tests/gem_gtt_speed.c @@ -31,7 +31,6 @@ #include <stdint.h> #include <stdio.h> #include <string.h> -#include <assert.h> #include <fcntl.h> #include <inttypes.h> #include <errno.h> @@ -75,7 +74,7 @@ int main(int argc, char **argv) fd = drm_open_any(); handle = gem_create(fd, size); - assert(handle); + igt_assert(handle); for (tiling = I915_TILING_NONE; tiling <= I915_TILING_Y; tiling++) { if (tiling != I915_TILING_NONE) { diff --git a/tests/gem_hang.c b/tests/gem_hang.c index f9db3400..5a66fea3 100644 --- a/tests/gem_hang.c +++ b/tests/gem_hang.c @@ -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> diff --git a/tests/gem_hangcheck_forcewake.c b/tests/gem_hangcheck_forcewake.c index 20dda7fa..e2a7e5e7 100644 --- a/tests/gem_hangcheck_forcewake.c +++ b/tests/gem_hangcheck_forcewake.c @@ -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> diff --git a/tests/gem_largeobject.c b/tests/gem_largeobject.c index eb9bb02f..67363272 100644 --- a/tests/gem_largeobject.c +++ b/tests/gem_largeobject.c @@ -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> diff --git a/tests/gem_linear_blits.c b/tests/gem_linear_blits.c index 8fdbca5a..b3d916fd 100644 --- a/tests/gem_linear_blits.c +++ b/tests/gem_linear_blits.c @@ -36,7 +36,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <assert.h> #include <fcntl.h> #include <inttypes.h> #include <errno.h> @@ -138,7 +137,7 @@ copy(int fd, uint32_t dst, uint32_t src) drmCommandNone(fd, DRM_I915_GEM_THROTTLE); ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec); } - assert(ret == 0); + igt_assert(ret == 0); gem_close(fd, handle); } diff --git a/tests/gem_lut_handle.c b/tests/gem_lut_handle.c index 1b7974b5..dcb6b519 100644 --- a/tests/gem_lut_handle.c +++ b/tests/gem_lut_handle.c @@ -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> @@ -98,7 +97,7 @@ static int many_exec(int fd, uint32_t batch, int num_exec, int num_reloc, unsign gem_exec = calloc(num_exec+1, sizeof(*gem_exec)); gem_reloc = calloc(num_reloc, sizeof(*gem_reloc)); - assert(gem_exec && gem_reloc); + igt_assert(gem_exec && gem_reloc); for (n = 0; n < num_exec; n++) { gem_exec[n].handle = gem_create(fd, 4096); diff --git a/tests/gem_mmap.c b/tests/gem_mmap.c index f9369f43..900c391a 100644 --- a/tests/gem_mmap.c +++ b/tests/gem_mmap.c @@ -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> @@ -60,7 +59,7 @@ int main(int argc, char **argv) arg.size = 4096; printf("Testing mmaping of bad object.\n"); ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg); - assert(ret == -1 && errno == ENOENT); + igt_assert(ret == -1 && errno == ENOENT); handle = gem_create(fd, OBJECT_SIZE); @@ -69,23 +68,23 @@ int main(int argc, char **argv) arg.offset = 0; arg.size = OBJECT_SIZE; ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg); - assert(ret == 0); + igt_assert(ret == 0); addr = (uint8_t *)(uintptr_t)arg.addr_ptr; printf("Testing contents of newly created object.\n"); memset(expected, 0, sizeof(expected)); - assert(memcmp(addr, expected, sizeof(expected)) == 0); + igt_assert(memcmp(addr, expected, sizeof(expected)) == 0); printf("Testing coherency of writes and mmap reads.\n"); memset(buf, 0, sizeof(buf)); memset(buf + 1024, 0x01, 1024); memset(expected + 1024, 0x01, 1024); gem_write(fd, handle, 0, buf, OBJECT_SIZE); - assert(memcmp(buf, addr, sizeof(buf)) == 0); + igt_assert(memcmp(buf, addr, sizeof(buf)) == 0); printf("Testing that mapping stays after close\n"); gem_close(fd, handle); - assert(memcmp(buf, addr, sizeof(buf)) == 0); + igt_assert(memcmp(buf, addr, sizeof(buf)) == 0); printf("Testing unmapping\n"); munmap(addr, OBJECT_SIZE); diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c index 23419768..f86b13ce 100644 --- a/tests/gem_mmap_gtt.c +++ b/tests/gem_mmap_gtt.c @@ -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> @@ -53,7 +52,7 @@ mmap_bo(int fd, uint32_t handle) void *ptr; ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); - assert(ptr != MAP_FAILED); + igt_assert(ptr != MAP_FAILED); return ptr; } diff --git a/tests/gem_mmap_offset_exhaustion.c b/tests/gem_mmap_offset_exhaustion.c index b2d23f55..1ec3299f 100644 --- a/tests/gem_mmap_offset_exhaustion.c +++ b/tests/gem_mmap_offset_exhaustion.c @@ -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> @@ -64,7 +63,7 @@ create_and_map_bo(int fd) if (!ptr) { fprintf(stderr, "mmap failed\n"); - assert(ptr); + igt_assert(ptr); } /* touch it to force it into the gtt */ diff --git a/tests/gem_non_secure_batch.c b/tests/gem_non_secure_batch.c index 9148b00d..aeac6df9 100644 --- a/tests/gem_non_secure_batch.c +++ b/tests/gem_non_secure_batch.c @@ -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> diff --git a/tests/gem_partial_pwrite_pread.c b/tests/gem_partial_pwrite_pread.c index 68994cb9..b2ccfd2c 100644 --- a/tests/gem_partial_pwrite_pread.c +++ b/tests/gem_partial_pwrite_pread.c @@ -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> diff --git a/tests/gem_pin.c b/tests/gem_pin.c index 4626746f..f886f4f3 100644 --- a/tests/gem_pin.c +++ b/tests/gem_pin.c @@ -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> @@ -81,7 +80,7 @@ static void exec(int fd, uint32_t handle, uint32_t offset) execbuf.rsvd2 = 0; do_or_die(drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf)); - assert(gem_exec[0].offset == offset); + igt_assert(gem_exec[0].offset == offset); } static int gem_linear_blt(uint32_t *batch, @@ -222,15 +221,15 @@ int main(int argc, char **argv) /* pin anidle bo */ handle[i] = gem_create(fd, 4096); offset[i] = gem_pin(fd, handle[i], 0); - assert(offset[i]); + igt_assert(offset[i]); gem_write(fd, handle[i], 0, batch, sizeof(batch)); } else { /* try to pin an anidle bo */ handle[i] = gem_create(fd, 4096); make_busy(fd, handle[i]); offset[i] = gem_pin(fd, handle[i], 256*1024); - assert(offset[i]); - assert((offset[i] & (256*1024-1)) == 0); + igt_assert(offset[i]); + igt_assert((offset[i] & (256*1024-1)) == 0); gem_write(fd, handle[i], 0, batch, sizeof(batch)); } } diff --git a/tests/gem_pipe_control_store_loop.c b/tests/gem_pipe_control_store_loop.c index af6a7581..f3d6a4db 100644 --- a/tests/gem_pipe_control_store_loop.c +++ b/tests/gem_pipe_control_store_loop.c @@ -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> diff --git a/tests/gem_pread.c b/tests/gem_pread.c index 0a6b63b2..74e7321a 100644 --- a/tests/gem_pread.c +++ b/tests/gem_pread.c @@ -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> diff --git a/tests/gem_pread_after_blit.c b/tests/gem_pread_after_blit.c index 8f34961f..8a1c205f 100644 --- a/tests/gem_pread_after_blit.c +++ b/tests/gem_pread_after_blit.c @@ -37,7 +37,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <assert.h> #include <fcntl.h> #include <inttypes.h> #include <errno.h> diff --git a/tests/gem_prw_concurrent_blit.c b/tests/gem_prw_concurrent_blit.c index f828eb3e..cbac71b6 100644 --- a/tests/gem_prw_concurrent_blit.c +++ b/tests/gem_prw_concurrent_blit.c @@ -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> @@ -73,7 +72,7 @@ cmp_bo(drm_intel_bo *bo, uint32_t val, int width, int height) vaddr = tmp = malloc(size*4); drm_intel_bo_get_subdata(bo, 0, size*4, tmp); while (size--) - assert(*vaddr++ == val); + igt_assert(*vaddr++ == val); free(tmp); } @@ -83,7 +82,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; } diff --git a/tests/gem_pwrite.c b/tests/gem_pwrite.c index cf3c6aaf..62b5c2f2 100644 --- a/tests/gem_pwrite.c +++ b/tests/gem_pwrite.c @@ -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> diff --git a/tests/gem_pwrite_pread.c b/tests/gem_pwrite_pread.c index 175e1aa5..7dc88957 100644 --- a/tests/gem_pwrite_pread.c +++ b/tests/gem_pwrite_pread.c @@ -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> @@ -243,7 +242,7 @@ static void test_copy(int fd, uint32_t src, uint32_t dst, uint32_t *buf, int len gem_close(fd, exec[2].handle); for (i = 0; i < len/4; i++) - assert(buf[i] == i); + igt_assert(buf[i] == i); } static void test_as_gtt_mmap(int fd, uint32_t src, uint32_t dst, int len) @@ -292,7 +291,7 @@ static void test_as_gtt_mmap(int fd, uint32_t src, uint32_t dst, int len) gem_set_domain(fd, dst, I915_GEM_DOMAIN_GTT, 0); for (i = 0; i < len/4; i++) - assert(dst_ptr[i] == i); + igt_assert(dst_ptr[i] == i); munmap(dst_ptr, len); munmap(src_ptr, len); @@ -344,7 +343,7 @@ static void test_as_cpu_mmap(int fd, uint32_t src, uint32_t dst, int len) gem_set_domain(fd, dst, I915_GEM_DOMAIN_CPU, 0); for (i = 0; i < len/4; i++) - assert(dst_ptr[i] == i); + igt_assert(dst_ptr[i] == i); munmap(dst_ptr, len); munmap(src_ptr, len); diff --git a/tests/gem_readwrite.c b/tests/gem_readwrite.c index 6abe1351..bc7a47e1 100644 --- a/tests/gem_readwrite.c +++ b/tests/gem_readwrite.c @@ -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> @@ -90,45 +89,45 @@ int main(int argc, char **argv) printf("Testing contents of newly created object.\n"); ret = do_read(fd, handle, buf, 0, OBJECT_SIZE); - assert(ret == 0); + igt_assert(ret == 0); memset(&expected, 0, sizeof(expected)); - assert(memcmp(expected, buf, sizeof(expected)) == 0); + igt_assert(memcmp(expected, buf, sizeof(expected)) == 0); printf("Testing read beyond end of buffer.\n"); ret = do_read(fd, handle, buf, OBJECT_SIZE / 2, OBJECT_SIZE); - assert(ret == -1 && errno == EINVAL); + igt_assert(ret == -1 && errno == EINVAL); printf("Testing full write of buffer\n"); memset(buf, 0, sizeof(buf)); memset(buf + 1024, 0x01, 1024); memset(expected + 1024, 0x01, 1024); ret = do_write(fd, handle, buf, 0, OBJECT_SIZE); - assert(ret == 0); + igt_assert(ret == 0); ret = do_read(fd, handle, buf, 0, OBJECT_SIZE); - assert(ret == 0); - assert(memcmp(buf, expected, sizeof(buf)) == 0); + igt_assert(ret == 0); + igt_assert(memcmp(buf, expected, sizeof(buf)) == 0); printf("Testing partial write of buffer\n"); memset(buf + 4096, 0x02, 1024); memset(expected + 4096, 0x02, 1024); ret = do_write(fd, handle, buf + 4096, 4096, 1024); - assert(ret == 0); + igt_assert(ret == 0); ret = do_read(fd, handle, buf, 0, OBJECT_SIZE); - assert(ret == 0); - assert(memcmp(buf, expected, sizeof(buf)) == 0); + igt_assert(ret == 0); + igt_assert(memcmp(buf, expected, sizeof(buf)) == 0); printf("Testing partial read of buffer\n"); ret = do_read(fd, handle, buf, 512, 1024); - assert(ret == 0); - assert(memcmp(buf, expected + 512, 1024) == 0); + igt_assert(ret == 0); + igt_assert(memcmp(buf, expected + 512, 1024) == 0); printf("Testing read of bad buffer handle\n"); ret = do_read(fd, 1234, buf, 0, 1024); - assert(ret == -1 && errno == ENOENT); + igt_assert(ret == -1 && errno == ENOENT); printf("Testing write of bad buffer handle\n"); ret = do_write(fd, 1234, buf, 0, 1024); - assert(ret == -1 && errno == ENOENT); + igt_assert(ret == -1 && errno == ENOENT); close(fd); diff --git a/tests/gem_reloc_overflow.c b/tests/gem_reloc_overflow.c index 140b6847..f91fc917 100644 --- a/tests/gem_reloc_overflow.c +++ b/tests/gem_reloc_overflow.c @@ -29,7 +29,6 @@ #include <stdio.h> #include <stdint.h> #include <string.h> -#include <assert.h> #include <fcntl.h> #include <inttypes.h> #include <errno.h> diff --git a/tests/gem_reloc_vs_gpu.c b/tests/gem_reloc_vs_gpu.c index 90ba8602..c563a014 100644 --- a/tests/gem_reloc_vs_gpu.c +++ b/tests/gem_reloc_vs_gpu.c @@ -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> @@ -93,7 +92,7 @@ static void create_special_bo(void) BATCH(CMD_POLY_STIPPLE_OFFSET << 16); BATCH(0); } - assert(len % 2 == 0); + igt_assert(len % 2 == 0); BATCH(MI_NOOP); BATCH(MI_BATCH_BUFFER_END); @@ -176,7 +175,7 @@ int main(int argc, char **argv) for (i = 0; i < NUM_TARGET_BOS; i++) { pc_target_bo[i] = drm_intel_bo_alloc(bufmgr, "special batch", 4096, 4096); emit_dummy_load(pitch); - assert(pc_target_bo[i]->offset == 0); + igt_assert(pc_target_bo[i]->offset == 0); drm_intel_bo_emit_reloc(special_bo, special_reloc_ofs, pc_target_bo[i], 0, diff --git a/tests/gem_ring_sync_loop.c b/tests/gem_ring_sync_loop.c index b111275b..499a5168 100644 --- a/tests/gem_ring_sync_loop.c +++ b/tests/gem_ring_sync_loop.c @@ -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> diff --git a/tests/gem_ringfill.c b/tests/gem_ringfill.c index a72ad5f3..5c66bcfa 100644 --- a/tests/gem_ringfill.c +++ b/tests/gem_ringfill.c @@ -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> @@ -159,7 +158,7 @@ static int check_ring(drm_intel_bufmgr *bufmgr, igt_progress(output, i, width*height); - assert(y < height); + igt_assert(y < height); /* Dummy load to fill the ring */ copy(batch, &src, 0, 0, width, height, &tmp, 0, 0); diff --git a/tests/gem_seqno_wrap.c b/tests/gem_seqno_wrap.c index a54c4140..c9368759 100644 --- a/tests/gem_seqno_wrap.c +++ b/tests/gem_seqno_wrap.c @@ -33,7 +33,6 @@ #include <stdlib.h> #include <string.h> #include <time.h> -#include <assert.h> #include <fcntl.h> #include <unistd.h> #include <sys/types.h> @@ -77,7 +76,7 @@ static void init_buffer(drm_intel_bufmgr *bufmgr, /* buf->bo = drm_intel_bo_alloc(bufmgr, "", size, 4096); */ buf->bo = bo; buf->size = width * height * 4; - assert(buf->bo); + igt_assert(buf->bo); buf->tiling = I915_TILING_NONE; buf->data = buf->cpu_mapping = NULL; buf->num_tiles = width * height * 4; @@ -121,7 +120,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", width * height * 4, 0); - assert(bo); + igt_assert(bo); /* gtt map doesn't have a write parameter, so just keep the mapping * around (to avoid the set_domain with the gtt write domain set) and @@ -160,8 +159,8 @@ static void render_copyfunc(struct scratch_buf *src, "test is shallow!\n"); warned = 1; } - assert(dst->bo); - assert(src->bo); + igt_assert(dst->bo); + igt_assert(src->bo); intel_copy_bo(batch_blt, dst->bo, src->bo, width, height); intel_batchbuffer_flush(batch_blt); } @@ -191,7 +190,7 @@ static int run_sync_test(int num_buffers, bool verify) struct scratch_buf *s_src, *s_dst; fd = drm_open_any(); - assert(fd >= 0); + igt_assert(fd >= 0); gem_quiescent_gpu(fd); @@ -204,24 +203,24 @@ static int run_sync_test(int num_buffers, bool verify) bufmgr = drm_intel_bufmgr_gem_init(fd, 4096); drm_intel_bufmgr_gem_enable_reuse(bufmgr); batch_blt = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd)); - assert(batch_blt); + igt_assert(batch_blt); batch_3d = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd)); - assert(batch_3d); + igt_assert(batch_3d); src = malloc(num_buffers * sizeof(**src)); - assert(src); + igt_assert(src); dst1 = malloc(num_buffers * sizeof(**dst1)); - assert(dst1); + igt_assert(dst1); dst2 = malloc(num_buffers * sizeof(**dst2)); - assert(dst2); + igt_assert(dst2); s_src = malloc(num_buffers * sizeof(*s_src)); - assert(s_src); + igt_assert(s_src); s_dst = malloc(num_buffers * sizeof(*s_dst)); - assert(s_dst); + igt_assert(s_dst); p_dst1 = malloc(num_buffers * sizeof(unsigned int)); if (p_dst1 == NULL) @@ -234,11 +233,11 @@ static int run_sync_test(int num_buffers, bool verify) for (i = 0; i < num_buffers; i++) { p_dst1[i] = p_dst2[i] = i; src[i] = create_bo(bufmgr, i, width, height); - assert(src[i]); + igt_assert(src[i]); dst1[i] = create_bo(bufmgr, ~i, width, height); - assert(dst1[i]); + igt_assert(dst1[i]); dst2[i] = create_bo(bufmgr, ~i, width, height); - assert(dst2[i]); + igt_assert(dst2[i]); init_buffer(bufmgr, &s_src[i], src[i], width, height); init_buffer(bufmgr, &s_dst[i], dst1[i], width, height); } @@ -317,7 +316,7 @@ static int run_cmd(char *s) if (getcwd(path, PATH_MAX) == NULL) perror("getcwd"); - assert(snprintf(full_path, PATH_MAX, "%s/%s", path, wexp.we_wordv[0]) > 0); + igt_assert(snprintf(full_path, PATH_MAX, "%s/%s", path, wexp.we_wordv[0]) > 0); /* if (!options.verbose) { close(STDOUT_FILENO); @@ -423,7 +422,7 @@ static int read_seqno(void) int wrap = 0; r = __read_seqno(&seqno); - assert(r == 0); + igt_assert(r == 0); if (last_seqno > seqno) wrap++; @@ -444,14 +443,14 @@ static int write_seqno(uint32_t seqno) return 0; fh = dfs_open(O_RDWR); - assert(snprintf(buf, sizeof(buf), "0x%x", seqno) > 0); + igt_assert(snprintf(buf, sizeof(buf), "0x%x", seqno) > 0); r = write(fh, buf, strnlen(buf, sizeof(buf))); close(fh); if (r < 0) return r; - assert(r == strnlen(buf, sizeof(buf))); + igt_assert(r == strnlen(buf, sizeof(buf))); last_seqno = seqno; @@ -498,17 +497,17 @@ static int run_test(void) static void preset_run_once(void) { - assert(write_seqno(1) == 0); - assert(run_test() == 0); + igt_assert(write_seqno(1) == 0); + igt_assert(run_test() == 0); - assert(write_seqno(0x7fffffff) == 0); - assert(run_test() == 0); + igt_assert(write_seqno(0x7fffffff) == 0); + igt_assert(run_test() == 0); - assert(write_seqno(0xffffffff) == 0); - assert(run_test() == 0); + igt_assert(write_seqno(0xffffffff) == 0); + igt_assert(run_test() == 0); - assert(write_seqno(0xfffffff0) == 0); - assert(run_test() == 0); + igt_assert(write_seqno(0xfffffff0) == 0); + igt_assert(run_test() == 0); } static void random_run_once(void) @@ -521,25 +520,25 @@ static void random_run_once(void) val += random(); } while (val == 0); - assert(write_seqno(val) == 0); - assert(run_test() == 0); + igt_assert(write_seqno(val) == 0); + igt_assert(run_test() == 0); } static void wrap_run_once(void) { const uint32_t pw_val = calc_prewrap_val(); - assert(write_seqno(UINT32_MAX - pw_val) == 0); + igt_assert(write_seqno(UINT32_MAX - pw_val) == 0); while(!read_seqno()) - assert(run_test() == 0); + igt_assert(run_test() == 0); } static void background_run_once(void) { const uint32_t pw_val = calc_prewrap_val(); - assert(write_seqno(UINT32_MAX - pw_val) == 0); + igt_assert(write_seqno(UINT32_MAX - pw_val) == 0); while(!read_seqno()) sleep(3); @@ -650,7 +649,7 @@ int main(int argc, char **argv) parse_options(argc, argv); card_index = drm_get_card(0); - assert(card_index != -1); + igt_assert(card_index != -1); srandom(time(NULL)); diff --git a/tests/gem_set_tiling_vs_blt.c b/tests/gem_set_tiling_vs_blt.c index 9c4fcb5d..d73c3aec 100644 --- a/tests/gem_set_tiling_vs_blt.c +++ b/tests/gem_set_tiling_vs_blt.c @@ -47,7 +47,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <assert.h> #include <fcntl.h> #include <inttypes.h> #include <errno.h> @@ -121,7 +120,7 @@ static void do_test(uint32_t tiling, unsigned stride, test_bo = drm_intel_bo_alloc(bufmgr, "tiled busy bo", TEST_SIZE, 4096); test_bo_handle = test_bo->handle; ret = drm_intel_bo_set_tiling(test_bo, &tiling_after, stride_after); - assert(ret == 0); + igt_assert(ret == 0); drm_intel_gem_bo_map_gtt(test_bo); ptr = test_bo->virtual; *ptr = 0; @@ -140,7 +139,7 @@ static void do_test(uint32_t tiling, unsigned stride, test_bo_handle = test_bo->handle; /* ensure we have the right tiling before we start. */ ret = drm_intel_bo_set_tiling(test_bo, &tiling, stride); - assert(ret == 0); + igt_assert(ret == 0); if (tiling == I915_TILING_NONE) { drm_intel_bo_subdata(test_bo, 0, TEST_SIZE, data); @@ -182,7 +181,7 @@ static void do_test(uint32_t tiling, unsigned stride, if (test_bo_handle != test_bo->handle) fprintf(stderr, "libdrm reuse trick failed\n"); ret = drm_intel_bo_set_tiling(test_bo, &tiling_after, stride_after); - assert(ret == 0); + igt_assert(ret == 0); /* Note: We don't care about gen4+ here because the blitter doesn't use * fences there. So not setting tiling flags on the tiled buffer is ok. @@ -210,7 +209,7 @@ static void do_test(uint32_t tiling, unsigned stride, memset(data, 0, TEST_SIZE); drm_intel_bo_get_subdata(target_bo, 0, TEST_SIZE, data); for (i = 0; i < TEST_SIZE/4; i++) - assert(data[i] == i); + igt_assert(data[i] == i); /* check whether tiling on the test_bo actually changed. */ drm_intel_gem_bo_map_gtt(test_bo); @@ -220,7 +219,7 @@ static void do_test(uint32_t tiling, unsigned stride, tiling_changed = true; ptr = NULL; drm_intel_gem_bo_unmap_gtt(test_bo); - assert(tiling_changed); + igt_assert(tiling_changed); drm_intel_bo_unreference(test_bo); drm_intel_bo_unreference(target_bo); @@ -251,8 +250,8 @@ int main(int argc, char **argv) tiling = I915_TILING_NONE; tiling_after = I915_TILING_X; do_test(tiling, TEST_STRIDE, tiling_after, TEST_STRIDE); - assert(tiling == I915_TILING_NONE); - assert(tiling_after == I915_TILING_X); + igt_assert(tiling == I915_TILING_NONE); + igt_assert(tiling_after == I915_TILING_X); } igt_subtest("tiled-to-untiled") { @@ -260,8 +259,8 @@ int main(int argc, char **argv) tiling = I915_TILING_X; tiling_after = I915_TILING_NONE; do_test(tiling, TEST_STRIDE, tiling_after, TEST_STRIDE); - assert(tiling == I915_TILING_X); - assert(tiling_after == I915_TILING_NONE); + igt_assert(tiling == I915_TILING_X); + igt_assert(tiling_after == I915_TILING_NONE); } igt_subtest("tiled-to-tiled") { @@ -269,8 +268,8 @@ int main(int argc, char **argv) tiling = I915_TILING_X; tiling_after = I915_TILING_X; do_test(tiling, TEST_STRIDE/2, tiling_after, TEST_STRIDE); - assert(tiling == I915_TILING_X); - assert(tiling_after == I915_TILING_X); + igt_assert(tiling == I915_TILING_X); + igt_assert(tiling_after == I915_TILING_X); } return 0; diff --git a/tests/gem_set_tiling_vs_gtt.c b/tests/gem_set_tiling_vs_gtt.c index 30f7a3a7..a620c997 100644 --- a/tests/gem_set_tiling_vs_gtt.c +++ b/tests/gem_set_tiling_vs_gtt.c @@ -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> @@ -69,7 +68,7 @@ int main(int argc, char **argv) handle = gem_create(fd, OBJECT_SIZE); ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); - assert(ptr); + igt_assert(ptr); /* gtt coherency is done with set_domain in libdrm, don't break that */ gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); @@ -86,7 +85,7 @@ int main(int argc, char **argv) for (i = 0; i < OBJECT_SIZE/4; i++) if (ptr[i] != data[i]) tiling_changed = true; - assert(tiling_changed); + igt_assert(tiling_changed); gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); for (i = 0; i < OBJECT_SIZE/4; i++) @@ -111,7 +110,7 @@ int main(int argc, char **argv) i, row, half, ofs); printf("read: 0x%08x, expected: 0x%08x\n", ptr[i], val); - assert(0); + igt_assert(0); } } @@ -129,7 +128,7 @@ int main(int argc, char **argv) for (i = 0; i < OBJECT_SIZE/4; i++) if (ptr[i] != data[i]) tiling_changed = true; - assert(tiling_changed); + igt_assert(tiling_changed); munmap(ptr, OBJECT_SIZE); diff --git a/tests/gem_set_tiling_vs_pwrite.c b/tests/gem_set_tiling_vs_pwrite.c index 70211490..f27accd7 100644 --- a/tests/gem_set_tiling_vs_pwrite.c +++ b/tests/gem_set_tiling_vs_pwrite.c @@ -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> @@ -65,7 +64,7 @@ int main(int argc, char **argv) handle = gem_create(fd, OBJECT_SIZE); ptr = gem_mmap(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); - assert(ptr); + igt_assert(ptr); gem_set_tiling(fd, handle, I915_TILING_X, TEST_STRIDE); @@ -78,7 +77,7 @@ int main(int argc, char **argv) memset(data, 0, OBJECT_SIZE); gem_read(fd, handle, 0, data, OBJECT_SIZE); for (i = 0; i < OBJECT_SIZE/4; i++) - assert(i == data[i]); + igt_assert(i == data[i]); /* touch it before changing the tiling, so that the fence sticks around */ gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); @@ -91,7 +90,7 @@ int main(int argc, char **argv) memset(data, 0, OBJECT_SIZE); gem_read(fd, handle, 0, data, OBJECT_SIZE); for (i = 0; i < OBJECT_SIZE/4; i++) - assert(i == data[i]); + igt_assert(i == data[i]); munmap(ptr, OBJECT_SIZE); diff --git a/tests/gem_storedw_batches_loop.c b/tests/gem_storedw_batches_loop.c index f6a6026c..e05e8449 100644 --- a/tests/gem_storedw_batches_loop.c +++ b/tests/gem_storedw_batches_loop.c @@ -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> diff --git a/tests/gem_storedw_loop_blt.c b/tests/gem_storedw_loop_blt.c index fe6a7974..415ecc50 100644 --- a/tests/gem_storedw_loop_blt.c +++ b/tests/gem_storedw_loop_blt.c @@ -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> diff --git a/tests/gem_storedw_loop_bsd.c b/tests/gem_storedw_loop_bsd.c index 0031cadb..8549105f 100644 --- a/tests/gem_storedw_loop_bsd.c +++ b/tests/gem_storedw_loop_bsd.c @@ -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> diff --git a/tests/gem_storedw_loop_render.c b/tests/gem_storedw_loop_render.c index a76c409b..0f42af13 100644 --- a/tests/gem_storedw_loop_render.c +++ b/tests/gem_storedw_loop_render.c @@ -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> diff --git a/tests/gem_storedw_loop_vebox.c b/tests/gem_storedw_loop_vebox.c index 9d7e22c1..0293a388 100644 --- a/tests/gem_storedw_loop_vebox.c +++ b/tests/gem_storedw_loop_vebox.c @@ -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> diff --git a/tests/gem_stress.c b/tests/gem_stress.c index 2f2d1ed8..283510bd 100644 --- a/tests/gem_stress.c +++ b/tests/gem_stress.c @@ -118,7 +118,7 @@ struct { static void tile2xy(struct scratch_buf *buf, unsigned tile, unsigned *x, unsigned *y) { - assert(tile < buf->num_tiles); + igt_assert(tile < buf->num_tiles); *x = (tile*options.tile_size) % (buf->stride/sizeof(uint32_t)); *y = ((tile*options.tile_size) / (buf->stride/sizeof(uint32_t))) * options.tile_size; } @@ -173,7 +173,7 @@ static void keep_gpu_busy(void) int tmp; tmp = 1 << gpu_busy_load; - assert(tmp <= 1024); + igt_assert(tmp <= 1024); emit_blt(busy_bo, 0, 4096, 0, 0, tmp, 128, busy_bo, 0, 4096, 0, 128); @@ -229,7 +229,7 @@ static void cpu_copyfunc(struct scratch_buf *src, unsigned src_x, unsigned src_y struct scratch_buf *dst, unsigned dst_x, unsigned dst_y, unsigned logical_tile_no) { - assert(batch->ptr == batch->buffer); + igt_assert(batch->ptr == batch->buffer); if (options.ducttape) drm_intel_bo_wait_rendering(dst->bo); @@ -251,7 +251,7 @@ static void prw_copyfunc(struct scratch_buf *src, unsigned src_x, unsigned src_y uint32_t tmp_tile[options.tile_size*options.tile_size]; int i; - assert(batch->ptr == batch->buffer); + igt_assert(batch->ptr == batch->buffer); if (options.ducttape) drm_intel_bo_wait_rendering(dst->bo); @@ -450,12 +450,12 @@ static void sanitize_stride(struct scratch_buf *buf) if (buf_width(buf) < options.tile_size) buf->stride = options.tile_size * sizeof(uint32_t); - assert(buf->stride <= 8192); - assert(buf_width(buf) <= options.max_dimension); - assert(buf_height(buf) <= options.max_dimension); + igt_assert(buf->stride <= 8192); + igt_assert(buf_width(buf) <= options.max_dimension); + igt_assert(buf_height(buf) <= options.max_dimension); - assert(buf_width(buf) >= options.tile_size); - assert(buf_height(buf) >= options.tile_size); + igt_assert(buf_width(buf) >= options.tile_size); + igt_assert(buf_height(buf) >= options.tile_size); } @@ -463,7 +463,7 @@ static void init_buffer(struct scratch_buf *buf, unsigned size) { buf->bo = drm_intel_bo_alloc(bufmgr, "tiled bo", size, 4096); buf->size = size; - assert(buf->bo); + igt_assert(buf->bo); buf->tiling = I915_TILING_NONE; buf->stride = 4096; @@ -610,7 +610,7 @@ static int get_num_fences(void) val = gem_available_fences(drm_fd); printf ("total %d fences\n", val); - assert(val > 4); + igt_assert(val > 4); return val - 2; } @@ -880,9 +880,9 @@ int main(int argc, char **argv) tile_permutation = malloc(num_total_tiles*sizeof(uint32_t)); current_permutation = malloc(num_total_tiles*sizeof(uint32_t)); tmp_permutation = malloc(num_total_tiles*sizeof(uint32_t)); - assert(tile_permutation); - assert(current_permutation); - assert(tmp_permutation); + igt_assert(tile_permutation); + igt_assert(current_permutation); + igt_assert(tmp_permutation); fan_out(); diff --git a/tests/gem_suspend.c b/tests/gem_suspend.c index b0d7dcda..4d88013e 100644 --- a/tests/gem_suspend.c +++ b/tests/gem_suspend.c @@ -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> @@ -57,19 +56,19 @@ test_fence_restore(int fd, bool tiled2untiled) /* Access the buffer objects in the order we want to have the laid out. */ ptr1 = gem_mmap(fd, handle1, OBJECT_SIZE, PROT_READ | PROT_WRITE); - assert(ptr1 != MAP_FAILED); + igt_assert(ptr1 != MAP_FAILED); for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++) ptr1[i] = i; ptr_tiled = gem_mmap(fd, handle_tiled, OBJECT_SIZE, PROT_READ | PROT_WRITE); - assert(ptr_tiled != MAP_FAILED); + igt_assert(ptr_tiled != MAP_FAILED); if (tiled2untiled) gem_set_tiling(fd, handle_tiled, I915_TILING_X, 2048); for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++) ptr_tiled[i] = i; ptr2 = gem_mmap(fd, handle2, OBJECT_SIZE, PROT_READ | PROT_WRITE); - assert(ptr2 != MAP_FAILED); + igt_assert(ptr2 != MAP_FAILED); for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++) ptr2[i] = i; @@ -82,11 +81,11 @@ test_fence_restore(int fd, bool tiled2untiled) printf("checking the first canary object\n"); for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++) - assert(ptr1[i] == i); + igt_assert(ptr1[i] == i); printf("checking the second canary object\n"); for (i = 0; i < OBJECT_SIZE/sizeof(uint32_t); i++) - assert(ptr2[i] == i); + igt_assert(ptr2[i] == i); gem_close(fd, handle1); gem_close(fd, handle2); diff --git a/tests/gem_threaded_access_tiled.c b/tests/gem_threaded_access_tiled.c index 2895bf80..a51cd4d8 100644 --- a/tests/gem_threaded_access_tiled.c +++ b/tests/gem_threaded_access_tiled.c @@ -26,7 +26,6 @@ #include <stdlib.h> #include <string.h> -#include <assert.h> #include <fcntl.h> #include <unistd.h> #include <pthread.h> @@ -76,12 +75,12 @@ static int copy_tile_threaded(drm_intel_bo *bo) for (i = 0; i < NUM_THREADS; i++) { tctx[i].bo = bo; r = pthread_create(&thr[i], NULL, copy_fn, (void *)&tctx[i]); - assert(r == 0); + igt_assert(r == 0); } for (i = 0; i < NUM_THREADS; i++) { pthread_join(thr[i], &status); - assert(status == 0); + igt_assert(status == 0); } return 0; @@ -98,23 +97,23 @@ int main(int argc, char **argv) igt_skip_on_simulation(); fd = drm_open_any(); - assert(fd >= 0); + igt_assert(fd >= 0); bufmgr = drm_intel_bufmgr_gem_init(fd, 4096); - assert(bufmgr); + igt_assert(bufmgr); bo = drm_intel_bo_alloc_tiled(bufmgr, "mmap bo", WIDTH, HEIGHT, 1, &tiling_mode, &pitch, 0); - assert(bo); + igt_assert(bo); r = drm_intel_gem_bo_map_gtt(bo); - assert(!r); + igt_assert(!r); r = copy_tile_threaded(bo); - assert(!r); + igt_assert(!r); r = drm_intel_gem_bo_unmap_gtt(bo); - assert(!r); + igt_assert(!r); drm_intel_bo_unreference(bo); drm_intel_bufmgr_destroy(bufmgr); diff --git a/tests/gem_tiled_blits.c b/tests/gem_tiled_blits.c index 0cfc118e..2d21e27c 100644 --- a/tests/gem_tiled_blits.c +++ b/tests/gem_tiled_blits.c @@ -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> @@ -71,7 +70,7 @@ create_bo(uint32_t start_val) bo = drm_intel_bo_alloc(bufmgr, "tiled bo", 1024 * 1024, 4096); do_or_die(drm_intel_bo_set_tiling(bo, &tiling, width * 4)); - assert(tiling == I915_TILING_X); + igt_assert(tiling == I915_TILING_X); linear_bo = drm_intel_bo_alloc(bufmgr, "linear src", 1024 * 1024, 4096); diff --git a/tests/gem_tiled_fence_blits.c b/tests/gem_tiled_fence_blits.c index 951961d7..aa20293a 100644 --- a/tests/gem_tiled_fence_blits.c +++ b/tests/gem_tiled_fence_blits.c @@ -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> @@ -71,8 +70,8 @@ create_bo(int fd, uint32_t start_val) bo = drm_intel_bo_alloc(bufmgr, "tiled bo", 1024 * 1024, 4096); ret = drm_intel_bo_set_tiling(bo, &tiling, width * 4); - assert(ret == 0); - assert(tiling == I915_TILING_X); + igt_assert(ret == 0); + igt_assert(tiling == I915_TILING_X); /* Fill the BO with dwords starting at start_val */ for (i = 0; i < 1024 * 1024 / 4; i++) diff --git a/tests/gem_tiled_partial_pwrite_pread.c b/tests/gem_tiled_partial_pwrite_pread.c index 340af1c5..196cb0fb 100644 --- a/tests/gem_tiled_partial_pwrite_pread.c +++ b/tests/gem_tiled_partial_pwrite_pread.c @@ -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> @@ -292,8 +291,8 @@ int main(int argc, char **argv) scratch_bo = drm_intel_bo_alloc_tiled(bufmgr, "scratch bo", 1024, BO_SIZE/4096, 4, &tiling_mode, &scratch_pitch, 0); - assert(tiling_mode == I915_TILING_X); - assert(scratch_pitch == 4096); + igt_assert(tiling_mode == I915_TILING_X); + igt_assert(scratch_pitch == 4096); staging_bo = drm_intel_bo_alloc(bufmgr, "staging bo", BO_SIZE, 4096); tiled_staging_bo = drm_intel_bo_alloc_tiled(bufmgr, "scratch bo", 1024, BO_SIZE/4096, 4, diff --git a/tests/gem_tiled_pread.c b/tests/gem_tiled_pread.c index 189affce..9abdb884 100644 --- a/tests/gem_tiled_pread.c +++ b/tests/gem_tiled_pread.c @@ -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> @@ -71,7 +70,7 @@ gem_get_tiling(int fd, uint32_t handle, uint32_t *tiling, uint32_t *swizzle) get_tiling.handle = handle; ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_GET_TILING, &get_tiling); - assert(ret == 0); + igt_assert(ret == 0); *tiling = get_tiling.tiling_mode; *swizzle = get_tiling.swizzle_mode; diff --git a/tests/gem_tiled_pread_pwrite.c b/tests/gem_tiled_pread_pwrite.c index 546662f1..875e9c8e 100644 --- a/tests/gem_tiled_pread_pwrite.c +++ b/tests/gem_tiled_pread_pwrite.c @@ -47,7 +47,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <assert.h> #include <fcntl.h> #include <inttypes.h> #include <errno.h> @@ -77,7 +76,7 @@ gem_get_tiling(int fd, uint32_t handle, uint32_t *tiling, uint32_t *swizzle) get_tiling.handle = handle; ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_GET_TILING, &get_tiling); - assert(ret == 0); + igt_assert(ret == 0); *tiling = get_tiling.tiling_mode; *swizzle = get_tiling.swizzle_mode; diff --git a/tests/gem_tiled_swapping.c b/tests/gem_tiled_swapping.c index 06034f81..b1431dcd 100644 --- a/tests/gem_tiled_swapping.c +++ b/tests/gem_tiled_swapping.c @@ -47,7 +47,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <assert.h> #include <fcntl.h> #include <inttypes.h> #include <errno.h> @@ -107,10 +106,10 @@ main(int argc, char **argv) /* need slightly more than total ram */ count = intel_get_total_ram_mb() * 11 / 10; bo_handles = calloc(count, sizeof(uint32_t)); - assert(bo_handles); + igt_assert(bo_handles); idx_arr = calloc(count, sizeof(int)); - assert(idx_arr); + igt_assert(idx_arr); if (intel_get_total_swap_mb() == 0) { printf("no swap detected\n"); diff --git a/tests/gem_tiling_max_stride.c b/tests/gem_tiling_max_stride.c index 21daab02..28e94bc6 100644 --- a/tests/gem_tiling_max_stride.c +++ b/tests/gem_tiling_max_stride.c @@ -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 void do_test_invalid_tiling(int fd, uint32_t handle, int tiling, int stri ret = ioctl(fd, DRM_IOCTL_I915_GEM_SET_TILING, &st); } while (ret == -1 && (errno == EINTR || errno == EAGAIN)); - assert(ret == -1 && errno == EINVAL); + igt_assert(ret == -1 && errno == EINVAL); } static void test_invalid_tiling(int fd, uint32_t handle, int stride) @@ -100,7 +99,7 @@ int main(int argc, char *argv[]) size = stride * tile_height; data = malloc(size); - assert(data); + igt_assert(data); /* Fill each line with the line number */ for (y = 0; y < tile_height; y++) { @@ -111,7 +110,7 @@ int main(int argc, char *argv[]) handle = gem_create(fd, size); ptr = gem_mmap(fd, handle, size, PROT_READ | PROT_WRITE); - assert(ptr); + igt_assert(ptr); test_invalid_tiling(fd, handle, 0); test_invalid_tiling(fd, handle, 64); @@ -139,7 +138,7 @@ int main(int argc, char *argv[]) for (i = 0; i < size / 4; ) { for (y = 0; y < tile_height; y++) { for (x = 0; x < tile_width / 4; x++) { - assert(y == data[i]); + igt_assert(y == data[i]); i++; } } diff --git a/tests/gem_unfence_active_buffers.c b/tests/gem_unfence_active_buffers.c index 9f2946cf..1649ef0b 100644 --- a/tests/gem_unfence_active_buffers.c +++ b/tests/gem_unfence_active_buffers.c @@ -41,7 +41,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <assert.h> #include <fcntl.h> #include <inttypes.h> #include <errno.h> @@ -118,7 +117,7 @@ int main(int argc, char **argv) test_bo = drm_intel_bo_alloc(bufmgr, "test_bo", TEST_SIZE, 4096); ret = drm_intel_bo_set_tiling(test_bo, &tiling, TEST_STRIDE); - assert(ret == 0); + igt_assert(ret == 0); drm_intel_bo_disable_reuse(test_bo); diff --git a/tests/gem_unref_active_buffers.c b/tests/gem_unref_active_buffers.c index 5cc7e145..6d63b893 100644 --- a/tests/gem_unref_active_buffers.c +++ b/tests/gem_unref_active_buffers.c @@ -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> @@ -69,7 +68,7 @@ int main(int argc, char **argv) //drm_intel_bufmgr_gem_enable_reuse(bufmgr); batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd)); - assert(batch); + igt_assert(batch); /* put some load onto the gpu to keep the light buffers active for long * enough */ diff --git a/tests/gem_vmap_blits.c b/tests/gem_vmap_blits.c index 8c28ff92..c09bcfc2 100644 --- a/tests/gem_vmap_blits.c +++ b/tests/gem_vmap_blits.c @@ -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> @@ -98,7 +97,7 @@ gem_read(int fd, uint32_t handle, int offset, int size, void *buf) pread.size = size; pread.data_ptr = (uintptr_t)buf; ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_PREAD, &pread); - assert(ret == 0); + igt_assert(ret == 0); } static void @@ -184,7 +183,7 @@ copy(int fd, uint32_t dst, uint32_t src) drmCommandNone(fd, DRM_I915_GEM_THROTTLE); ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec); } - assert(ret == 0); + igt_assert(ret == 0); gem_close(fd, handle); } diff --git a/tests/gem_wait_render_timeout.c b/tests/gem_wait_render_timeout.c index e67ed309..2df91ba1 100644 --- a/tests/gem_wait_render_timeout.c +++ b/tests/gem_wait_render_timeout.c @@ -69,7 +69,7 @@ gem_bo_wait_timeout(int fd, uint32_t handle, uint64_t *timeout_ns) struct local_drm_i915_gem_wait wait; int ret; - assert(timeout_ns); + igt_assert(timeout_ns); wait.bo_handle = handle; wait.timeout_ns = *timeout_ns; @@ -150,15 +150,15 @@ int main(int argc, char **argv) #define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC #endif - assert(clock_gettime(CLOCK_MONOTONIC_RAW, &start) == 0); + igt_assert(clock_gettime(CLOCK_MONOTONIC_RAW, &start) == 0); for (i = 0; i < iter; i++) blt_color_fill(batch, dst, BUF_PAGES); intel_batchbuffer_flush(batch); drm_intel_bo_wait_rendering(dst); - assert(clock_gettime(CLOCK_MONOTONIC_RAW, &end) == 0); + igt_assert(clock_gettime(CLOCK_MONOTONIC_RAW, &end) == 0); diff = do_time_diff(&end, &start); - assert(diff >= 0); + igt_assert(diff >= 0); if ((diff / MSEC_PER_SEC) > ENOUGH_WORK_IN_SECONDS) done = true; @@ -166,7 +166,7 @@ int main(int argc, char **argv) iter <<= 1; } while (!done && iter < 1000000); - assert(iter < 1000000); + igt_assert(iter < 1000000); printf("%d iters is enough work\n", iter); gem_quiescent_gpu(fd); @@ -180,15 +180,15 @@ int main(int argc, char **argv) blt_color_fill(batch, dst2, BUF_PAGES); intel_batchbuffer_flush(batch); - assert(gem_bo_busy(fd, dst2->handle) == true); + igt_assert(gem_bo_busy(fd, dst2->handle) == true); ret = gem_bo_wait_timeout(fd, dst2->handle, &timeout); if (ret) { fprintf(stderr, "Timed wait failed %s\n", strerror(errno)); exit(EXIT_FAILURE); } - assert(gem_bo_busy(fd, dst2->handle) == false); - assert(timeout != 0); + igt_assert(gem_bo_busy(fd, dst2->handle) == false); + igt_assert(timeout != 0); if (timeout == (ENOUGH_WORK_IN_SECONDS * NSEC_PER_SEC)) printf("Buffer was already done!\n"); else { @@ -197,8 +197,8 @@ int main(int argc, char **argv) /* check that polling with timeout=0 works. */ timeout = 0; - assert(gem_bo_wait_timeout(fd, dst2->handle, &timeout) == 0); - assert(timeout == 0); + igt_assert(gem_bo_wait_timeout(fd, dst2->handle, &timeout) == 0); + igt_assert(timeout == 0); /* Now check that we correctly time out, twice the auto-tune load should * be good enough. */ @@ -209,14 +209,14 @@ int main(int argc, char **argv) intel_batchbuffer_flush(batch); ret = gem_bo_wait_timeout(fd, dst2->handle, &timeout); - assert(ret == -ETIME); - assert(timeout == 0); - assert(gem_bo_busy(fd, dst2->handle) == true); + igt_assert(ret == -ETIME); + igt_assert(timeout == 0); + igt_assert(gem_bo_busy(fd, dst2->handle) == true); /* check that polling with timeout=0 works. */ timeout = 0; - assert(gem_bo_wait_timeout(fd, dst2->handle, &timeout) == -ETIME); - assert(timeout == 0); + igt_assert(gem_bo_wait_timeout(fd, dst2->handle, &timeout) == -ETIME); + igt_assert(timeout == 0); if (do_signals) diff --git a/tests/gem_write_read_ring_switch.c b/tests/gem_write_read_ring_switch.c index 128c0e74..0090f511 100644 --- a/tests/gem_write_read_ring_switch.c +++ b/tests/gem_write_read_ring_switch.c @@ -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> @@ -77,7 +76,7 @@ static void run_test(int ring, const char *testname) * set_domain. */ drm_intel_bo_map(target_bo, 0); ptr = target_bo->virtual; - assert(*ptr == 0); + igt_assert(*ptr == 0); /* put some load onto the gpu to keep the light buffers active for long * enough */ @@ -141,7 +140,7 @@ static void run_test(int ring, const char *testname) intel_batchbuffer_flush_on_ring(batch, ring); gem_set_domain(fd, target_bo->handle, I915_GEM_DOMAIN_GTT, 0); - assert(*ptr == COLOR); + igt_assert(*ptr == COLOR); drm_intel_bo_unmap(target_bo); drm_intel_bo_unreference(target_bo); @@ -191,7 +190,7 @@ int main(int argc, char **argv) //drm_intel_bufmgr_gem_enable_reuse(bufmgr); batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd)); - assert(batch); + igt_assert(batch); dummy_bo = drm_intel_bo_alloc(bufmgr, "dummy bo", 4096, 4096); if (!dummy_bo) { diff --git a/tests/gen3_mixed_blits.c b/tests/gen3_mixed_blits.c index 5bb6d868..4aec5229 100644 --- a/tests/gen3_mixed_blits.c +++ b/tests/gen3_mixed_blits.c @@ -36,7 +36,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <assert.h> #include <fcntl.h> #include <inttypes.h> #include <errno.h> @@ -268,11 +267,11 @@ render_copy(int fd, if ((b - batch) & 1) *b++ = 0; - assert(b - batch <= 1024); + igt_assert(b - batch <= 1024); handle = gem_create(fd, 4096); gem_write(fd, handle, 0, batch, (b-batch)*sizeof(batch[0])); - assert(r-reloc == 2); + igt_assert(r-reloc == 2); tiling_bits = 0; if (use_fence) @@ -320,7 +319,7 @@ render_copy(int fd, drmCommandNone(fd, DRM_I915_GEM_THROTTLE); ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec); } - assert(ret == 0); + igt_assert(ret == 0); gem_close(fd, handle); } @@ -350,11 +349,11 @@ static void blt_copy(int fd, uint32_t dst, uint32_t src) if ((b - batch) & 1) *b++ = 0; - assert(b - batch <= 1024); + igt_assert(b - batch <= 1024); handle = gem_create(fd, 4096); gem_write(fd, handle, 0, batch, (b-batch)*sizeof(batch[0])); - assert(r-reloc == 2); + igt_assert(r-reloc == 2); obj[0].handle = dst; obj[0].relocation_count = 0; @@ -398,7 +397,7 @@ static void blt_copy(int fd, uint32_t dst, uint32_t src) drmCommandNone(fd, DRM_I915_GEM_THROTTLE); ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec); } - assert(ret == 0); + igt_assert(ret == 0); gem_close(fd, handle); } @@ -432,7 +431,7 @@ create_bo(int fd, uint32_t val, int tiling) /* Fill the BO with dwords starting at val */ v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE); - assert(v); + igt_assert(v); for (i = 0; i < WIDTH*HEIGHT; i++) v[i] = val++; munmap(v, WIDTH*HEIGHT*4); @@ -447,7 +446,7 @@ check_bo(int fd, uint32_t handle, uint32_t val) int i; v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ); - assert(v); + igt_assert(v); for (i = 0; i < WIDTH*HEIGHT; i++) { if (v[i] != val) { fprintf(stderr, "Expected 0x%08x, found 0x%08x " diff --git a/tests/gen3_render_linear_blits.c b/tests/gen3_render_linear_blits.c index 529e23ff..506d6d24 100644 --- a/tests/gen3_render_linear_blits.c +++ b/tests/gen3_render_linear_blits.c @@ -36,7 +36,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <assert.h> #include <fcntl.h> #include <inttypes.h> #include <errno.h> @@ -241,11 +240,11 @@ copy(int fd, uint32_t dst, uint32_t src) if ((b - batch) & 1) *b++ = 0; - assert(b - batch <= 1024); + igt_assert(b - batch <= 1024); handle = gem_create(fd, 4096); gem_write(fd, handle, 0, batch, (b-batch)*sizeof(batch[0])); - assert(r-reloc == 2); + igt_assert(r-reloc == 2); obj[0].handle = dst; obj[0].relocation_count = 0; @@ -289,7 +288,7 @@ copy(int fd, uint32_t dst, uint32_t src) drmCommandNone(fd, DRM_I915_GEM_THROTTLE); ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec); } - assert(ret == 0); + igt_assert(ret == 0); gem_close(fd, handle); } diff --git a/tests/gen3_render_mixed_blits.c b/tests/gen3_render_mixed_blits.c index 1353b9d7..343fe99c 100644 --- a/tests/gen3_render_mixed_blits.c +++ b/tests/gen3_render_mixed_blits.c @@ -36,7 +36,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <assert.h> #include <fcntl.h> #include <inttypes.h> #include <errno.h> @@ -255,11 +254,11 @@ copy(int fd, if ((b - batch) & 1) *b++ = 0; - assert(b - batch <= 1024); + igt_assert(b - batch <= 1024); handle = gem_create(fd, 4096); gem_write(fd, handle, 0, batch, (b-batch)*sizeof(batch[0])); - assert(r-reloc == 2); + igt_assert(r-reloc == 2); obj[0].handle = dst; obj[0].relocation_count = 0; @@ -303,7 +302,7 @@ copy(int fd, drmCommandNone(fd, DRM_I915_GEM_THROTTLE); ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec); } - assert(ret == 0); + igt_assert(ret == 0); gem_close(fd, handle); } @@ -320,7 +319,7 @@ create_bo(int fd, uint32_t val, int tiling) /* Fill the BO with dwords starting at val */ v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE); - assert(v); + igt_assert(v); for (i = 0; i < WIDTH*HEIGHT; i++) v[i] = val++; munmap(v, WIDTH*HEIGHT*4); @@ -335,7 +334,7 @@ check_bo(int fd, uint32_t handle, uint32_t val) int i; v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ); - assert(v); + igt_assert(v); for (i = 0; i < WIDTH*HEIGHT; i++) { if (v[i] != val) { fprintf(stderr, "Expected 0x%08x, found 0x%08x " diff --git a/tests/gen3_render_tiledx_blits.c b/tests/gen3_render_tiledx_blits.c index 0e96e797..e5841814 100644 --- a/tests/gen3_render_tiledx_blits.c +++ b/tests/gen3_render_tiledx_blits.c @@ -36,7 +36,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <assert.h> #include <fcntl.h> #include <inttypes.h> #include <errno.h> @@ -242,11 +241,11 @@ copy(int fd, uint32_t dst, uint32_t src) if ((b - batch) & 1) *b++ = 0; - assert(b - batch <= 1024); + igt_assert(b - batch <= 1024); handle = gem_create(fd, 4096); gem_write(fd, handle, 0, batch, (b-batch)*sizeof(batch[0])); - assert(r-reloc == 2); + igt_assert(r-reloc == 2); obj[0].handle = dst; obj[0].relocation_count = 0; @@ -290,7 +289,7 @@ copy(int fd, uint32_t dst, uint32_t src) drmCommandNone(fd, DRM_I915_GEM_THROTTLE); ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec); } - assert(ret == 0); + igt_assert(ret == 0); gem_close(fd, handle); } @@ -307,7 +306,7 @@ create_bo(int fd, uint32_t val) /* Fill the BO with dwords starting at val */ v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE); - assert(v); + igt_assert(v); for (i = 0; i < WIDTH*HEIGHT; i++) v[i] = val++; munmap(v, WIDTH*HEIGHT*4); @@ -322,7 +321,7 @@ check_bo(int fd, uint32_t handle, uint32_t val) int i; v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ); - assert(v); + igt_assert(v); for (i = 0; i < WIDTH*HEIGHT; i++) { if (v[i] != val) { fprintf(stderr, "Expected 0x%08x, found 0x%08x " diff --git a/tests/gen3_render_tiledy_blits.c b/tests/gen3_render_tiledy_blits.c index 90fc7eb9..993b3c27 100644 --- a/tests/gen3_render_tiledy_blits.c +++ b/tests/gen3_render_tiledy_blits.c @@ -36,7 +36,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <assert.h> #include <fcntl.h> #include <inttypes.h> #include <errno.h> @@ -242,11 +241,11 @@ copy(int fd, uint32_t dst, uint32_t src) if ((b - batch) & 1) *b++ = 0; - assert(b - batch <= 1024); + igt_assert(b - batch <= 1024); handle = gem_create(fd, 4096); gem_write(fd, handle, 0, batch, (b-batch)*sizeof(batch[0])); - assert(r-reloc == 2); + igt_assert(r-reloc == 2); obj[0].handle = dst; obj[0].relocation_count = 0; @@ -290,7 +289,7 @@ copy(int fd, uint32_t dst, uint32_t src) drmCommandNone(fd, DRM_I915_GEM_THROTTLE); ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &exec); } - assert(ret == 0); + igt_assert(ret == 0); gem_close(fd, handle); } @@ -307,7 +306,7 @@ create_bo(int fd, uint32_t val) /* Fill the BO with dwords starting at val */ v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ | PROT_WRITE); - assert(v); + igt_assert(v); for (i = 0; i < WIDTH*HEIGHT; i++) v[i] = val++; munmap(v, WIDTH*HEIGHT*4); @@ -322,7 +321,7 @@ check_bo(int fd, uint32_t handle, uint32_t val) int i; v = gem_mmap(fd, handle, WIDTH*HEIGHT*4, PROT_READ); - assert(v); + igt_assert(v); for (i = 0; i < WIDTH*HEIGHT; i++) { if (v[i] != val) { fprintf(stderr, "Expected 0x%08x, found 0x%08x " diff --git a/tests/getclient.c b/tests/getclient.c index 481ce119..dcb7b326 100644 --- a/tests/getclient.c +++ b/tests/getclient.c @@ -45,7 +45,7 @@ int main(int argc, char **argv) */ client.idx = 0; ret = ioctl(fd, DRM_IOCTL_GET_CLIENT, &client); - assert(ret == 0); + igt_assert(ret == 0); /* Look for some absurd client index and make sure it's invalid. * The DRM drivers currently always return data, so the user has @@ -54,7 +54,7 @@ int main(int argc, char **argv) */ client.idx = 0x7fffffff; ret = ioctl(fd, DRM_IOCTL_GET_CLIENT, &client); - assert(ret == -1 && errno == EINVAL); + igt_assert(ret == -1 && errno == EINVAL); close(fd); return 0; diff --git a/tests/getstats.c b/tests/getstats.c index 8a7d2999..7975257d 100644 --- a/tests/getstats.c +++ b/tests/getstats.c @@ -43,7 +43,7 @@ int main(int argc, char **argv) fd = drm_open_any(); ret = ioctl(fd, DRM_IOCTL_GET_STATS, &stats); - assert(ret == 0); + igt_assert(ret == 0); close(fd); return 0; diff --git a/tests/getversion.c b/tests/getversion.c index 4847e796..d6da2ad6 100644 --- a/tests/getversion.c +++ b/tests/getversion.c @@ -39,10 +39,10 @@ int main(int argc, char **argv) fd = drm_open_any(); v = drmGetVersion(fd); - assert(strlen(v->name) != 0); - assert(strlen(v->date) != 0); - assert(strlen(v->desc) != 0); - assert(v->version_major >= 1); + igt_assert(strlen(v->name) != 0); + igt_assert(strlen(v->date) != 0); + igt_assert(strlen(v->desc) != 0); + igt_assert(v->version_major >= 1); drmFree(v); close(fd); return 0; diff --git a/tests/kms_flip.c b/tests/kms_flip.c index e0f0adbb..fb4d511f 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -25,7 +25,6 @@ #include "config.h" #endif -#include <assert.h> #include <cairo.h> #include <errno.h> #include <fcntl.h> @@ -156,9 +155,9 @@ static void emit_dummy_load(struct test_output *o) limit = intel_gen(devid) < 6 ? 500 : 5000; dummy_bo = drm_intel_bo_alloc(bufmgr, "dummy_bo", fb_info->size, 4096); - assert(dummy_bo); + igt_assert(dummy_bo); target_bo = gem_handle_to_libdrm_bo(bufmgr, drm_fd, "imported", fb_info->gem_handle); - assert(target_bo); + igt_assert(target_bo); for (i = 0; i < limit; i++) { BEGIN_BATCH(8); @@ -231,13 +230,13 @@ static int set_dpms(struct test_output *o, int mode) static void set_flag(unsigned int *v, unsigned int flag) { - assert(!(*v & flag)); + igt_assert(!(*v & flag)); *v |= flag; } static void clear_flag(unsigned int *v, unsigned int flag) { - assert(*v & flag); + igt_assert(*v & flag); *v &= ~flag; } @@ -270,7 +269,7 @@ static int __wait_for_vblank(unsigned int flags, int crtc_idx, memset(&wait_vbl, 0, sizeof(wait_vbl)); crtc_idx_mask = crtc_idx << DRM_VBLANK_HIGH_CRTC_SHIFT; - assert(!(crtc_idx_mask & ~DRM_VBLANK_HIGH_CRTC_MASK)); + igt_assert(!(crtc_idx_mask & ~DRM_VBLANK_HIGH_CRTC_MASK)); wait_vbl.request.type = crtc_idx_mask; if (flags & TEST_VBLANK_ABSOLUTE) @@ -497,7 +496,7 @@ static void recreate_fb(struct test_output *o) /* Call rmfb/getfb/addfb to ensure those don't introduce stalls */ r = drmModeGetFB(drm_fd, fb_info->fb_id); - assert(r); + igt_assert(r); do_or_die(drmModeAddFB(drm_fd, o->fb_width, o->fb_height, o->depth, o->bpp, fb_info->stride, @@ -518,7 +517,7 @@ static void set_y_tiling(struct test_output *o, int fb_idx) /* Call rmfb/getfb/addfb to ensure those don't introduce stalls */ r = drmModeGetFB(drm_fd, fb_info->fb_id); - assert(r); + igt_assert(r); gem_set_tiling(drm_fd, r->handle, I915_TILING_Y, fb_info->stride); gem_close(drm_fd, r->handle); drmFree(r); @@ -576,7 +575,7 @@ static void eat_error_state(struct test_output *o) int fd; ssize_t r; - assert(card_index != -1); + igt_assert(card_index != -1); /* clear the error state */ snprintf(fname, FILENAME_MAX, "%s/%i/%s", @@ -630,7 +629,7 @@ static void hang_gpu(struct test_output *o) int fd; ssize_t r; - assert(card_index != -1); + igt_assert(card_index != -1); snprintf(fname, FILENAME_MAX, "%s/%i/%s", dfs_base, card_index, dfs_entry); @@ -701,19 +700,19 @@ static unsigned int run_test_step(struct test_output *o) do_or_die(__wait_for_vblank(TEST_VBLANK_ABSOLUTE | TEST_VBLANK_BLOCK, o->pipe, exp_seq, 0, &reply)); - assert(gettime_us() - start < 500); - assert(reply.sequence == exp_seq); - assert(timercmp(&reply.ts, &o->flip_state.last_ts, ==)); + igt_assert(gettime_us() - start < 500); + igt_assert(reply.sequence == exp_seq); + igt_assert(timercmp(&reply.ts, &o->flip_state.last_ts, ==)); } if (do_flip && (o->flags & TEST_EINVAL) && o->flip_state.count > 0) - assert(do_page_flip(o, new_fb_id, true) == expected_einval); + igt_assert(do_page_flip(o, new_fb_id, true) == expected_einval); if (o->flags & TEST_FB_BAD_TILING) new_fb_id = o->fb_ids[o->current_fb_id]; if (do_vblank && (o->flags & TEST_EINVAL) && o->vblank_state.count > 0) - assert(do_wait_for_vblank(o, o->pipe, target_seq, &vbl_reply) + igt_assert(do_wait_for_vblank(o, o->pipe, target_seq, &vbl_reply) == -EINVAL); if (o->flags & TEST_DPMS_OFF) @@ -756,7 +755,7 @@ static unsigned int run_test_step(struct test_output *o) } if (do_flip && (o->flags & TEST_EBUSY)) - assert(do_page_flip(o, new_fb_id, true) == -EBUSY); + igt_assert(do_page_flip(o, new_fb_id, true) == -EBUSY); if (do_flip && (o->flags & TEST_RMFB)) recreate_fb(o); @@ -792,11 +791,11 @@ static unsigned int run_test_step(struct test_output *o) } if (do_vblank && (o->flags & TEST_EINVAL) && o->vblank_state.count > 0) - assert(do_wait_for_vblank(o, o->pipe, target_seq, &vbl_reply) + igt_assert(do_wait_for_vblank(o, o->pipe, target_seq, &vbl_reply) == -EINVAL); if (do_flip && (o->flags & TEST_EINVAL) && !(o->flags & TEST_FB_BAD_TILING)) - assert(do_page_flip(o, new_fb_id, true) == expected_einval); + igt_assert(do_page_flip(o, new_fb_id, true) == expected_einval); if (do_flip && (o->flags & TEST_HANG)) { gem_sync(drm_fd, handle); @@ -860,7 +859,7 @@ static void paint_flip_mode(struct kmstest_fb *fb, bool odd_frame) cairo_set_source_rgb(cr, 1, 1, 1); cairo_fill(cr); - assert(!cairo_status(cr)); + igt_assert(!cairo_status(cr)); } static int @@ -912,7 +911,7 @@ static unsigned int wait_for_events(struct test_output *o) int ret; event_mask = o->pending_events; - assert(event_mask); + igt_assert(event_mask); memset(&evctx, 0, sizeof evctx); evctx.version = DRM_EVENT_CONTEXT_VERSION; @@ -941,7 +940,7 @@ static unsigned int wait_for_events(struct test_output *o) do_or_die(drmHandleEvent(drm_fd, &evctx)); event_mask ^= o->pending_events; - assert(event_mask); + igt_assert(event_mask); return event_mask; } @@ -1028,7 +1027,7 @@ static void run_test_on_crtc(struct test_output *o, int crtc_idx, int duration) } goto out; } - assert(fb_is_bound(o, o->fb_ids[0])); + igt_assert(fb_is_bound(o, o->fb_ids[0])); /* quiescent the hw a bit so ensure we don't miss a single frame */ if (o->flags & TEST_CHECK_TS) @@ -1105,7 +1104,7 @@ static void get_timestamp_format(void) int ret; ret = drmGetCap(drm_fd, DRM_CAP_TIMESTAMP_MONOTONIC, &cap_mono); - assert(ret == 0 || errno == EINVAL); + igt_assert(ret == 0 || errno == EINVAL); monotonic_timestamp = ret == 0 && cap_mono == 1; printf("Using %s timestamps\n", monotonic_timestamp ? "monotonic" : "real"); diff --git a/tests/kms_render.c b/tests/kms_render.c index 7b2197c0..953977aa 100644 --- a/tests/kms_render.c +++ b/tests/kms_render.c @@ -24,7 +24,6 @@ #include "config.h" #endif -#include <assert.h> #include <cairo.h> #include <errno.h> #include <stdint.h> @@ -78,16 +77,16 @@ static void gpu_blit(struct kmstest_fb *dst_fb, struct kmstest_fb *src_fb) drm_intel_bo *src_bo; int bpp; - assert(dst_fb->drm_format == src_fb->drm_format); - assert(src_fb->drm_format == DRM_FORMAT_RGB565 || + igt_assert(dst_fb->drm_format == src_fb->drm_format); + igt_assert(src_fb->drm_format == DRM_FORMAT_RGB565 || drm_format_to_bpp(src_fb->drm_format) != 16); bpp = drm_format_to_bpp(src_fb->drm_format); dst_bo = gem_handle_to_libdrm_bo(bufmgr, drm_fd, "destination", dst_fb->gem_handle); - assert(dst_bo); + igt_assert(dst_bo); src_bo = gem_handle_to_libdrm_bo(bufmgr, drm_fd, "source", src_fb->gem_handle); - assert(src_bo); + igt_assert(src_bo); intel_blt_copy(batch, src_bo, 0, 0, src_fb->width * bpp / 8, @@ -114,12 +113,12 @@ static int test_format(const char *test_name, ret = asprintf(&mode_format_str, "%s @ %dHz / %s", mode->name, mode->vrefresh, kmstest_format_str(format)); - assert(ret > 0); + igt_assert(ret > 0); ret = asprintf(&cconf_str, "pipe %s, encoder %s, connector %s", kmstest_pipe_str(cconf->pipe), kmstest_encoder_type_str(cconf->encoder->encoder_type), kmstest_connector_type_str(cconf->connector->connector_type)); - assert(ret > 0); + igt_assert(ret > 0); printf("Beginning test %s with %s on %s\n", test_name, mode_format_str, cconf_str); @@ -194,7 +193,7 @@ static int run_test(const char *test_name, enum test_flags flags) int i; resources = drmModeGetResources(drm_fd); - assert(resources); + igt_assert(resources); /* Find any connected displays */ for (i = 0; i < resources->count_connectors; i++) { diff --git a/tests/prime_nv_api.c b/tests/prime_nv_api.c index d3dff29c..433b004c 100644 --- a/tests/prime_nv_api.c +++ b/tests/prime_nv_api.c @@ -50,7 +50,7 @@ static int find_and_open_devices(void) break; ret = fgets(vendor_id, 8, fl); - assert(ret); + igt_assert(ret); fclose(fl); venid = strtoul(vendor_id, NULL, 16); diff --git a/tests/prime_nv_pcopy.c b/tests/prime_nv_pcopy.c index a0fb9d26..b7aad707 100644 --- a/tests/prime_nv_pcopy.c +++ b/tests/prime_nv_pcopy.c @@ -356,8 +356,8 @@ static int swtile_y(uint8_t *out, const uint8_t *in, int w, int h) { uint32_t x, y, dx, dy; uint8_t *endptr = out + w * h; - assert(!(w % 128)); - assert(!(h % 32)); + igt_assert(!(w % 128)); + igt_assert(!(h % 32)); for (y = 0; y < h; y += 32) { for (x = 0; x < w; x += 128, out += TILE_SIZE) { @@ -365,8 +365,8 @@ static int swtile_y(uint8_t *out, const uint8_t *in, int w, int h) for (dy = 0; dy < 32; ++dy) { uint32_t out_ofs = (dx * 32 + dy) * 16; uint32_t in_ofs = (y + dy) * w + (x + 16 * dx); - assert(out_ofs < TILE_SIZE); - assert(in_ofs < w*h); + igt_assert(out_ofs < TILE_SIZE); + igt_assert(in_ofs < w*h); // To do the Y tiling quirk: // out_ofs = out_ofs ^ (((out_ofs >> 9) & 1) << 6); @@ -375,7 +375,7 @@ static int swtile_y(uint8_t *out, const uint8_t *in, int w, int h) } } } - assert(out == endptr); + igt_assert(out == endptr); return 0; } @@ -383,21 +383,21 @@ static int swtile_x(uint8_t *out, const uint8_t *in, int w, int h) { uint32_t x, y, dy; uint8_t *endptr = out + w * h; - assert(!(w % 512)); - assert(!(h % 8)); + igt_assert(!(w % 512)); + igt_assert(!(h % 8)); for (y = 0; y < h; y += 8) { for (x = 0; x < w; x += 512, out += TILE_SIZE) { for (dy = 0; dy < 8; ++dy) { uint32_t out_ofs = 512 * dy; uint32_t in_ofs = (y + dy) * w + x; - assert(out_ofs < TILE_SIZE); - assert(in_ofs < w*h); + igt_assert(out_ofs < TILE_SIZE); + igt_assert(in_ofs < w*h); memcpy(&out[out_ofs], &in[in_ofs], 512); } } } - assert(out == endptr); + igt_assert(out == endptr); return 0; } diff --git a/tests/prime_nv_test.c b/tests/prime_nv_test.c index 7ee861eb..48422e66 100644 --- a/tests/prime_nv_test.c +++ b/tests/prime_nv_test.c @@ -58,7 +58,7 @@ static int find_and_open_devices(void) break; ret = fgets(vendor_id, 8, fl); - assert(ret); + igt_assert(ret); fclose(fl); venid = strtoul(vendor_id, NULL, 16); @@ -403,7 +403,7 @@ create_bo(drm_intel_bufmgr *ibufmgr, uint32_t val, int width, int height) drm_intel_bo *bo; bo = drm_intel_bo_alloc(ibufmgr, "bo", 4*width*height, 0); - assert(bo); + igt_assert(bo); /* gtt map doesn't have a write parameter, so just keep the mapping * around (to avoid the set_domain with the gtt write domain set) and diff --git a/tests/prime_self_import.c b/tests/prime_self_import.c index f5ee1626..4a260d36 100644 --- a/tests/prime_self_import.c +++ b/tests/prime_self_import.c @@ -36,7 +36,6 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <assert.h> #include <fcntl.h> #include <inttypes.h> #include <errno.h> @@ -63,18 +62,18 @@ check_bo(int fd1, uint32_t handle1, int fd2, uint32_t handle2) ptr1 = gem_mmap(fd1, handle1, BO_SIZE, PROT_READ | PROT_WRITE); ptr2 = gem_mmap(fd2, handle2, BO_SIZE, PROT_READ | PROT_WRITE); - assert(ptr1); + igt_assert(ptr1); /* check whether it's still our old object first. */ for (i = 0; i < BO_SIZE; i++) { - assert(ptr1[i] == counter); - assert(ptr2[i] == counter); + igt_assert(ptr1[i] == counter); + igt_assert(ptr2[i] == counter); } counter++; memset(ptr1, counter, BO_SIZE); - assert(memcmp(ptr1, ptr2, BO_SIZE) == 0); + igt_assert(memcmp(ptr1, ptr2, BO_SIZE) == 0); munmap(ptr1, BO_SIZE); munmap(ptr2, BO_SIZE); @@ -160,7 +159,7 @@ static void test_with_one_bo_two_files(void) handle_import = prime_fd_to_handle(fd2, dma_buf_fd2); /* dma-buf selfimporting an flink bo should give the same handle */ - assert(handle_import == handle_open); + igt_assert(handle_import == handle_open); close(fd1); close(fd2); @@ -187,11 +186,11 @@ static void test_with_one_bo(void) /* reimport should give us the same handle so that userspace can check * whether it has that bo already somewhere. */ handle_import2 = prime_fd_to_handle(fd2, dma_buf_fd); - assert(handle_import1 == handle_import2); + igt_assert(handle_import1 == handle_import2); /* Same for re-importing on the exporting fd. */ handle_selfimport = prime_fd_to_handle(fd1, dma_buf_fd); - assert(handle == handle_selfimport); + igt_assert(handle == handle_selfimport); /* close dma_buf, check whether nothing disappears. */ close(dma_buf_fd); @@ -221,12 +220,12 @@ static int get_object_count(void) char *path; ret = asprintf(&path, "/sys/kernel/debug/dri/%d/i915_gem_objects", device); - assert(ret != -1); + igt_assert(ret != -1); file = fopen(path, "r"); scanned = fscanf(file, "%i objects", &ret); - assert(scanned == 1); + igt_assert(scanned == 1); return ret; } @@ -263,7 +262,7 @@ static void test_reimport_close_race(void) threads = calloc(num_threads, sizeof(pthread_t)); fds[0] = drm_open_any(); - assert(fds[0] >= 0); + igt_assert(fds[0] >= 0); handle = gem_create(fds[0], BO_SIZE); @@ -273,7 +272,7 @@ static void test_reimport_close_race(void) r = pthread_create(&threads[i], NULL, thread_fn_reimport_vs_close, (void *)(uintptr_t)fds); - assert(r == 0); + igt_assert(r == 0); } sleep(5); @@ -282,7 +281,7 @@ static void test_reimport_close_race(void) for (i = 0; i < num_threads; i++) { pthread_join(threads[i], &status); - assert(status == 0); + igt_assert(status == 0); } close(fds[0]); @@ -291,7 +290,7 @@ static void test_reimport_close_race(void) obj_count = get_object_count() - obj_count; printf("leaked %i objects\n", obj_count); - assert(obj_count == 0); + igt_assert(obj_count == 0); } static void *thread_fn_export_vs_close(void *p) @@ -340,13 +339,13 @@ static void test_export_close_race(void) threads = calloc(num_threads, sizeof(pthread_t)); fd = drm_open_any(); - assert(fd >= 0); + igt_assert(fd >= 0); for (i = 0; i < num_threads; i++) { r = pthread_create(&threads[i], NULL, thread_fn_export_vs_close, (void *)(uintptr_t)fd); - assert(r == 0); + igt_assert(r == 0); } sleep(5); @@ -355,7 +354,7 @@ static void test_export_close_race(void) for (i = 0; i < num_threads; i++) { pthread_join(threads[i], &status); - assert(status == 0); + igt_assert(status == 0); } close(fd); @@ -363,7 +362,7 @@ static void test_export_close_race(void) obj_count = get_object_count() - obj_count; printf("leaked %i objects\n", obj_count); - assert(obj_count == 0); + igt_assert(obj_count == 0); } int main(int argc, char **argv) diff --git a/tests/sysfs_rc6_residency.c b/tests/sysfs_rc6_residency.c index 983cfc96..34b0b406 100644 --- a/tests/sysfs_rc6_residency.c +++ b/tests/sysfs_rc6_residency.c @@ -47,7 +47,7 @@ static unsigned int readit(const char *path) abort(); } scanned = fscanf(file, "%u", &ret); - assert(scanned == 1); + igt_assert(scanned == 1); fclose(file); @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) close(fd); ret = asprintf(&path, "/sys/class/drm/card%d/power/rc6_enable", device); - assert(ret != -1); + igt_assert(ret != -1); /* For some reason my ivb isn't idle even after syncing up with the gpu. * Let's add a sleept just to make it happy. */ @@ -87,11 +87,11 @@ int main(int argc, char *argv[]) exit(EXIT_SUCCESS); ret = asprintf(&path, "/sys/class/drm/card%d/power/rc6_residency_ms", device); - assert(ret != -1); + igt_assert(ret != -1); ret = asprintf(&pathp, "/sys/class/drm/card%d/power/rc6p_residency_ms", device); - assert(ret != -1); + igt_assert(ret != -1); ret = asprintf(&pathpp, "/sys/class/drm/card%d/power/rc6pp_residency_ms", device); - assert(ret != -1); + igt_assert(ret != -1); value1 = readit(path); value1p = readit(pathp); diff --git a/tests/sysfs_rps.c b/tests/sysfs_rps.c index 0dd392fa..59a2e92c 100644 --- a/tests/sysfs_rps.c +++ b/tests/sysfs_rps.c @@ -39,7 +39,7 @@ static int origmin, origmax; if (!(COND)) { \ writeval(stuff[MIN].filp, origmin); \ writeval(stuff[MAX].filp, origmax); \ - assert(0); \ + igt_assert(0); \ } \ } while (0); @@ -69,7 +69,7 @@ static int readval(FILE *filp) fflush(filp); rewind(filp); scanned = fscanf(filp, "%d", &val); - assert(scanned == 1); + igt_assert(scanned == 1); return val; } @@ -83,7 +83,7 @@ static int do_writeval(FILE *filp, int val, int lerrno) rewind(filp); ret = fprintf(filp, "%d", val); if (ret && lerrno) - assert(errno = lerrno); + igt_assert(errno = lerrno); fflush(filp); return ret; } @@ -146,14 +146,14 @@ int main(int argc, char *argv[]) int val = -1; char *path; ret = asprintf(&path, sysfs_base_path, device, junk->name); - assert(ret != -1); + igt_assert(ret != -1); junk->filp = fopen(path, junk->mode); if (junk->filp == NULL) { printf("Kernel is too old. GTFO\n"); exit(77); } val = readval(junk->filp); - assert(val >= 0); + igt_assert(val >= 0); junk++; } while(junk->name != NULL); diff --git a/tests/testdisplay.c b/tests/testdisplay.c index 3506b2f9..34133597 100644 --- a/tests/testdisplay.c +++ b/tests/testdisplay.c @@ -49,7 +49,6 @@ #include "config.h" #endif -#include <assert.h> #include <cairo.h> #include <errno.h> #include <math.h> @@ -203,7 +202,7 @@ static void connector_find_preferred_mode(uint32_t connector_id, c->pipe = config.pipe; if (mode_num != -1) { - assert(mode_num < config.connector->count_modes); + igt_assert(mode_num < config.connector->count_modes); c->mode = config.connector->modes[mode_num]; } else { c->mode = config.default_mode; @@ -310,7 +309,7 @@ static void paint_output_info(struct connector *c, struct kmstest_fb *fb) if (qr_code) paint_image(cr, "./pass.png"); - assert(!cairo_status(cr)); + igt_assert(!cairo_status(cr)); } static void sighandler(int signo) @@ -370,7 +369,7 @@ set_mode(struct connector *c) fb_ptr = gem_mmap(drm_fd, fb_info.gem_handle, fb_info.size, PROT_READ | PROT_WRITE); - assert(fb_ptr); + igt_assert(fb_ptr); paint_color_key(&fb_info); gem_close(drm_fd, fb_info.gem_handle); @@ -519,7 +518,7 @@ static void enter_exec_path( char **argv ) *(pos+1) = '\0'; ret = chdir(exec_path); - assert(ret == 0); + igt_assert(ret == 0); free(exec_path); } |