104 Commits

Author SHA1 Message Date
Chris Wilson
2a37b1d78e lib: Make igt_assert() abort under gdb
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-20 12:45:55 +01:00
Daniel Vetter
912a7d8556 tests/gem_concurrent_blit: Fix segmentation fault
Apparently the simple changes introduced in

commit 78865847f9fae7e590960f9836f2ec8b611a190e
Author:     Daniel Vetter <daniel.vetter@ffwll.ch>
AuthorDate: Mon Aug 19 07:23:49 2013 +0200
Commit:     Daniel Vetter <daniel.vetter@ffwll.ch>
CommitDate: Mon Aug 19 08:09:25 2013 +0200

    lib/drmtest: skip fixtures after an igt_skip

pushed the stack space requirement for run_modes over some magic limit
(I guess where the strack grow logic starts to fail, but I didn't
check). Fix this by moving the data into .bss.

Also add some asserts to check that fixtures aren't abused while at
it (i.e. the useful parts of my debug printf/assert craze).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68299
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-20 06:42:10 +02: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
e55b89f1c3 lib: handle SIGSEGV similarly to other error signals
Signed-off-by: Imre Deak <imre.deak@intel.com>
2013-08-19 16:38:21 +03:00
Imre Deak
9cbbce148f lib: shorten DP/eDP connector names
Signed-off-by: Imre Deak <imre.deak@intel.com>
2013-08-19 16:38:21 +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
4ba1f2e104 lib/drmtest: Properly skip if no intel gfx supported
drm/* kernel test nirvana!

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-19 08:09:25 +02:00
Daniel Vetter
47a32a3aec lib/drmtest: make igt_fail work outside of subtests
With the abortable fixtures we can now correctly fail all subsequent
sutbests if we hit upon an igt_assert outside of a subtest.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-19 08:09:25 +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
Chris Wilson
6332994c26 drmtest: Squelch the rude interrupter
Stop printing the debugging information of how many times we emitted a
signal.
2013-08-16 12:23:00 +01: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
f219889608 lib/drmtest: fix subtest output when skipping all tests
(null) isn't too nice ...

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-14 22:13:38 +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
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
f542b0970a lib/drmtest: Don't spoil stdout when listing tests
Oops.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-14 13:48:10 +02:00
Daniel Vetter
629f48fa0e lib/drmtest: Don't run the rude interruptor when just listing subtests
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-13 23:05:51 +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
2371c79bbd lib/drmtest: roll out igt_assert
I've left the asserts as-is where they check for tests that use the
infrastructure in drmtest.c incorrectly. That way piglit's
differentiation between a failed testcase and a crashing testcase
should be more useful.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-13 15:07:44 +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
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