33 Commits

Author SHA1 Message Date
Thomas Wood
e2cef00896 lib: add igt_simple_init_parse_opts
This function allows simple tests to register additional command line
options.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-07-23 15:23:53 +01:00
Thomas Wood
94ac74ebb8 lib: move option parsing into common_init
Move option parsing into common_init so it can be shared between simple
tests and tests with subtests. This allows for more common command line
behaviour across all tests.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-07-23 15:23:53 +01:00
Thomas Wood
e057b86109 lib: warn when attempting to run an unknown subtest
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-07-23 15:23:53 +01:00
Chris Wilson
4f7d4dcae5 Use SIGTERM in replace of SIGQUIT
SIGTERM is the normal signal to use when instructing a process to exit.
The only difference is that an unhandled SIGQUIT is meant to generate a
coredump, which is not what we want, but in practice I encountered an
issue where SIGTERM seemed to be deliverable more reliably than SIGQUIT
(in tests using multiple signal helpers).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-21 16:32:42 +01:00
Thomas Wood
8a3853c812 core: increase the exit handler limit
Increase the maximum number of exit handlers since some tests now
require more that the previous limit.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81320
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-07-17 11:25:19 +01:00
Daniel Vetter
5a98fe9d4a lib: Add argc/argv to igt_simple_init
There's a pile of ideas around to add generally useful options like
--debug to all igt tests. Or unify the runtime behaviour between
simple and subtest tests a bit more.

The first step to get there is to add argc/argv to igt_simple_init so
that we can get at the argument list.

Cc: Tim Gore <tim.gore@intel.com>
Cc: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-07-14 15:03:59 +02:00
Daniel Vetter
bebcb582fc lib/igt_core: Don't log when listing subtests
I've noticed some spam in the userptr list ...

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-07-11 15:23:54 +02:00
Chris Wilson
f47ee31dd5 Wait for any pid in order to reap failure quicker
When waiting for the forked tests, we can respond quicker to a failure
(such as oom) by waiting for any child to exit rather than waiting for
each child in order. Then when we see that a test failed, we can kill
all other children before aborting.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-11 10:41:28 +01:00
Damien Lespiau
e16d4a2d68 core: Apply the same treatment to the in errno message in __igt_fail_assert()
Just like the it was done for the requirement message, display the errno
message only if errno is set, and display it at the end of the assert
message.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-10 18:05:33 +01:00
Damien Lespiau
4145462250 core: Only display the errno message if errno is set
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-10 18:05:25 +01:00
Damien Lespiau
b2d1a598ab core: Put the requirement failure messages together
The errno message was a bit in the middle here, it makes more sense to
group the messages about why the test requirement wasn't met together.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-07-10 18:04:47 +01:00
Thomas Wood
52a3a2e205 lib: various documentation fixes
Fix some documentation comments and mark some struct members private.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-06-12 10:12:13 +01:00
Rodrigo Vivi
82ad15fd10 Fix make distclean by fixing includes of version.h
Actually only the igt_core was breaking the make distcheck,
but let's make it consistent and let the code cleaner.

Credits-to: Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
2014-06-09 11:17:20 -07:00
Daniel Vetter
831eb21197 lib/igt_core: Fixup docs with symbolic exit codes
Conflict between me and Thomas pushing patches in parallel.

Cc: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-05-14 15:34:00 +02:00
Thomas Wood
17eb062661 lib: add exit status defines
Add defines for success, skip and timeout exit statuses.

Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-05-14 12:33:02 +01:00
Thomas Wood
d8e5313a27 lib: add igt_set_timeout
Add a function to stop and fail a test after the specified number of
seconds have elapsed.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Acked-by: Damien Lespiau <damien.lespiau@intel.com>
2014-05-14 12:33:01 +01:00
Daniel Vetter
126b8ba72f lib/igt_core: Fix type on igt_log doc
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-05-13 12:28:26 +02:00
Daniel Vetter
1503d17cc5 lib/igt_core: Document testrunner interface a bit
Also fix up one gtkdoc fumble in igt_fb. We should use symbolic
defines if possible instead of just listening the magic 0, 77, 78
values for exit codes, but that's a separate patch.

