diff mbox

[igt,v7,2/4] tests: Run igt.cocci

Message ID 1446116638-25348-3-git-send-email-daniels@collabora.com (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Stone Oct. 29, 2015, 11:03 a.m. UTC
Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 tests/drm_import_export.c        |  2 +-
 tests/gem_bad_reloc.c            |  8 ++----
 tests/gem_concurrent_all.c       |  6 ++--
 tests/gem_ctx_exec.c             |  9 ++----
 tests/gem_ctx_param_basic.c      |  4 +--
 tests/gem_mmap_gtt.c             |  8 ++----
 tests/gem_pin.c                  |  4 +--
 tests/gem_pwrite_pread.c         | 12 ++++----
 tests/gem_reg_read.c             |  2 +-
 tests/gem_tiled_swapping.c       |  4 +--
 tests/gem_tiled_wb.c             |  2 +-
 tests/gem_tiled_wc.c             |  2 +-
 tests/kms_draw_crc.c             |  6 ++--
 tests/kms_frontbuffer_tracking.c | 60 ++++++++++++++++++++--------------------
 tests/kms_panel_fitting.c        |  2 +-
 tests/kms_pipe_b_c_ivb.c         | 30 ++++++++++----------
 tests/kms_plane_scaling.c        |  2 +-
 tests/kms_rotation_crc.c         |  4 +--
 tests/pm_backlight.c             | 20 +++++++-------
 19 files changed, 88 insertions(+), 99 deletions(-)
diff mbox

Patch

diff --git a/tests/drm_import_export.c b/tests/drm_import_export.c
index 29c228f..49486ab 100644
--- a/tests/drm_import_export.c
+++ b/tests/drm_import_export.c
@@ -212,7 +212,7 @@  static void test_import_close_race(void)
 		else {
 			pthread_mutex_lock(&t_data.mutex);
 			igt_assert_eq(drm_intel_bo_gem_export_to_prime(bo, &(t_data.prime_fd)), 0);
-			igt_assert(t_data.prime_fd != -1);
+			igt_assert_neq(t_data.prime_fd, -1);
 			pthread_mutex_unlock(&t_data.mutex);
 		}
 
diff --git a/tests/gem_bad_reloc.c b/tests/gem_bad_reloc.c
index 9c285ed..e8701da 100644
--- a/tests/gem_bad_reloc.c
+++ b/tests/gem_bad_reloc.c
@@ -107,9 +107,7 @@  static int negative_reloc(int fd, unsigned flags)
 	execbuf.buffer_count = 2;
 	execbuf.batch_len = 8;
 
-	do_or_die(drmIoctl(fd,
-			   DRM_IOCTL_I915_GEM_EXECBUFFER2,
-			   &execbuf));
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
 	gem_close(fd, gem_exec[1].handle);
 
 	igt_info("Found offset %lld for 4k batch\n", (long long)gem_exec[0].offset);
@@ -136,9 +134,7 @@  static int negative_reloc(int fd, unsigned flags)
 
 	execbuf.buffer_count = 1;
 	execbuf.flags = flags & USE_LUT;
-	do_or_die(drmIoctl(fd,
-			   DRM_IOCTL_I915_GEM_EXECBUFFER2,
-			   &execbuf));
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
 
 	igt_info("Batch is now at offset %lld\n", (long long)gem_exec[0].offset);
 
diff --git a/tests/gem_concurrent_all.c b/tests/gem_concurrent_all.c
index 1d2d787..3970fc6 100644
--- a/tests/gem_concurrent_all.c
+++ b/tests/gem_concurrent_all.c
@@ -298,8 +298,8 @@  gpu_set_bo(drm_intel_bo *bo, uint32_t val, int width, int height)
 	gem_pwrite.offset = 0;
 	gem_pwrite.size = execbuf.batch_len;
 	gem_pwrite.data_ptr = (uintptr_t)buf;
-	do_or_die(drmIoctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &gem_pwrite));
-	do_or_die(drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf));
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &gem_pwrite);
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
 
 	drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &create.handle);
 }
@@ -868,7 +868,7 @@  static void bit17_require(void)
 	arg.handle = gem_create(fd, 4096);
 	gem_set_tiling(fd, arg.handle, I915_TILING_X, 512);
 
