diff mbox

[i-g-t,2/2] tests: apply igt.cocci

Message ID 1427730818-29044-2-git-send-email-thomas.wood@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Wood March 30, 2015, 3:53 p.m. UTC
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 tests/core_getclient.c             |  2 +-
 tests/core_getstats.c              |  2 +-
 tests/drm_import_export.c          |  2 --
 tests/eviction_common.c            |  7 ++++---
 tests/gem_close_race.c             |  2 +-
 tests/gem_cs_prefetch.c            |  2 +-
 tests/gem_ctx_bad_exec.c           |  8 ++++----
 tests/gem_ctx_create.c             |  4 ++--
 tests/gem_ctx_exec.c               | 12 +++++++-----
 tests/gem_exec_bad_domains.c       | 14 +++++++-------
 tests/gem_fence_thrash.c           | 38 +++++++++++++++++++++++++-------------
 tests/gem_fenced_exec_thrash.c     |  4 ++--
 tests/gem_mmap.c                   |  4 ++--
 tests/gem_readwrite.c              | 12 ++++++------
 tests/gem_threaded_access_tiled.c  |  1 -
 tests/gem_unfence_active_buffers.c |  2 +-
 tests/gem_userptr_blits.c          |  1 -
 tests/gem_workarounds.c            |  8 ++++----
 tests/kms_3d.c                     |  8 ++++----
 tests/kms_flip.c                   | 29 +++++++++++++++++------------
 tests/pm_rc6_residency.c           |  8 ++++----
 tests/pm_rps.c                     |  4 ++--
 tests/prime_nv_test.c              |  2 +-
 tests/prime_udl.c                  |  6 +++---
 24 files changed, 99 insertions(+), 83 deletions(-)

Comments

Chris Wilson March 30, 2015, 3:59 p.m. UTC | #1
On Mon, Mar 30, 2015 at 04:53:38PM +0100, Thomas Wood wrote:
> diff --git a/tests/eviction_common.c b/tests/eviction_common.c
> index 4fa5c04..9e06cbb 100644
> --- a/tests/eviction_common.c
> +++ b/tests/eviction_common.c
> @@ -200,18 +200,19 @@ static void mlocked_evictions(int fd, struct igt_eviction_test_ops *ops,
>  			ops->close(fd, bo[n]);
>  
>  out:
> -		write(result[1], &ret, sizeof(ret));
> +		igt_assert_eq(write(result[1], &ret, sizeof(ret)),
> +			      sizeof(ret));
>  	}
>  
>  	igt_waitchildren();
>  
>  	fcntl(result[0], F_SETFL, fcntl(result[0], F_GETFL) | O_NONBLOCK);
> -	read(result[0], &ret, sizeof(ret));
> +	igt_assert_eq(read(result[0], &ret, sizeof(ret)), sizeof(ret));

No. This read() may return -1 (with ret then being == -1 due to the
earlier initialisation) if the child is killed by a sigbus....

Hah, and now I realise my overcomplication, if we just get the status
back via igt_waitchildren passing the result back via a pipe is silly.
-Chris
diff mbox

Patch

