129 Commits

Author SHA1 Message Date
Daniel Vetter
f4b93781be lib/drmtest: use igt_require/assert in the prefault helpers 2013-09-03 15:19:30 +02:00
Daniel Vetter
225a91bc54 lib/drmtest: include sys/mman.h from drmtest.h
We need it for mmapping to get at PROT_READ|WRITE anyway.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-09-03 10:38:29 +02:00
Daniel Vetter
9cc16e8afd lib/drmtest: extract gem_execbuf helper
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-09-03 10:37:14 +02:00
Daniel Vetter
cd1f220847 lib/drmtest: extract igt_fork from gem_concurrent_blt
Making sure that we correctly collect the exit codes from all children
is a bit a hassle. So add another magic igt codeblock for easy forking
and joining.

Note that children are (currently at least) not allowed to call igt_skip.
Add an assert to enforce this.

v2:
- Properly propagate the exit code.
- Fix the segfault.
- Add a child int and num_children paramter to the magic codeblock as
  suggested by Chris Wilson.
- Don't dump noise into stdout when a child thread fails, the parent
  will do that for us already.

v3: Now with some docs.

v4: Fixup igt_waitchildren to properly reset state so it can be used
again.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-29 18:18:33 +02:00
Chris Wilson
d0ed912107 kms_flip: Exercise flip-vs-render
For machine with split BCS/RCS rings, we also need to test whether we
correctly wait upon outstanding render work before flipping and changing
modes. This should also serve to exercise the ring selection code for
flips.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-29 16:19:41 +01:00
Daniel Vetter
8869e1e628 lib/drmtest: don't complete fixtures with a longjmp
Longjmp creates havoc with stack variables of the current stackframe.
And since fixtures should be used to set up such variables creating
havoc isn't a great idea. With this I can revert a bunch of
bogus patches I've done to paper over this by moving stack variables
to be global.

The same issue is actually a feature for subtest blocks since subtests
should be independant anyway.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-26 20:55:54 +02:00
Chris Wilson
55b8c33ca5 overlay: Auatomatically mount debugfs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-19 18:16:11 +01:00
Imre Deak
5cabaae4dd lib: add subtest extra command line option handling
At the moment any command line option handling done by tests will
interfere with the option handling of the subtest interface. To fix this
add a new version of the subtest_init function accepting optional short
and long command line options. Merge these together with the subtest
interface's own long options and handle both together in the same
getopt_long call.

Signed-off-by: Imre Deak <imre.deak@intel.com>
2013-08-19 16:38:22 +03:00
Imre Deak
9a9f13167a lib: export kmstest_get_connector_default_mode
Signed-off-by: Imre Deak <imre.deak@intel.com>
2013-08-19 16:38:21 +03:00
Daniel Vetter
8dbd1fb9d4 lib/drmtest: igt_skip when drm_get_card fails
Also add printf support to igt_skip to make sure there's always a
reason why we fail a testcase.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-19 11:09:25 +02:00
Daniel Vetter
9ad062d0b3 lib/drmtest: extract gem_create_context
libdrm requirements are now up to it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-19 10:55:28 +02:00
Daniel Vetter
5951ffb6a0 lib/drmtest: rip out drm_open_any_master
It's unused. Also most of our tests failed to ask for the right type
of drm fd anyway. So it's imo better to just let them fall over when
they don't get master but want it, like they already do today.

This also allows us to garbage-collect the master parameter to
drm_get_card and associated code.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-19 10:34:34 +02:00
Daniel Vetter
78865847f9 lib/drmtest: skip fixtures after an igt_skip
This way we can just enclose all igt_skip/igt_require calls into
fixtures even when we have subtests, and still output correct SKIP
message for all of them. Wohoo, magic!

The only thing which doesn't work yet is enumerating failed subtests,
but I think that should work out on top of this.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-19 08:09:25 +02:00
Daniel Vetter
e58891d0ae tests/prime: test dma-buf llseek support
This exercises a proposed patch from Christopher James Halse Rogers.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-15 14:01:10 +02:00
Daniel Vetter
79abed393f lib/drmtest: Use igt_assert in the do_ioctl/do_or_die helpers
abort results in "crash" test results in the piglit runner, igt gives
us neater output.

The downside is that we can now only use these in igt tests, but
that's already the case (and given their placement in drmtest.h their
intended use-case, too).

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-15 14:01:10 +02:00
Daniel Vetter
696c8f6434 lib/drmtest: documentation for igt_fixture
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-14 18:30:03 +02:00
Daniel Vetter
15c19229f4 lib/drmtest: add igt_subtest_name and use it in kms_flip
Useful when the testname is constructed with igt_subtest_f.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-14 18:03:09 +02:00
Daniel Vetter
2dbd998429 tests: Introduce igt_fixture
Just a tiny wrapper to protect global test setup/teardown code when
just listing subtests. Rolling this out over all tests with subtests
should allow us to generate the testlist with piglit as an
unpriviledged user on a non-intel system.