-	do_or_die(drmIoctl(fd, DRM_IOCTL_I915_GEM_GET_TILING2, &arg));
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_GET_TILING2, &arg);
 	gem_close(fd, arg.handle);
 	igt_require(arg.phys_swizzle_mode == arg.swizzle_mode);
 }
diff --git a/tests/gem_ctx_exec.c b/tests/gem_ctx_exec.c
index f2b7cb6..179e991 100644
--- a/tests/gem_ctx_exec.c
+++ b/tests/gem_ctx_exec.c
@@ -116,8 +116,7 @@  static void big_exec(int fd, uint32_t handle, int ring)
 
 	execbuf.buffer_count = 1;
 	i915_execbuffer2_set_context_id(execbuf, ctx_id1);
-	igt_assert(drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2,
-			    &execbuf) == 0);
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
 
 	for (i = 0; i < num_buffers; i++) {
 		uint32_t tmp_handle = gem_create(fd, 4096);
@@ -141,12 +140,10 @@  static void big_exec(int fd, uint32_t handle, int ring)
 	       i - 1, num_buffers);
 
 	/* double check that it works */
-	igt_assert(drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2,
-			    &execbuf) == 0);
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
 
 	i915_execbuffer2_set_context_id(execbuf, ctx_id2);
-	igt_assert(drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2,
-			    &execbuf) == 0);
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
 	gem_sync(fd, handle);
 }
 
diff --git a/tests/gem_ctx_param_basic.c b/tests/gem_ctx_param_basic.c
index 94245ce..b75800c 100644
--- a/tests/gem_ctx_param_basic.c
+++ b/tests/gem_ctx_param_basic.c
@@ -40,9 +40,9 @@  int32_t ctx;
 #define LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM DRM_IOWR (DRM_COMMAND_BASE + LOCAL_I915_GEM_CONTEXT_SETPARAM, struct local_i915_gem_context_param)
 
 #define TEST_SUCCESS(ioc) \
-	igt_assert(drmIoctl(fd, (ioc), &ctx_param) == 0);
+	do_ioctl(fd, (ioc), &ctx_param);
 #define TEST_FAIL(ioc, exp_errno) \
-	igt_assert(drmIoctl(fd, (ioc), &ctx_param) < 0 && errno == exp_errno);
+	do_ioctl_err(fd, (ioc), &ctx_param, exp_errno);
 
 igt_main
 {
diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c
index 62ba35f..f586bf1 100644
--- a/tests/gem_mmap_gtt.c
+++ b/tests/gem_mmap_gtt.c
@@ -90,9 +90,7 @@  test_access(int fd)
 
 	/* Check that fd1 can mmap. */
 	mmap_arg.handle = handle;
-	igt_assert(drmIoctl(fd,
-			    DRM_IOCTL_I915_GEM_MMAP_GTT,
-			    &mmap_arg) == 0);
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg);
 
 	igt_assert(mmap64(0, OBJECT_SIZE, PROT_READ | PROT_WRITE,
 			  MAP_SHARED, fd, mmap_arg.offset));
@@ -122,9 +120,7 @@  test_short(int fd)
 	mmap_arg.handle = gem_create(fd, OBJECT_SIZE);
 	igt_assert(mmap_arg.handle);
 
-	igt_assert(drmIoctl(fd,
-			    DRM_IOCTL_I915_GEM_MMAP_GTT,
-			    &mmap_arg) == 0);
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg);
 	for (pages = 1; pages <= OBJECT_SIZE / PAGE_SIZE; pages <<= 1) {
 		uint8_t *r, *w;
 
diff --git a/tests/gem_pin.c b/tests/gem_pin.c
index e49d0f7..8da75c5 100644
--- a/tests/gem_pin.c
+++ b/tests/gem_pin.c
@@ -80,7 +80,7 @@  static void exec(int fd, uint32_t handle, uint32_t offset)
 	i915_execbuffer2_set_context_id(execbuf, 0);
 	execbuf.rsvd2 = 0;
 
-	do_or_die(drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf));
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
 	igt_assert(gem_exec[0].offset == offset);
 }
 
