55 Commits

Author SHA1 Message Date
Thomas Wood
790f1f804b lib: add a environment variable to control output
Disable output of terminal control characters and progress meters when
IGT_PLAIN_OUTPUT is set in the environment.

Cc: Derek Morton <derek.j.morton@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-11-11 14:52:47 +00:00
Daniel Stone
6ead44d70b lib/igt_core: Add igt_assert_fd
Skip open-coding and assert that fds are valid.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2015-10-07 17:57:26 +01:00
Daniel Stone
715a17bb35 lib/igt_core: Add igt_assert_neq_*() variants
Similar to igt_assert_eq_*(), add variants for non-equality of types
other than int.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2015-10-07 17:57:26 +01:00
Daniel Vetter
c9112dca9e lib/core: Fix docs for igt_assert_lt(e)
Logical negation is hard.

v2: The second integer isn't plural (Daniel).

Cc: "Morton, Derek J" <derek.j.morton@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-10-07 18:24:54 +02:00
Paulo Zanoni
a1fce7490c lib/igt_core: use print("%s", #expr) instead of print(#expr)
If I have a program with the following:

    igt_skip_on(i % 2 == 0);
    igt_skip_on_f(i % 2 == 0, "i:%d\n", i);
    igt_require(i % 2 == 0);
    igt_require_f(i % 2 == 0, "i:%d\n", i);

then I'll get compiler error messages complaining about format
conversions related to the '%' character used in the mod operation. So
put the whole string as a %s argument to avoid interpreting '%' and
any other possible chars.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-08-14 15:26:28 -03:00
Daniel Vetter
5b0a8433fd lib/core: Add igt_reset_timeout
Convenience wrapper suggested by Chris for igt_set_timeout(0, NULL).

v2: While at it add an empty line in kms_flip to make
set/reset_timeout a visual block.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-08-12 14:46:46 +02:00
Daniel Vetter
370c989723 lib/core: Add optional reason for timeout failure
"Timed out" isn't a terribly informative message, allow users to set
something more informative. Inspired by a request from Jesse.

Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-08-12 14:46:40 +02:00
Chris Wilson
40ebf95163 igt/gem_streaming_writes: Bind into the GTT early
If we are using a streaming GGTT write into the source, we need to
trigger an early fault in order to obtain a mappable offset. This is
required when later we start reserving execbuf object top-down to try
and avoid mappable space!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-28 19:01:41 +01:00
Thomas Wood
d01ebbd97d docs: various documentation fixes
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-07-02 08:17:17 +01:00
Damien Lespiau
0a38e977c0 lib: Add double versions of igt_assert_cmp() and igt_assert_eq()
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27 16:04:08 +01:00
Damien Lespiau
23888526c7 docs: Add documentation for igt_assert_cmpuint()
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27 16:04:08 +01:00
Damien Lespiau
f660d0a054 docs: Add documentation for igt_assert_u32()
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27 16:04:07 +01:00
Damien Lespiau
fd6846c99f lib: Add a user data pointer to the argument parsing functions
It can be useful to have one of those to carry state between the handler
parsing the options and the rest of the test. Right now the only thing
we can do is to use global variables for that.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-05-15 12:22:14 +01:00
Chris Wilson
578795ff95 lib: Teach igt to handle signal failures gracefully
If we see a fatal signal in a subtest, fail.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-08 14:42:27 +01:00
Thomas Wood
b47032e191 lib: add a define for test failure exit status
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-14 17:43:05 +01:00
Joonas Lahtinen
a95033fdbc tests: install test programs to libexec
Install the test programs by default so that they can be packaged.

Tested with the testdisplay test so that it still runs after the
modifications as it depends on a data file to be present. Need to
pass -r option to enable QR code display on success (PNG data file).

Packaging is useful when building a complete software stack for a
DUT from scratch. This should bring us closer to achieving a
built-from-scratch testing workflow.

Package maintainers can always decide to ignore the installed files.

v2:
- Install more tests including scripts and their data

v3:
- Add clarification to commit message about why we do this.
  (Chris Wilson & Thomas Wood)
- Change libexec into pkglibexec to comply to standard
  (Thomas Wood)
- Do not install $(common_files). (Thomas Wood)
- Make it really obvious the installed files are tests by using
  tests directory name to avoid any confusion with packagers.

v4:
- Fixed commit message.

v5:
- Add file locator helper to retain backwards compatibility.
  (Thomas Wood)
- Test with testdisplay -r option that draws the .png file.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-02 16:32:47 +01:00
Chris Wilson
7763349a9a igt/gem_concurrent_blit: Separate out the combinatorial explosion
Apparently nobody else likes testing and debugging GEM coherency issues.
However, this also means that QA is skipping these vital tests. Split
out a set of canaries into igt/gem_concurrent_blit and keep the rest in
igt/gem_concurrent_all.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89497
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-03-26 08:15:19 +00:00
Thomas Wood
a6c40c7665 lib: move igt_interactive_debug into igt_core.c
igt_interactive_debug should be defined in igt_core.c, rather than the
header, to avoid it being defined more than once.

Reported-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-03-12 15:11:11 +00:00
Daniel Vetter
305fb1db5c lib: add igt_assert_lt
Found one user in gem_wait.c

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-02-27 16:24:25 +01:00
Thomas Wood
26f40811d7 lib: small documentation fixes
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-25 16:59:22 +00:00
Thomas Wood
8fb19782f8 lib: remove handled option arguments from argv
Remove options from argv that have been handled by getopt to allow
additional non-option parameters to be processed in the test application.

This fixes issues when using options such as --debug with tests that accept
additional non-option parameters.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-25 16:48:25 +00:00
Thomas Wood
55cc132b32 lib: use defines for igt_simple_init and igt_subtest_init
Using defines removes an extra function call and prepares for changes
to the command line argument handling.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-25 16:48:25 +00:00
Rodrigo Vivi
3d65ff780d lib: s/IGT_DEBUG_INTERACTIVE/--interactive-debug=var
Use cmdline variable for interactive debug instead of env var.

v2: Make interactive-debug domain optional and use "all" when not set.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-01-20 11:36:10 +01:00
Thomas Wood
0167619bbc lib: use critical log level for assertion failure messages
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-01-16 11:11:10 +00:00
Thomas Wood
df11a0f4a8 lib: add a critical warning level
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-01-16 11:11:10 +00:00
Thomas Wood
8161a21762 lib: introduce log domains
Log domains can be used to identify the source of log messages, such as
the test being run or the helper library.

v2: Add separate domains for different parts of the helper library and
    use an empty default domain for applications.
    Expand the log output to include the process name and the log level
    of the message in addition to the domain and pid.
    Print the expanded message only for warning and debug messages.

v3: check for glibc before using program_invocation_short_name

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-12-11 17:55:15 +00:00
Thomas Wood
ae3a946631 lib: fix symbol names in documentation comments
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-11-25 11:59:37 +00:00
Thomas Wood
f8b3c704af lib: add the ability to include a description with a test
The IGT_TEST_DESCRIPTION macro can be used to define a description for a
test.

v2: Remove semicolon from end of macro (Damien Lespiau)
    Add API documentation for the macro.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-11-06 13:24:29 +00:00
Thomas Wood
e622850966 lib/igt_core.h: add debug messages for test requirements
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-10-31 14:10:26 +00:00
Thomas Wood
d950f37be3 lib/igt_core.h: fix igt_skip_on_f requirement message
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-10-31 14:10:26 +00:00
Thomas Wood
d4e3b6a0f5 lib: various documentation fixes
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-10-17 15:34:43 +01:00
Thomas Wood
519f377ddd doc: various spelling and typo fixes
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-09-30 17:54:02 +01:00
Tim Gore
f33fa71481 lib/igt_core: make single/simple tests use igt_exit
Currently tests that use igt_simple_main will simply call
"exit()" if they pass, making it difficult to ensure that
any required cleanup is done. At present this is not an
issue, but it will be when I submit a patch to turn off the
lowmemorykiller for all tests.

Signed-off-by: Tim Gore <tim.gore@intel.com>
[danvet: Also update api docs.]
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2014-09-29 16:57:49 +02:00
Chris Wilson
fb9c9e3adc core: Prettify igt_require_f output
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-06 12:45:44 +01:00
Chris Wilson
d28b9d27bf igt: Tweak the igt_assert_cmpint macro
Minor tweak to embed the constant format string rather than passing it
to the vararg printf.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-29 19:55:30 +01:00
Chris Wilson
3b94d3f8ce igt: Prettify igt_assert_eq() failure messages
This just improves the language about the exact failure to reduce
confusion.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-29 13:20:36 +01:00
Chris Wilson
e0dffbdeda core: Improve phrasing for test requirements
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-25 14:39:18 +01:00
Chris Wilson
745945546f igt_core: Refactor igt_stop_helper() to use igt_wait_helper()
Reduce code duplication as the igt_stop_helper can reuse
igt_wait_helper() to replace its own waiting routine.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-24 11:52:37 +01:00
Thomas Wood
784344ef88 lib: add an exit code to use when invalid options are specified
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-07-23 16:43:05 +01:00
Thomas Wood
80d2c9bf82 tests: convert simple tests to use igt_simple_init_parse_opts
Convert simple tests to use igt_simple_init_parse_opts if they require
extra options.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2014-07-23 15:23:54 +01:00
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
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
Daniel Vetter
3f50598fb7 lib/igt_core: Fixup gtkdoc for logging functions
Without the () gtkdoc won't recognize them as function references.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-07-14 23:21:04 +02: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
2347e6d21e lib: Introduce igt_fail_on/_f
I've yet again totally screwed things up (this time automated with
cocci even, but not yet pushed luckily). So finally add a new version
for easier conversion and adjust the cocci script.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-06-13 18:14:13 +02:00
Daniel Vetter
3448b5ad4b lib/igt_core: Add igt_assert_eq
Suggested by Chris Wilson. Not yet rolled out since I'm trying to use
cocci for this.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-06-13 11:17:04 +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
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
924115bfcd lib: more unecessary header removal
This time big with media_fill.h

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-03-22 20:18:51 +01:00