The aim here is to make our QA team happy who currently suffers from
this. Even more so for the prime tests since you need a system with
intel _and_ nouveau gpus to just be able to list tests.

Exemplary conversion with gem_concurrent_blt.c

Fixture is the same name other test suites like googletest use for
setup/teardown code used by multiple tests.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-14 17:04:56 +02:00
Daniel Vetter
f8c0dfe399 lib/drmtest: sprinkle documentation over igt_skip|fail|success|exit
And make the behaviour of igt_exit() a bit saner.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-14 16:52:08 +02:00
Daniel Vetter
6234658063 tests: add igt_subtest_f for snprintf'ing testnames
Useful when stitching together combinatorial testnames.

v2:
- ## rules are just fun. We need 2 indirections to actually get
  __LINE__ to properly expand.
- Kill stray ; which botched the logic.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-14 13:47:47 +02:00
Daniel Vetter
8f5387eb99 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>
2013-08-13 15:15:18 +02:00
Daniel Vetter
646a6fefbc lib/drmtest: add igt_assert as a replacement for assert
The aim is that we keep on running subtests even when a not-too-lethal
assert failed in a subtest. To make that useful also print per-subtest
test results from igt_skip|fail|success functions.

If required we can always go googletest-nuts with different types of
asserts later on, but I think for now we're good with what we have
here.