diff --git a/tests/core_getclient.c b/tests/core_getclient.c
index 7598e0f..986fed1 100644
--- a/tests/core_getclient.c
+++ b/tests/core_getclient.c
@@ -47,7 +47,7 @@  igt_simple_main
 	 */
 	client.idx = 0;
 	ret = ioctl(fd, DRM_IOCTL_GET_CLIENT, &client);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	/* Look for some absurd client index and make sure it's invalid.
 	 * The DRM drivers currently always return data, so the user has
diff --git a/tests/core_getstats.c b/tests/core_getstats.c
index 52a2d20..4c33457 100644
--- a/tests/core_getstats.c
+++ b/tests/core_getstats.c
@@ -51,7 +51,7 @@  igt_simple_main
 	fd = drm_open_any();
 
 	ret = ioctl(fd, DRM_IOCTL_GET_STATS, &stats);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	close(fd);
 }
diff --git a/tests/drm_import_export.c b/tests/drm_import_export.c
index 57b13dd..8f61d55 100644
--- a/tests/drm_import_export.c
+++ b/tests/drm_import_export.c
@@ -139,14 +139,12 @@  pthread_t test_thread_id4;
 igt_main {
 	igt_fixture {
 		fd1 = drm_open_any();
-		igt_assert(fd1 >= 0);
 		bufmgr1 = drm_intel_bufmgr_gem_init(fd1, 8 *1024);
 		igt_assert(bufmgr1);
 
 		drm_intel_bufmgr_gem_enable_reuse(bufmgr1);
 
 		fd = drm_open_any();
-		igt_assert(fd >= 0);
 		bufmgr = drm_intel_bufmgr_gem_init(fd, 8 *1024);
 		igt_assert(bufmgr);
 
diff --git a/tests/eviction_common.c b/tests/eviction_common.c
index 4fa5c04..9e06cbb 100644
--- a/tests/eviction_common.c
+++ b/tests/eviction_common.c
@@ -200,18 +200,19 @@  static void mlocked_evictions(int fd, struct igt_eviction_test_ops *ops,
 			ops->close(fd, bo[n]);
 
 out:
-		write(result[1], &ret, sizeof(ret));
+		igt_assert_eq(write(result[1], &ret, sizeof(ret)),
+			      sizeof(ret));
 	}
 
 	igt_waitchildren();
 
 	fcntl(result[0], F_SETFL, fcntl(result[0], F_GETFL) | O_NONBLOCK);
-	read(result[0], &ret, sizeof(ret));
+	igt_assert_eq(read(result[0], &ret, sizeof(ret)), sizeof(ret));
 	close(result[0]);
 	close(result[1]);
 
 	errno = ret;
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 }
 
 static int swapping_evictions(int fd, struct igt_eviction_test_ops *ops,
diff --git a/tests/gem_close_race.c b/tests/gem_close_race.c
index f89b3b6..d03fdcf 100644
--- a/tests/gem_close_race.c
+++ b/tests/gem_close_race.c
@@ -232,7 +232,7 @@  igt_main
 		sprintf(device, "/dev/dri/card%d", drm_get_card());
 		fd = open(device, O_RDWR);
 
-		igt_assert(fd != -1);
+		igt_assert_neq(fd, -1);
 		devid = intel_get_drm_devid(fd);
 		has_64bit_relocations = intel_gen(devid) >= 8;
 		close(fd);
diff --git a/tests/gem_cs_prefetch.c b/tests/gem_cs_prefetch.c
index ac3da6d..a051540 100644
--- a/tests/gem_cs_prefetch.c
+++ b/tests/gem_cs_prefetch.c
@@ -109,7 +109,7 @@  igt_simple_main
 	igt_assert(sample_batch_bo);
 	ret = drm_intel_bo_subdata(sample_batch_bo, 4096-sizeof(batch_end),
 				   sizeof(batch_end), batch_end);
-	igt_assert(ret == 0);
+	igt_assert_eq(ret, 0);
 
 	/* fill the entire gart with batches and run them */
 	for (i = 0; i < count; i++) {
diff --git a/tests/gem_ctx_bad_exec.c b/tests/gem_ctx_bad_exec.c
index 36afd7d..89d26c1 100644
--- a/tests/gem_ctx_bad_exec.c
+++ b/tests/gem_ctx_bad_exec.c
@@ -102,15 +102,15 @@  igt_main
 	}
 
 	igt_subtest("render")
-		igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
+		igt_assert_eq(exec(fd, handle, I915_EXEC_RENDER, ctx_id), 0);
 	igt_subtest("bsd")
-		igt_assert(exec(fd, handle, I915_EXEC_BSD, ctx_id) != 0);
+		igt_assert_neq(exec(fd, handle, I915_EXEC_BSD, ctx_id), 0);
 	igt_subtest("blt")
-		igt_assert(exec(fd, handle, I915_EXEC_BLT, ctx_id) != 0);
+		igt_assert_neq(exec(fd, handle, I915_EXEC_BLT, ctx_id), 0);
 #ifdef I915_EXEC_VEBOX
 	igt_fixture
 		igt_require(gem_has_vebox(fd));
 	igt_subtest("vebox")
-		igt_assert(exec(fd, handle, I915_EXEC_VEBOX, ctx_id) != 0);
+		igt_assert_neq(exec(fd, handle, I915_EXEC_VEBOX, ctx_id), 0);
 #endif
 }
