lib: allow igt_skip_on_simulation outside of fixtures.

Thomas noticed that in simulation mode a lot of the tests fall over
instead of skipping properly. This is due to recently added
self-checks which ensure that any call to igt_skip happens either
within a fixture or subtest block (or it's a simple test without
subtests). This is to catch bugs since pretty much always not wrapping
up hardware setup and checks into these blocks is a bug.

Bug simulation skipping is a bit different, so allow that exception.
Otherwise we'd need to fix up piles of tests (and likely need to play
a game of whack-a-mole).

Also add a library testcase for all the different variants to make
sure it really works.

Cc: Thomas Wood <thomas.wood@intel.com>
Cc: Ben Widawsky <benjamin.widawsky@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Daniel Vetter
2014-03-22 13:22:11 +01:00
parent c196c14319
commit a388f3b98f
4 changed files with 152 additions and 1 deletions
+11 -1
View File
@@ -1117,13 +1117,23 @@ bool igt_run_in_simulation(void)
*
* Skip tests when INTEL_SIMULATION environment variable is set. It uses
* igt_skip() internally and hence is fully subtest aware.
*
* Note that in contrast to all other functions which use igt_skip() internally
* it is allowed to use this outside of an #igt_fixture block in a test with
* subtests. This is because in contrast to most other test requirements,
* checking for simulation mode doesn't depend upon the present hardware and it
* so makes a lot of sense to have this check in the outermost #igt_main block.
*/
void igt_skip_on_simulation(void)
{
if (igt_only_list_subtests())
return;
igt_require(!igt_run_in_simulation());
if (!in_fixture) {
igt_fixture
igt_require(!igt_run_in_simulation());
} else
igt_require(!igt_run_in_simulation());
}
/* structured logging */