@@ -172,7 +172,7 @@  static void make_busy(int fd, uint32_t handle)
 
 	gem_write(fd, handle, 0, batch, execbuf.batch_len);
 	for (count = 0; count < 10; count++)
-		do_or_die(drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf));
+		do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
 	gem_close(fd, tmp);
 }
 
diff --git a/tests/gem_pwrite_pread.c b/tests/gem_pwrite_pread.c
index ef8890e..fe136d3 100644
--- a/tests/gem_pwrite_pread.c
+++ b/tests/gem_pwrite_pread.c
@@ -100,7 +100,7 @@  static void copy(int fd, uint32_t src, uint32_t dst, void *buf, int len, int loo
 
 	while (loops--) {
 		gem_write(fd, src, 0, buf, len);
-		do_or_die(drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf));
+		do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
 		gem_read(fd, dst, 0, buf, len);
 	}
 
@@ -120,7 +120,7 @@  static void as_gtt_mmap(int fd, uint32_t src, uint32_t dst, void *buf, int len,
 			       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
 		memcpy(src_ptr, buf, len);
 
-		do_or_die(drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf));
+		do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
 		gem_set_domain(fd, dst,
 			       I915_GEM_DOMAIN_GTT, 0);
 		memcpy(buf, dst_ptr, len);
@@ -145,7 +145,7 @@  static void as_cpu_mmap(int fd, uint32_t src, uint32_t dst, void *buf, int len,
 			       I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
 		memcpy(src_ptr, buf, len);
 
-		do_or_die(drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf));
+		do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
 		gem_set_domain(fd, dst,
 			       I915_GEM_DOMAIN_CPU, 0);
 		memcpy(buf, dst_ptr, len);
@@ -167,7 +167,7 @@  static void test_copy(int fd, uint32_t src, uint32_t dst, uint32_t *buf, int len
 	gem_write(fd, src, 0, buf, len);
 	memset(buf, 0, len);
 
-	do_or_die(drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf));
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
 	gem_read(fd, dst, 0, buf, len);
 
 	gem_close(fd, exec[2].handle);
@@ -189,7 +189,7 @@  static void test_as_gtt_mmap(int fd, uint32_t src, uint32_t dst, int len)
 	for (i = 0; i < len/4; i++)
 		src_ptr[i] = i;
 
-	do_or_die(drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf));
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
 	gem_close(fd, exec[2].handle);
 
 	gem_set_domain(fd, dst, I915_GEM_DOMAIN_GTT, 0);
@@ -213,7 +213,7 @@  static void test_as_cpu_mmap(int fd, uint32_t src, uint32_t dst, int len)
 	for (i = 0; i < len/4; i++)
 		src_ptr[i] = i;
 
-	do_or_die(drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf));
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
 	gem_close(fd, exec[2].handle);
 
 	gem_set_domain(fd, dst, I915_GEM_DOMAIN_CPU, 0);
diff --git a/tests/gem_reg_read.c b/tests/gem_reg_read.c
index 8fa70d0..79facc1 100644
--- a/tests/gem_reg_read.c
+++ b/tests/gem_reg_read.c
@@ -65,7 +65,7 @@  static bool check_kernel_x86_64(void)
 	struct utsname uts;
 
 	ret = uname(&uts);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	if (!strcmp(uts.machine, "x86_64"))
 		return true;
diff --git a/tests/gem_tiled_swapping.c b/tests/gem_tiled_swapping.c
index f45244b..b5849bc 100644
--- a/tests/gem_tiled_swapping.c
+++ b/tests/gem_tiled_swapping.c
@@ -157,8 +157,8 @@  static void thread_fini(struct thread *t)
 
 static void check_memory_layout(void)
 {
-	if (igt_debugfs_search("i915_swizzle_info", "L-shaped"))
-		igt_skip("L-shaped memory configuration detected\n");
+	igt_skip_on_f(igt_debugfs_search("i915_swizzle_info", "L-shaped"),
+		      "L-shaped memory configuration detected\n");
 
 	igt_debug("normal memory configuration detected, continuing\n");
 }
