tests: introduce igt_require
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 13 Aug 2013 11:20:58 +0000 (13:20 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 13 Aug 2013 13:15:18 +0000 (15:15 +0200)
commit8f5387eb99b640771812d28a0b949aca729bf296
tree4ccb29a62ff7c4f055cf18fe31c9482ad16ae698
parent5e25fcc285240353ab15bd4c3a0d0e02d970f45b
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>
lib/drmtest.c
lib/drmtest.h
tests/gem_caching.c
tests/gem_cs_tlb.c
tests/gem_dummy_reloc_loop.c
tests/gem_exec_nop.c
tests/gem_reg_read.c
tests/gem_write_read_ring_switch.c