[26/33] Run igt_assert_comparisons.cocci

Submitted by Lyude Paul on June 10, 2019, 3:03 p.m.

Details

Message ID 20190610150321.512-26-lyude@redhat.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in IGT - Trybot

Not browsing as part of any series.

Commit Message

Lyude Paul June 10, 2019, 3:03 p.m.
From: Lyude Paul <lyude@redhat.com>

Turns out there's a _lot_ of places that aren't using the right
comparison macros right now, so let's go and actually fix that. This
imports a bunch of changes from running the igt_assert_comparisons.cocci
semantic patch, all of which were verified by hand.

There were a few incorrect changes that coccinelle suggested which I
ommitted, mainly spots where igt_assert_fd() should be used instead of
one of the comparison macros. There were also a few spots that still
need fixing because coccinelle somehow didn't detect them, but I didn't
bother going through and trying to find them all.

Signed-off-by: Lyude Paul <lyude@redhat.com>
---
 lib/gpu_cmds.c                  | 10 +++++-----
 lib/igt_alsa.c                  |  2 +-
 lib/igt_audio.c                 | 10 +++++-----
 lib/igt_aux.c                   |  2 +-
 lib/igt_chamelium.c             |  4 ++--
 lib/igt_debugfs.c               |  4 ++--
 lib/igt_draw.c                  |  6 +++---
 lib/igt_dummyload.c             |  2 +-
 lib/igt_eld.c                   |  2 +-
 lib/igt_fb.c                    |  4 ++--
 lib/igt_kms.c                   | 12 ++++++------
 lib/igt_pm.c                    |  2 +-
 lib/igt_psr.c                   |  2 +-
 lib/instdone.c                  |  2 +-
 lib/intel_batchbuffer.c         | 12 ++++++------
 lib/intel_mmio.c                |  4 ++--
 lib/ioctl_wrappers.c            | 10 +++++-----
 lib/rendercopy_gen6.c           |  6 +++---
 lib/rendercopy_gen7.c           |  6 +++---
 lib/rendercopy_gen8.c           |  8 ++++----
 lib/rendercopy_gen9.c           |  2 +-
 lib/rendercopy_i830.c           |  2 +-
 lib/rendercopy_i915.c           |  2 +-
 lib/tests/igt_stats.c           |  4 ++--
 tests/amdgpu/amd_abm.c          | 10 +++++-----
 tests/amdgpu/amd_basic.c        |  2 +-
 tests/i915/gem_concurrent_all.c |  2 +-
 tests/i915/gem_cpu_reloc.c      |  2 +-
 tests/i915/gem_create.c         |  4 ++--
 tests/i915/gem_exec_capture.c   |  2 +-
 tests/i915/gem_exec_nop.c       |  2 +-
 tests/i915/gem_gtt_speed.c      |  2 +-
 tests/i915/gem_reg_read.c       |  4 ++--
 tests/i915/gem_reset_stats.c    |  2 +-
 tests/i915/gem_stolen.c         |  4 ++--
 tests/i915/i915_module_load.c   |  2 +-
 tests/i915/i915_pm_rpm.c        |  2 +-
 tests/i915/i915_query.c         |  2 +-
 tests/kms_atomic_transition.c   |  2 +-
 tests/kms_available_modes_crc.c |  2 +-
 tests/kms_chamelium.c           | 32 ++++++++++++++++----------------
 tests/kms_cursor_legacy.c       |  2 +-
 tests/kms_hdmi_inject.c         |  4 ++--
 tests/kms_lease.c               |  4 ++--
 tests/kms_properties.c          |  6 +++---
 tests/kms_setmode.c             |  2 +-
 tests/perf.c                    | 30 +++++++++++++++---------------
 tests/perf_pmu.c                |  8 ++++----
 tests/syncobj_basic.c           |  2 +-
 tests/vc4_dmabuf_poll.c         |  2 +-
 50 files changed, 129 insertions(+), 129 deletions(-)

Patch hide | download patch | download mbox

diff --git a/lib/gpu_cmds.c b/lib/gpu_cmds.c
index 8d270ee8..1c8816ba 100644
--- a/lib/gpu_cmds.c
+++ b/lib/gpu_cmds.c
@@ -33,7 +33,7 @@  gen7_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end)
 	if (ret == 0)
 		ret = drm_intel_bo_mrb_exec(batch->bo, batch_end,
 					    NULL, 0, 0, 0);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 }
 
 void
@@ -45,7 +45,7 @@  gen7_render_context_flush(struct intel_batchbuffer *batch, uint32_t batch_end)
 	if (ret == 0)
 		ret = drm_intel_gem_bo_context_exec(batch->bo, batch->ctx,
 				batch_end, 0);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 }
 
 uint32_t
@@ -114,7 +114,7 @@  gen7_fill_surface_state(struct intel_batchbuffer *batch,
 				intel_batchbuffer_subdata_offset(batch, ss) + 4,
 				buf->bo, 0,
 				read_domain, write_domain);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	ss->ss2.height = igt_buf_height(buf) - 1;
 	ss->ss2.width  = igt_buf_width(buf) - 1;