diff --git a/tests/gem_ctx_create.c b/tests/gem_ctx_create.c
index 046c974..b1e8acb 100644
--- a/tests/gem_ctx_create.c
+++ b/tests/gem_ctx_create.c
@@ -47,7 +47,7 @@  igt_main
 
 		ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE, &create);
 		igt_skip_on(ret != 0 && (errno == ENODEV || errno == EINVAL));
-		igt_assert(ret == 0);
+		igt_assert_eq(ret, 0);
 		igt_assert(create.ctx_id != 0);
 	}
 
@@ -57,7 +57,7 @@  igt_main
 
 		ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE, &create);
 		igt_skip_on(ret != 0 && (errno == ENODEV || errno == EINVAL));
-		igt_assert(ret == 0);
+		igt_assert_eq(ret, 0);
 		igt_assert(create.ctx_id != 0);
 
 		create.pad = 1;
diff --git a/tests/gem_ctx_exec.c b/tests/gem_ctx_exec.c
index 43b38a2..9c45647 100644
--- a/tests/gem_ctx_exec.c
+++ b/tests/gem_ctx_exec.c
@@ -175,16 +175,16 @@  igt_main
 
 	igt_subtest("basic") {
 		ctx_id = gem_context_create(fd);
-		igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
+		igt_assert_eq(exec(fd, handle, I915_EXEC_RENDER, ctx_id), 0);
 		gem_sync(fd, handle);
 		gem_context_destroy(fd, ctx_id);
 
 		ctx_id = gem_context_create(fd);
-		igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
+		igt_assert_eq(exec(fd, handle, I915_EXEC_RENDER, ctx_id), 0);
 		gem_sync(fd, handle);
 		gem_context_destroy(fd, ctx_id);
 
-		igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) < 0);
+		igt_assert_lt(exec(fd, handle, I915_EXEC_RENDER, ctx_id), 0);
 		gem_sync(fd, handle);
 	}
 
@@ -208,8 +208,10 @@  igt_main
 		 */
 		for (i = 0; i < 20; i++) {
 			igt_set_stop_rings(STOP_RING_DEFAULTS);
-			igt_assert(exec(fd, handle, I915_EXEC_RENDER, 0) == 0);
-			igt_assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
+			igt_assert_eq(exec(fd, handle, I915_EXEC_RENDER, 0),
+				      0);
+			igt_assert_eq(exec(fd, handle, I915_EXEC_RENDER, ctx_id),
+				      0);
 			gem_sync(fd, handle);
 		}
 
diff --git a/tests/gem_exec_bad_domains.c b/tests/gem_exec_bad_domains.c
index 69e9189..0d5c9c8 100644
--- a/tests/gem_exec_bad_domains.c
+++ b/tests/gem_exec_bad_domains.c
@@ -170,13 +170,13 @@  igt_main
 		OUT_BATCH(0);
 		OUT_RELOC(tmp, I915_GEM_DOMAIN_CPU, 0, 0);
 		ADVANCE_BATCH();
-		igt_assert(run_batch() == -EINVAL);
+		igt_assert_eq(run_batch(), -EINVAL);
 
 		BEGIN_BATCH(2, 1);
 		OUT_BATCH(0);
 		OUT_RELOC(tmp, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU, 0);
 		ADVANCE_BATCH();