v2: Also print out proper SKIP message when skipping all subsequent
tests since a global (i.e. outside of a subtest) init step failed and
resulted in an igt_skip call.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-13 15:07:01 +02:00
Daniel Vetter
6877877558 tests: s/return igt_retval();/igt_exit();/
Requested-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 12:26:35 +02:00
Daniel Vetter
1caaf0a6b6 s/drmtest_/igt_/
Requested-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 12:20:22 +02:00
Daniel Vetter
814b135541 s/drmtest_subtest_block/drmtest_subtest/
The _block postfix meant to convey that a C statement/block must
follow can be misread as the verb to block. So drop it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 12:15:16 +02:00
Daniel Vetter
16024841a1 lib/drmtest: __ prefix for drmtest_run_subtest
Now that callers must setup the longjmp target (we can't do that in
run_subtest itself since that callframe won't survive) tests shouldn't
call this function directly any more.

Make this clear by adding a __ prefix.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 11:57:32 +02:00
Daniel Vetter
7847ea2965 tests: use drmtest_skip to check for rings
To simplify things add a set of gem_check_<ring> functions which take
care of this. Since I've opted for static inlines drmtest.h grew a few
more header includes which was a neat opportunity to dump a few redundant
#defines.

This kills all the skipped_all hand-rolled logic we have.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 11:17:58 +02:00
Daniel Vetter
7553ad6e10 tests: use drmtest_skip() in caching ioctl helpers
This way we can rip out all the skip handling from the test control flow,
and additionally (by using drmtest_retval()) even get correct exit codes.

The only tricky part is that when we only want ot skip parts of a test
(like for gem_pread and gem_pwrite) we need to split out those parts as
subtests. But no addition of control-flow is required, the set/longjmp
magic in the helpers all makes it happen.

Also we make extensive use of the behaviour of drmtest_skip to skip
all subsequent subtests if it is called outside of a subtest. This allows
us to re-flatten the control flow a lot.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 11:17:58 +02:00
Daniel Vetter
ba0d2acf0e lib/drmtest: skip/fail handling
Exitcode handling in igt testcases has too ugly facets in combination
with subtests:

- When individual subtest needed to be skipped for different reasons
  we need to painstakingly thread this information through the test to
  make sure that we still succeed if just one testcase worked (for
  running it with the simple automake test runner in igt). But it also
  needs to correctly report the skip exit value if only this one
  skipped testcase has been run (e.g. when run with piglit or in QA's
  test infrastructure).

- We'd prefer to easily skip (and also fail) subtests without
  hampering other subtests. Again threading the return value of each
  subtest through the code is cumbersome.

To simplify test case writing use longjmps to be able to get out of
subcases easily. But since longjmps are funny things thug it all away
into the newly added drmtest_subtest_block macro.

Note that if drmtest_skip is called outside of a subtest, but in a
testcase with subtests all subsequent subtests will be automatically
skipped.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 11:10:26 +02:00
Daniel Vetter
9f6365e4ea lib/drmtest: Add drmtest_subtest_block macro
Doesn't do more than an if (drmtest_run_test(name)) right now, but
as soon as we get a bit of infrastructure to handle test failures and
skipping, this will get more interesting.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 11:10:26 +02:00
Daniel Vetter
40ea6f4ea8 tests: s/cacheing/caching
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 11:10:26 +02:00
Chris Wilson
467796acc8 Expand gem_set_cacheing testing to handle the proposed DISPLAY domain 2013-08-10 15:49:33 +01:00
Imre Deak
24de8bac80 lib: export drm_format_to_bpp
Needed by the next patch.

Signed-off-by: Imre Deak <imre.deak@intel.com>
2013-07-29 18:40:00 +03:00
Daniel Vetter
8e46c382e3 lib/drmtest: add gem_flink and gem_open
Requires us to rename a few things in the gem_flink test to avoid
variable shadowing.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-23 23:15:12 +02:00
Daniel Vetter
10834f8610 tests/gem_suspend: exercise fence restore code
This exercise the bug fixed in

commit 94a335dba34ff47cad3d6d0c29b452d43a1be3c8
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Wed Jul 17 14:51:28 2013 +0200

    drm/i915: correctly restore fences with objects attached

For fun I've also added a subtest for the inverse transition.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-23 20:46:57 +02:00
Daniel Vetter
5bc0324e86 lib/drmtest: document interface groups with one-liners
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-22 09:25:41 +02:00
Xiong Zhang
7ea2983b11 lib/drmtest: add drmtest_disable/enable_prefault() function
V2: add exit handler to enable prefault (Daniel)

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
2013-07-19 18:12:36 +02:00
Damien Lespiau
4b34765594 lib: Introduce drmtest_skip_on_simulation()
This will allow us to explicitely blacklist tests we don't want to run
on simulation.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-07-18 15:48:46 +01:00
Damien Lespiau
c25e892ec3 lib: Rename IGT_QUICK to INTEL_SIMULATION
It's more accurate this way as the quick mode is really useful for in
the simulation environment.

v2: Use the INTEL_ prefix to have a chance to share the same environment
    variable as piglit OpenGL tests

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-07-18 15:48:42 +01:00
Imre Deak
528b1f381c tests: add kms_render
Add a test going through all connectors/crtcs/modes/formats painting to
a front FB with CPU or painting to a back FB with CPU and blitting it
to the front FB.

Only formats understood by cairo are supported for now.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
2013-06-06 01:43:51 +03:00
Imre Deak
f68d964c57 lib: refactor kmstest_create_fb
Factor out parts that will be used by an upcoming patch adding
kmstest_create_fb2.

Also call the fb paint functions directly, there is not much
point in passing a function pointer for that.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
2013-06-06 01:43:51 +03:00
Imre Deak
bfb0cdd668 lib: add kmstest_get_connector_config
This is used by multiple test cases, so make it shared.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
2013-06-06 01:43:51 +03:00
Imre Deak
542a40c485 lib: add kmstest_cairo_printf_line
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
[v3: fix mode printing in paint_output_info() botched by debugging leftover :/ ]
2013-06-06 01:43:51 +03:00
Imre Deak
3a2aed1f30 lib: move connector_type_str and co to drmtest
These are used by multiple test cases, so make them shared.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
2013-06-06 01:43:50 +03:00
Imre Deak
bce7d8a061 lib: export the exit handler interface
Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-05-22 18:18:28 +02:00
Imre Deak
cf26435be8 lib: add helper to set VT graphics mode
Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-05-08 21:00:42 +02:00
Zhong Li
8ddf84d129 i-g-t: check kernel enable rings or not
1. add functions check kernel enable a ring or not.
2. add function gem_get_num_rings() to check how many rings kernel has
enable.
3. gem_ring_sync_loop.c will call gem_get_num_rings() directly instead
of original static fucntion get_number_rings().

Signed-off-by: Zhong Li <zhong.li@intel.com>
[Ben: Wrapped commit message + whitespace fixes]
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
2013-05-03 17:39:14 -07:00
Chris Wilson
2facc1368d Check for vebox support before testing
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63941
2013-04-26 08:30:52 +01:00
Damien Lespiau
bb33d08845 lib: Add a way to specify values for "quick" runs
In some environments, we don't really want to loop 100000 times or
allocate 152352621 buffers because it makes the tests too long to run.

This adds a way to specify "quick" values to reduce the time taken by
certain tests.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-02-13 18:09:11 +01:00
Daniel Vetter
0af2b184ad lib: extract kmstest_get_pipe_from_crtc_id 2012-12-17 15:30:54 +01:00