@@ -418,7 +418,7 @@  gen8_fill_surface_state(struct intel_batchbuffer *batch,
 	ret = drm_intel_bo_emit_reloc(batch->bo,
 				intel_batchbuffer_subdata_offset(batch, ss) + 8 * 4,
 				buf->bo, 0, read_domain, write_domain);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	ss->ss2.height = igt_buf_height(buf) - 1;
 	ss->ss2.width  = igt_buf_width(buf) - 1;
@@ -473,7 +473,7 @@  gen11_fill_surface_state(struct intel_batchbuffer *batch,
 	ret = drm_intel_bo_emit_reloc(batch->bo,
 				intel_batchbuffer_subdata_offset(batch, ss) + 8 * 4,
 				buf->bo, 0, read_domain, write_domain);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	if (is_dst) {
 		ss->ss1.memory_object_control = 2;
diff --git a/lib/igt_alsa.c b/lib/igt_alsa.c
index 5b5980a9..268cf4ad 100644
--- a/lib/igt_alsa.c
+++ b/lib/igt_alsa.c
@@ -366,7 +366,7 @@  void alsa_configure_output(struct alsa *alsa, snd_pcm_format_t fmt,
 					 SND_PCM_ACCESS_RW_INTERLEAVED,
 					 channels, sampling_rate,
 					 soft_resample, latency);
-		igt_assert(ret >= 0);
+		igt_assert_lte(0, ret);
 	}
 
 	alsa->output_format = fmt;
diff --git a/lib/igt_audio.c b/lib/igt_audio.c
index e0b1bafe..23e288c1 100644
--- a/lib/igt_audio.c
+++ b/lib/igt_audio.c
@@ -91,8 +91,8 @@  struct audio_signal *audio_signal_init(int channels, int sampling_rate)
 {
 	struct audio_signal *signal;
 
-	igt_assert(channels > 0);
-	igt_assert(channels <= CHANNELS_MAX);
+	igt_assert_lt(0, channels);
+	igt_assert_lte(channels, CHANNELS_MAX);
 
 	signal = calloc(1, sizeof(struct audio_signal));
 	signal->sampling_rate = sampling_rate;
@@ -118,8 +118,8 @@  int audio_signal_add_frequency(struct audio_signal *signal, int frequency,
 	struct audio_signal_freq *freq;
 
 	igt_assert(index < FREQS_MAX);
-	igt_assert(channel < signal->channels);
-	igt_assert(frequency >= MIN_FREQ);
+	igt_assert_lt(channel, signal->channels);
+	igt_assert_lte(MIN_FREQ, frequency);
 
 	/* Stay within the Nyquist–Shannon sampling theorem. */
 	if (frequency > signal->sampling_rate / 2) {
@@ -507,7 +507,7 @@  size_t audio_extract_channel_s32_le(double *dst, size_t dst_cap,
 {
 	size_t dst_len, i;
 
-	igt_assert(channel < n_channels);
+	igt_assert_lt(channel, n_channels);
 	igt_assert(src_len % n_channels == 0);
 	dst_len = src_len / n_channels;
 	if (dst_cap == 0)
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 578f8579..d3817616 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -1600,7 +1600,7 @@  void igt_start_siglatency(int sig)
 
 	if (igt_siglatency.sig)
 		(void)igt_stop_siglatency(NULL);
-	igt_assert(igt_siglatency.sig == 0);
+	igt_assert_eq(igt_siglatency.sig, 0);
 	igt_siglatency.sig = sig;
 
 	memset(&sev, 0, sizeof(sev));
diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index eaf3b5b0..884ace88 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -1029,7 +1029,7 @@  void chamelium_get_audio_channel_mapping(struct chamelium *chamelium,
 	res = chamelium_rpc(chamelium, port, "GetAudioChannelMapping", "(i)",
 			    port->id);
 	res_len = xmlrpc_array_size(&chamelium->env, res);
-	igt_assert(res_len == CHAMELIUM_MAX_AUDIO_CHANNELS);
+	igt_assert_eq(res_len, CHAMELIUM_MAX_AUDIO_CHANNELS);
 	for (i = 0; i < res_len; i++) {
 		xmlrpc_array_read_item(&chamelium->env, res, i, &res_channel);
 		xmlrpc_read_int(&chamelium->env, res_channel, &mapping[i]);
@@ -1061,7 +1061,7 @@  static void audio_format_from_xml(struct chamelium *chamelium,
 		xmlrpc_read_int(&chamelium->env, res_rate, rate);
 	if (channels) {
 		xmlrpc_read_int(&chamelium->env, res_channel, channels);
-		igt_assert(*channels <= CHAMELIUM_MAX_AUDIO_CHANNELS);
+		igt_assert_lte(*channels, CHAMELIUM_MAX_AUDIO_CHANNELS);
 	}
 
 	xmlrpc_DECREF(res_channel);
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 82ce1834..6eebd2b9 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -1049,8 +1049,8 @@  void igt_drop_caches_set(int drm_fd, uint64_t val)
 	int dir;
 
 	dir = igt_debugfs_dir(drm_fd);
-	igt_assert(igt_sysfs_printf(dir, "i915_gem_drop_caches",
-				    "0x%" PRIx64, val) > 0);
+	igt_assert_lt(0, igt_sysfs_printf(dir, "i915_gem_drop_caches",
+					  "0x%" PRIx64, val));
 	close(dir);
 }
 
diff --git a/lib/igt_draw.c b/lib/igt_draw.c
index bea86c61..7eff3034 100644
--- a/lib/igt_draw.c
+++ b/lib/igt_draw.c
@@ -362,7 +362,7 @@  static void draw_rect_mmap_cpu(int fd, struct buf_data *buf, struct rect *rect,
 
 	gem_sw_finish(fd, buf->handle);
 
-	igt_assert(gem_munmap(ptr, buf->size) == 0);
+	igt_assert_eq(gem_munmap(ptr, buf->size), 0);
 }
 
 static void draw_rect_mmap_gtt(int fd, struct buf_data *buf, struct rect *rect,
@@ -378,7 +378,7 @@  static void draw_rect_mmap_gtt(int fd, struct buf_data *buf, struct rect *rect,
 
 	draw_rect_ptr_linear(ptr, buf->stride, rect, color, buf->bpp);
 
-	igt_assert(gem_munmap(ptr, buf->size) == 0);
+	igt_assert_eq(gem_munmap(ptr, buf->size), 0);
 }
 
 static void draw_rect_mmap_wc(int fd, struct buf_data *buf, struct rect *rect,
@@ -412,7 +412,7 @@  static void draw_rect_mmap_wc(int fd, struct buf_data *buf, struct rect *rect,
 		break;
 	}
 
-	igt_assert(gem_munmap(ptr, buf->size) == 0);
+	igt_assert_eq(gem_munmap(ptr, buf->size), 0);
 }
 
 static void draw_rect_pwrite_untiled(int fd, struct buf_data *buf,
diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index 0e06276a..d00fc715 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -545,7 +545,7 @@  static void unplug_sync_fd(struct igt_cork *cork)
  */
 uint32_t igt_cork_plug(struct igt_cork *cork, int fd)
 {
-	igt_assert(cork->fd == -1);
+	igt_assert_eq(cork->fd, -1);
 
 	switch (cork->type) {
 	case CORK_SYNC_FD:
diff --git a/lib/igt_eld.c b/lib/igt_eld.c
index 8b602796..e06e5175 100644
--- a/lib/igt_eld.c
+++ b/lib/igt_eld.c
@@ -183,7 +183,7 @@  static bool eld_parse_entry(const char *path, struct eld_entry *eld)
 		else if (strcmp(key, "sad_count") == 0)
 			eld->sads_len = atoi(value);
 		else if (sscanf(key, "sad%d_%ms", &sad_index, &sad_key) == 2) {
-			igt_assert(sad_index < ELD_SADS_CAP);
+			igt_assert_lt(sad_index, ELD_SADS_CAP);
 			igt_assert(sad_index < eld->sads_len);
 			parse_sad_field(&eld->sads[sad_index], sad_key, value);
 			free(sad_key);
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 9d4f905e..b2b005fd 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1061,7 +1061,7 @@  int igt_cairo_printf_line(cairo_t *cr, enum igt_text_align align,
 
 	va_start(ap, fmt);
 	ret = vasprintf(&text, fmt, ap);
-	igt_assert(ret >= 0);
+	igt_assert_lte(0, ret);
 	va_end(ap);
 
 	cairo_text_extents(cr, text, &extents);
@@ -3137,7 +3137,7 @@  unsigned int igt_fb_convert_with_stride(struct igt_fb *dst, struct igt_fb *src,
 					   src->height, dst_fourcc,
 					   dst_modifier, dst, 0,
 					   dst_stride);
-	igt_assert(fb_id > 0);
+	igt_assert_lt(0, fb_id);
 
 	cr = igt_get_cairo_ctx(dst->fd, dst);
 	cairo_set_source_surface(cr, surf, 0, 0);
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index da188a39..27f17c2f 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1001,7 +1001,7 @@  void kmstest_force_edid(int drm_fd, drmModeConnector *connector,
 	temp = drmModeGetConnector(drm_fd, connector->connector_id);
 	drmModeFreeConnector(temp);
 
-	igt_assert(ret != -1);
+	igt_assert_neq(ret, -1);
 }
 
 /**
@@ -1473,7 +1473,7 @@  void kmstest_unset_all_crtcs(int drm_fd, drmModeResPtr resources)
 	for (i = 0; i < resources->count_crtcs; i++) {
 		rc = drmModeSetCrtc(drm_fd, resources->crtcs[i], 0, 0, 0, NULL,
 				    0, NULL);
-		igt_assert(rc == 0);
+		igt_assert_eq(rc, 0);
 	}
 }
 
@@ -1621,7 +1621,7 @@  static void parse_crtc(char *info, struct kmstest_crtc *crtc)
 	igt_assert_eq(ret, 3);
 
 	crtc->pipe = kmstest_pipe_to_index(pipe);
-	igt_assert(crtc->pipe >= 0);
+	igt_assert_lte(0, crtc->pipe);
 
 	ret = sscanf(buf + 6, "%d%*c%d%*c",
 		     &crtc->width, &crtc->height);
@@ -1673,7 +1673,7 @@  static void kmstest_get_crtc(int device, enum pipe pipe, struct kmstest_crtc *cr
 	fclose(file);
 	close(fd);
 
-	igt_assert(ncrtc == 1);
+	igt_assert_eq(ncrtc, 1);
 }
 
 /**
@@ -1691,7 +1691,7 @@  void igt_assert_plane_visible(int fd, enum pipe pipe, int plane_index, bool visi
 
 	kmstest_get_crtc(fd, pipe, &crtc);
 
-	igt_assert(plane_index < crtc.n_planes);
+	igt_assert_lt(plane_index, crtc.n_planes);
 
 	if (crtc.planes[plane_index].pos_x > crtc.width ||
 	    crtc.planes[plane_index].pos_y > crtc.height)
@@ -1758,7 +1758,7 @@  igt_display_log(igt_display_t *display, const char *fmt, ...)
 static void igt_display_log_shift(igt_display_t *display, int shift)
 {
 	display->log_shift += shift;
-	igt_assert(display->log_shift >= 0);
+	igt_assert_lte(0, display->log_shift);
 }
 
 static void igt_output_refresh(igt_output_t *output)
diff --git a/lib/igt_pm.c b/lib/igt_pm.c
index fd22273a..8373c1a0 100644
--- a/lib/igt_pm.c
+++ b/lib/igt_pm.c
@@ -183,7 +183,7 @@  static int __igt_pm_enable_audio_runtime_pm(void)
 
 		ret = read(fd, buf, sizeof(buf) - 1);
 		close(fd);
-		igt_assert(ret > 0);
+		igt_assert_lt(0, ret);
 		buf[ret] = '\0';
 		strchomp(buf);
 
diff --git a/lib/igt_psr.c b/lib/igt_psr.c
index b92ea73f..9aa7c357 100644
--- a/lib/igt_psr.c
+++ b/lib/igt_psr.c
@@ -139,7 +139,7 @@  static bool psr_set(int debugfs_fd, int mode)
 		}
 
 		ret = psr_write(debugfs_fd, debug_val);
-		igt_assert(ret > 0);
+		igt_assert_lt(0, ret);
 	}
 
 	/* Restore original value on exit */
diff --git a/lib/instdone.c b/lib/instdone.c
index a83f8836..fd76b453 100644
--- a/lib/instdone.c
+++ b/lib/instdone.c
@@ -280,7 +280,7 @@  int num_instdone_bits = 0;
 static void
 add_instdone_bit(uint32_t reg, uint32_t bit, const char *name)
 {
-	igt_assert(num_instdone_bits < MAX_INSTDONE_BITS);
+	igt_assert_lt(num_instdone_bits, MAX_INSTDONE_BITS);
 	instdone_bits[num_instdone_bits].reg = reg;
 	instdone_bits[num_instdone_bits].bit = bit;
 	instdone_bits[num_instdone_bits].name = name;
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index 07de5cbb..dd3e59b6 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -267,13 +267,13 @@  intel_batchbuffer_flush_with_context(struct intel_batchbuffer *batch,
 		return;
 
 	ret = drm_intel_bo_subdata(batch->bo, 0, used, batch->buffer);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	batch->ptr = NULL;
 
 	ret = drm_intel_gem_bo_context_exec(batch->bo, context, used,
 					    I915_EXEC_RENDER);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	intel_batchbuffer_reset(batch);
 }
@@ -339,7 +339,7 @@  intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch,
 	intel_batchbuffer_emit_dword(batch, offset);
 	if (batch->gen >= 8)
 		intel_batchbuffer_emit_dword(batch, offset >> 32);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 }
 
 /**
@@ -404,8 +404,8 @@  intel_blt_copy(struct intel_batchbuffer *batch,
 	uint32_t cmd_bits = 0;
 	uint32_t br13_bits;
 
-	igt_assert(bpp*(src_x1 + width) <= 8*src_pitch);
-	igt_assert(bpp*(dst_x1 + width) <= 8*dst_pitch);
+	igt_assert_lte(bpp * (src_x1 + width), 8 * src_pitch);
+	igt_assert_lte(bpp * (dst_x1 + width), 8 * dst_pitch);
 	igt_assert(src_pitch * (src_y1 + height) <= src_bo->size);
 	igt_assert(dst_pitch * (dst_y1 + height) <= dst_bo->size);
 
@@ -782,7 +782,7 @@  void igt_blitter_fast_copy(struct intel_batchbuffer *batch,
 	uint32_t src_pitch, dst_pitch;
 	uint32_t dword0, dword1;
 
-	igt_assert(src->bpp == dst->bpp);
+	igt_assert_eq_u32(src->bpp, dst->bpp);
 
 	src_pitch = fast_copy_pitch(src->stride, src->tiling);
 	dst_pitch = fast_copy_pitch(dst->stride, src->tiling);
diff --git a/lib/intel_mmio.c b/lib/intel_mmio.c
index a5458aeb..76e3ee2f 100644
--- a/lib/intel_mmio.c
+++ b/lib/intel_mmio.c
@@ -250,7 +250,7 @@  intel_register_read(uint32_t reg)
 	igt_assert(mmio_data.inited);
 
 	if (intel_gen(mmio_data.i915_devid) >= 6)
-		igt_assert(mmio_data.key != -1);
+		igt_assert_neq(mmio_data.key, -1);
 
 	if (!mmio_data.safe)
 		goto read_out;
@@ -290,7 +290,7 @@  intel_register_write(uint32_t reg, uint32_t val)
 	igt_assert(mmio_data.inited);
 
 	if (intel_gen(mmio_data.i915_devid) >= 6)
-		igt_assert(mmio_data.key != -1);
+		igt_assert_neq(mmio_data.key, -1);
 
 	if (!mmio_data.safe)
 		goto write_out;
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 280fdd62..53d5a510 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -111,7 +111,7 @@  gem_handle_to_libdrm_bo(drm_intel_bufmgr *bufmgr, int fd, const char *name, uint
 	memset(&flink, 0, sizeof(handle));
 	flink.handle = handle;
 	ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 	errno = 0;
 
 	bo = drm_intel_bo_gem_create_from_name(bufmgr, name, flink.name);
@@ -196,7 +196,7 @@  int __gem_set_tiling(int fd, uint32_t handle, uint32_t tiling, uint32_t stride)
  */
 void gem_set_tiling(int fd, uint32_t handle, uint32_t tiling, uint32_t stride)
 {
-	igt_assert(__gem_set_tiling(fd, handle, tiling, stride) == 0);
+	igt_assert_eq(__gem_set_tiling(fd, handle, tiling, stride), 0);
 }
 
 int __gem_set_caching(int fd, uint32_t handle, uint32_t caching)
@@ -249,7 +249,7 @@  uint32_t gem_get_caching(int fd, uint32_t handle)
 	memset(&arg, 0, sizeof(arg));
 	arg.handle = handle;
 	ret = ioctl(fd, DRM_IOCTL_I915_GEM_GET_CACHING, &arg);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 	errno = 0;
 
 	return arg.caching;
@@ -272,7 +272,7 @@  uint32_t gem_open(int fd, uint32_t name)
 	memset(&open_struct, 0, sizeof(open_struct));
 	open_struct.name = name;
 	ret = ioctl(fd, DRM_IOCTL_GEM_OPEN, &open_struct);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 	igt_assert(open_struct.handle != 0);
 	errno = 0;
 
@@ -298,7 +298,7 @@  uint32_t gem_flink(int fd, uint32_t handle)
 	memset(&flink, 0, sizeof(flink));
 	flink.handle = handle;
 	ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 	errno = 0;
 
 	return flink.name;
diff --git a/lib/rendercopy_gen6.c b/lib/rendercopy_gen6.c
index 83c7d694..e4f84628 100644
--- a/lib/rendercopy_gen6.c
+++ b/lib/rendercopy_gen6.c
@@ -68,7 +68,7 @@  gen6_render_flush(struct intel_batchbuffer *batch,
 	if (ret == 0)
 		ret = drm_intel_gem_bo_context_exec(batch->bo, context,
 						    batch_end, 0);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 }
 
 static uint32_t
@@ -109,7 +109,7 @@  gen6_bind_buf(struct intel_batchbuffer *batch, const struct igt_buf *buf,
 				      intel_batchbuffer_subdata_offset(batch, &ss->ss1),
 				      buf->bo, 0,
 				      read_domain, write_domain);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	ss->ss2.height = igt_buf_height(buf) - 1;
 	ss->ss2.width  = igt_buf_width(buf) - 1;
@@ -531,7 +531,7 @@  void gen6_render_copyfunc(struct intel_batchbuffer *batch,
 	uint32_t cc_vp, cc_blend, offset;
 	uint32_t batch_end;
 
-	igt_assert(src->bpp == dst->bpp);
+	igt_assert_eq_u32(src->bpp, dst->bpp);
 	intel_batchbuffer_flush_with_context(batch, context);
 
 	batch->ptr = batch->buffer + 1024;
diff --git a/lib/rendercopy_gen7.c b/lib/rendercopy_gen7.c
index a3c8b7f3..ad9e2ff6 100644
--- a/lib/rendercopy_gen7.c
+++ b/lib/rendercopy_gen7.c
@@ -42,7 +42,7 @@  gen7_render_flush(struct intel_batchbuffer *batch,
 	if (ret == 0)
 		ret = drm_intel_gem_bo_context_exec(batch->bo, context,
 						    batch_end, 0);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 }
 
 static uint32_t
@@ -107,7 +107,7 @@  gen7_bind_buf(struct intel_batchbuffer *batch,
 				      intel_batchbuffer_subdata_offset(batch, &ss[1]),
 				      buf->bo, 0,
 				      read_domain, write_domain);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	return intel_batchbuffer_subdata_offset(batch, ss);
 }
@@ -513,7 +513,7 @@  void gen7_render_copyfunc(struct intel_batchbuffer *batch,
 	uint32_t vertex_buffer;
 	uint32_t batch_end;
 
-	igt_assert(src->bpp == dst->bpp);
+	igt_assert_eq_u32(src->bpp, dst->bpp);
 	intel_batchbuffer_flush_with_context(batch, context);
 
 	batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
diff --git a/lib/rendercopy_gen8.c b/lib/rendercopy_gen8.c
index e22d8501..027e3259 100644
--- a/lib/rendercopy_gen8.c
+++ b/lib/rendercopy_gen8.c
@@ -106,7 +106,7 @@  static void annotation_add_state(struct annotations_context *aub,
 				 uint32_t start_offset,
 				 size_t   size)
 {
-	igt_assert(aub->index < MAX_ANNOTATIONS);
+	igt_assert_lt(aub->index, MAX_ANNOTATIONS);
 
 	add_annotation(&aub->annotations[aub->index++],
 		       AUB_TRACE_TYPE_NOTYPE, 0,
@@ -138,7 +138,7 @@  gen6_render_flush(struct intel_batchbuffer *batch,
 	if (ret == 0)
 		ret = drm_intel_gem_bo_context_exec(batch->bo, context,
 						    batch_end, 0);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 }
 
 /* Mostly copy+paste from gen6, except height, width, pitch moved */
@@ -195,7 +195,7 @@  gen8_bind_buf(struct intel_batchbuffer *batch,
 				      intel_batchbuffer_subdata_offset(batch, &ss->ss8),
 				      buf->bo, 0,
 				      read_domain, write_domain);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	ss->ss2.height = igt_buf_height(buf) - 1;
 	ss->ss2.width  = igt_buf_width(buf) - 1;
@@ -910,7 +910,7 @@  void gen8_render_copyfunc(struct intel_batchbuffer *batch,
 	uint32_t vertex_buffer;
 	uint32_t batch_end;
 
-	igt_assert(src->bpp == dst->bpp);
+	igt_assert_eq_u32(src->bpp, dst->bpp);
 	intel_batchbuffer_flush_with_context(batch, context);
 
 	intel_batchbuffer_align(batch, 8);
diff --git a/lib/rendercopy_gen9.c b/lib/rendercopy_gen9.c
index 259a3ca2..d44e8122 100644
--- a/lib/rendercopy_gen9.c
+++ b/lib/rendercopy_gen9.c
@@ -968,7 +968,7 @@  void _gen9_render_copyfunc(struct intel_batchbuffer *batch,
 	uint32_t vertex_buffer;
 	uint32_t batch_end;
 
-	igt_assert(src->bpp == dst->bpp);
+	igt_assert_eq_u32(src->bpp, dst->bpp);
 	intel_batchbuffer_flush_with_context(batch, context);
 
 	intel_batchbuffer_align(batch, 8);
diff --git a/lib/rendercopy_i830.c b/lib/rendercopy_i830.c
index e8c04718..74ab7dba 100644
--- a/lib/rendercopy_i830.c
+++ b/lib/rendercopy_i830.c
@@ -237,7 +237,7 @@  void gen2_render_copyfunc(struct intel_batchbuffer *batch,
 			  unsigned width, unsigned height,
 			  const struct igt_buf *dst, unsigned dst_x, unsigned dst_y)
 {
-	igt_assert(src->bpp == dst->bpp);
+	igt_assert_eq_u32(src->bpp, dst->bpp);
 
 	gen2_emit_invariant(batch);
 	gen2_emit_copy_pipeline(batch);
diff --git a/lib/rendercopy_i915.c b/lib/rendercopy_i915.c
index 1baa7a1b..e1c5b0ab 100644
--- a/lib/rendercopy_i915.c
+++ b/lib/rendercopy_i915.c
@@ -25,7 +25,7 @@  void gen3_render_copyfunc(struct intel_batchbuffer *batch,
 			  unsigned width, unsigned height,
 			  const struct igt_buf *dst, unsigned dst_x, unsigned dst_y)
 {
-	igt_assert(src->bpp == dst->bpp);
+	igt_assert_eq_u32(src->bpp, dst->bpp);
 
 	/* invariant state */
 	{
diff --git a/lib/tests/igt_stats.c b/lib/tests/igt_stats.c
index f42fbf86..b8ea7db7 100644
--- a/lib/tests/igt_stats.c
+++ b/lib/tests/igt_stats.c
@@ -135,7 +135,7 @@  static void test_invalidate_sorted(void)
 	median2 = igt_stats_get_median(&stats);
 
 	igt_assert_eq_double(median2, 40);
-	igt_assert(median1 != median2);
+	igt_assert_neq_double(median1, median2);
 }
 
 static void test_mean(void)
@@ -166,7 +166,7 @@  static void test_invalidate_mean(void)
 	igt_stats_push(&stats, 100);
 
 	mean2 = igt_stats_get_mean(&stats);
-	igt_assert(mean1 != mean2);
+	igt_assert_neq_double(mean1, mean2);
 
 	igt_stats_fini(&stats);
 }
diff --git a/tests/amdgpu/amd_abm.c b/tests/amdgpu/amd_abm.c
index 74156462..b8077be4 100644
--- a/tests/amdgpu/amd_abm.c
+++ b/tests/amdgpu/amd_abm.c
@@ -201,7 +201,7 @@  static void backlight_monotonic_basic(data_t *data)
 		backlight_write_brightness(brightness);
 		usleep(100000);
 		pwm = read_target_backlight_pwm(data->debugfs);
-		igt_assert(pwm < prev_pwm);
+		igt_assert_lt(pwm, prev_pwm);
 		prev_pwm = pwm;
 	}
 
@@ -230,7 +230,7 @@  static void backlight_monotonic_abm(data_t *data)
 			backlight_write_brightness(brightness);
 			usleep(100000);
 			pwm = read_target_backlight_pwm(data->debugfs);
-			igt_assert(pwm < prev_pwm);
+			igt_assert_lt(pwm, prev_pwm);
 			prev_pwm = pwm;
 		}
 	}
@@ -255,8 +255,8 @@  static void abm_enabled(data_t *data)
 		set_abm_level(data, i);
 		usleep(100000);
 		pwm = read_target_backlight_pwm(data->debugfs);
-		igt_assert(pwm <= prev_pwm);
-		igt_assert(pwm < pwm_without_abm);
+		igt_assert_lte(pwm, prev_pwm);
+		igt_assert_lt(pwm, pwm_without_abm);
 		prev_pwm = pwm;
 	}
 
@@ -285,7 +285,7 @@  static void abm_gradual(data_t *data)
 	for (i = 0; i < 10; i++) {
 		usleep(100000);
 		pwm = read_current_backlight_pwm(data->debugfs);
-		igt_assert(pwm < prev_pwm);
+		igt_assert_lt(pwm, prev_pwm);
 		prev_pwm = pwm;
 	}
 
diff --git a/tests/amdgpu/amd_basic.c b/tests/amdgpu/amd_basic.c
index d3c060e3..fa2b3e99 100644
--- a/tests/amdgpu/amd_basic.c
+++ b/tests/amdgpu/amd_basic.c
@@ -793,7 +793,7 @@  static void amdgpu_test_exec_cs_helper(amdgpu_context_handle context_handle,
 	amdgpu_va_handle va_handle;
 
 	/* prepare CS */
-	igt_assert(pm4_dw <= 1024);
+	igt_assert_lte(pm4_dw, 1024);
 
 	/* allocate IB */
 	r = amdgpu_bo_alloc_and_map(device, 4096, 4096,
diff --git a/tests/i915/gem_concurrent_all.c b/tests/i915/gem_concurrent_all.c
index 3ddaab82..89fe616c 100644
--- a/tests/i915/gem_concurrent_all.c
+++ b/tests/i915/gem_concurrent_all.c
@@ -806,7 +806,7 @@  static void buffers_create(struct buffers *b)
 	igt_assert(b->bufmgr);
 
 	buffers_destroy(b);
-	igt_assert(b->count == 0);
+	igt_assert_eq(b->count, 0);
 	b->count = count;
 
 	for (int i = 0; i < count; i++) {
diff --git a/tests/i915/gem_cpu_reloc.c b/tests/i915/gem_cpu_reloc.c
index 47099862..a23cb11d 100644
--- a/tests/i915/gem_cpu_reloc.c
+++ b/tests/i915/gem_cpu_reloc.c
@@ -89,7 +89,7 @@  gen8_emit_store_addr(uint32_t *cs, struct drm_i915_gem_relocation_entry *addr)
 {
 	*cs++ = (MI_STORE_DWORD_IMM | 1 << 21) + 1;
 	addr->offset += sizeof(*cs);
-	igt_assert((addr->delta & 7) == 0);
+	igt_assert_eq(addr->delta & 7, 0);
 	cs += 2; /* addr */
 	cs += 2; /* value: implicit 0xffffffffffffffff */
 	return cs;
diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c
index 43cbf45f..1afc41f8 100644
--- a/tests/i915/gem_create.c
+++ b/tests/i915/gem_create.c
@@ -86,12 +86,12 @@  static void invalid_flag_test(int fd)
 	create_v2.flags = ~I915_CREATE_PLACEMENT_STOLEN;
 	ret = drmIoctl(fd, LOCAL_IOCTL_I915_GEM_CREATE, &create_v2);
 
-	igt_assert(ret <= 0);
+	igt_assert_lte(ret, 0);
 
 	create_v2.flags = ~0;
 	ret = drmIoctl(fd, LOCAL_IOCTL_I915_GEM_CREATE, &create_v2);
 
-	igt_assert(ret <= 0);
+	igt_assert_lte(ret, 0);
 }
 
 static int create_ioctl(int fd, struct drm_i915_gem_create *create)
diff --git a/tests/i915/gem_exec_capture.c b/tests/i915/gem_exec_capture.c
index 4457496d..97f6eea5 100644
--- a/tests/i915/gem_exec_capture.c
+++ b/tests/i915/gem_exec_capture.c
@@ -317,7 +317,7 @@  static struct offset {
 	gem_close(fd, obj[0].handle);
 
 	qsort(offsets, count, sizeof(*offsets), cmp);
-	igt_assert(offsets[0].addr <= offsets[count-1].addr);
+	igt_assert_lte_u64(offsets[0].addr, offsets[count - 1].addr);
 	return offsets;
 }
 
diff --git a/tests/i915/gem_exec_nop.c b/tests/i915/gem_exec_nop.c
index 8922685a..7392fb55 100644
--- a/tests/i915/gem_exec_nop.c
+++ b/tests/i915/gem_exec_nop.c
@@ -361,7 +361,7 @@  stable_nop_on_ring(int fd, uint32_t handle, unsigned int engine,
 	igt_stats_t s;
 	double n;
 
-	igt_assert(reps >= 5);
+	igt_assert_lte(5, reps);
 
 	igt_stats_init_with_size(&s, reps);
 	s.is_float = true;
diff --git a/tests/i915/gem_gtt_speed.c b/tests/i915/gem_gtt_speed.c
index dfa7216c..487e6365 100644
--- a/tests/i915/gem_gtt_speed.c
+++ b/tests/i915/gem_gtt_speed.c
@@ -59,7 +59,7 @@  static void streaming_load(void *src, int len)
 {
 	__m128i tmp, *s = src;
 
-	igt_assert((len & 15) == 0);
+	igt_assert_eq(len & 15, 0);
 	igt_assert((((uintptr_t)src) & 15) == 0);
 
 	while (len >= 16) {
diff --git a/tests/i915/gem_reg_read.c b/tests/i915/gem_reg_read.c
index 79facc1f..f0de8496 100644
--- a/tests/i915/gem_reg_read.c
+++ b/tests/i915/gem_reg_read.c
@@ -120,7 +120,7 @@  static void test_timestamp_moving(int fd)
 	igt_fail_on(timer_query(fd, &first_val) != 0);
 	sleep(1);
 	igt_fail_on(timer_query(fd, &second_val) != 0);
-	igt_assert(second_val != first_val);
+	igt_assert_neq_u64(second_val, first_val);
 }
 
 static void test_timestamp_monotonic(int fd)
@@ -140,7 +140,7 @@  retry:
 			first_val = second_val;
 			goto retry;
 		}
-		igt_assert(second_val >= first_val);
+		igt_assert_lte_u64(first_val, second_val);
 	} while(difftime(time(NULL), start) < 5);
 
 }
diff --git a/tests/i915/gem_reset_stats.c b/tests/i915/gem_reset_stats.c
index ac9af23f..11ad9dbd 100644
--- a/tests/i915/gem_reset_stats.c
+++ b/tests/i915/gem_reset_stats.c
@@ -647,7 +647,7 @@  static void _check_param_ctx(const int fd, const int ctx, const cap_t cap)
 		igt_assert_eq(_test_params(fd, ctx, 0, 0), 0);
 
 		if (cap != root) {
-			igt_assert(get_reset_count(fd, ctx) == 0);
+			igt_assert_eq(get_reset_count(fd, ctx), 0);
 		}
 	}
 
diff --git a/tests/i915/gem_stolen.c b/tests/i915/gem_stolen.c
index e2c52723..0a466731 100644
--- a/tests/i915/gem_stolen.c
+++ b/tests/i915/gem_stolen.c
@@ -257,7 +257,7 @@  static void stolen_fill_purge_test(int fd)
 		i++;
 	} while (handle[i-1] && i < MAX_OBJECTS);
 
-	igt_assert(obj_count > 0);
+	igt_assert_lt(0, obj_count);
 
 	/* Mark all stolen objects purgeable */
 	for (i = 0; i < obj_count; i++)
@@ -343,7 +343,7 @@  static void stolen_hibernate(int fd)
 	 * is good enough to verify the content preservation across
 	 * hibernation.
 	 */
-	igt_assert(obj_count > 0);
+	igt_assert_lt(0, obj_count);
 
 	/* Copy data to all stolen backed objects */
 	for (i = 0; i < obj_count; i++) {
diff --git a/tests/i915/i915_module_load.c b/tests/i915/i915_module_load.c
index 7fe83520..fb5672f9 100644
--- a/tests/i915/i915_module_load.c
+++ b/tests/i915/i915_module_load.c
@@ -234,7 +234,7 @@  inject_fault(const char *module_name, const char *opt, int fault)
 	char buf[1024];
 	int dir;
 
-	igt_assert(fault > 0);
+	igt_assert_lt(0, fault);
 	snprintf(buf, sizeof(buf), "%s=%d", opt, fault);
 
 	if (igt_kmod_load(module_name, buf)) {
diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c
index f9f67ed3..64345799 100644
--- a/tests/i915/i915_pm_rpm.c
+++ b/tests/i915/i915_pm_rpm.c
@@ -1824,7 +1824,7 @@  static void pm_test_tiling(void)
 			gem_set_tiling(drm_fd, handles[j],
 					tiling_modes[i], stride);
 			gem_get_tiling(drm_fd, handles[j], &ti, &sw);
-			igt_assert(tiling_modes[i] == ti);
+			igt_assert_eq_u32(tiling_modes[i], ti);
 		}
 
 		enable_one_screen_and_wait(&ms_data);
diff --git a/tests/i915/i915_query.c b/tests/i915/i915_query.c
index ecbec3ae..671bafc7 100644
--- a/tests/i915/i915_query.c
+++ b/tests/i915/i915_query.c
@@ -412,7 +412,7 @@  test_query_topology_matches_eu_total(int fd)
 
 	free(topo_info);
 
-	igt_assert(n_eus_topology == n_eus);
+	igt_assert_eq(n_eus_topology, n_eus);
 }
 
 /*
diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 1540daa2..04dcdbe8 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -404,7 +404,7 @@  static int fd_completed(int fd)
 	int ret;
 
 	ret = poll(&pfd, 1, 0);
-	igt_assert(ret >= 0);
+	igt_assert_lte(0, ret);
 	return ret;
 }
 
diff --git a/tests/kms_available_modes_crc.c b/tests/kms_available_modes_crc.c
index 07772767..f811da9a 100644
--- a/tests/kms_available_modes_crc.c
+++ b/tests/kms_available_modes_crc.c
@@ -433,7 +433,7 @@  test_available_modes(data_t* data)
 		igt_output_set_pipe(output, PIPE_NONE);
 		igt_display_commit2(&data->display, data->commit);
 	}
-	igt_assert(invalids == 0);
+	igt_assert_eq(invalids, 0);
 }
 
 
diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index 3beea0c6..9b0f7a04 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -571,7 +571,7 @@  static int chamelium_get_pattern_fb(data_t *data, size_t width, size_t height,
 
 	fb_id = igt_create_fb(data->drm_fd, width, height, fourcc,
 			      LOCAL_DRM_FORMAT_MOD_NONE, fb);
-	igt_assert(fb_id > 0);
+	igt_assert_lt(0, fb_id);
 
 	ptr = igt_fb_map_buffer(fb->fd, fb);
 	igt_assert(ptr);
@@ -595,11 +595,11 @@  static void do_test_display(data_t *data, struct chamelium_port *port,
 
 	fb_id = chamelium_get_pattern_fb(data, mode->hdisplay, mode->vdisplay,
 					 DRM_FORMAT_XRGB8888, 64, &fb);
-	igt_assert(fb_id > 0);
+	igt_assert_lt(0, fb_id);
 
 	frame_id = igt_fb_convert(&frame_fb, &fb, fourcc,
 				  LOCAL_DRM_FORMAT_MOD_NONE);
-	igt_assert(frame_id > 0);
+	igt_assert_lt(0, frame_id);
 
 	if (check == CHAMELIUM_CHECK_CRC)
 		fb_crc = chamelium_calculate_fb_crc_async_start(data->drm_fd,
@@ -619,7 +619,7 @@  static void do_test_display(data_t *data, struct chamelium_port *port,
 		crc = chamelium_read_captured_crcs(data->chamelium,
 						   &captured_frame_count);
 
-		igt_assert(captured_frame_count == count);
+		igt_assert_eq(captured_frame_count, count);
 
 		igt_debug("Captured %d frames\n", captured_frame_count);
 
@@ -636,7 +636,7 @@  static void do_test_display(data_t *data, struct chamelium_port *port,
 		   check == CHAMELIUM_CHECK_CHECKERBOARD) {
 		struct chamelium_frame_dump *dump;
 
-		igt_assert(count == 1);
+		igt_assert_eq(count, 1);
 
 		dump = chamelium_port_dump_pixels(data->chamelium, port, 0, 0,
 						  0, 0);
@@ -743,7 +743,7 @@  test_display_frame_dump(data_t *data, struct chamelium_port *port)
 						    DRM_FORMAT_XRGB8888,
 						    LOCAL_DRM_FORMAT_MOD_NONE,
 						    0, 0, 0, &fb);
-		igt_assert(fb_id > 0);
+		igt_assert_lt(0, fb_id);
 
 		enable_output(data, port, output, mode, &fb);
 
@@ -908,7 +908,7 @@  static void audio_state_start(struct audio_state *state, const char *name)
 	state->run = true;
 	ret = pthread_create(&state->thread, NULL,
 			     run_audio_thread, state->alsa);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	/* The Chamelium device only supports this PCM format. */
 	state->capture.format = SND_PCM_FORMAT_S32_LE;
@@ -985,7 +985,7 @@  static void audio_state_stop(struct audio_state *state, bool success)
 	igt_debug("Stopping audio playback\n");
 	state->run = false;
 	ret = pthread_join(state->thread, NULL);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	ok = chamelium_stream_stop_realtime_audio(state->stream);
 	igt_assert(ok);
@@ -1075,7 +1075,7 @@  static bool test_audio_frequencies(struct audio_state *state)
 
 	audio_state_start(state, "frequencies");
 
-	igt_assert(state->capture.rate == state->playback.rate);
+	igt_assert_eq(state->capture.rate, state->playback.rate);
 
 	/* Needs to be a multiple of 128, because that's the number of samples
 	 * we get per channel each time we receive an audio page from the
@@ -1113,7 +1113,7 @@  static bool test_audio_frequencies(struct audio_state *state)
 
 		for (j = 0; j < state->playback.channels; j++) {
 			capture_chan = state->channel_mapping[j];
-			igt_assert(capture_chan >= 0);
+			igt_assert_lte(0, capture_chan);
 			igt_debug("Processing channel %zu (captured as "
 				  "channel %d)\n", j, capture_chan);
 
@@ -1239,7 +1239,7 @@  static bool test_audio_flatline(struct audio_state *state)
 
 		for (i = 0; i < state->playback.channels; i++) {
 			capture_chan = state->channel_mapping[i];
-			igt_assert(capture_chan >= 0);
+			igt_assert_lte(0, capture_chan);
 			igt_debug("Processing channel %zu (captured as "
 				  "channel %d)\n", i, capture_chan);
 
@@ -1382,7 +1382,7 @@  test_display_audio(data_t *data, struct chamelium_port *port,
 					    DRM_FORMAT_XRGB8888,
 					    LOCAL_DRM_FORMAT_MOD_NONE,
 					    0, 0, 0, &fb);
-	igt_assert(fb_id > 0);
+	igt_assert_lt(0, fb_id);
 
 	enable_output(data, port, output, mode, &fb);
 
@@ -1391,7 +1391,7 @@  test_display_audio(data_t *data, struct chamelium_port *port,
 	for (i = 0; i < test_sampling_rates_count; i++) {
 		for (j = 0; j < test_formats_count; j++) {
 			ret = alsa_open_output(alsa, audio_device);
-			igt_assert(ret >= 0);
+			igt_assert_lte(0, ret);
 
 			/* TODO: playback on all 8 available channels (this
 			 * isn't supported by Chamelium devices yet, see
@@ -1756,7 +1756,7 @@  static void prepare_randomized_plane(data_t *data,
 	/* Get a pattern framebuffer for the overlay plane. */
 	fb_id = chamelium_get_pattern_fb(data, overlay_fb_w, overlay_fb_h,
 					 DRM_FORMAT_XRGB8888, 32, &pattern_fb);
-	igt_assert(fb_id > 0);
+	igt_assert_lt(0, fb_id);
 
 	randomize_plane_stride(data, overlay_fb_w, overlay_fb_h,
 			       format, modifier, &stride);
@@ -1765,7 +1765,7 @@  static void prepare_randomized_plane(data_t *data,
 
 	fb_id = igt_fb_convert_with_stride(overlay_fb, &pattern_fb, format,
 					   modifier, stride);
-	igt_assert(fb_id > 0);
+	igt_assert_lt(0, fb_id);
 
 	randomize_plane_coordinates(data, plane, mode, overlay_fb,
 				    &overlay_src_w, &overlay_src_h,
@@ -1896,7 +1896,7 @@  static void test_display_planes_random(data_t *data,
 		crc = chamelium_read_captured_crcs(data->chamelium,
 						   &captured_frame_count);
 
-		igt_assert(captured_frame_count == 1);
+		igt_assert_eq(captured_frame_count, 1);
 
 		expected_crc = chamelium_calculate_fb_crc_async_finish(fb_crc);
 
diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index f41f68d8..f2b54f7d 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -696,7 +696,7 @@  static void flip_vs_cursor(igt_display_t *display, enum flip_test mode, int nloo
 		igt_assert(shared != MAP_FAILED);
 
 		cpu = sched_getcpu();
-		igt_assert(cpu >= 0);
+		igt_assert_lte(0, cpu);
 
 		CPU_ZERO(&mask);
 		CPU_SET(cpu, &mask);
diff --git a/tests/kms_hdmi_inject.c b/tests/kms_hdmi_inject.c
index 8c0d1333..29bc2988 100644
--- a/tests/kms_hdmi_inject.c
+++ b/tests/kms_hdmi_inject.c
@@ -129,7 +129,7 @@  hdmi_inject_4k(int drm_fd, drmModeConnector *connector)
 			     &connector->connector_id, 1,
 			     &connector->modes[i]);
 
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	igt_remove_fb(drm_fd, &fb);
 
@@ -177,7 +177,7 @@  hdmi_inject_audio(int drm_fd, drmModeConnector *connector)
 			     &connector->modes[0]);
 
 
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	/*
 	 * Test if we have /proc/asound/HDMI/eld#0.0 and is its contents are
diff --git a/tests/kms_lease.c b/tests/kms_lease.c
index 927c2315..b389b952 100644
--- a/tests/kms_lease.c
+++ b/tests/kms_lease.c
@@ -528,7 +528,7 @@  static void atomic_implicit_crtc(data_t *data)
 	igt_assert(req);
 	ret = drmModeAtomicAddProperty(req, data->plane_id,
 				       crtc_id_prop, data->crtc_id);
-	igt_assert(ret >= 0);
+	igt_assert_lte(0, ret);
 
 	/* sanity check */
 	ret = drmModeAtomicCommit(data->master.fd, req, DRM_MODE_ATOMIC_TEST_ONLY, NULL);
@@ -543,7 +543,7 @@  static void atomic_implicit_crtc(data_t *data)
 	igt_assert(req);
 	ret = drmModeAtomicAddProperty(req, data->connector_id,
 				       crtc_id_prop, data->crtc_id);
-	igt_assert(ret >= 0);
+	igt_assert_lte(0, ret);
 
 	/* sanity check */
 	ret = drmModeAtomicCommit(data->master.fd, req, DRM_MODE_ATOMIC_TEST_ONLY, NULL);
diff --git a/tests/kms_properties.c b/tests/kms_properties.c
index eb9cbdda..9cf123e3 100644
--- a/tests/kms_properties.c
+++ b/tests/kms_properties.c
@@ -98,7 +98,7 @@  static void max_bpc_prop_test(int fd, uint32_t id, uint32_t type, drmModePropert
 			igt_assert_eq(ret, 0);
 		} else {
 			ret = drmModeAtomicAddProperty(req, id, prop_id, i);
-			igt_assert(ret >= 0);
+			igt_assert_lte(0, ret);
 
 			ret = drmModeAtomicCommit(fd, req, DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
 			igt_assert_eq(ret, 0);
@@ -161,7 +161,7 @@  static void test_properties(int fd, uint32_t type, uint32_t id, bool atomic)
 			igt_assert_eq(ret, 0);
 		} else {
 			ret = drmModeAtomicAddProperty(req, id, prop_id, prop_value);
-			igt_assert(ret >= 0);
+			igt_assert_lte(0, ret);
 
 			ret = drmModeAtomicCommit(fd, req, DRM_MODE_ATOMIC_TEST_ONLY, NULL);
 			igt_assert_eq(ret, 0);
@@ -348,7 +348,7 @@  static void test_invalid_properties(int fd,
 			igt_assert(req);
 
 			ret = drmModeAtomicAddProperty(req, id1, prop_id, prop_value);
-			igt_assert(ret >= 0);
+			igt_assert_lte(0, ret);
 
 			ret = drmModeAtomicCommit(fd, req, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
 			igt_assert_eq(ret, -ENOENT);
diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 8ace587e..a338b35e 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -719,7 +719,7 @@  static void iterate_combinations(int n, int k, bool allow_repetitions,
 	int v;
 
 	if (!k) {
-		igt_assert(set->count < set->capacity);
+		igt_assert_lt(set->count, set->capacity);
 		set->items[set->count++] = *comb;
 		return;
 	}
diff --git a/tests/perf.c b/tests/perf.c
index 5ad8b2db..5891c872 100644
--- a/tests/perf.c
+++ b/tests/perf.c
@@ -236,7 +236,7 @@  __perf_open(int fd, struct drm_i915_perf_open_param *param, bool prevent_pm)
 
 	ret = igt_ioctl(fd, DRM_IOCTL_I915_PERF_OPEN, param);
 
-	igt_assert(ret >= 0);
+	igt_assert_lte(0, ret);
 	errno = 0;
 
 	if (prevent_pm) {
@@ -545,7 +545,7 @@  hsw_sanity_check_render_basic_reports(uint32_t *oa_report0, uint32_t *oa_report1
 		freq = ((uint64_t)clock_delta * 1000) / time_delta;
 		igt_debug("freq = %"PRIu64"\n", freq);
 
-		igt_assert(freq <= gt_max_freq_mhz);
+		igt_assert_lte_u64(freq, gt_max_freq_mhz);
 	}
 
 	igt_debug("clock delta = %"PRIu32"\n", clock_delta);
@@ -741,7 +741,7 @@  gen8_sanity_check_test_oa_reports(uint32_t *oa_report0, uint32_t *oa_report1,
 	freq = ((uint64_t)clock_delta * 1000) / time_delta;
 	igt_debug("freq = %"PRIu64"\n", freq);
 
-	igt_assert(freq <= gt_max_freq_mhz);
+	igt_assert_lte_u64(freq, gt_max_freq_mhz);
 
 	igt_debug("clock delta = %"PRIu32"\n", clock_delta);
 
@@ -1724,7 +1724,7 @@  test_oa_exponents(void)
 			/* igt_debug(" > read %i bytes\n", ret); */
 
 			/* We should never have no data. */
-			igt_assert(ret > 0);
+			igt_assert_lt(0, ret);
 
 			for (int offset = 0;
 			     offset < ret && n_timer_reports < ARRAY_SIZE(timer_reports);
@@ -2063,7 +2063,7 @@  test_blocking(void)
 		       errno == EINTR)
 			;
 
-		igt_assert(ret > 0);
+		igt_assert_lt(0, ret);
 
 		/* For Haswell reports don't contain a well defined reason
 		 * field we so assume all reports to be 'periodic'. For gen8+
@@ -2117,14 +2117,14 @@  test_blocking(void)
 	/* With completely broken blocking (but also not returning an error) we
 	 * could end up with an open loop,
 	 */
-	igt_assert(n <= (max_iterations + n_extra_iterations));
+	igt_assert_lte(n, (max_iterations + n_extra_iterations));
 
 	/* Make sure the driver is reporting new samples with a reasonably
 	 * low latency...
 	 */
-	igt_assert(n > (min_iterations + n_extra_iterations));
+	igt_assert_lt((min_iterations + n_extra_iterations), n);
 
-	igt_assert(kernel_ns <= (test_duration_ns / 100ull));
+	igt_assert_lte_s64(kernel_ns, (test_duration_ns / 100ull));
 
 	__perf_close(stream_fd);
 }
@@ -2304,14 +2304,14 @@  test_polling(void)
 	/* With completely broken blocking while polling (but still somehow
 	 * reporting a POLLIN event) we could end up with an open loop.
 	 */
-	igt_assert(n <= (max_iterations + n_extra_iterations));
+	igt_assert_lte(n, (max_iterations + n_extra_iterations));
 
 	/* Make sure the driver is reporting new samples with a reasonably
 	 * low latency...
 	 */
-	igt_assert(n > (min_iterations + n_extra_iterations));
+	igt_assert_lt((min_iterations + n_extra_iterations), n);
 
-	igt_assert(kernel_ns <= (test_duration_ns / 100ull));
+	igt_assert_lte_s64(kernel_ns, (test_duration_ns / 100ull));
 
 	__perf_close(stream_fd);
 }
@@ -2659,7 +2659,7 @@  test_short_reads(void)
 		ret = read(stream_fd,
 			   header,
 			   page_size);
-		igt_assert(ret > 0);
+		igt_assert_lt(0, ret);
 	} while (header->type == DRM_I915_PERF_RECORD_OA_REPORT_LOST);
 
 	igt_assert_eq(ret, record_size);
@@ -3625,7 +3625,7 @@  static int i915_perf_add_config(int fd, struct drm_i915_perf_oa_config *config)
 	int config_id = __i915_perf_add_config(fd, config);
 
 	igt_debug("config_id=%i\n", config_id);
-	igt_assert(config_id > 0);
+	igt_assert_lt(0, config_id);
 
 	return config_id;
 }
@@ -3946,7 +3946,7 @@  test_whitelisted_registers_userspace_config(void)
 
 	/* Create a new config */
 	ret = igt_ioctl(drm_fd, DRM_IOCTL_I915_PERF_ADD_CONFIG, &config);
-	igt_assert(ret > 0); /* Config 0 should be used by the kernel */
+	igt_assert_lt(0, ret); /* Config 0 should be used by the kernel */
 	config_id = ret;
 
 	i915_perf_remove_config(drm_fd, config_id);
@@ -3967,7 +3967,7 @@  read_i915_module_ref(void)
 		if (strncmp(line, "i915 ", 5) == 0) {
 			unsigned long mem;
 			int ret = sscanf(line + 5, "%lu %u", &mem, &ref_count);
-			igt_assert(ret == 2);
+			igt_assert_eq(ret, 2);
 			goto done;
 		}
 	}
diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
index 72b9166a..c861911e 100644
--- a/tests/perf_pmu.c
+++ b/tests/perf_pmu.c
@@ -423,7 +423,7 @@  static void log_busy(unsigned int num_engines, uint64_t *val)
 		int len;
 
 		len = snprintf(p, rem, "%u=%" PRIu64 "\n",  i, val[i]);
-		igt_assert(len > 0);
+		igt_assert_lt(0, len);
 		rem -= len;
 		p += len;
 	}
@@ -1015,7 +1015,7 @@  static void init_other(unsigned int i, bool valid)
 	if (valid) {
 		igt_assert(fd >= 0);
 	} else {
-		igt_assert(fd < 0);
+		igt_assert_lt(fd, 0);
 		return;
 	}
 
@@ -1031,7 +1031,7 @@  static void read_other(unsigned int i, bool valid)
 	if (valid) {
 		igt_assert(fd >= 0);
 	} else {
-		igt_assert(fd < 0);
+		igt_assert_lt(fd, 0);
 		return;
 	}
 
@@ -1089,7 +1089,7 @@  static void cpu_hotplug(int gem_fd)
 					       cpu), sizeof(name));
 			cpufd = open(name, O_WRONLY);
 			if (cpufd == -1) {
-				igt_assert(cpu > 0);
+				igt_assert_lt(0, cpu);
 				/*
 				 * Signal parent that we cycled through all
 				 * CPUs and we are done.
diff --git a/tests/syncobj_basic.c b/tests/syncobj_basic.c
index 44769d3b..b90e0d65 100644
--- a/tests/syncobj_basic.c
+++ b/tests/syncobj_basic.c
@@ -171,7 +171,7 @@  test_valid_cycle(int fd)
 	second_handle = syncobj_fd_to_handle(fd, syncobj_fd, 0);
 	close(syncobj_fd);
 
-	igt_assert(first_handle != second_handle);
+	igt_assert_neq_u32(first_handle, second_handle);
 
 	syncobj_destroy(fd, first_handle);
 	syncobj_destroy(fd, second_handle);
diff --git a/tests/vc4_dmabuf_poll.c b/tests/vc4_dmabuf_poll.c
index ac44d4cf..c9db33e4 100644
--- a/tests/vc4_dmabuf_poll.c
+++ b/tests/vc4_dmabuf_poll.c
@@ -54,7 +54,7 @@  poll_write_bo_test(int fd, int poll_flag)
 
 	/* Block for a couple of minutes waiting for rendering to complete. */
 	int poll_ret = poll(&p, 1, 120 * 1000);
-	igt_assert(poll_ret == 1);
+	igt_assert_eq(poll_ret, 1);
 
 	/* Now that we've waited for idle, a nonblocking wait for the
 	 * BO should pass.