diff --git a/tests/gem_tiled_wb.c b/tests/gem_tiled_wb.c
index 227ebde..67d54bd 100644
--- a/tests/gem_tiled_wb.c
+++ b/tests/gem_tiled_wb.c
@@ -123,7 +123,7 @@  get_tiling(int fd, uint32_t handle, uint32_t *tiling, uint32_t *swizzle)
 	memset(&arg, 0, sizeof(arg));
 	arg.handle = handle;
 
-	do_or_die(drmIoctl(fd, DRM_IOCTL_I915_GEM_GET_TILING2, &arg));
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_GET_TILING2, &arg);
 	igt_require(arg.phys_swizzle_mode == arg.swizzle_mode);
 
 	*tiling = arg.tiling_mode;
diff --git a/tests/gem_tiled_wc.c b/tests/gem_tiled_wc.c
index a6316cc..65ac385 100644
--- a/tests/gem_tiled_wc.c
+++ b/tests/gem_tiled_wc.c
@@ -118,7 +118,7 @@  get_tiling(int fd, uint32_t handle, uint32_t *tiling, uint32_t *swizzle)
 	memset(&arg, 0, sizeof(arg));
 	arg.handle = handle;
 
-	do_or_die(drmIoctl(fd, DRM_IOCTL_I915_GEM_GET_TILING2, &arg));
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_GET_TILING2, &arg);
 	igt_require(arg.phys_swizzle_mode == arg.swizzle_mode);
 
 	*tiling = arg.tiling_mode;
diff --git a/tests/kms_draw_crc.c b/tests/kms_draw_crc.c
index 10a84fa..dccf535 100644
--- a/tests/kms_draw_crc.c
+++ b/tests/kms_draw_crc.c
@@ -138,7 +138,7 @@  static void get_method_crc(enum igt_draw_method method, uint32_t drm_format,
 
 	rc = drmModeSetCrtc(drm_fd, ms.crtc_id, fb.fb_id, 0, 0,
 			    &ms.connector_id, 1, ms.mode);
-	igt_assert(rc == 0);
+	igt_assert_eq(rc, 0);
 
 	igt_pipe_crc_collect_crc(pipe_crc, crc);
 
@@ -181,7 +181,7 @@  static void get_fill_crc(uint64_t tiling, igt_crc_t *crc)
 
 	rc = drmModeSetCrtc(drm_fd, ms.crtc_id, fb.fb_id, 0, 0,
 			    &ms.connector_id, 1, ms.mode);
-	igt_assert(rc == 0);
+	igt_assert_eq(rc, 0);
 
 	igt_pipe_crc_collect_crc(pipe_crc, crc);
 
@@ -207,7 +207,7 @@  static void fill_fb_subtest(void)
 
 	rc = drmModeSetCrtc(drm_fd, ms.crtc_id, fb.fb_id, 0, 0,
 			    &ms.connector_id, 1, ms.mode);
-	igt_assert(rc == 0);
+	igt_assert_eq(rc, 0);
 
 	igt_pipe_crc_collect_crc(pipe_crc, &base_crc);
 
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 15707b9..38ed662 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -717,7 +717,7 @@  static void fbc_print_status(void)
 	char buf[128];
 
 	igt_debugfs_read("i915_fbc_status", buf);
-	printf("FBC status:\n%s\n", buf);
+	igt_info("FBC status:\n%s\n", buf);
 }
 
 static bool psr_is_enabled(void)
@@ -734,7 +734,7 @@  static void psr_print_status(void)
 	char buf[256];
 
 	igt_debugfs_read("i915_edp_psr_status", buf);
-	printf("PSR status:\n%s\n", buf);
+	igt_info("PSR status:\n%s\n", buf);
 }
 
 static struct timespec fbc_get_last_action(void)
