124 Commits

Author SHA1 Message Date
Daniel Vetter
5f790db084 lib/drmtest: Fix igt_stop_signal_helper for subtest listing
We need to bail out early for otherwise we'll hit the
!signal_helper->running assert.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-09-11 11:09:08 +02:00
Daniel Vetter
b3a61c8028 lib/drmtest: skip when prefault control isn't available
Instead of crashing with an igt_assert. Fixes the only crashing test
when running igt on non-intel systems.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-09-11 10:47:07 +02:00
Daniel Vetter
2b218f69d7 lib/drmtest: Use ARRAY_SIZE
Less fragile ...

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-09-11 10:40:25 +02:00
Daniel Vetter
57e6746181 lib/drmtest: double-check that we clean up helper processes
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-09-10 18:22:17 +02:00
Daniel Vetter
e73c1a07f3 lib/drmtest: consolidate the helper process killing in one exit handler
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-09-10 18:22:17 +02:00
Daniel Vetter
edd723457c lib/drmtest: create helpers for forking helper threads
The upshot is that we can share the logic to make sure the helpers
are all properly stoved again in a 2nd step.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-09-10 17:40:06 +02:00
Daniel Vetter
2096649053 lib/drmtest: fixup for the prefault rework
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-09-08 14:03:20 +02:00
Daniel Vetter
fbd64de6be lib/drmtest: Avoid calling exit handlers multiple times
- reset the count when forking
- don't add the same handler multiple times
- don't restore the exit signal handlers in the forked helper
  process
- reset the exit handler count once called to make sure we don't call
  it multiple times when dying
- don't wait for the signal helper if it's gone already

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-09-08 14:03:03 +02:00
Daniel Vetter
f4b93781be lib/drmtest: use igt_require/assert in the prefault helpers 2013-09-03 15:19:30 +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
6f118bf96a lib/drmtest: Improve output when igt_waitchildren fails
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-09-02 08:08:29 +02:00
Daniel Vetter
a0aa8f1a2c lib/drmtest: Print info when children died due to signals
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-29 21:44:48 +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
02c0d20fa8 lib/drmtest: restore in_fixture assert
I didn't really want to revert those, too ...

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-26 21:16:37 +02:00
Daniel Vetter
ad0f081f2b Revert "tests/gem_concurrent_blit: Fix segmentation fault"
This reverts commit 912a7d855600aadb937517ec5bab26bfd9b8953d.

Now fixed for real!

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-26 20:55:54 +02: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
Imre Deak
86f60ee593 tests/kms_setmode: don't save/restore vt graphics for dry-run
Signed-off-by: Imre Deak <imre.deak@intel.com>
2013-08-26 17:20:29 +03:00
Imre Deak
40cc4b8d10 lib/drmtest: fix handling of -h --help argument parsing
So far we handled -h or --help arguments properly only if the test
called igt_subtest_init_parse_opts(). Fix this for igt_subtest_init()
callers too. Make sure we still don't exit for any other
unknown options, which the caller may parse with a second getopt scan.

Signed-off-by: Imre Deak <imre.deak@intel.com>
2013-08-26 17:18:38 +03:00
Daniel Vetter
e075e7b43c lib/drmtest: fix logic fumble in gem_context_create
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68363
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-21 10:23:08 +02:00
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