-		igt_assert(run_batch() == -EINVAL);
+		igt_assert_eq(run_batch(), -EINVAL);
 	}
 
 	igt_subtest("gtt-domain") {
@@ -184,13 +184,13 @@  igt_main
 		OUT_BATCH(0);
 		OUT_RELOC(tmp, I915_GEM_DOMAIN_GTT, 0, 0);
 		ADVANCE_BATCH();
-		igt_assert(run_batch() == -EINVAL);
+		igt_assert_eq(run_batch(), -EINVAL);
 
 		BEGIN_BATCH(2, 1);
 		OUT_BATCH(0);
 		OUT_RELOC(tmp, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT, 0);
 		ADVANCE_BATCH();
-		igt_assert(run_batch() == -EINVAL);
+		igt_assert_eq(run_batch(), -EINVAL);
 	}
 
 	/* Note: Older kernels disallow this. Punt on the skip check though
@@ -204,7 +204,7 @@  igt_main
 		OUT_RELOC(tmp, I915_GEM_DOMAIN_INSTRUCTION,
 			  I915_GEM_DOMAIN_INSTRUCTION, 0);
 		ADVANCE_BATCH();
-		igt_assert(run_batch() == 0);
+		igt_assert_eq(run_batch(), 0);
 	}
 
 	igt_subtest("double-write-domain")
@@ -216,14 +216,14 @@  igt_main
 		OUT_RELOC(tmp, ~(I915_GEM_GPU_DOMAINS | I915_GEM_DOMAIN_GTT | I915_GEM_DOMAIN_CPU),
 			  0, 0);
 		ADVANCE_BATCH();
-		igt_assert(run_batch() == -EINVAL);
+		igt_assert_eq(run_batch(), -EINVAL);
 
 		BEGIN_BATCH(2, 1);
 		OUT_BATCH(0);
 		OUT_RELOC(tmp, I915_GEM_DOMAIN_GTT << 1,
 			  I915_GEM_DOMAIN_GTT << 1, 0);
 		ADVANCE_BATCH();
-		igt_assert(run_batch() == -EINVAL);
+		igt_assert_eq(run_batch(), -EINVAL);
 	}
 
 	igt_fixture {
diff --git a/tests/gem_fence_thrash.c b/tests/gem_fence_thrash.c
index 6447e13..df66b8a 100644
--- a/tests/gem_fence_thrash.c
+++ b/tests/gem_fence_thrash.c
@@ -203,31 +203,43 @@  igt_main
 	igt_skip_on_simulation();
 
 	igt_subtest("bo-write-verify-none")
-		igt_assert(run_test(0, bo_write_verify, I915_TILING_NONE, 80) == 0);
+		igt_assert_eq(run_test(0, bo_write_verify, I915_TILING_NONE, 80),
+		              0);
 
 	igt_subtest("bo-write-verify-x")
-		igt_assert(run_test(0, bo_write_verify, I915_TILING_X, 80) == 0);
+		igt_assert_eq(run_test(0, bo_write_verify, I915_TILING_X, 80),
+		              0);
 
 	igt_subtest("bo-write-verify-y")
-		igt_assert(run_test(0, bo_write_verify, I915_TILING_Y, 80) == 0);
+		igt_assert_eq(run_test(0, bo_write_verify, I915_TILING_Y, 80),
+		              0);
 
 	igt_subtest("bo-write-verify-threaded-none")
-		igt_assert(run_test(5, bo_write_verify, I915_TILING_NONE, 2) == 0);
+		igt_assert_eq(run_test(5, bo_write_verify, I915_TILING_NONE, 2),
+		              0);
 
 	igt_subtest("bo-write-verify-threaded-x") {
-		igt_assert(run_test(2, bo_write_verify, I915_TILING_X, 2) == 0);
-		igt_assert(run_test(5, bo_write_verify, I915_TILING_X, 2) == 0);
-		igt_assert(run_test(10, bo_write_verify, I915_TILING_X, 2) == 0);
-		igt_assert(run_test(20, bo_write_verify, I915_TILING_X, 2) == 0);
+		igt_assert_eq(run_test(2, bo_write_verify, I915_TILING_X, 2),
+		              0);
+		igt_assert_eq(run_test(5, bo_write_verify, I915_TILING_X, 2),
+		              0);
+		igt_assert_eq(run_test(10, bo_write_verify, I915_TILING_X, 2),
+		              0);
+		igt_assert_eq(run_test(20, bo_write_verify, I915_TILING_X, 2),
+		              0);
 	}
 
 	igt_subtest("bo-write-verify-threaded-y") {
-		igt_assert(run_test(2, bo_write_verify, I915_TILING_Y, 2) == 0);
-		igt_assert(run_test(5, bo_write_verify, I915_TILING_Y, 2) == 0);
-		igt_assert(run_test(10, bo_write_verify, I915_TILING_Y, 2) == 0);
-		igt_assert(run_test(20, bo_write_verify, I915_TILING_Y, 2) == 0);
+		igt_assert_eq(run_test(2, bo_write_verify, I915_TILING_Y, 2),
+		              0);
+		igt_assert_eq(run_test(5, bo_write_verify, I915_TILING_Y, 2),
+		              0);
+		igt_assert_eq(run_test(10, bo_write_verify, I915_TILING_Y, 2),
+		              0);
+		igt_assert_eq(run_test(20, bo_write_verify, I915_TILING_Y, 2),
+		              0);
 	}
 
 	igt_subtest("bo-copy")
-		igt_assert(run_test(1, bo_copy, I915_TILING_X, 1) == 0);
+		igt_assert_eq(run_test(1, bo_copy, I915_TILING_X, 1), 0);
 }
diff --git a/tests/gem_fenced_exec_thrash.c b/tests/gem_fenced_exec_thrash.c
index 75f251c..8607160 100644
--- a/tests/gem_fenced_exec_thrash.c
+++ b/tests/gem_fenced_exec_thrash.c
@@ -227,10 +227,10 @@  igt_main
 	igt_fixture {
 		fd = drm_open_any();
 		num_fences = gem_available_fences(fd);
-		igt_assert(num_fences > 4);
+		igt_assert_lt(4, num_fences);
 		devid = intel_get_drm_devid(fd);
 
-		igt_assert(num_fences <= MAX_FENCES);
+		igt_assert_lte(num_fences, MAX_FENCES);
 	}
 
 	igt_subtest("2-spare-fences")
diff --git a/tests/gem_mmap.c b/tests/gem_mmap.c
index bbc5c4c..c0f45e5 100644
--- a/tests/gem_mmap.c
+++ b/tests/gem_mmap.c
@@ -68,7 +68,7 @@  igt_main
 		arg.offset = 0;
 		arg.size = OBJECT_SIZE;
 		ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg);
-		igt_assert(ret == 0);
+		igt_assert_eq(ret, 0);
 		addr = (uint8_t *)(uintptr_t)arg.addr_ptr;
 
 		igt_info("Testing contents of newly created object.\n");
@@ -91,7 +91,7 @@  igt_main
 	}
 
 	igt_subtest("short-mmap") {
-		igt_assert(OBJECT_SIZE > 4096);
+		igt_assert_lt(4096, OBJECT_SIZE);
 		handle = gem_create(fd, OBJECT_SIZE);
 		addr = gem_mmap__cpu(fd, handle, 0, 4096, PROT_WRITE);
 		memset(addr, 0, 4096);
diff --git a/tests/gem_readwrite.c b/tests/gem_readwrite.c
index a8a7105..4203ac7 100644
--- a/tests/gem_readwrite.c
+++ b/tests/gem_readwrite.c
@@ -93,7 +93,7 @@  igt_main
 	igt_subtest("new-obj") {
 		igt_info("Testing contents of newly created object.\n");
 		ret = do_read(fd, handle, buf, 0, OBJECT_SIZE);
-		igt_assert(ret == 0);
+		igt_assert_eq(ret, 0);
 		memset(&expected, 0, sizeof(expected));
 		igt_assert(memcmp(expected, buf, sizeof(expected)) == 0);
 	}
@@ -110,23 +110,23 @@  igt_main
 		memset(buf + 1024, 0x01, 1024);
 		memset(expected + 1024, 0x01, 1024);
 		ret = do_write(fd, handle, buf, 0, OBJECT_SIZE);
-		igt_assert(ret == 0);
+		igt_assert_eq(ret, 0);
 		ret = do_read(fd, handle, buf, 0, OBJECT_SIZE);
-		igt_assert(ret == 0);
+		igt_assert_eq(ret, 0);
 		igt_assert(memcmp(buf, expected, sizeof(buf)) == 0);
 
 		igt_info("Testing partial write of buffer\n");
 		memset(buf + 4096, 0x02, 1024);
 		memset(expected + 4096, 0x02, 1024);
 		ret = do_write(fd, handle, buf + 4096, 4096, 1024);
-		igt_assert(ret == 0);
+		igt_assert_eq(ret, 0);
 		ret = do_read(fd, handle, buf, 0, OBJECT_SIZE);
-		igt_assert(ret == 0);
+		igt_assert_eq(ret, 0);
 		igt_assert(memcmp(buf, expected, sizeof(buf)) == 0);
 
 		igt_info("Testing partial read of buffer\n");
 		ret = do_read(fd, handle, buf, 512, 1024);
-		igt_assert(ret == 0);
+		igt_assert_eq(ret, 0);
 		igt_assert(memcmp(buf, expected + 512, 1024) == 0);
 	}
 
diff --git a/tests/gem_threaded_access_tiled.c b/tests/gem_threaded_access_tiled.c
index 16a50ad..e0b8360 100644
--- a/tests/gem_threaded_access_tiled.c
+++ b/tests/gem_threaded_access_tiled.c
@@ -99,7 +99,6 @@  igt_simple_main
 	igt_skip_on_simulation();
 
 	fd = drm_open_any();
-	igt_assert(fd >= 0);
 
 	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
 	igt_assert(bufmgr);
diff --git a/tests/gem_unfence_active_buffers.c b/tests/gem_unfence_active_buffers.c
index 125568e..4bd6ff6 100644
--- a/tests/gem_unfence_active_buffers.c
+++ b/tests/gem_unfence_active_buffers.c
@@ -117,7 +117,7 @@  igt_simple_main
 		test_bo = drm_intel_bo_alloc(bufmgr, "test_bo",
 					     TEST_SIZE, 4096);
 		ret = drm_intel_bo_set_tiling(test_bo, &tiling, TEST_STRIDE);
-		igt_assert(ret == 0);
+		igt_assert_eq(ret, 0);
 
 		drm_intel_bo_disable_reuse(test_bo);
 
diff --git a/tests/gem_userptr_blits.c b/tests/gem_userptr_blits.c
index 41d5769..9728db9 100644
--- a/tests/gem_userptr_blits.c
+++ b/tests/gem_userptr_blits.c
@@ -1322,7 +1322,6 @@  int main(int argc, char **argv)
 		int ret;
 
 		fd = drm_open_any();
-		igt_assert(fd >= 0);
 
 		ret = has_userptr(fd);
 		igt_skip_on_f(ret == 0, "No userptr support - %s (%d)\n",
diff --git a/tests/gem_workarounds.c b/tests/gem_workarounds.c
index f1da3ef..e8a141d 100644
--- a/tests/gem_workarounds.c
+++ b/tests/gem_workarounds.c
@@ -195,20 +195,20 @@  igt_main
 		batch = intel_batchbuffer_alloc(bufmgr, devid);
 
 		fd = igt_debugfs_open("i915_wa_registers", O_RDONLY);
-		igt_assert(fd >= 0);
+		igt_assert_lte(0, fd);
 
 		file = fdopen(fd, "r");
 		igt_assert(file > 0);
 
 		ret = getline(&line, &line_size, file);
-		igt_assert(ret > 0);
+		igt_assert_lt(0, ret);
 		sscanf(line, "Workarounds applied: %d", &num_wa_regs);
 
 		if (IS_BROADWELL(devid) ||
 		    IS_CHERRYVIEW(devid))
-			igt_assert(num_wa_regs > 0);
+			igt_assert_lt(0, num_wa_regs);
 		else
-			igt_assert(num_wa_regs >= 0);
+			igt_assert_lte(0, num_wa_regs);
 
 		wa_regs = malloc(num_wa_regs * sizeof(*wa_regs));
 
diff --git a/tests/kms_3d.c b/tests/kms_3d.c
index fdc05b1..8a157c6 100644
--- a/tests/kms_3d.c
+++ b/tests/kms_3d.c
@@ -61,8 +61,8 @@  igt_simple_main
 			    &length);
 
 	kmstest_force_edid(drm_fd, connector, edid, length);
-	if (!kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_ON))
-		igt_skip("Could not force connector on\n");
+	igt_skip_on_f(!kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_ON),
+		      "Could not force connector on\n");
 
 	connector_id = connector->connector_id;
 
@@ -74,7 +74,7 @@  igt_simple_main
 			mode_count++;
 	}
 
-	igt_assert(mode_count == 15);
+	igt_assert_eq(mode_count, 15);
 
 	/* set 3D modes */
 	igt_info("Testing:\n");