@@ -988,7 +988,7 @@  static struct rect pat4_get_rect(struct fb_region *fb, int r)
 {
 	struct rect rect;
 
-	igt_assert(r == 0);
+	igt_assert_eq(r, 0);
 
 	rect.x = 0;
 	rect.y = 0;
@@ -1058,16 +1058,16 @@  static void unset_all_crtcs(void)
 	for (i = 0; i < drm.res->count_crtcs; i++) {
 		rc = drmModeSetCrtc(drm.fd, drm.res->crtcs[i], -1, 0, 0, NULL,
 				    0, NULL);
-		igt_assert(rc == 0);
+		igt_assert_eq(rc, 0);
 
 		rc = drmModeSetCursor(drm.fd, drm.res->crtcs[i], 0, 0, 0);
-		igt_assert(rc == 0);
+		igt_assert_eq(rc, 0);
 	}
 
 	for (i = 0; i < drm.plane_res->count_planes; i++) {
 		rc = drmModeSetPlane(drm.fd, drm.plane_res->planes[i], 0, 0, 0,
 				     0, 0, 0, 0, 0, 0, 0, 0);
-		igt_assert(rc == 0);
+		igt_assert_eq(rc, 0);
 	}
 }
 
@@ -1119,7 +1119,7 @@  static void start_busy_thread(struct igt_fb *fb)
 	busy_thread.bpp = fb_get_bpp(fb);
 
 	rc = pthread_create(&busy_thread.thread, NULL, busy_thread_func, NULL);
-	igt_assert(rc == 0);
+	igt_assert_eq(rc, 0);
 }
 
 static void stop_busy_thread(void)
@@ -1172,7 +1172,7 @@  static void init_blue_crc(enum pixel_format format)
 	rc = drmModeSetCrtc(drm.fd, prim_mode_params.crtc_id,
 			    blue.fb_id, 0, 0, &prim_mode_params.connector_id, 1,
 			    prim_mode_params.mode);
-	igt_assert(rc == 0);
+	igt_assert_eq(rc, 0);
 	collect_crcs(&blue_crcs[format].crc);
 
 	print_crc("Blue CRC:  ", &blue_crcs[format].crc);
@@ -1220,7 +1220,7 @@  static void init_crcs(enum pixel_format format,
 				   tmp_fbs[r].fb_id, 0, 0,
 				   &prim_mode_params.connector_id, 1,
 				   prim_mode_params.mode);
-		igt_assert(rc == 0);
+		igt_assert_eq(rc, 0);
 		collect_crcs(&pattern->crcs[format][r]);
 	}
 
@@ -1336,7 +1336,7 @@  static void setup_sink_crc(void)
 	set_mode_for_params(&prim_mode_params);
 
 	sink_crc.fd = igt_debugfs_open("i915_sink_crc_eDP1", O_RDONLY);
-	igt_assert(sink_crc.fd >= 0);
+	igt_assert_lte(0, sink_crc.fd);
 
 	rc = read(sink_crc.fd, crc.data, SINK_CRC_SIZE);
 	errno_ = errno;
@@ -1672,13 +1672,13 @@  static void set_cursor_for_test(const struct test_mode *t,
 	fill_fb_region(&params->cursor, COLOR_PRIM_BG);
 
 	rc = drmModeMoveCursor(drm.fd, params->crtc_id, 0, 0);
-	igt_assert(rc == 0);
+	igt_assert_eq(rc, 0);
 
 	rc = drmModeSetCursor(drm.fd, params->crtc_id,
 			      params->cursor.fb->gem_handle,
 			      params->cursor.w,
 			      params->cursor.h);
-	igt_assert(rc == 0);
+	igt_assert_eq(rc, 0);
 
 	do_assertions(ASSERT_NO_ACTION_CHANGE);
 }
@@ -1695,7 +1695,7 @@  static void set_sprite_for_test(const struct test_mode *t,
 			     params->sprite.w, params->sprite.h,
 			     0, 0, params->sprite.w << 16,
 			     params->sprite.h << 16);
-	igt_assert(rc == 0);
+	igt_assert_eq(rc, 0);
 
 	do_assertions(ASSERT_NO_ACTION_CHANGE);
 }
@@ -2170,7 +2170,7 @@  static void wait_flip_event(void)
 		break;
 	case 1:
 		rc = drmHandleEvent(drm.fd, &evctx);
-		igt_assert(rc == 0);
+		igt_assert_eq(rc, 0);
 		break;
 	default:
 		igt_assert_f(false, "Unexpected poll rc %d\n", rc);
