summaryrefslogtreecommitdiff
path: root/lib/igt_core.c
AgeCommit message (Collapse)Author
2017-12-13lib/core: Don't leak dummyloads between subtestsChris Wilson
If a test fails or skips early, it may not clean up after itself. In lieu of having a framework for test deconstructors, hook igt_terminate_spin_batches() into exit_subtest() itself so that we don't allow a recursive batch from an earlier test to leak into the next and cause an unexpected GPU hang. Similarly, we also want to terminate the dummyload as the first step in our atexit handlers (currently it is at the start of the last step) as some atexit handlers may be unwittingly exposed to dummyloads and so cause another wait on GPU hang. We trust that the core already distinguishes correctly between the principal test process and its children. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2017-12-05lib: avoid < in gtkdoc commentsDaniel Vetter
For reasons entirely not clear to me meson gtkdoc runs in strict xml parsing mode, whereas automake gtkdoc doesn't. And gtkdoc itself is tooooooooo dense to correctly escape this stuff. Paper around this. v2: {foo} instead of of tripy &lt;foo> (Joonas) v3: More fixups (Joonas) Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-12-04igt: Make dependency on libunwind mandatoryArkadiusz Hiler
With Android support gone there is not much reason for keeping libunwind dependency optional. This also deals (cheaply!) with ifdefs covering huge portions of code, removing a placement minefield. Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-11-29igt: Remove Android supportArkadiusz Hiler
This patch gets rid of the Android support, deleting all the hacks and moving code around to the places it belongs. Android build is not really maintained properly and rots rather fast. With recent push for Meson here and Android going for Soong it will only accelerate. It's a good time to drop the illusion of providing any support. Cc: Daniel Vetter <daniel.vetter@intel.com> Cc: Kalyan Kondapally <kalyan.kondapally@intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Cc: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Acked-by: Petri Latvala <petri.latvala@intel.com>
2017-11-24lib/igt_core: Move write_stderr out of LIBUNWIND ifdefArkadiusz Hiler
write_stderr() and __write_stderr() are defined behind ifdef on HAVE_LIBUNWIND, but do no depend on the lib in any way. fatal_sig_handler() uses those helpers unconditionally. This patch just moves the code couple of lines up, so the helpers are always available and do not break build on systems without libunwind. Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2017-11-22lib/core: Avoid unused result in backtrace printingTvrtko Ursulin
Add helpers for direct write to stderr to consolidate the code and avoid the unused result warning in build. v2: Use igt_ignore_warn since it is questionable whether igt_assert is safe in signal handlers. (Chris Wilson) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-11-09lib: Always enable ftrace-dump-on-oopsChris Wilson
Some debugging information is too voluminous to enable by default, yet may be invaluable when it comes to post-mortem debugging. trace_printk() provides the facility for the trace ringbuffer to be dumped on oops, this way we can cheaply spam the debug log and only present it in case of emergency. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2017-10-16aux: Suspend signal helper for shell commandsImre Deak
The clone() system call with a larger executable (like /bin/sh) may have difficulty to make progress on some platforms if interrupted frequently. So suspend the signal helper process for the duration of the syscall. This is needed to solve an actual problem by the next patch. v2: - Clarify/fix code comments. (Chris) - Update igt_system_quiet() as well accordingly. Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Daniel Vetter <daniel.vetter@intel.com> Signed-off-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
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-25igt_core: Rework igt_system()Petri Latvala
Instead of redirecting output to pipes and forking, redirect after forking to avoid having to carefully unredirect before logging anything. igt@tools_test@sysfs_l3_parity had a racy condition where it prints the output of intel_l3_parity prepended by [cmd], but that ended up being printed again prepended by [cmd] because output was redirected, causing outputs to appear multiple times. This patch fixes that. CC: Abdiel Janulgue <abdiel.janulgue@linux.intel.com> Signed-off-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.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-08build: use HAVE_LIBGEN_H consistentlyDaniel Vetter
Also, we are _GNU_SOURCE, so simplify the conditions accordingly. The next patch will remove _GNU_SOURCE everywhere else. Reviewed-by: Eric Anholt <eric@anholt.net> 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-28lib/igt_core: Use HTML character for documentation comment in examplePaul Kocialkowski
The gtkdoc output for the example configuration given in the file confuses gtkdoc because of the use of # for comments, that is interpreted as a headline (although it is an example block). This uses the HTML character instead to ensure the rendering is correct. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com> (with one small typo fixed) Reviewed-by: Lyude Paul <lyude@redhat.com>
2017-08-24lib/core: Use igt_info instead of printfDaniel Vetter
igt_info doesn't add anything when printing to stdout, but so looks the same. But it has the upside of appending the lines also to the igt crashdump log, where I especially want the backtraces. Atm they're the only thing that doesn't end up in there, which is a bit confusing. While at it also convert the other lines - the test summary usually doesn't make it since the test fails before that, and the version line tends to scroll off the crashdump. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
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-20lib/igt_core: Split out env-related handling to common_init_envPaul Kocialkowski
This moves the parts of the code doing env-related handling from common_init to a new dedicated common_init_env function, making common_init a bit more readable. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com> Reviewed-by: Lyude <lyude@redhat.com>
2017-07-20lib/igt_core: Move all config-related parsing to common_init_configPaul Kocialkowski
This moves all the pieces related to config parsing to the dedicated function for this purpose, renamed common_init_config for consistency. It allows making the common_init function less big and more readable. Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com> Reviewed-by: Lyude <lyude@redhat.com>
2017-07-20lib/igt_core: Handle glib errors correctly to avoid stderr spewPaul Kocialkowski
This adds the required error clean/free calls after calling configuration parsing functions. In addition to properly handling memory, this avoids glib spewing out error messages on stderr, which breaks the whole CI with this message: GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory. This indicates a bug in someone's code. You must ensure an error is NULL before it's set. The overwriting error message was: Key file does not have group ?DUT? Fixes: ee31e0b5 ("Introduce common frame dumping configuration...") Cc: Paul Kocialkowski <paul.kocialkowski@linux.intel.com> Cc: Lyude <lyude@redhat.com> Cc: Martin Peres <martin.peres@linux.intel.com> Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Signed-off-by: Paul Kocialkowski <paul.kocialkowski@linux.intel.com>
2017-07-19igt_core: Add the rest of Paul's patch I forgot by accidentLyude
Whoops, I meant to commit the entirity of Paul's patch but it appears I forgot to stage all of the changes to igt_core. This should have been included in the previous commit. Signed-off-by: Lyude <lyude@redhat.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-01-06lib: Always unbind the fbcon around igtChris Wilson
The fbcon imposes unpredictable latencies on tests - each drmIoctl has been observed to trigger two 650us calls to console_unlock() as it flushes printk buffer for the DRM_DEBUG around the ioctl. This makes tests such as gem_wait fail as they expect the ioctl to be spent on the operation under test not clogged up by the console. References: https://bugs.freedesktop.org/show_bug.cgi?id=99130 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-12-01Silence a bunch of "const discard" warningsChris Wilson
A few warnings of the form: gem_mmap_gtt.c: In function ‘copy_wc_page’: gem_mmap_gtt.c:480:16: warning: initialization discards ‘const’ qualifier from pointer target type [enabled by default] __m128i *S = (const __m128i *)src; are no more. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-11-29lib: Make signal helper definitions reusableAbdiel Janulgue
Lots of test cases are re-declaring this. v2: Remove definition in benchmarks/gem_syslatency.c Signed-off-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
2016-10-14tests: prefix IGT kernel log messages with [IGT]Jani Nikula
Make the IGT logging stand out better and easier to grep. Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2016-09-20lib/igt_core: Print stacktrace in initialization/fixture blocks.Marius Vlad
Likely candidate for this behaviour is the igt_fixture block. Seen in the CI by running tests/kms_psr_sink_crc which is causing segfaults in the fixture block. While at it fix some minor printing bugs. Signed-off-by: Marius Vlad <marius.c.vlad@intel.com> CC: Chris Wilson <chris@chris-wilson.co.uk>
2016-09-02lib/igt_core: Wrap print_backtrace_sig_safe() with HAVE_LIBUNWIND.Marius Vlad
Reported-by: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-09-01lib/igt_core: Print stacktrace when receiving one of the crash signals.marius vlad
While at it add SIGFPE as a crash signal. v3: Remove calls to igt_assert_eq() as these are not async-safe. As one user of this method remove the function pointer and recursive call. (Chris Wilson) v2: Added some helpers to avoid printf() inside a signal handler. (Chris Wilson) Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-06-28lib: Suppress kmsg on exit for unknown programmesChris Wilson
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-05-03lib: compute exitcode firstChris Wilson
Before we print the exitcode to the debug/kmsg logs, we should inspect what its final value will be. For example, in the case of running multiple subtests which all happen to be skipped, igt_exitcode is 0, but the final exit code will be 77. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Tested-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2016-05-02lib: Fixup u64 multiply for computing nanosecondsChris Wilson
32bit builds ran into a silly multiplication issue when computing elapsed nanoseconds of more than 2s... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-14lib: Fix doc warnings for real!Daniel Vetter
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-03-29lib: Tidy error message for a helper process who unexpectedly diesChris Wilson
Transform gem_exec_suspend: igt_core.c:1429: igt_stop_helper: Assertion `(((signed char) ((((__extension__ (((union { __typeof(status) __in; int __i; }) { .__in = (status) }).__i))) & 0x7f) + 1) >> 1) > 0) && (((__extension__ (((union { __typeof(status) __in; int __i; }) { .__in = (status) }).__i))) & 0x7f) == (proc->use_SIGKILL ? 9 : 15)' failed. into (gem_exec_suspend:16589) igt-core-DEBUG: Helper died too early with status=0 gem_exec_suspend: igt_core.c:1437: igt_stop_helper: Assertion `helper_was_alive(proc, status)' failed. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-19lib: Fix some doc warningsDaniel Vetter
Cc: Marius Vlad <marius.c.vlad@intel.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-09lib: remove saved_sig_maskDaniel Vetter
Oversight from the exit handler cleanup, spotted by Chris Wilson. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
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>
2016-02-17lib/igt_core.c: Expand --run-subtest functionality.Derek Morton
Added extended wildcard support when specifying --run-subtest. Wildcard format is as specified in rfc3977 and the uwildmat() implementation is taken from libinn. See https://tools.ietf.org/html/rfc3977#section-4 for a description of allowed wildcard expressions. v2: Use comma as list separator (Ville Syrjala) support both ^ and ! as not operators (Dave Gordon) v3: Updated to use uwildmat() (Dave Gordon) Signed-off-by: Derek Morton <derek.j.morton@intel.com> [danvet: Fixup whitespace. Add #include <stdint.h>. Run lint.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-01-06igt_core: Fix logging to display extended lineDerek Morton
line[strlen(line)] will always evaluate to NULL so line_continuation was always true. That prevented the program name, pid and log level ever being printed. Changed to [strlen(line) - 1] so the last character before the null terminator is compared with '\n' to determine line_continuation. Signed-off-by: Derek Morton <derek.j.morton@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
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-24lib/igt_core: Prefer CLOCK_MONOTONIC_RAWJoonas Lahtinen
CLOCK_MONOTONIC_RAW is not affected by NTP, so it should be THE clock used for timing execution of tests. When fetching either the starting or ending time of a test, show the time as -1.000s. v6: - Whitespace corrections (Chris) v5: - Do not use C99 style comments (Chris) v4: - Introduce time_valid macro (Chris) - Reduce amount of boilerplate code for calculating elapsed time v3: - Do not exit directly from handler (Chris) - Show elapsed time as -1 if it is not calculable v2: - Cache the used clock (Chris) - Do not change the clock during execution - Spit out and error if monotonic time can not be read Cc: Thomas Wood <thomas.wood@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
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-11-11lib: highlight subtest results on terminalsThomas Wood
Make subtest results easier to identify by making them bold when the output is a terminal. Signed-off-by: Thomas Wood <thomas.wood@intel.com>