@@ -109,7 +109,7 @@  igt_simple_main
 				     &connector->connector_id, 1,
 				     &connector->modes[i]);
 
-		igt_assert(ret == 0);
+		igt_assert_eq(ret, 0);
 	}
 
 	kmstest_force_connector(drm_fd, connector, FORCE_CONNECTOR_UNSPECIFIED);
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 25c9243..d63c79b 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -916,19 +916,20 @@  static unsigned int run_test_step(struct test_output *o)
 
 	if (o->flags & TEST_ENOENT) {
 		/* hope that fb 0xfffffff0 does not exist */
-		igt_assert(do_page_flip(o, 0xfffffff0, false) == -ENOENT);
-		igt_assert(set_mode(o, 0xfffffff0, 0, 0) == -ENOENT);
+		igt_assert_eq(do_page_flip(o, 0xfffffff0, false), -ENOENT);
+		igt_assert_eq(set_mode(o, 0xfffffff0, 0, 0), -ENOENT);
 	}
 
 	if (do_flip && (o->flags & TEST_EINVAL) && o->flip_state.count > 0)
-		igt_assert(do_page_flip(o, new_fb_id, true) == expected_einval);
+		igt_assert_eq(do_page_flip(o, new_fb_id, true),
+			      expected_einval);
 
 	if (o->flags & TEST_FB_BAD_TILING)
 		new_fb_id = o->fb_ids[o->current_fb_id];
 
 	if (do_vblank && (o->flags & TEST_EINVAL) && o->vblank_state.count > 0)