@@ -2187,13 +2187,13 @@  static void page_flip_for_params(struct modeset_params *params,
 	case FLIP_PAGEFLIP:
 		rc = drmModePageFlip(drm.fd, params->crtc_id,
 				     params->fb.fb->fb_id, 0, NULL);
-		igt_assert(rc == 0);
+		igt_assert_eq(rc, 0);
 		break;
 	case FLIP_PAGEFLIP_EVENT:
 		rc = drmModePageFlip(drm.fd, params->crtc_id,
 				     params->fb.fb->fb_id,
 				     DRM_MODE_PAGE_FLIP_EVENT, NULL);
-		igt_assert(rc == 0);
+		igt_assert_eq(rc, 0);
 		wait_flip_event();
 		break;
 	case FLIP_MODESET:
@@ -2349,7 +2349,7 @@  static void move_subtest(const struct test_mode *t)
 		case PLANE_CUR:
 			rc = drmModeMoveCursor(drm.fd, params->crtc_id, rect.x,
 					       rect.y);
-			igt_assert(rc == 0);
+			igt_assert_eq(rc, 0);
 			break;
 		case PLANE_SPR:
 			rc = drmModeSetPlane(drm.fd, params->sprite_id,
@@ -2358,7 +2358,7 @@  static void move_subtest(const struct test_mode *t)
 					     rect.x, rect.y, rect.w,
 					     rect.h, 0, 0, rect.w << 16,
 					     rect.h << 16);
-			igt_assert(rc == 0);
+			igt_assert_eq(rc, 0);
 			break;
 		default:
 			igt_assert(false);
@@ -2410,13 +2410,13 @@  static void onoff_subtest(const struct test_mode *t)
 			case PLANE_CUR:
 				rc = drmModeSetCursor(drm.fd, params->crtc_id,
 						      0, 0, 0);
-				igt_assert(rc == 0);
+				igt_assert_eq(rc, 0);
 				break;
 			case PLANE_SPR:
 				rc = drmModeSetPlane(drm.fd, params->sprite_id,
 						     0, 0, 0, 0, 0, 0, 0, 0, 0,
 						     0, 0);
-				igt_assert(rc == 0);
+				igt_assert_eq(rc, 0);
 				break;
 			default:
 				igt_assert(false);
@@ -2430,7 +2430,7 @@  static void onoff_subtest(const struct test_mode *t)
 						  params->cursor.fb->gem_handle,
 						  params->cursor.w,
 						  params->cursor.h);
-				igt_assert(rc == 0);
+				igt_assert_eq(rc, 0);
 				break;
 			case PLANE_SPR:
 				rc = drmModeSetPlane(drm.fd, params->sprite_id,
@@ -2441,7 +2441,7 @@  static void onoff_subtest(const struct test_mode *t)
 						     0,
 						     params->sprite.w << 16,
 						     params->sprite.h << 16);
-				igt_assert(rc == 0);
+				igt_assert_eq(rc, 0);
 				break;
 			default:
 				igt_assert(false);
@@ -2471,7 +2471,7 @@  static bool prim_plane_disabled(void)
 	igt_assert(found);
 
 	rc = drmSetClientCap(drm.fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 0);
-	igt_assert(rc == 0);
+	igt_assert_eq(rc, 0);
 
 	return disabled;
 }
@@ -2513,7 +2513,7 @@  static void fullscreen_plane_subtest(const struct test_mode *t)
 			     fullscreen_fb.height, 0, 0,
 			     fullscreen_fb.width << 16,
 			     fullscreen_fb.height << 16);
