diff options
-rw-r--r-- | tests/gem_caching.c | 64 | ||||
-rw-r--r-- | tests/gem_cs_prefetch.c | 5 | ||||
-rw-r--r-- | tests/gem_cs_tlb.c | 3 | ||||
-rw-r--r-- | tests/gem_double_irq_loop.c | 25 | ||||
-rw-r--r-- | tests/gem_exec_bad_domains.c | 5 | ||||
-rw-r--r-- | tests/gem_exec_big.c | 3 | ||||
-rw-r--r-- | tests/gem_exec_nop.c | 3 | ||||
-rw-r--r-- | tests/gem_fence_thrash.c | 16 | ||||
-rw-r--r-- | tests/gem_largeobject.c | 15 | ||||
-rw-r--r-- | tests/gem_non_secure_batch.c | 15 | ||||
-rw-r--r-- | tests/gem_partial_pwrite_pread.c | 64 | ||||
-rw-r--r-- | tests/gem_persistent_relocs.c | 8 | ||||
-rw-r--r-- | tests/gem_pipe_control_store_loop.c | 5 | ||||
-rw-r--r-- | tests/gem_reloc_vs_gpu.c | 6 | ||||
-rw-r--r-- | tests/gem_ring_sync_loop.c | 20 | ||||
-rw-r--r-- | tests/gem_storedw_loop_blt.c | 43 | ||||
-rw-r--r-- | tests/gem_storedw_loop_bsd.c | 50 | ||||
-rw-r--r-- | tests/gem_storedw_loop_render.c | 38 | ||||
-rw-r--r-- | tests/gem_storedw_loop_vebox.c | 20 | ||||
-rw-r--r-- | tests/gem_tiled_partial_pwrite_pread.c | 64 | ||||
-rw-r--r-- | tests/gem_tiled_pread_pwrite.c | 8 | ||||
-rw-r--r-- | tests/gem_tiled_swapping.c | 8 | ||||
-rw-r--r-- | tests/gem_unref_active_buffers.c | 10 | ||||
-rw-r--r-- | tests/gem_wait_render_timeout.c | 6 | ||||
-rw-r--r-- | tests/gem_write_read_ring_switch.c | 5 |
25 files changed, 146 insertions, 363 deletions
diff --git a/tests/gem_caching.c b/tests/gem_caching.c index 473872ce..6c1d9415 100644 --- a/tests/gem_caching.c +++ b/tests/gem_caching.c @@ -159,11 +159,9 @@ int main(int argc, char **argv) drm_intel_bo_map(scratch_bo, false); cpu_ptr = scratch_bo->virtual; for (j = 0; j < len; j++) { - if (cpu_ptr[j] != val0) { - printf("mismatch at %i, got: %i, expected: %i\n", - j, cpu_ptr[j], val0); - igt_fail(1); - } + igt_assert_f(cpu_ptr[j] == val0, + "mismatch at %i, got: %i, expected: %i\n", + j, cpu_ptr[j], val0); } drm_intel_bo_unmap(scratch_bo); @@ -196,25 +194,19 @@ int main(int argc, char **argv) gtt_ptr = staging_bo->virtual; for (j = 0; j < start; j++) { - if (gtt_ptr[j] != val0) { - printf("mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n", - j, start, len, gtt_ptr[j], val0); - igt_fail(1); - } + igt_assert_f(gtt_ptr[j] == val0, + "mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n", + j, start, len, gtt_ptr[j], val0); } for (; j < start + len; j++) { - if (gtt_ptr[j] != val1) { - printf("mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n", - j, start, len, gtt_ptr[j], val1); - igt_fail(1); - } + igt_assert_f(gtt_ptr[j] == val1, + "mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n", + j, start, len, gtt_ptr[j], val1); } for (; j < BO_SIZE; j++) { - if (gtt_ptr[j] != val0) { - printf("mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n", - j, start, len, gtt_ptr[j], val0); - igt_fail(1); - } + igt_assert_f(gtt_ptr[j] == val0, + "mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n", + j, start, len, gtt_ptr[j], val0); } drm_intel_gem_bo_unmap_gtt(staging_bo); @@ -240,11 +232,9 @@ int main(int argc, char **argv) do_or_die(drm_intel_bo_map(scratch_bo, false)); cpu_ptr = scratch_bo->virtual; for (j = 0; j < len; j++) { - if (cpu_ptr[j] != val0) { - printf("mismatch in read at %i, got: %i, expected: %i\n", - j, cpu_ptr[j], val0); - igt_fail(1); - } + igt_assert_f(cpu_ptr[j] == val0, + "mismatch in read at %i, got: %i, expected: %i\n", + j, cpu_ptr[j], val0); } drm_intel_bo_unmap(scratch_bo); @@ -267,25 +257,19 @@ int main(int argc, char **argv) gtt_ptr = staging_bo->virtual; for (j = 0; j < start; j++) { - if (gtt_ptr[j] != val1) { - printf("mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n", - j, start, len, gtt_ptr[j], val1); - igt_fail(1); - } + igt_assert_f(gtt_ptr[j] == val1, + "mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n", + j, start, len, gtt_ptr[j], val1); } for (; j < start + len; j++) { - if (gtt_ptr[j] != val2) { - printf("mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n", - j, start, len, gtt_ptr[j], val2); - igt_fail(1); - } + igt_assert_f(gtt_ptr[j] == val2, + "mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n", + j, start, len, gtt_ptr[j], val2); } for (; j < BO_SIZE; j++) { - if (gtt_ptr[j] != val1) { - printf("mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n", - j, start, len, gtt_ptr[j], val1); - igt_fail(1); - } + igt_assert_f(gtt_ptr[j] == val1, + "mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n", + j, start, len, gtt_ptr[j], val1); } drm_intel_gem_bo_unmap_gtt(staging_bo); drm_intel_bo_unmap(scratch_bo); diff --git a/tests/gem_cs_prefetch.c b/tests/gem_cs_prefetch.c index 395ff8c5..01554eff 100644 --- a/tests/gem_cs_prefetch.c +++ b/tests/gem_cs_prefetch.c @@ -100,10 +100,7 @@ int main(int argc, char **argv) fd = drm_open_any(); bufmgr = drm_intel_bufmgr_gem_init(fd, 4096); - if (!bufmgr) { - fprintf(stderr, "failed to init libdrm\n"); - igt_fail(-1); - } + igt_assert(bufmgr); drm_intel_bufmgr_gem_enable_reuse(bufmgr); diff --git a/tests/gem_cs_tlb.c b/tests/gem_cs_tlb.c index 870821b5..490b6d3c 100644 --- a/tests/gem_cs_tlb.c +++ b/tests/gem_cs_tlb.c @@ -125,8 +125,7 @@ static void run_on_ring(int fd, unsigned ring_id, const char *ring_name) gem_close(fd, handle); } - if (exec(fd, handle_new, split, >t_offset_new, 0)) - igt_fail(1); + igt_assert(exec(fd, handle_new, split, >t_offset_new, 0) == 0); if (split > 0) { /* Check that we've managed to collide in the tlb. */ diff --git a/tests/gem_double_irq_loop.c b/tests/gem_double_irq_loop.c index bc128614..2dcfaca4 100644 --- a/tests/gem_double_irq_loop.c +++ b/tests/gem_double_irq_loop.c @@ -99,11 +99,6 @@ int main(int argc, char **argv) igt_skip_on_simulation(); - if (argc != 1) { - fprintf(stderr, "usage: %s\n", argv[0]); - igt_fail(-1); - } - fd = drm_open_any(); devid = intel_get_drm_devid(fd); if (!HAS_BLT_RING(devid)) { @@ -112,29 +107,17 @@ int main(int argc, char **argv) } bufmgr = drm_intel_bufmgr_gem_init(fd, 4096); - if (!bufmgr) { - fprintf(stderr, "failed to init libdrm\n"); - igt_fail(-1); - } + igt_assert(bufmgr); drm_intel_bufmgr_gem_enable_reuse(bufmgr); batch = intel_batchbuffer_alloc(bufmgr, devid); - if (!batch) { - fprintf(stderr, "failed to create batch buffer\n"); - igt_fail(-1); - } + igt_assert(batch); target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096); - if (!target_buffer) { - fprintf(stderr, "failed to alloc target buffer\n"); - igt_fail(-1); - } + igt_assert(target_buffer); blt_bo = drm_intel_bo_alloc(bufmgr, "target bo", 4*4096*4096, 4096); - if (!blt_bo) { - fprintf(stderr, "failed to alloc blt buffer\n"); - igt_fail(-1); - } + igt_assert(blt_bo); dummy_reloc_loop(); diff --git a/tests/gem_exec_bad_domains.c b/tests/gem_exec_bad_domains.c index b89922ba..51894f7d 100644 --- a/tests/gem_exec_bad_domains.c +++ b/tests/gem_exec_bad_domains.c @@ -144,10 +144,7 @@ static void multi_write_domain(int fd) gem_close(fd, handle); gem_close(fd, handle_target); - if (ret == 0 || errno != EINVAL) { - fprintf(stderr, "multiple write domains not rejected\n"); - igt_fail(1); - } + igt_assert(ret != 0 && errno == EINVAL); } int fd; diff --git a/tests/gem_exec_big.c b/tests/gem_exec_big.c index 7bd6a9f4..79ec6b2d 100644 --- a/tests/gem_exec_big.c +++ b/tests/gem_exec_big.c @@ -114,8 +114,7 @@ int main(int argc, char **argv) gem_write(fd, handle, 0, batch, sizeof(batch)); for (reloc_ofs = 4096; reloc_ofs < batch_size; reloc_ofs += 4096) - if (exec(fd, handle, reloc_ofs)) - igt_fail(1); + igt_assert(exec(fd, handle, reloc_ofs) == 0); } gem_close(fd, handle); diff --git a/tests/gem_exec_nop.c b/tests/gem_exec_nop.c index be5f2c58..265220e6 100644 --- a/tests/gem_exec_nop.c +++ b/tests/gem_exec_nop.c @@ -97,8 +97,7 @@ static void loop(int fd, uint32_t handle, unsigned ring_id, const char *ring_nam struct timeval start, end; gettimeofday(&start, NULL); - if (exec(fd, handle, count, ring_id)) - igt_fail(1); + igt_assert(exec(fd, handle, count, ring_id) == 0); gettimeofday(&end, NULL); printf("Time to exec x %d: %7.3fµs (ring=%s)\n", count, elapsed(&start, &end, count), ring_name); diff --git a/tests/gem_fence_thrash.c b/tests/gem_fence_thrash.c index 8c963afe..be196b09 100644 --- a/tests/gem_fence_thrash.c +++ b/tests/gem_fence_thrash.c @@ -128,20 +128,16 @@ _bo_write_verify(struct test *t) for (i = 0; i < dwords; i++) { a[i] = i; v = a[i]; - if (v != i) { - printf("tiling %s: write failed at %d (%x)\n", - tile_str[t->tiling], i, v); - igt_fail(-1); - } + igt_assert_f(v == i, + "tiling %s: write failed at %d (%x)\n", + tile_str[t->tiling], i, v); } for (i = 0; i < dwords; i++) { v = a[i]; - if (v != i) { - printf("tiling %s: verify failed at %d (%x)\n", - tile_str[t->tiling], i, v); - igt_fail(-2); - } + igt_assert_f(v == i, + "tiling %s: verify failed at %d (%x)\n", + tile_str[t->tiling], i, v); } } diff --git a/tests/gem_largeobject.c b/tests/gem_largeobject.c index cd5bf207..913e3683 100644 --- a/tests/gem_largeobject.c +++ b/tests/gem_largeobject.c @@ -48,7 +48,6 @@ test_large_object(int fd) struct drm_i915_gem_create create; struct drm_i915_gem_pin pin; uint32_t obj_size; - int ret; memset(&create, 0, sizeof(create)); memset(&pin, 0, sizeof(pin)); @@ -62,20 +61,10 @@ test_large_object(int fd) create.size = obj_size; printf("obj size %i\n", obj_size); - ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create); - if (ret) { - fprintf(stderr, "object creation failed: %s\n", - strerror(errno)); - igt_fail(ret); - } + igt_assert(ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create) == 0); pin.handle = create.handle; - ret = ioctl(fd, DRM_IOCTL_I915_GEM_PIN, &pin); - if (ret) { - fprintf(stderr, "pin failed: %s\n", - strerror(errno)); - igt_fail(ret); - } + igt_assert(ioctl(fd, DRM_IOCTL_I915_GEM_PIN, &pin) == 0); gem_write(fd, create.handle, 0, data, obj_size); diff --git a/tests/gem_non_secure_batch.c b/tests/gem_non_secure_batch.c index ca4bd2c8..101b9dcf 100644 --- a/tests/gem_non_secure_batch.c +++ b/tests/gem_non_secure_batch.c @@ -81,11 +81,6 @@ int main(int argc, char **argv) int fd; int devid; - if (argc != 1) { - fprintf(stderr, "usage: %s\n", argv[0]); - igt_fail(-1); - } - fd = drm_open_any(); devid = intel_get_drm_devid(fd); @@ -99,17 +94,11 @@ int main(int argc, char **argv) printf("num rings detected: %i\n", num_rings); bufmgr = drm_intel_bufmgr_gem_init(fd, 4096); - if (!bufmgr) { - fprintf(stderr, "failed to init libdrm\n"); - igt_fail(-1); - } + igt_assert(bufmgr); drm_intel_bufmgr_gem_enable_reuse(bufmgr); batch = intel_batchbuffer_alloc(bufmgr, devid); - if (!batch) { - fprintf(stderr, "failed to create batch buffer\n"); - igt_fail(-1); - } + igt_assert(batch); mi_lri_loop(); gem_quiescent_gpu(fd); diff --git a/tests/gem_partial_pwrite_pread.c b/tests/gem_partial_pwrite_pread.c index 61739c41..af772438 100644 --- a/tests/gem_partial_pwrite_pread.c +++ b/tests/gem_partial_pwrite_pread.c @@ -120,11 +120,9 @@ static void test_partial_reads(void) drm_intel_bo_get_subdata(scratch_bo, start, len, tmp); for (j = 0; j < len; j++) { - if (tmp[j] != val) { - printf("mismatch at %i, got: %i, expected: %i\n", - j, tmp[j], val); - igt_fail(1); - } + igt_assert_f(tmp[j] == val, + "mismatch at %i, got: %i, expected: %i\n", + j, tmp[j], val); } igt_progress("partial reads test: ", i, ROUNDS); @@ -156,25 +154,19 @@ static void test_partial_writes(void) gtt_ptr = staging_bo->virtual; for (j = 0; j < start; j++) { - if (gtt_ptr[j] != val) { - printf("mismatch at %i, got: %i, expected: %i\n", - j, tmp[j], val); - igt_fail(1); - } + igt_assert_f(gtt_ptr[j] == val, + "mismatch at %i, got: %i, expected: %i\n", + j, tmp[j], val); } for (; j < start + len; j++) { - if (gtt_ptr[j] != tmp[0]) { - printf("mismatch at %i, got: %i, expected: %i\n", - j, tmp[j], i); - igt_fail(1); - } + igt_assert_f(gtt_ptr[j] == tmp[0], + "mismatch at %i, got: %i, expected: %i\n", + j, tmp[j], i); } for (; j < BO_SIZE; j++) { - if (gtt_ptr[j] != val) { - printf("mismatch at %i, got: %i, expected: %i\n", - j, tmp[j], val); - igt_fail(1); - } + igt_assert_f(gtt_ptr[j] == val, + "mismatch at %i, got: %i, expected: %i\n", + j, tmp[j], val); } drm_intel_gem_bo_unmap_gtt(staging_bo); @@ -201,11 +193,9 @@ static void test_partial_read_writes(void) drm_intel_bo_get_subdata(scratch_bo, start, len, tmp); for (j = 0; j < len; j++) { - if (tmp[j] != val) { - printf("mismatch in read at %i, got: %i, expected: %i\n", - j, tmp[j], val); - igt_fail(1); - } + igt_assert_f(tmp[j] == val, + "mismatch in read at %i, got: %i, expected: %i\n", + j, tmp[j], val); } /* Change contents through gtt to make the pread cachelines @@ -226,25 +216,19 @@ static void test_partial_read_writes(void) gtt_ptr = staging_bo->virtual; for (j = 0; j < start; j++) { - if (gtt_ptr[j] != val) { - printf("mismatch at %i, got: %i, expected: %i\n", - j, tmp[j], val); - igt_fail(1); - } + igt_assert_f(gtt_ptr[j] == val, + "mismatch at %i, got: %i, expected: %i\n", + j, tmp[j], val); } for (; j < start + len; j++) { - if (gtt_ptr[j] != tmp[0]) { - printf("mismatch at %i, got: %i, expected: %i\n", - j, tmp[j], tmp[0]); - igt_fail(1); - } + igt_assert_f(gtt_ptr[j] == tmp[0], + "mismatch at %i, got: %i, expected: %i\n", + j, tmp[j], tmp[0]); } for (; j < BO_SIZE; j++) { - if (gtt_ptr[j] != val) { - printf("mismatch at %i, got: %i, expected: %i\n", - j, tmp[j], val); - igt_fail(1); - } + igt_assert_f(gtt_ptr[j] == val, + "mismatch at %i, got: %i, expected: %i\n", + j, tmp[j], val); } drm_intel_gem_bo_unmap_gtt(staging_bo); diff --git a/tests/gem_persistent_relocs.c b/tests/gem_persistent_relocs.c index fd0d8552..ffa4559e 100644 --- a/tests/gem_persistent_relocs.c +++ b/tests/gem_persistent_relocs.c @@ -257,11 +257,9 @@ static void do_test(int fd, bool faulting_reloc) for (repeat = 0; repeat < 8; repeat++) { drm_intel_bo_get_subdata(pc_target_bo[i], repeat*small_pitch, 4, &test); - if (test != 0xdeadbeef) { - fprintf(stderr, "mismatch in buffer %i: 0x%08x instead of 0xdeadbeef at offset %i\n", - i, test, repeat*small_pitch); - igt_fail(1); - } + igt_assert_f(test == 0xdeadbeef, + "mismatch in buffer %i: 0x%08x instead of 0xdeadbeef at offset %i\n", + i, test, repeat*small_pitch); } drm_intel_bo_unreference(pc_target_bo[i]); drm_intel_bo_unreference(special_bos[i]); diff --git a/tests/gem_pipe_control_store_loop.c b/tests/gem_pipe_control_store_loop.c index 9759d87c..5eae6ca5 100644 --- a/tests/gem_pipe_control_store_loop.c +++ b/tests/gem_pipe_control_store_loop.c @@ -73,10 +73,7 @@ store_pipe_control_loop(bool preuse_buffer) /* we want to check tlb consistency of the pipe_control target, * so get a new buffer every time around */ target_bo = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096); - if (!target_bo) { - fprintf(stderr, "failed to alloc target buffer\n"); - igt_fail(-1); - } + igt_assert(target_bo); if (preuse_buffer) { BEGIN_BATCH(6); diff --git a/tests/gem_reloc_vs_gpu.c b/tests/gem_reloc_vs_gpu.c index cab726ee..14d11042 100644 --- a/tests/gem_reloc_vs_gpu.c +++ b/tests/gem_reloc_vs_gpu.c @@ -256,10 +256,8 @@ static void do_test(int fd, bool faulting_reloc) /* Only check at the end to avoid unnecessary synchronous behaviour. */ for (i = 0; i < NUM_TARGET_BOS; i++) { drm_intel_bo_get_subdata(pc_target_bo[i], 0, 4, &test); - if (test != 0xdeadbeef) { - fprintf(stderr, "mismatch in buffer %i: 0x%08x instead of 0xdeadbeef\n", i, test); - igt_fail(1); - } + igt_assert_f(test == 0xdeadbeef, + "mismatch in buffer %i: 0x%08x instead of 0xdeadbeef\n", i, test); drm_intel_bo_unreference(pc_target_bo[i]); } diff --git a/tests/gem_ring_sync_loop.c b/tests/gem_ring_sync_loop.c index 0316c3ea..152a6fee 100644 --- a/tests/gem_ring_sync_loop.c +++ b/tests/gem_ring_sync_loop.c @@ -95,11 +95,6 @@ int main(int argc, char **argv) int fd; int devid; - if (argc != 1) { - fprintf(stderr, "usage: %s\n", argv[0]); - igt_fail(-1); - } - fd = drm_open_any(); devid = intel_get_drm_devid(fd); if (!HAS_BLT_RING(devid)) { @@ -109,23 +104,14 @@ int main(int argc, char **argv) bufmgr = drm_intel_bufmgr_gem_init(fd, 4096); - if (!bufmgr) { - fprintf(stderr, "failed to init libdrm\n"); - igt_fail(-1); - } + igt_assert(bufmgr); drm_intel_bufmgr_gem_enable_reuse(bufmgr); batch = intel_batchbuffer_alloc(bufmgr, devid); - if (!batch) { - fprintf(stderr, "failed to create batch buffer\n"); - igt_fail(-1); - } + igt_assert(batch); target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096); - if (!target_buffer) { - fprintf(stderr, "failed to alloc target buffer\n"); - igt_fail(-1); - } + igt_assert(target_buffer); store_dword_loop(fd); diff --git a/tests/gem_storedw_loop_blt.c b/tests/gem_storedw_loop_blt.c index 1be05ec0..84f9e28c 100644 --- a/tests/gem_storedw_loop_blt.c +++ b/tests/gem_storedw_loop_blt.c @@ -79,12 +79,9 @@ store_dword_loop(int divider) drm_intel_bo_map(target_buffer, 0); buf = target_buffer->virtual; - if (buf[0] != val) { - fprintf(stderr, - "value mismatch: cur 0x%08x, stored 0x%08x\n", - buf[0], val); - igt_fail(-1); - } + igt_assert_f(buf[0] == val, + "value mismatch: cur 0x%08x, stored 0x%08x\n", + buf[0], val); drm_intel_bo_unmap(target_buffer); @@ -105,47 +102,27 @@ int main(int argc, char **argv) int fd; int devid; - if (argc != 1) { - fprintf(stderr, "usage: %s\n", argv[0]); - igt_fail(-1); - } - fd = drm_open_any(); devid = intel_get_drm_devid(fd); has_ppgtt = gem_uses_aliasing_ppgtt(fd); - if (IS_GEN2(devid) || IS_GEN3(devid) || IS_GEN4(devid) || IS_GEN5(devid)) { - - fprintf(stderr, "MI_STORE_DATA can only use GTT address on gen4+/g33 and " - "needs snoopable mem on pre-gen6\n"); - return 77; - } + igt_skip_on_f(intel_gen(devid) < 6, + "MI_STORE_DATA can only use GTT address on gen4+/g33 and " + "needs snoopable mem on pre-gen6\n"); /* This only works with ppgtt */ - if (!has_ppgtt) { - fprintf(stderr, "no ppgtt detected, which is required\n"); - return 77; - } + igt_require(has_ppgtt); bufmgr = drm_intel_bufmgr_gem_init(fd, 4096); - if (!bufmgr) { - fprintf(stderr, "failed to init libdrm\n"); - igt_fail(-1); - } + igt_assert(bufmgr); drm_intel_bufmgr_gem_enable_reuse(bufmgr); batch = intel_batchbuffer_alloc(bufmgr, devid); - if (!batch) { - fprintf(stderr, "failed to create batch buffer\n"); - igt_fail(-1); - } + igt_assert(batch); target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096); - if (!target_buffer) { - fprintf(stderr, "failed to alloc target buffer\n"); - igt_fail(-1); - } + igt_assert(target_buffer); store_dword_loop(1); store_dword_loop(2); diff --git a/tests/gem_storedw_loop_bsd.c b/tests/gem_storedw_loop_bsd.c index 58d978fb..5ee3c210 100644 --- a/tests/gem_storedw_loop_bsd.c +++ b/tests/gem_storedw_loop_bsd.c @@ -79,12 +79,9 @@ store_dword_loop(int divider) drm_intel_bo_map(target_buffer, 0); buf = target_buffer->virtual; - if (buf[0] != val) { - fprintf(stderr, - "value mismatch: cur 0x%08x, stored 0x%08x\n", - buf[0], val); - igt_fail(-1); - } + igt_assert_f(buf[0] == val, + "value mismatch: cur 0x%08x, stored 0x%08x\n", + buf[0], val); drm_intel_bo_unmap(target_buffer); @@ -105,53 +102,30 @@ int main(int argc, char **argv) int fd; int devid; - if (argc != 1) { - fprintf(stderr, "usage: %s\n", argv[0]); - igt_fail(-1); - } - fd = drm_open_any(); devid = intel_get_drm_devid(fd); has_ppgtt = gem_uses_aliasing_ppgtt(fd); - if (IS_GEN2(devid) || IS_GEN3(devid) || IS_GEN4(devid) || IS_GEN5(devid)) { - - fprintf(stderr, "MI_STORE_DATA can only use GTT address on gen4+/g33 and " - "needs snoopable mem on pre-gen6\n"); - return 77; - } - - if (IS_GEN6(devid)) { + igt_skip_on_f(intel_gen(devid) < 6, + "MI_STORE_DATA can only use GTT address on gen4+/g33 and " + "needs snoopable mem on pre-gen6\n"); - fprintf(stderr, "MI_STORE_DATA broken on gen6 bsd\n"); - return 77; - } + igt_skip_on_f(intel_gen(devid) == 6, + "MI_STORE_DATA broken on gen6 bsd\n"); /* This only works with ppgtt */ - if (!has_ppgtt) { - fprintf(stderr, "no ppgtt detected, which is required\n"); - return 77; - } + igt_require(has_ppgtt); bufmgr = drm_intel_bufmgr_gem_init(fd, 4096); - if (!bufmgr) { - fprintf(stderr, "failed to init libdrm\n"); - igt_fail(-1); - } + igt_assert(bufmgr); drm_intel_bufmgr_gem_enable_reuse(bufmgr); batch = intel_batchbuffer_alloc(bufmgr, devid); - if (!batch) { - fprintf(stderr, "failed to create batch buffer\n"); - igt_fail(-1); - } + igt_assert(batch); target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096); - if (!target_buffer) { - fprintf(stderr, "failed to alloc target buffer\n"); - igt_fail(-1); - } + igt_assert(target_buffer); store_dword_loop(1); store_dword_loop(2); diff --git a/tests/gem_storedw_loop_render.c b/tests/gem_storedw_loop_render.c index fb957c05..d62c884b 100644 --- a/tests/gem_storedw_loop_render.c +++ b/tests/gem_storedw_loop_render.c @@ -79,12 +79,9 @@ store_dword_loop(int divider) drm_intel_bo_map(target_buffer, 0); buf = target_buffer->virtual; - if (buf[0] != val) { - fprintf(stderr, - "value mismatch: cur 0x%08x, stored 0x%08x\n", - buf[0], val); - igt_fail(-1); - } + igt_assert_f(buf[0] == val, + "value mismatch: cur 0x%08x, stored 0x%08x\n", + buf[0], val); drm_intel_bo_unmap(target_buffer); @@ -105,41 +102,24 @@ int main(int argc, char **argv) int fd; int devid; - if (argc != 1) { - fprintf(stderr, "usage: %s\n", argv[0]); - igt_fail(-1); - } - fd = drm_open_any(); devid = intel_get_drm_devid(fd); has_ppgtt = gem_uses_aliasing_ppgtt(fd); - if (IS_GEN2(devid) || IS_GEN3(devid) || IS_GEN4(devid) || IS_GEN5(devid)) { - - fprintf(stderr, "MI_STORE_DATA can only use GTT address on gen4+/g33 and " - "needs snoopable mem on pre-gen6\n"); - return 77; - } + igt_skip_on_f(intel_gen(devid) < 6, + "MI_STORE_DATA can only use GTT address on gen4+/g33 and " + "needs snoopable mem on pre-gen6\n"); bufmgr = drm_intel_bufmgr_gem_init(fd, 4096); - if (!bufmgr) { - fprintf(stderr, "failed to init libdrm\n"); - igt_fail(-1); - } + igt_assert(bufmgr); drm_intel_bufmgr_gem_enable_reuse(bufmgr); batch = intel_batchbuffer_alloc(bufmgr, devid); - if (!batch) { - fprintf(stderr, "failed to create batch buffer\n"); - igt_fail(-1); - } + igt_assert(batch); target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096); - if (!target_buffer) { - fprintf(stderr, "failed to alloc target buffer\n"); - igt_fail(-1); - } + igt_assert(target_buffer); store_dword_loop(1); store_dword_loop(2); diff --git a/tests/gem_storedw_loop_vebox.c b/tests/gem_storedw_loop_vebox.c index 4aefd4f9..27f970a5 100644 --- a/tests/gem_storedw_loop_vebox.c +++ b/tests/gem_storedw_loop_vebox.c @@ -102,28 +102,18 @@ int main(int argc, char **argv) fd = drm_open_any(); - /* This only works with ppgtt */ - if (!gem_has_vebox(fd) || !gem_uses_aliasing_ppgtt(fd)) - return 77; + igt_require(gem_has_vebox(fd)); + igt_require(gem_uses_aliasing_ppgtt(fd)); bufmgr = drm_intel_bufmgr_gem_init(fd, 4096); - if (!bufmgr) { - fprintf(stderr, "failed to init libdrm\n"); - igt_fail(-1); - } + igt_assert(bufmgr); drm_intel_bufmgr_gem_enable_reuse(bufmgr); batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd)); - if (!batch) { - fprintf(stderr, "failed to create batch buffer\n"); - igt_fail(-1); - } + igt_require(batch); target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096); - if (!target_buffer) { - fprintf(stderr, "failed to alloc target buffer\n"); - igt_fail(-1); - } + igt_require(target_buffer); store_dword_loop(1); store_dword_loop(2); diff --git a/tests/gem_tiled_partial_pwrite_pread.c b/tests/gem_tiled_partial_pwrite_pread.c index da52f7a1..d535e382 100644 --- a/tests/gem_tiled_partial_pwrite_pread.c +++ b/tests/gem_tiled_partial_pwrite_pread.c @@ -143,11 +143,9 @@ static void test_partial_reads(void) drm_intel_bo_get_subdata(scratch_bo, start, len, tmp); for (j = 0; j < len; j++) { - if (tmp[j] != val) { - printf("mismatch at %i, got: %i, expected: %i\n", - start + j, tmp[j], val); - igt_fail(1); - } + igt_assert_f(tmp[j] == val, + "mismatch at %i, got: %i, expected: %i\n", + start + j, tmp[j], val); } igt_progress("partial reads test: ", i, ROUNDS); @@ -177,25 +175,19 @@ static void test_partial_writes(void) compare_tmp); for (j = 0; j < start; j++) { - if (compare_tmp[j] != val) { - printf("amismatch at %i, got: %i, expected: %i\n", - j, tmp[j], val); - igt_fail(1); - } + igt_assert_f(compare_tmp[j] == val, + "mismatch at %i, got: %i, expected: %i\n", + j, tmp[j], val); } for (; j < start + len; j++) { - if (compare_tmp[j] != tmp[0]) { - printf("bmismatch at %i, got: %i, expected: %i\n", - j, tmp[j], i); - igt_fail(1); - } + igt_assert_f(compare_tmp[j] == tmp[0], + "mismatch at %i, got: %i, expected: %i\n", + j, tmp[j], i); } for (; j < BO_SIZE; j++) { - if (compare_tmp[j] != val) { - printf("cmismatch at %i, got: %i, expected: %i\n", - j, tmp[j], val); - igt_fail(1); - } + igt_assert_f(compare_tmp[j] == val, + "mismatch at %i, got: %i, expected: %i\n", + j, tmp[j], val); } drm_intel_gem_bo_unmap_gtt(staging_bo); @@ -220,11 +212,9 @@ static void test_partial_read_writes(void) drm_intel_bo_get_subdata(scratch_bo, start, len, tmp); for (j = 0; j < len; j++) { - if (tmp[j] != val) { - printf("mismatch in read at %i, got: %i, expected: %i\n", - start + j, tmp[j], val); - igt_fail(1); - } + igt_assert_f(tmp[j] == val, + "mismatch in read at %i, got: %i, expected: %i\n", + start + j, tmp[j], val); } /* Change contents through gtt to make the pread cachelines @@ -245,25 +235,19 @@ static void test_partial_read_writes(void) compare_tmp); for (j = 0; j < start; j++) { - if (compare_tmp[j] != val) { - printf("mismatch at %i, got: %i, expected: %i\n", - j, tmp[j], val); - igt_fail(1); - } + igt_assert_f(compare_tmp[j] == val, + "mismatch at %i, got: %i, expected: %i\n", + j, tmp[j], val); } for (; j < start + len; j++) { - if (compare_tmp[j] != tmp[0]) { - printf("mismatch at %i, got: %i, expected: %i\n", - j, tmp[j], tmp[0]); - igt_fail(1); - } + igt_assert_f(compare_tmp[j] == tmp[0], + "mismatch at %i, got: %i, expected: %i\n", + j, tmp[j], tmp[0]); } for (; j < BO_SIZE; j++) { - if (compare_tmp[j] != val) { - printf("mismatch at %i, got: %i, expected: %i\n", - j, tmp[j], val); - igt_fail(1); - } + igt_assert_f(compare_tmp[j] == val, + "mismatch at %i, got: %i, expected: %i\n", + j, tmp[j], val); } drm_intel_gem_bo_unmap_gtt(staging_bo); diff --git a/tests/gem_tiled_pread_pwrite.c b/tests/gem_tiled_pread_pwrite.c index 3a0817c5..3e1a7a8a 100644 --- a/tests/gem_tiled_pread_pwrite.c +++ b/tests/gem_tiled_pread_pwrite.c @@ -138,11 +138,9 @@ main(int argc, char **argv) /* Check the target bo's contents. */ data = gem_mmap(fd, handle_target, sizeof(linear), PROT_READ | PROT_WRITE); for (j = 0; j < WIDTH*HEIGHT; j++) - if (data[j] != j) { - fprintf(stderr, "mismatch at %i: %i\n", - j, data[j]); - igt_fail(1); - } + igt_assert_f(data[j] == j, + "mismatch at %i: %i\n", + j, data[j]); munmap(data, sizeof(linear)); /* Leak both bos so that we use all of system mem! */ diff --git a/tests/gem_tiled_swapping.c b/tests/gem_tiled_swapping.c index ab76fe1d..8785a6f8 100644 --- a/tests/gem_tiled_swapping.c +++ b/tests/gem_tiled_swapping.c @@ -129,11 +129,9 @@ main(int argc, char **argv) data = gem_mmap(fd, bo_handles[idx_arr[i]], LINEAR_DWORDS, PROT_READ | PROT_WRITE); for (j = 0; j < WIDTH*HEIGHT; j++) - if (data[j] != j) { - fprintf(stderr, "mismatch at %i: %i\n", - j, data[j]); - igt_fail(1); - } + igt_assert_f(data[j] == j, + "mismatch at %i: %i\n", + j, data[j]); munmap(data, LINEAR_DWORDS); } diff --git a/tests/gem_unref_active_buffers.c b/tests/gem_unref_active_buffers.c index f597183c..924769f2 100644 --- a/tests/gem_unref_active_buffers.c +++ b/tests/gem_unref_active_buffers.c @@ -60,10 +60,7 @@ int main(int argc, char **argv) fd = drm_open_any(); bufmgr = drm_intel_bufmgr_gem_init(fd, 4096); - if (!bufmgr) { - fprintf(stderr, "failed to init libdrm\n"); - igt_fail(-1); - } + igt_assert(bufmgr); /* don't enable buffer reuse!! */ //drm_intel_bufmgr_gem_enable_reuse(bufmgr); @@ -74,10 +71,7 @@ int main(int argc, char **argv) * enough */ for (i = 0; i < 1000; i++) { load_bo = drm_intel_bo_alloc(bufmgr, "target bo", 1024*4096, 4096); - if (!load_bo) { - fprintf(stderr, "failed to alloc target buffer\n"); - igt_fail(-1); - } + igt_assert(load_bo); BEGIN_BATCH(8); OUT_BATCH(XY_SRC_COPY_BLT_CMD | diff --git a/tests/gem_wait_render_timeout.c b/tests/gem_wait_render_timeout.c index 4424bfa1..ae317298 100644 --- a/tests/gem_wait_render_timeout.c +++ b/tests/gem_wait_render_timeout.c @@ -182,11 +182,7 @@ int main(int argc, char **argv) intel_batchbuffer_flush(batch); 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)); - igt_fail(1); - } + igt_assert(gem_bo_wait_timeout(fd, dst2->handle, &timeout) == 0); igt_assert(gem_bo_busy(fd, dst2->handle) == false); igt_assert(timeout != 0); if (timeout == (ENOUGH_WORK_IN_SECONDS * NSEC_PER_SEC)) diff --git a/tests/gem_write_read_ring_switch.c b/tests/gem_write_read_ring_switch.c index 4773d88e..d04043b7 100644 --- a/tests/gem_write_read_ring_switch.c +++ b/tests/gem_write_read_ring_switch.c @@ -67,10 +67,7 @@ static void run_test(int ring) gem_require_ring(fd, I915_EXEC_BLT); target_bo = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096); - if (!target_bo) { - fprintf(stderr, "failed to alloc target buffer\n"); - igt_fail(-1); - } + igt_assert(target_bo); /* Need to map first so that we can do our own domain mangement with * set_domain. */ |