-		igt_assert(do_wait_for_vblank(o, o->pipe, target_seq, &vbl_reply)
-		       == -EINVAL);
+		igt_assert_eq(do_wait_for_vblank(o, o->pipe, target_seq, &vbl_reply),
+			      -EINVAL);
 
 	if (o->flags & TEST_VBLANK_RACE) {
 		spawn_vblank_wait_thread(o);
@@ -943,7 +944,8 @@  static unsigned int run_test_step(struct test_output *o)
 		set_dpms(o, DRM_MODE_DPMS_OFF);
 
 	if (o->flags & TEST_MODESET)
-		igt_assert(set_mode(o, o->fb_ids[o->current_fb_id], 0, 0) == 0);
+		igt_assert_eq(set_mode(o, o->fb_ids[o->current_fb_id], 0, 0),
+			      0);
 
 	if (o->flags & TEST_DPMS)
 		set_dpms(o, DRM_MODE_DPMS_ON);
@@ -954,7 +956,8 @@  static unsigned int run_test_step(struct test_output *o)
 
 		/* modeset/DPMS is done, vblank wait should work normally now */
 		start = gettime_us();
-		igt_assert(__wait_for_vblank(TEST_VBLANK_BLOCK, o->pipe, 2, 0, &reply) == 0);
+		igt_assert_eq(__wait_for_vblank(TEST_VBLANK_BLOCK, o->pipe, 2, 0, &reply),
+			      0);
 		end = gettime_us();
 		/*
 		 * we waited for two vblanks, so verify that
@@ -977,7 +980,8 @@  static unsigned int run_test_step(struct test_output *o)
 	/* try to make sure we can issue two flips during the same frame */
 	if (do_flip && (o->flags & TEST_EBUSY)) {
 		struct vblank_reply reply;
-		igt_assert(__wait_for_vblank(TEST_VBLANK_BLOCK, o->pipe, 1, 0, &reply) == 0);
+		igt_assert_eq(__wait_for_vblank(TEST_VBLANK_BLOCK, o->pipe, 1, 0, &reply),
+			      0);
 	}
 
 	if (do_flip)
@@ -998,7 +1002,7 @@  static unsigned int run_test_step(struct test_output *o)
 	}
 
 	if (do_flip && (o->flags & TEST_EBUSY))