-	igt_assert(rc == 0);
+	igt_assert_eq(rc, 0);
 	update_wanted_crc(t, &pattern->crcs[t->format][0]);
 
 	switch (t->screen) {
@@ -2533,7 +2533,7 @@  static void fullscreen_plane_subtest(const struct test_mode *t)
 
 	rc = drmModeSetPlane(drm.fd, params->sprite_id, 0, 0, 0, 0, 0, 0, 0, 0,
 			     0, 0, 0);
-	igt_assert(rc == 0);
+	igt_assert_eq(rc, 0);
 
 	if (t->screen == SCREEN_PRIM)
 		assertions = ASSERT_LAST_ACTION_CHANGED;
@@ -2817,15 +2817,15 @@  static void try_invalid_strides(void)
 
 	/* Smaller than 512, yet still 64-byte aligned. */
 	rc = __gem_set_tiling(drm.fd, gem_handle, I915_TILING_X, 448);
-	igt_assert(rc == -EINVAL);
+	igt_assert_eq(rc, -EINVAL);
 
 	/* Bigger than 512, but not 64-byte aligned. */
 	rc = __gem_set_tiling(drm.fd, gem_handle, I915_TILING_X, 1022);
-	igt_assert(rc == -EINVAL);
+	igt_assert_eq(rc, -EINVAL);
 
 	/* Just make sure something actually works. */
 	rc = __gem_set_tiling(drm.fd, gem_handle, I915_TILING_X, 1024);
-	igt_assert(rc == 0);
+	igt_assert_eq(rc, 0);
 
 	gem_close(drm.fd, gem_handle);
 }
@@ -2950,11 +2950,11 @@  static int opt_handler(int option, int option_index, void *data)
 		igt_assert(errno == 0);
 		break;
 	case '1':
-		igt_assert(opt.only_pipes == PIPE_COUNT);
+		igt_assert_eq(opt.only_pipes, PIPE_COUNT);
 		opt.only_pipes = PIPE_SINGLE;
 		break;
 	case '2':
-		igt_assert(opt.only_pipes == PIPE_COUNT);
+		igt_assert_eq(opt.only_pipes, PIPE_COUNT);
 		opt.only_pipes = PIPE_DUAL;
 		break;
 	default:
diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c
index 6b44241..f8726e2 100644
--- a/tests/kms_panel_fitting.c
+++ b/tests/kms_panel_fitting.c
@@ -122,7 +122,7 @@  static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 				&output->id,
 				1,
 				mode);
-		igt_assert(ret == 0);
+		igt_assert_eq(ret, 0);
 	} else {
 		igt_display_commit2(display, s);
 	}
diff --git a/tests/kms_pipe_b_c_ivb.c b/tests/kms_pipe_b_c_ivb.c
index 9d66bda..bd727f0 100644
--- a/tests/kms_pipe_b_c_ivb.c
+++ b/tests/kms_pipe_b_c_ivb.c
@@ -94,7 +94,7 @@  set_mode_on_pipe(data_t *data, enum pipe pipe, igt_output_t *output)
 				    mode->hdisplay, mode->vdisplay,
 				    DRM_FORMAT_XRGB8888, I915_TILING_NONE,
 				    1.0, 1.0, 1.0, &fb);
-	igt_assert(fb_id >= 0);
+	igt_assert_lte(0, fb_id);
 
 	igt_plane_set_fb(primary, &fb);
 	return igt_display_try_commit2(&data->display, COMMIT_LEGACY);
@@ -150,12 +150,12 @@  test_dpms(data_t *data)
 		 kmstest_pipe_name(PIPE_C), igt_output_name(output2));
 
 	ret = set_big_mode_on_pipe(data, PIPE_B, output1);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	kmstest_set_connector_dpms(data->drm_fd, output1->config.connector, DRM_MODE_DPMS_OFF);
 
 	ret = set_big_mode_on_pipe(data, PIPE_C, output2);
-	igt_assert(ret != 0);
+	igt_assert_neq(ret, 0);
 }
 
 static void
@@ -172,13 +172,13 @@  test_lane_reduction(data_t *data)
 		 kmstest_pipe_name(PIPE_C), igt_output_name(output2));
 
 	ret = set_big_mode_on_pipe(data, PIPE_B, output1);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	ret = set_normal_mode_on_pipe(data, PIPE_B, output1);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	ret = set_normal_mode_on_pipe(data, PIPE_C, output2);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 }
 
 static void
@@ -195,16 +195,16 @@  test_disable_pipe_B(data_t *data)
 		 kmstest_pipe_name(PIPE_C), igt_output_name(output2));
 
 	ret = set_big_mode_on_pipe(data, PIPE_B, output1);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	ret = disable_pipe(data, PIPE_B, output1);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	ret = set_normal_mode_on_pipe(data, PIPE_C, output2);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	ret = set_normal_mode_on_pipe(data, PIPE_B, output1);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 }
 
 static void
