tests: introduce igt_require

Since igt_skip has funny control flow we can abuse it and make it work
like a special kind of assert which automatically skips tests if a
requirement fails.

Note that in places where we have a less strict test which should
always succeed (e.g. ioctl works or isn't available) the igt_assert
should be place before the igt_require with the more strict
requirements. Otherwise we'll skip a test instead of properly failing
it.

Convert a few users of igt_skip over to igt_require to showcase its
use.

v2: s/gem_check_/gem_require_/ so that we consistently use "require"
to indicate magic check that can call igt_skip. Imo hiding the
igt_require for feature checks is ok, but for more traditional assert
like use cases an explicit igt_require might be better.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
diff --git a/tests/gem_exec_nop.c b/tests/gem_exec_nop.c
index 4cb157c..47bcf10 100644
--- a/tests/gem_exec_nop.c
+++ b/tests/gem_exec_nop.c
@@ -92,6 +92,8 @@
 {
 	int count;
 
+	gem_require_ring(fd, ring_id);
+
 	for (count = 1; count <= SLOW_QUICK(1<<17, 1<<4); count <<= 1) {
 		struct timeval start, end;
 
@@ -103,8 +105,8 @@
 		       count, elapsed(&start, &end, count), ring_name);
 		fflush(stdout);
 	}
-
 }
+
 int main(int argc, char **argv)
 {
 	uint32_t batch[2] = {MI_BATCH_BUFFER_END};
@@ -122,16 +124,13 @@
 		loop(fd, handle, I915_EXEC_RENDER, "render");
 
 	igt_subtest("bsd")
-		if (gem_check_blt(fd))
-			loop(fd, handle, I915_EXEC_BSD, "bsd");
+		loop(fd, handle, I915_EXEC_BSD, "bsd");
 
 	igt_subtest("blt")
-		if (gem_check_blt(fd))
-			loop(fd, handle, I915_EXEC_BLT, "blt");
+		loop(fd, handle, I915_EXEC_BLT, "blt");
 
 	igt_subtest("vebox")
-		if (gem_check_vebox(fd))
-			loop(fd, handle, LOCAL_I915_EXEC_VEBOX, "vebox");
+		loop(fd, handle, LOCAL_I915_EXEC_VEBOX, "vebox");
 
 	gem_close(fd, handle);