-		igt_assert(do_page_flip(o, new_fb_id, true) == -EBUSY);
+		igt_assert_eq(do_page_flip(o, new_fb_id, true), -EBUSY);
 
 	if (do_flip && (o->flags & TEST_RMFB))
 		recreate_fb(o);
@@ -1038,11 +1042,12 @@  static unsigned int run_test_step(struct test_output *o)
 		igt_system_suspend_autoresume();
 
 	if (do_vblank && (o->flags & TEST_EINVAL) && o->vblank_state.count > 0)
-		igt_assert(do_wait_for_vblank(o, o->pipe, target_seq, &vbl_reply)
-			   == -EINVAL);
+		igt_assert_eq(do_wait_for_vblank(o, o->pipe, target_seq, &vbl_reply),
+			      -EINVAL);
 
 	if (do_flip && (o->flags & TEST_EINVAL) && !(o->flags & TEST_FB_BAD_TILING))
-		igt_assert(do_page_flip(o, new_fb_id, true) == expected_einval);
+		igt_assert_eq(do_page_flip(o, new_fb_id, true),
+			      expected_einval);
 
 	if (hang)
 		unhang_gpu(drm_fd, hang);
diff --git a/tests/pm_rc6_residency.c b/tests/pm_rc6_residency.c
index a945b47..53856b4 100644
--- a/tests/pm_rc6_residency.c
+++ b/tests/pm_rc6_residency.c
@@ -161,13 +161,13 @@  igt_main
 		if (IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid))
 			residency_accuracy(media, "media_rc6");
 	igt_subtest("rc6p-accuracy") {
-		if (!IS_GEN6(devid) && !IS_IVYBRIDGE(devid))
-			igt_skip("This platform doesn't support RC6p\n");
+		igt_skip_on_f(!IS_GEN6(devid) && !IS_IVYBRIDGE(devid),
+			      "This platform doesn't support RC6p\n");
 		residency_accuracy(rc6p, "rc6p");
 	}
 	igt_subtest("rc6pp-accuracy") {
-		if (!IS_GEN6(devid) && !IS_IVYBRIDGE(devid))
-			igt_skip("This platform doesn't support RC6pp\n");
+		igt_skip_on_f(!IS_GEN6(devid) && !IS_IVYBRIDGE(devid),
+			      "This platform doesn't support RC6pp\n");
 		residency_accuracy(rc6pp, "rc6pp");
 	}
 }
