133 Commits

Author SHA1 Message Date
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
c67ebf413a lib/drmtest: fixup igt_fail for the list-only case
Oops.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-13 11:40:57 +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
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
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
a4038d3853 lib/drmtest: make signal process cleanup more robust
If we skip a test and and fail somewhere the parent might die before the
child. So add some cleanup to handle this case. Also make sure that the
parent indeed waits for the child to die.

This is required to make the latest version of the piglit runner happy,
it tends to wait for all zombies to disappear.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-12 11:10:26 +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
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
Chris Wilson
ab6ac67243 lib: Reset sig_stat after stopping the rude interrupter 2013-08-06 16:58:59 +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
Damien Lespiau
aefc5c63e4 lib: Allow users of env_set() to specify a default value
So when the environment value isn't set, one can specify the default
value to return.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-07-19 18:38:47 +01:00
Daniel Vetter
289024b328 lib/drmtest: fix const mismatch warning
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-19 18:24:59 +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
Chris Wilson
c6cec844f9 Make the failure message for drm_open_any() more specific
Do not suggest retrying as root if we already are.
2013-07-03 10:01:15 +01:00
Chris Wilson
9eb7d8950c Avoid corrupting the exitcode with a failure to open a quiescent fd
In the atexit handler, we attempt to quiesce the GPU. This involves
opening a fd - which will fail if the test is not being run as root and
will obliterate the test status and pollute the output.
2013-07-03 10:01:15 +01:00
Daniel Vetter
26af13f84f lib/drmtest: set default sighandler for QUIT in the signal process
Otherwise the thing doesn't reliably die when run from the piglit
framework somehow.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-06-29 18:31:45 +02:00
Imre Deak
67a4ea0ee1 lib: fix drm_fourcc.h include path
Signed-off-by: Imre Deak <imre.deak@intel.com>
2013-06-07 21:29:31 +03: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
334baf05ca lib: use kmstest_cairo_printf_line in paint_marker
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
1cb4f90946 tests/lib: make sure the GPU is idle at test start and exit
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64270

v2:
- Make sure also that the GPU is idle at start and error exit of any
  test using drm_open_any(). (Daniel)
v3:
- actually call gem_quiescent_gpu() at exit

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-05-28 18:32:32 +02:00
Imre Deak
a3b47dbe69 lib: make sure all rings are idle in gpu_quiescent_gpu()
Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-05-28 18:32:29 +02: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
4dec89aef7 lib: fix exit handler when multiple handlers are registered
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
Daniel Vetter
cb3a44fa26 lib/drmtest: tune down signal handler stats
Avoids tests with a spurious WARN result in piglit.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-04-08 00:31:06 +02:00
Damien Lespiau
c6c6f0f593 lib: Add a comment about why we only parse long options for subtests
For thet next one wondering about that.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-22 11:08:17 +00:00
Damien Lespiau
75f52a6e3b lib: Factor out a function to check if an environment variable is set
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2013-03-04 15:45:18 +00: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
Daniel Vetter
9fc7e1386a lib/drmtest: subtest infrastructure
To make these helpers as least invasive as possible simply initialize
the options with a getopt parser and let the control flow be steered
with a simple helper which gets the subtest name as an argument.

The only tricky part for using it is that the subtest check helper
doubles up as the conduit to enumerate tests (and in that mode
prevents any test from being run). It is therefore important that
nothing gets printed to stdout outside of these checks.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-11-28 11:57:58 +01:00
Daniel Vetter
021909e10d tests: dont polute stderr if the test succeeds/skips
Results in spurious 'warn' results in piglit. Also don't print
progress indicators when not outputting to a terminal.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-11-28 11:08:37 +01:00
Imre Deak
21393431f1 drmtest: add function to remove an DRM FB
Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-10-16 16:51:56 +02:00
Imre Deak
6456e75f0d fix warn: 'div' shadows a global declaration
Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2012-10-10 15:59:02 +02:00
Daniel Vetter
5f94468f52 lib: remove auto-quiescenting of the gpu
In retrospective, this is an ugly idea. Any tests that needs this
can call it themselves.
2012-10-09 19:27:41 +02:00
Daniel Vetter
b8e384a4d5 lib: make drmtest_progress more robust 2012-10-09 17:50:40 +02:00
Daniel Vetter
df7edaab90 lib: helper to convert gem_hanlde to drm_intel_bo 2012-10-02 10:32:10 +02:00
Daniel Vetter
9d1a3587ac drmtest: use do_or_die 2012-10-01 11:34:10 +02:00
Ben Widawsky
54ed938d39 clang: Fix warnings found through clang.
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
2012-08-30 14:19:10 -07:00