Cc: tim.gore@intel.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-05-13 11:29:34 +02:00
Daniel Vetter
71c6f87eb3 lib/igt_core: fix igt_skip_on_simulation regression
I've forgotten that we might want to call this from within specific
subtests (or special helpers like the autoresume one).

Also props for being competent enough to write a testcase, but
incompetent enough to botch the job up.

Fix both things and remove a leftover debug printf while at it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-26 15:09:23 +01:00
Daniel Vetter
7bb40944e2 lib: Use @include tag for include files
Occasionally useful to read documentation ...

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-23 14:45:13 +01:00
Daniel Vetter
8221fda087 lib: s/igt_env_set/igt_check_boolean_env_var
So I wasn't really happy with env_set since it's way too close to
setenv(), whic actually _sets_ and environment variable. So use check
instead of set as the verb (well adjective for env_set).

Also sprinkle in some hints that we talk about a boolean setting here.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-23 14:38:17 +01:00
Daniel Vetter
f5daeec724 lib: extract igt_aux.[hc]
And shovel all the various helpers in there.

Also move igt_set_vt_graphics_mode to igt_kms.h since the function is
implemented in igt_kms.c. And it fits better. I kinda missed this in
the prep work.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-23 13:47:09 +01:00
Daniel Vetter
c03c6ceb29 lib: rename intel_gpu_tools.h to intel_io.h
With the header cleanup we can now give this header a suitable name,
since it now really only contains register access and other I/O
functions and assorted definitions.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22 21:34:29 +01:00
Daniel Vetter
254f19ba8d lib: unnecessary header removal for drmtest.h, part 2
I've left unistd.h in it - it's not strictly required but most users
of drmtest.h want it for the open helpers, and then you kinda need to
close that file descriptor again ...

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22 21:29:01 +01:00
Daniel Vetter
cd6d5a61b3 lib: add #include "foo.h" lines like in manpages
Should help in alleviating the header mess we have atm.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22 19:39:47 +01:00
Daniel Vetter
0e22f14ed6 tests|lib: remove assert.h includes
Only the igt core and non-test tools should have asserts to catch
internal errors, tests and helper libraries should all user igt_asert
instead.

Fix things up where assert instead of igt_assert was used.

One tiny step towards header sanity.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22 19:39:46 +01:00
Daniel Vetter
a388f3b98f 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>
2014-03-22 14:28:03 +01:00
Daniel Vetter
10571b8ccb lib/igt_core: Document library design best practices
This is what I've been doing in the past few months when refactoring
i-g-t code. More ideas and also patterns to add highly welcome.

v2: Some minor polish on the text and add another bullet to reference
the kernel's coding style.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-17 10:43:20 +01:00
Daniel Vetter
3ea97f2e51 lib/igt_core: Small api doc fix
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-17 09:47:50 +01:00
Daniel Vetter
5cf8d8d6db lib/igt_core: document the caveats of magic code blocks
v2: Polish the wording a bit.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-14 10:59:15 +01:00
Daniel Vetter
bd53d722dd lib: add igt_vlog to print varargs
... and put it to immediate use in igt_display_log.

To make this all add up also drop the return value of igt_display_log,
no one really cared anyway.

Aside: I've noticed that every time another subtest runs (at least
with kms_pipe_crc_basic) the log indent level moves one up ...

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-13 19:44:40 +01:00
Daniel Vetter
55e64989e5 lib/igt_core: api documentation
At most a bit of comment of function declaration movement for more
polish. One tricky bit is to #ifdef out (only for gtkdoc of course)
the struct option; forward declaration - gtkdoc needlessly lists it.

FIXME: The struct documentation for igt_helper_process somehow doesn't
get picked up ... Same issue seems to be with the igt_log_level enum,
I've shoveled the relevant documentation into igt_log in free-form for
now.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-12 16:39:39 +01:00
Daniel Vetter
d63fe1519d lib: extract igt_core.c
Same game as with ioctl_wrappers.c.

To split was rather clean except for the static function
oom_adjust_for_doom. But that was a bug, the calls to it in the
various open helpers should simply be done at init and fork time.
Which was already the case, except for simple testcase.  So fix it up.

While at it also start with a small section header for the
documentation.

v2: Don't forget to update the xml template ...

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-12 16:39:39 +01:00