diff --git a/tests/pm_rps.c b/tests/pm_rps.c
index 697a154..156c79e 100644
--- a/tests/pm_rps.c
+++ b/tests/pm_rps.c
@@ -673,13 +673,13 @@  igt_main
 			int val = -1;
 			char *path;
 			ret = asprintf(&path, sysfs_base_path, device, junk->name);
-			igt_assert(ret != -1);
+			igt_assert_neq(ret, -1);
 			junk->filp = fopen(path, junk->mode);
 			igt_require(junk->filp);
 			setbuf(junk->filp, NULL);
 
 			val = readval(junk->filp);
-			igt_assert(val >= 0);
+			igt_assert_lte(0, val);
 			junk++;
 		} while(junk->name != NULL);
 
diff --git a/tests/prime_nv_test.c b/tests/prime_nv_test.c
index dc9287c..57be069 100644
--- a/tests/prime_nv_test.c
+++ b/tests/prime_nv_test.c
@@ -358,7 +358,7 @@  static void test_i915_blt_fill_nv_read(void)
 igt_main
 {
 	igt_fixture {
-		igt_assert(find_and_open_devices() == 0);
+		igt_assert_eq(find_and_open_devices(), 0);
 
 		igt_require(nouveau_fd != -1);
 		igt_require(intel_fd != -1);
diff --git a/tests/prime_udl.c b/tests/prime_udl.c
index d03aee0..e9002d3 100644
--- a/tests/prime_udl.c
+++ b/tests/prime_udl.c
@@ -153,7 +153,7 @@  igt_simple_main
 {
 	igt_skip_on_simulation();
 
-	igt_assert(find_and_open_devices() >= 0);
+	igt_assert_lte(0, find_and_open_devices());
 
 	igt_skip_on(udl_fd == -1);
 	igt_skip_on(intel_fd == -1);
@@ -167,9 +167,9 @@  igt_simple_main
 	intel_batch = intel_batchbuffer_alloc(bufmgr, devid);
 
 	/* create an object on the i915 */
-	igt_assert(test1() == 0);
+	igt_assert_eq(test1(), 0);
 
-	igt_assert(test2() == 0);
+	igt_assert_eq(test2(), 0);
 
 	intel_batchbuffer_free(intel_batch);