summaryrefslogtreecommitdiff
path: root/lib/igt_core.h
AgeCommit message (Collapse)Author
2018-03-05tests/perf_pmu: Handle CPU hotplug failures betterChris Wilson
CPU hotplug, especially CPU0, can be flaky on commodity hardware. To improve test reliability and reponse times when testing larger runs we need to handle those cases better. Handle failures to off-line a CPU by immediately skipping the test, and failures to on-line a CPU by immediately rebooting the machine. This patch includes igt_sysrq_reboot implementation from Chris Wilson. v2: Halt by default, reboot if env variable IGT_REBOOT_ON_FATAL_ERROR is set. (Petri Latvala) v3: Add missign docs and update stale comment. (Petri Latvala) v4: Use pause instead of sleep. (Chris Wilson) v5: Newlines! (Chris Wilson) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Petri Latvala <petri.latvala@intel.com> Cc: Tomi Sarvela <tomi.p.sarvela@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2018-02-27lib: Export kmsg()Chris Wilson
Export the kmsg() function for use by tests to write into the kernel message log, useful for tests to inline their progress with kernel error messages. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2017-10-03lib: Reduce dependency on glibPetri Latvala
In commit ebd6eb69f57b ("Make igtrc configuration common, with configurable suspend/resume delay") .igtrc handling was moved to igt_core from igt_chamelium. That made everything in IGT depend on GLIB by accident. In short, igt_core.h declared a variable of type GKeyFile*, requiring glib.h. Everything that tried to #include igt_core.h required glib.h to be available, by use of GLIB_CFLAGS. This "worked" so far because CAIRO_CFLAGS contained GLIB_CFLAGS. As the variable is only used by other stuff in lib/, stuff it in its own header file to leave igt_core.h without a dependency to glib.h. Also add a couple of missing #ifdef HAVE_GLIBs around. Reported-by: Felipe De Jesus Ruiz Garcia <felipe.de.jesus.ruiz.garcia@intel.com> Signed-off-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2017-09-08lib: prefix frame_dump_pathDaniel Vetter
Just a bit of ocd for anything non-static. Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Acked-by: Petri Latvala <petri.latvala@intel.com> Acked-by: Daniel Stone <daniels@collabora.com> Acked-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-09-05igt_core: Skip sync when listing subtestsTvrtko Ursulin
No need to sync filesystems when only listing subtest. Extremely marginal benefit of avoid a short stall after make followed by listing subtests. v2: Move sync to common_init for consolidation and simplicity. (Chris Wilson) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-08-14lib: Add igt_can_fail()Daniel Vetter
Useful to make sure folks use library helpers correctly. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2017-07-19Introduce common frame dumping configuration and helpersPaul Kocialkowski
This introduces a common FrameDumpPath configuration field, as well as helper functions in dedicated igt_frame for writing cairo surfaces to png files. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com> Reviewed-by: Lyude <lyude@redhat.com>
2017-07-06Make igtrc configuration common, with configurable suspend/resume delayPaul Kocialkowski
This adds support for configurable suspend/resume delay and takes the occasion to move igtrc configuation from igt_chamelium to igt_core. This way, suspend/resume delay configuration can be used for all tests. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com> Reviewed-by: Lyude Paul <lyude@redhat.com>
2017-06-14igt/igt_core: Provide an option to check for the log buffer contentsAbdiel Janulgue
Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2017-06-14lib/igt_core: Add igt_system helpersAbdiel Janulgue
Support executing external processes with the goal of capturing its standard streams to the igt logging infrastructure in addition to its exit status. v3: Rename igt_exec -> igt_system (Chris). v2: Fix leaks on fd teardown. Make sure redirected process printout when > 64kb still works, like full dmesg. (Petri). Cc: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2017-04-25benchmarks/gem_wsim: Command submission workload simulatorTvrtko Ursulin
Tool which emits batch buffers to engines with configurable sequences, durations, contexts, dependencies and userspace waits. Unfinished but shows promise so sending out for early feedback. v2: * Load workload descriptors from files. (also -w) * Help text. * Calibration control if needed. (-t) * NORELOC | LUT to eb flags. * Added sample workload to wsim/workload1. v3: * Multiple parallel different workloads (-w -w ...). * Multi-context workloads. * Variable (random) batch length. * Load balancing (round robin and queue depth estimation). * Workloads delays and explicit sync steps. * Workload frequency (period) control. v4: * Fixed queue-depth estimation by creating separate batches per engine when qd load balancing is on. * Dropped separate -s cmd line option. It can turn itself on automatically when needed. * Keep a single status page and lie about the write hazard as suggested by Chris. * Use batch_start_offset for controlling the batch duration. (Chris) * Set status page object cache level. (Chris) * Moved workload description to a README. * Tidied example workloads. * Some other cleanups and refactorings. v5: * Master and background workloads (-W / -w). * Single batch per step is enough even when balancing. (Chris) * Use hars_petruska_f54_1_random IGT functions and see to zero at start. (Chris) * Use WC cache domain when WC mapping. (Chris) * Keep seqnos 64-bytes apart in the status page. (Chris) * Add workload throttling and queue-depth throttling commands. (Chris) v6: * Added two more workloads. * Merged RT balancer from Chris. v7: * Merged NO_RELOC patch from Chris. * Added missing RT balancer to help text. TODO list: * Fence support. * Batch buffer caching (re-use pool). * Better error handling. * Less 1980's workload parsing. * More workloads. * Threads? * ... ? Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: "Rogozhkin, Dmitry V" <dmitry.v.rogozhkin@intel.com>
2017-02-07igt/core: Return condition result from igt_warn_on*()Lyude
This allows us to be a little more flexible with how we use igt_warn_on() and igt_warn_on_f() by allowing us to write statements like this: if (igt_warn_on(scary_condition)) { /* some error handling... */ } Signed-off-by: Lyude <lyude@redhat.com>
2017-01-03igt_core: add igt_constructorLyude
This is a simple macro for executing a block of code at the beginning of intel-gpu-tools, before any tests have been ran. Useful for initialization of global resources used in IGT libraries. Signed-off-by: Lyude <lyude@redhat.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Changes since v1: - Add the line number into the name of the constructor function so that multiple constructors may be used per-file.
2016-11-15lib: Add missing include for sync()Petri Latvala
Commit 721d8747e3a2 added sync() calls to igt_main and igt_simple_main, making self-tests fail to build. #including unistd.h in igt_core.h fixes that. Fixes: 721d8747e3a2 ("igt: Add a test for reordering execbufs") CC: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-11-07igt: Add a test for reordering execbufsChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-10-13igt/gem_wait: Use explicit timersChris Wilson
Rather than guestimating a workload that should take a certain amount of time, use a sigitimer to terminate a batch (and so complete the wait) after an exact amount of time. And in the process expand testing to cover multiple rings and hangcheck. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-27lib: Update igt_core docsDaniel Vetter
Just missing comment for igt_log_level. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-06-23Silence compiler warnings for expected and handled error conditionsChris Wilson
Silly compiler emitting warnings that just cause people to break code attempting to silence the compiler. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-27igt_core: Search "." as final fallback for igt_fopen_data()Matt Roper
Some validation teams seem to run tests out of source directories that have been nfs mounted or rsync'd to different locations on the target machine. This causes the igt_srcdir that the tests were built with to be invalid on the machine the tests get run on. Add the current directory as a final fallback for data file searches. Reference: https://bugs.freedesktop.org/show_bug.cgi?id=92248 Cc: Humberto Israel Perez Rodriguez <humberto.i.perez.rodriguez@intel.com> Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-04-20lib: Declare loop variable as volatile before setjmpTomeu Vizoso
The variable used as loop counter in the igt_fixture macro had unspecified value from the setjmp(3) man page quoted below. Because of that, in certain circumstances and with -O2 and -Os, the initialization of that variable would be eliminated and the compiler would complain of uninitialized usage. Below can be found a snippet that reproduces the problem with GCC 5.3.1 and 4.9.3 and the errors as printed by 5.3.1. "The compiler may optimize variables into registers, and longjmp() may restore the values of other registers in addition to the stack pointer and program counter. Consequently, the values of automatic variables are unspecified after a call to longjmp() if they meet all the following criteria: · they are local to the function that made the corresponding setjmp(3) call; · their values are changed between the calls to setjmp(3) and longjmp(); and · they are not declared as volatile." static void test(void) { igt_subtest_group { igt_fixture { } igt_subtest("foo") { } igt_fixture { } } } In file included from lib/intel_batchbuffer.h:8:0, from lib/drmtest.h:39, from lib/igt.h:27, from tests/kms_addfb_basic.c:28: tests/kms_addfb_basic.c: In function 'tiling_tests.isra.0': lib/igt_core.h:110:43: warning: '__tmpint245' is used uninitialized in this function [-Wuninitialized] #define igt_fixture for (int igt_tokencat(__tmpint,__LINE__) = 0; \ ^ lib/igt_core.h:110:43: note: '__tmpint245' was declared here #define igt_fixture for (int igt_tokencat(__tmpint,__LINE__) = 0; \ ^ lib/igt_core.h:148:31: note: in definition of macro '__igt_tokencat2' #define __igt_tokencat2(x, y) x ## y ^ lib/igt_core.h:110:30: note: in expansion of macro 'igt_tokencat' #define igt_fixture for (int igt_tokencat(__tmpint,__LINE__) = 0; \ ^ tests/kms_addfb_basic.c:245:3: note: in expansion of macro 'igt_fixture' igt_fixture { Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-03-19lib: Add igt_subtest_groupDaniel Vetter
Useful for creating common setup code in igt_fixture which is only needed by a subset of tests. And since I'm a good citizen it comes with a library testcase/example included. v2: Make testcase nastier to ensure a subtest group SKIPS when it's parent is skipping already. I accidentally got this right, but let's make sure. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-03-18igt/gem_softpin: Repeat tests with signal interruptionsChris Wilson
For the long running tests probing error conditions, throwing in the signal interruptions is a good idea. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-08lib/igt_core: remove igt_disable/enable_exit_handlersDaniel Vetter
No longer needed, and also not really a safe idea. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-02-26igt/gem_sync: Enforce a timeout of 20sChris Wilson
The sync test is supposed to complete in 10s. But some bugs cause it to run very, very slowly. As a defence against those, terminate the test if we wait for more than 20s. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-12-21lib: Make 'extra_long_opts' constVille Syrjälä
The extra_long_opts passed to igt_*_parse_opts() isn't modified, so let's make it const. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-11-11lib: add a environment variable to control outputThomas Wood
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-10-07lib/igt_core: Add igt_assert_fdDaniel Stone
Skip open-coding and assert that fds are valid. Signed-off-by: Daniel Stone <daniels@collabora.com>
2015-10-07lib/igt_core: Add igt_assert_neq_*() variantsDaniel Stone
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-07lib/core: Fix docs for igt_assert_lt(e)Daniel Vetter
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-08-14lib/igt_core: use print("%s", #expr) instead of print(#expr)Paulo Zanoni
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-12lib/core: Add igt_reset_timeoutDaniel Vetter
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-12lib/core: Add optional reason for timeout failureDaniel Vetter
"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-07-28igt/gem_streaming_writes: Bind into the GTT earlyChris Wilson
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-02docs: various documentation fixesThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-06-27lib: Add double versions of igt_assert_cmp() and igt_assert_eq()Damien Lespiau
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27docs: Add documentation for igt_assert_cmpuint()Damien Lespiau
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-06-27docs: Add documentation for igt_assert_u32()Damien Lespiau
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-05-15lib: Add a user data pointer to the argument parsing functionsDamien Lespiau
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-08lib: Teach igt to handle signal failures gracefullyChris Wilson
If we see a fatal signal in a subtest, fail. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-04-14lib: add a define for test failure exit statusThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-04-02tests: install test programs to libexecJoonas Lahtinen
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-03-26igt/gem_concurrent_blit: Separate out the combinatorial explosionChris Wilson
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-12lib: move igt_interactive_debug into igt_core.cThomas Wood
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-02-27lib: add igt_assert_ltDaniel Vetter
Found one user in gem_wait.c Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-02-25lib: small documentation fixesThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-02-25lib: remove handled option arguments from argvThomas Wood
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-25lib: use defines for igt_simple_init and igt_subtest_initThomas Wood
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-01-20lib: s/IGT_DEBUG_INTERACTIVE/--interactive-debug=varRodrigo Vivi
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-16lib: use critical log level for assertion failure messagesThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-01-16lib: add a critical warning levelThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>