@@ -221,13 +221,13 @@  test_from_C_to_B_with_3_lanes(data_t *data)
 		 kmstest_pipe_name(PIPE_C), igt_output_name(output2));
 
 	ret = set_normal_mode_on_pipe(data, PIPE_C, output2);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	ret = disable_pipe(data, PIPE_C, output2);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	ret = set_big_mode_on_pipe(data, PIPE_B, output1);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 }
 
 static void
@@ -244,10 +244,10 @@  test_fail_enable_pipe_C_while_B_has_3_lanes(data_t *data)
 		 kmstest_pipe_name(PIPE_C), igt_output_name(output2));
 
 	ret = set_big_mode_on_pipe(data, PIPE_B, output1);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	ret = set_normal_mode_on_pipe(data, PIPE_C, output2);
-	igt_assert(ret != 0);
+	igt_assert_neq(ret, 0);
 }
 
 static data_t data;
diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 22e0388..74bc6f8 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -124,7 +124,7 @@  static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 				&output->id,
 				1,
 				mode);
-		igt_assert(ret == 0);
+		igt_assert_eq(ret, 0);
 	} else {
 		igt_display_commit2(display, s);
 	}
diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 4fb00ab..e7126ad 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -268,9 +268,9 @@  static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
 			igt_plane_set_rotation(plane, data->rotation);
 			ret = igt_display_try_commit2(display, commit);
 			if (data->override_fmt || data->override_tiling) {
-				igt_assert(ret == -EINVAL);
+				igt_assert_eq(ret, -EINVAL);
 			} else {
-				igt_assert(ret == 0);
+				igt_assert_eq(ret, 0);
 				igt_pipe_crc_collect_crc(data->pipe_crc,
 							 &crc_output);
 				igt_assert_crc_equal(&data->ref_crc,
diff --git a/tests/pm_backlight.c b/tests/pm_backlight.c
index bc1d417..d24fb10 100644
--- a/tests/pm_backlight.c
+++ b/tests/pm_backlight.c
@@ -95,12 +95,12 @@  static void test_and_verify(int val)
 {
 	int result;
 
-	igt_assert(backlight_write(val, "brightness") == 0);
-	igt_assert(backlight_read(&result, "brightness") == 0);
+	igt_assert_eq(backlight_write(val, "brightness"), 0);
+	igt_assert_eq(backlight_read(&result, "brightness"), 0);
 	/* Check that the exact value sticks */
-	igt_assert(result == val);
+	igt_assert_eq(result, val);
 
-	igt_assert(backlight_read(&result, "actual_brightness") == 0);
+	igt_assert_eq(backlight_read(&result, "actual_brightness"), 0);
 	/* Some rounding may happen depending on hw. Just check that it's close enough. */
 	igt_assert(result <= val + val * TOLERANCE / 100 && result >= val - val * TOLERANCE / 100);
 }
@@ -118,15 +118,15 @@  static void test_bad_brightness(int max)
 	/* First write some sane value */
 	backlight_write(max / 2, "brightness");
 	/* Writing invalid values should fail and not change the value */
-	igt_assert(backlight_write(-1, "brightness") < 0);
+	igt_assert_lt(backlight_write(-1, "brightness"), 0);
 	backlight_read(&val, "brightness");
-	igt_assert(val == max / 2);
-	igt_assert(backlight_write(max + 1, "brightness") < 0);
+	igt_assert_eq(val, max / 2);
+	igt_assert_lt(backlight_write(max + 1, "brightness"), 0);
 	backlight_read(&val, "brightness");
-	igt_assert(val == max / 2);
-	igt_assert(backlight_write(INT_MAX, "brightness") < 0);
+	igt_assert_eq(val, max / 2);
+	igt_assert_lt(backlight_write(INT_MAX, "brightness"), 0);
 	backlight_read(&val, "brightness");
-	igt_assert(val == max / 2);
+	igt_assert_eq(val, max / 2);
 }
 
 static void test_fade(int max)